summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--audio/audio_hw.c123
-rw-r--r--audio/audio_hw.h25
-rw-r--r--overlay/device/samsung/smdk4412-common/DeviceSettings/res/values/config.xml24
-rw-r--r--rootdir/init.target.rc3
4 files changed, 12 insertions, 163 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index d515057..21d9172 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -25,7 +25,6 @@
#include <pthread.h>
#include <stdint.h>
#include <sys/time.h>
-#include <sys/stat.h>
#include <stdlib.h>
#include <expat.h>
#include <dlfcn.h>
@@ -197,6 +196,7 @@ struct m0_dev_cfg {
void *mCsdHandle;
int rx_dev_id, tx_dev_id, old_rx_dev;
+int voice_index;
static int (*csd_client_init)();
static int (*csd_client_deinit)();
@@ -533,6 +533,7 @@ static void set_incall_device(struct m0_audio_device *adev)
case AUDIO_DEVICE_OUT_EARPIECE:
rx_dev_id = DEVICE_HANDSET_RX_ACDB_ID;
tx_dev_id = DEVICE_HANDSET_TX_ACDB_ID;
+ voice_index = 5;
break;
case AUDIO_DEVICE_OUT_SPEAKER:
case AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET:
@@ -540,11 +541,13 @@ static void set_incall_device(struct m0_audio_device *adev)
case AUDIO_DEVICE_OUT_AUX_DIGITAL:
rx_dev_id = DEVICE_SPEAKER_MONO_RX_ACDB_ID;
tx_dev_id = DEVICE_HANDSET_TX_ACDB_ID;
+ voice_index = 7;
break;
case AUDIO_DEVICE_OUT_WIRED_HEADSET:
case AUDIO_DEVICE_OUT_WIRED_HEADPHONE:
rx_dev_id = DEVICE_HEADSET_RX_ACDB_ID;
tx_dev_id = DEVICE_HEADSET_TX_ACDB_ID;
+ voice_index = 5;
break;
case AUDIO_DEVICE_OUT_BLUETOOTH_SCO:
case AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET:
@@ -556,10 +559,12 @@ static void set_incall_device(struct m0_audio_device *adev)
rx_dev_id = DEVICE_BT_SCO_RX_ACDB_ID;
tx_dev_id = DEVICE_BT_SCO_TX_ACDB_ID;
}
+ voice_index = 7;
break;
default:
rx_dev_id = DEVICE_HANDSET_RX_ACDB_ID;
tx_dev_id = DEVICE_HANDSET_TX_ACDB_ID;
+ voice_index = 5;
break;
}
@@ -605,25 +610,8 @@ static void set_input_volumes(struct m0_audio_device *adev, int main_mic_on,
{
}
-static void set_output_volumes(struct m0_audio_device *adev)
+static void set_output_volumes(struct m0_audio_device *adev, bool tty_volume)
{
- int volume;
-
- switch(adev->out_device) {
- case AUDIO_DEVICE_OUT_SPEAKER:
- volume = get_volume(OUT_SPEAKER);
- ALOGV("%s: SPEAKER Volume: %i", __func__, volume);
- mixer_ctl_set_value(adev->mixer_ctls.speaker_volume,0,volume);
- mixer_ctl_set_value(adev->mixer_ctls.speaker_volume,1,volume);
- break;
- case AUDIO_DEVICE_OUT_WIRED_HEADSET:
- case AUDIO_DEVICE_OUT_WIRED_HEADPHONE:
- volume = get_volume(OUT_HEADPHONE);
- ALOGV("%s: HEADPHONE Volume: %i", __func__, volume);
- mixer_ctl_set_value(adev->mixer_ctls.headphone_volume,0,volume);
- mixer_ctl_set_value(adev->mixer_ctls.headphone_volume,1,volume);
- break;
- }
}
static void force_all_standby(struct m0_audio_device *adev)
@@ -754,8 +742,6 @@ static void select_output_device(struct m0_audio_device *adev)
set_eq_filter(adev);
- set_output_volumes(adev);
-
if (adev->mode == AUDIO_MODE_IN_CALL) {
if (!bt_on) {
/* force tx path according to TTY mode when in call */
@@ -2741,19 +2727,16 @@ static int adev_init_check(const struct audio_hw_device *dev)
static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
{
struct m0_audio_device *adev = (struct m0_audio_device *)dev;
- int voice_index;
adev->voice_volume = volume;
- voice_index = update_voice_index(adev);
-
ALOGD("%s: Voice Index: %i", __func__, voice_index);
if (adev->mode == AUDIO_MODE_IN_CALL) {
if (csd_volume_index == NULL) {
ALOGE("dlsym: Error:%s Loading csd_volume_index", dlerror());
} else {
- volume = volume * (float)voice_index;
+ volume = volume * voice_index;
ALOGD("%s: calling csd_volume_index(%f)", __func__, volume);
csd_volume_index(volume);
}
@@ -2761,36 +2744,6 @@ static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
return 0;
}
-int update_voice_index(struct m0_audio_device *adev)
-{
- int voice_index;
-
- switch(adev->out_device) {
- case AUDIO_DEVICE_OUT_EARPIECE:
- voice_index = get_volume(INCALL_EARPIECE);
- break;
- case AUDIO_DEVICE_OUT_SPEAKER:
- case AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET:
- case AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET:
- case AUDIO_DEVICE_OUT_AUX_DIGITAL:
- voice_index = get_volume(INCALL_SPEAKER);
- break;
- case AUDIO_DEVICE_OUT_WIRED_HEADSET:
- case AUDIO_DEVICE_OUT_WIRED_HEADPHONE:
- voice_index = get_volume(INCALL_HEADPHONE);
- break;
- case AUDIO_DEVICE_OUT_BLUETOOTH_SCO:
- case AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET:
- case AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT:
- voice_index = get_volume(INCALL_BT);
- break;
- default:
- voice_index = get_volume(INCALL_EARPIECE);
- break;
- }
- return voice_index;
-}
-
static int adev_set_master_volume(struct audio_hw_device *dev, float volume)
{
return -ENOSYS;
@@ -3210,63 +3163,11 @@ static int adev_config_parse(struct m0_audio_device *adev)
return ret;
}
-static int volume_file_check()
-{
- FILE *f;
- int i;
- int default_voice_vol = 5;
- int default_stream_vol = 50;
- struct stat st = {0};
-
- if (stat(AUDIO_DIR, &st) == -1) {
- ALOGE("Directory %s does not exist, skip creating volume files\n", AUDIO_DIR);
- return -ENODEV;
- }
-
- for ( i = 0; i < MAX_NUM_VOLUME_FILES; i++ ) {
- f = fopen(volume_file[i], "r");
- if(!f){
- ALOGW("Failed to open %s, attempting to create file\n", volume_file[i]);
- f = fopen(volume_file[i], "w");
- if(!f){
- ALOGE("Failed to create %s\n", volume_file[i]);
- continue;
- }else{
- ALOGI("Successfully created %s\n", volume_file[i]);
- /* first 4 files are for incall voice, anything over that is considered streaming out */
- if(i > 3)
- fprintf(f, "%d", default_stream_vol);
- else
- fprintf(f, "%d", default_voice_vol);
- fclose(f);
- chmod(volume_file[i], 0666);
- }
- }else{
- chmod(volume_file[i],0666);
- }
- }
-
- return 0;
-}
-
-int get_volume(char *file)
-{
- FILE *f;
- int index = 1;
-
- f = fopen(file, "r");
- if(f) {
- fscanf(f, "%i", &index);
- fclose(f);
- }
- return index;
-}
-
static int adev_open(const hw_module_t* module, const char* name,
hw_device_t** device)
{
struct m0_audio_device *adev;
- int ret, volfs;
+ int ret;
if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0)
return -EINVAL;
@@ -3306,16 +3207,10 @@ static int adev_open(const hw_module_t* module, const char* name,
adev->mixer_ctls.mixinl_in1l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN1L Volume");
adev->mixer_ctls.mixinl_in2l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN2L Volume");
- /* speaker/headphone volume control*/
- adev->mixer_ctls.speaker_volume = mixer_get_ctl_by_name(adev->mixer, "Speaker Volume");
- adev->mixer_ctls.headphone_volume = mixer_get_ctl_by_name(adev->mixer, "Headphone Volume");
-
ret = adev_config_parse(adev);
if (ret != 0)
goto err_mixer;
- volfs = volume_file_check();
-
/* Set the default route before the PCM stream is opened */
pthread_mutex_lock(&adev->lock);
adev->mode = AUDIO_MODE_NORMAL;
diff --git a/audio/audio_hw.h b/audio/audio_hw.h
index 33050c3..4d99bc7 100644
--- a/audio/audio_hw.h
+++ b/audio/audio_hw.h
@@ -64,18 +64,9 @@
/* sampling rate when using VX port for wide band */
#define VX_WB_SAMPLING_RATE 16000
-#define MAX_NUM_VOLUME_FILES 6
-#define AUDIO_DIR "/data/local/audio"
-
-/* in-call files */
-#define INCALL_EARPIECE "/data/local/audio/incall_earpiece"
-#define INCALL_HEADPHONE "/data/local/audio/incall_headphone"
-#define INCALL_SPEAKER "/data/local/audio/incall_speaker"
-#define INCALL_BT "/data/local/audio/incall_bt"
-
-/* out stream files */
-#define OUT_HEADPHONE "/data/local/audio/out_headphone"
-#define OUT_SPEAKER "/data/local/audio/out_speaker"
+/* product-specific defines */
+#define PRODUCT_DEVICE_PROPERTY "ro.product.device"
+#define PRODUCT_NAME_PROPERTY "ro.product.name"
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
@@ -113,14 +104,6 @@ enum tty_modes {
TTY_MODE_FULL
};
-char *volume_file[MAX_NUM_VOLUME_FILES] = {
- INCALL_EARPIECE,
- INCALL_HEADPHONE,
- INCALL_SPEAKER,
- INCALL_BT,
- OUT_HEADPHONE,
- OUT_SPEAKER
-};
/* ACDB Device ID macros */
#define DEVICE_HANDSET_RX_ACDB_ID 7 // HANDSET_SPKR
#define DEVICE_HANDSET_TX_ACDB_ID 4 // HANDSET_MIC
@@ -172,8 +155,6 @@ struct mixer_ctls
{
struct mixer_ctl *mixinl_in1l_volume;
struct mixer_ctl *mixinl_in2l_volume;
- struct mixer_ctl *speaker_volume;
- struct mixer_ctl *headphone_volume;
};
struct route_setting
diff --git a/overlay/device/samsung/smdk4412-common/DeviceSettings/res/values/config.xml b/overlay/device/samsung/smdk4412-common/DeviceSettings/res/values/config.xml
deleted file mode 100644
index 74f963a..0000000
--- a/overlay/device/samsung/smdk4412-common/DeviceSettings/res/values/config.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 The CyanogenMod Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- These resources are around just to allow their values to be customized
- for different hardware and product builds. -->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- Audio Tuning -->
- <bool name="has_incall_audio_tuning">true</bool>
- <bool name="has_output_audio_tuning">true</bool>
-
-</resources>
diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc
index 29c2e8d..a94f606 100644
--- a/rootdir/init.target.rc
+++ b/rootdir/init.target.rc
@@ -50,9 +50,6 @@ on post-fs-data
chown system radio /sys/devices/platform/mdm_hsic_pm0/waketime
chmod 0660 /sys/devices/platform/mdm_hsic_pm0/waketime
- mkdir /data/local/audio 0775 media audio
- chown media audio /data/local/audio
-
chown radio system /sys/devices/platform/samsung-pd.5/s3c-fimc.2/range_mode
chmod 0660 /sys/devices/platform/samsung-pd.5/s3c-fimc.2/range_mode