--- a/arch/arm/mach-msm/board-bravo-audio.c
+++ b/arch/arm/mach-msm/board-bravo-audio.c
@@ -34,19 +34,19 @@ static struct mutex bt_sco_lock;
static struct q6_hw_info q6_audio_hw[Q6_HW_COUNT] = {
[Q6_HW_HANDSET] = {
.min_gain = -2000,
- .max_gain = 0,
+ .max_gain = 600,
},
[Q6_HW_HEADSET] = {
.min_gain = -2000,
- .max_gain = 0,
+ .max_gain = 600,
},
[Q6_HW_SPEAKER] = {
.min_gain = -1500,
- .max_gain = 0,
+ .max_gain = 500,
},
[Q6_HW_TTY] = {
.min_gain = -2000,
- .max_gain = 0,
+ .max_gain = 600,
},
[Q6_HW_BT_SCO] = {
.min_gain = -2000,
--- a/arch/arm/mach-msm/board-incrediblec-audio.c
+++ b/arch/arm/mach-msm/board-incrediblec-audio.c
@@ -34,35 +34,30 @@ static struct mutex mic_lock;
static struct mutex bt_sco_lock;
static int headset_status = 0;
-struct q6_gain_info {
- int max_step;
- int gain[10];
-};
-
-static struct q6_gain_info q6_audio_hw[Q6_HW_COUNT] = {
+static struct q6_hw_info q6_audio_hw[Q6_HW_COUNT] = {
[Q6_HW_HANDSET] = {
- .max_step = 6,
- .gain = {-1600, -1300, -1000, -600, -300, 0, 0, 0, 0, 0},
+ .min_gain = -2000,
+ .max_gain = 600,
},
[Q6_HW_HEADSET] = {
- .max_step = 6,
- .gain = {-2000, -1600, -1200, -800, -400, 0, 0, 0, 0, 0},
+ .min_gain = -2000,
+ .max_gain = 600,
},
[Q6_HW_SPEAKER] = {
- .max_step = 6,
- .gain = {-1500, -1200, -900, -600, -300, 0, 0, 0, 0, 0},
+ .min_gain = -1500,
+ .max_gain = 500,
},
[Q6_HW_TTY] = {
- .max_step = 6,
- .gain = {-2000, -1600, -1200, -800, -400, 0, 0, 0, 0, 0},
+ .min_gain = -2000,
+ .max_gain = 600,
},
[Q6_HW_BT_SCO] = {
- .max_step = 6,
- .gain = {-2000, -1600, -1200, -800, -400, 0, 0, 0, 0, 0},
+ .min_gain = -2000,
+ .max_gain = 0,
},
[Q6_HW_BT_A2DP] = {
- .max_step = 6,
- .gain = {-2000, -1600, -1200, -800, -400, 0, 0, 0, 0, 0},
+ .min_gain = -2000,
+ .max_gain = 0,
},
};
@@ -254,14 +249,11 @@ void incrediblec_analog_init(void)
int incrediblec_get_rx_vol(uint8_t hw, int level)
{
- struct q6_gain_info *info;
+ struct q6_hw_info *info;
int vol;
info = &q6_audio_hw[hw];
-
- level = (level > 100)? 100 : ((level < 0) ? 0 : level);
- vol = info->gain[(uint32_t)((info->max_step - 1) * level / 100)];
-
+ vol = info->min_gain + ((info->max_gain - info->min_gain) * level) / 100;
D("%s %d\n", __func__, vol);
return vol;
}
--- a/arch/arm/mach-msm/board-supersonic-audio.c
+++ b/arch/arm/mach-msm/board-supersonic-audio.c
@@ -41,19 +41,19 @@ static int headset_status = 0;
static struct q6_hw_info q6_audio_hw[Q6_HW_COUNT] = {
[Q6_HW_HANDSET] = {
.min_gain = -2000,
- .max_gain = 0,
+ .max_gain = 600,
},
[Q6_HW_HEADSET] = {
.min_gain = -2000,
- .max_gain = 0,
+ .max_gain = 600,
},
[Q6_HW_SPEAKER] = {
.min_gain = -1500,
- .max_gain = 0,
+ .max_gain = 500,
},
[Q6_HW_TTY] = {
.min_gain = -2000,
- .max_gain = 0,
+ .max_gain = 600,
},
[Q6_HW_BT_SCO] = {
.min_gain = -2000,