diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-03-22 11:30:30 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-03-22 13:22:39 -0400 |
commit | f06bce9c8c54354ea4ff96852bd92e10204c8cfb (patch) | |
tree | aed335af807a33cf47577b7cc3412241a6460595 /sound/soc | |
parent | 2f14430af52fff08ed1987a3cee612e133a6b82f (diff) |
ASoC: Allow disabling of WM835x jack detection
If no report is specified then disable detection. Note that we don't
disable the slow clock, though the power consumption from it should
be negligable. That should be reference counted, ideally through DAPM.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/wm8350.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index fb1005edee79..8ac92f5e4f91 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
@@ -1393,7 +1393,8 @@ static irqreturn_t wm8350_hp_jack_handler(int irq, void *data) | |||
1393 | * @jack: jack to report detection events on | 1393 | * @jack: jack to report detection events on |
1394 | * @report: value to report | 1394 | * @report: value to report |
1395 | * | 1395 | * |
1396 | * Enables the headphone jack detection of the WM8350. | 1396 | * Enables the headphone jack detection of the WM8350. If no report |
1397 | * is specified then detection is disabled. | ||
1397 | */ | 1398 | */ |
1398 | int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which, | 1399 | int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which, |
1399 | struct snd_soc_jack *jack, int report) | 1400 | struct snd_soc_jack *jack, int report) |
@@ -1422,8 +1423,12 @@ int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which, | |||
1422 | return -EINVAL; | 1423 | return -EINVAL; |
1423 | } | 1424 | } |
1424 | 1425 | ||
1425 | wm8350_set_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_TOCLK_ENA); | 1426 | if (report) { |
1426 | wm8350_set_bits(wm8350, WM8350_JACK_DETECT, ena); | 1427 | wm8350_set_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_TOCLK_ENA); |
1428 | wm8350_set_bits(wm8350, WM8350_JACK_DETECT, ena); | ||
1429 | } else { | ||
1430 | wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, ena); | ||
1431 | } | ||
1427 | 1432 | ||
1428 | /* Sync status */ | 1433 | /* Sync status */ |
1429 | wm8350_hp_jack_handler(irq + wm8350->irq_base, priv); | 1434 | wm8350_hp_jack_handler(irq + wm8350->irq_base, priv); |
@@ -1459,7 +1464,8 @@ static irqreturn_t wm8350_mic_handler(int irq, void *data) | |||
1459 | * @detect_report: value to report when presence detected | 1464 | * @detect_report: value to report when presence detected |
1460 | * @short_report: value to report when microphone short detected | 1465 | * @short_report: value to report when microphone short detected |
1461 | * | 1466 | * |
1462 | * Enables the microphone jack detection of the WM8350. | 1467 | * Enables the microphone jack detection of the WM8350. If both reports |
1468 | * are specified as zero then detection is disabled. | ||
1463 | */ | 1469 | */ |
1464 | int wm8350_mic_jack_detect(struct snd_soc_codec *codec, | 1470 | int wm8350_mic_jack_detect(struct snd_soc_codec *codec, |
1465 | struct snd_soc_jack *jack, | 1471 | struct snd_soc_jack *jack, |
@@ -1472,8 +1478,14 @@ int wm8350_mic_jack_detect(struct snd_soc_codec *codec, | |||
1472 | priv->mic.report = detect_report; | 1478 | priv->mic.report = detect_report; |
1473 | priv->mic.short_report = short_report; | 1479 | priv->mic.short_report = short_report; |
1474 | 1480 | ||
1475 | wm8350_set_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_TOCLK_ENA); | 1481 | if (detect_report || short_report) { |
1476 | wm8350_set_bits(wm8350, WM8350_POWER_MGMT_1, WM8350_MIC_DET_ENA); | 1482 | wm8350_set_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_TOCLK_ENA); |
1483 | wm8350_set_bits(wm8350, WM8350_POWER_MGMT_1, | ||
1484 | WM8350_MIC_DET_ENA); | ||
1485 | } else { | ||
1486 | wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_1, | ||
1487 | WM8350_MIC_DET_ENA); | ||
1488 | } | ||
1477 | 1489 | ||
1478 | return 0; | 1490 | return 0; |
1479 | } | 1491 | } |