aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorPhilippe Langlais <philippe.langlais@linaro.org>2011-03-25 10:47:48 +0100
committerRobert Marklund <robert.marklund@stericsson.com>2011-05-13 10:40:24 +0200
commitc523464237b260c302d13e6e402a1eb2dbd75f94 (patch)
tree29fe02fa0407fd1134f94aa539364456759e1549 /sound
parentdc457f2be3d3769a7f7f955469c6dad89b78ec38 (diff)
sound accessory: update taken from 2.6.35 GLK
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/ux500/ux500_ab8500_accessory.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/sound/soc/ux500/ux500_ab8500_accessory.c b/sound/soc/ux500/ux500_ab8500_accessory.c
index ab022144a1f..4401f51d766 100644
--- a/sound/soc/ux500/ux500_ab8500_accessory.c
+++ b/sound/soc/ux500/ux500_ab8500_accessory.c
@@ -245,7 +245,7 @@ struct accessory_op_to_jack_state {
*/
struct devdata {
- struct ab8500 *ab8500;
+ struct ab8500_gpadc *gpadc;
struct platform_device *codec_p_dev;
@@ -697,16 +697,6 @@ void update_jack_status(enum accessory_jack_state jack_status)
}
/*
-* Returns the mic line voltage in millivolts.
-*/
-static int meas_voltage(u8 input)
-{
- int raw_vol = ab8500_gpadc_convert(devdata->ab8500->gpadc, input);
-
- return (raw_vol * 2500)/1023;
-}
-
-/*
* Returns 1 if accessories are plugged in, 0 if not.
*/
static int detect_plugged_in(void)
@@ -729,11 +719,11 @@ static int meas_voltage_stable(u8 input)
const int dmax = 30;
int v1, v2, dv;
- v1 = meas_voltage(input);
+ v1 = ab8500_gpadc_convert(devdata->gpadc, input);
do {
msleep(sleepms);
--iterations;
- v2 = meas_voltage(input);
+ v2 = ab8500_gpadc_convert(devdata->gpadc, input);
dv = abs(v2 - v1);
v1 = v2;
} while (iterations > 0 && dv > dmax);
@@ -1230,11 +1220,6 @@ static void deferred_init_handler_work(struct work_struct *work)
static int init_platform_devices(struct snd_soc_codec *codec)
{
- devdata->ab8500 = dev_get_drvdata(codec->dev->parent);
- if (!devdata->ab8500 || !devdata->ab8500->gpadc) {
- pr_err("%s: failed to get ab8500 plat. driver\n", __func__);
- return -ENOENT;
- }
devdata->codec_dev = codec->dev;
devdata->codec_p_dev = to_platform_device(codec->dev);
@@ -1257,6 +1242,8 @@ int ab8500_accessory_init(struct snd_soc_codec *codec)
goto fail_no_mem_for_devdata;
}
+ devdata->gpadc = ab8500_gpadc_get();
+
/* Get vamic1 regulator */
devdata->vamic1_reg = regulator_get(NULL, "v-amic1");
if (IS_ERR(devdata->vamic1_reg)) {