From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Liam Girdwood <lrg@ti.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Tony Lindgren <tony@atomide.com>
Cc: Jarkko Nikula <jarkko.nikula@bitmer.com>,
alsa-devel@alsa-project.org, linux-omap@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 7/9] ASoC: omap-abe-twl6040: Configure card according to platform data
Date: Thu, 22 Dec 2011 18:38:20 +0200 [thread overview]
Message-ID: <1324571902-16918-8-git-send-email-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <1324571902-16918-1-git-send-email-peter.ujfalusi@ti.com>
Disable the not connected pins on the board based on the
received platform data.
DO not register the jack function on boards, which does not have
means to detect it (jack is always connected).
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
sound/soc/omap/omap-abe-twl6040.c | 41 ++++++++++++++++++++++++++----------
1 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/sound/soc/omap/omap-abe-twl6040.c b/sound/soc/omap/omap-abe-twl6040.c
index 9e6e4c2..7a8fbe2 100644
--- a/sound/soc/omap/omap-abe-twl6040.c
+++ b/sound/soc/omap/omap-abe-twl6040.c
@@ -157,10 +157,29 @@ static const struct snd_soc_dapm_route audio_map[] = {
{"AFMR", NULL, "Line In"},
};
+#define twl6040_disconnect_pin(dapm, connected, pin) \
+ if (!connected) \
+ snd_soc_dapm_disable_pin(dapm, pin);
+
static int omapabe_twl6040_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_codec *codec = rtd->codec;
- int ret, hs_trim;
+ struct snd_soc_card *card = codec->card;
+ struct snd_soc_dapm_context *dapm = &codec->dapm;
+ struct omap_abe_twl6040_data *pdata = dev_get_platdata(card->dev);
+ int hs_trim;
+ int ret = 0;
+
+ /* Disable not connected paths if not used */
+ twl6040_disconnect_pin(dapm, pdata->has_hs, "Headset Stereophone");
+ twl6040_disconnect_pin(dapm, pdata->has_hf, "Ext Spk");
+ twl6040_disconnect_pin(dapm, pdata->has_ep, "Earphone Spk");
+ twl6040_disconnect_pin(dapm, pdata->has_aux, "Line Out");
+ twl6040_disconnect_pin(dapm, pdata->has_vibra, "Vinrator");
+ twl6040_disconnect_pin(dapm, pdata->has_hsmic, "Headset Mic");
+ twl6040_disconnect_pin(dapm, pdata->has_mainmic, "Main Handset Mic");
+ twl6040_disconnect_pin(dapm, pdata->has_submic, "Sub Handset Mic");
+ twl6040_disconnect_pin(dapm, pdata->has_afm, "Line In");
/*
* Configure McPDM offset cancellation based on the HSOTRIM value from
@@ -170,19 +189,17 @@ static int omapabe_twl6040_init(struct snd_soc_pcm_runtime *rtd)
omap_mcpdm_configure_dn_offsets(rtd, TWL6040_HSF_TRIM_LEFT(hs_trim),
TWL6040_HSF_TRIM_RIGHT(hs_trim));
- /* Headset jack detection */
- ret = snd_soc_jack_new(codec, "Headset Jack",
- SND_JACK_HEADSET, &hs_jack);
- if (ret)
- return ret;
-
- ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
- hs_jack_pins);
+ /* Headset jack detection only if it is supported */
+ if (pdata->jack_detection) {
+ ret = snd_soc_jack_new(codec, "Headset Jack",
+ SND_JACK_HEADSET, &hs_jack);
+ if (ret)
+ return ret;
- if (machine_is_omap_4430sdp())
+ ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
+ hs_jack_pins);
twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET);
- else
- snd_soc_jack_report(&hs_jack, SND_JACK_HEADSET, SND_JACK_HEADSET);
+ }
return ret;
}
--
1.7.8.1
next prev parent reply other threads:[~2011-12-22 16:38 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-22 16:38 [PATCH v2 0/9] OMAP4: ASoC: Support for PandaBoard family Peter Ujfalusi
2011-12-22 16:38 ` [PATCH v2 1/9] include: platform_data: Platform data header for OMAP4 ASoC audio Peter Ujfalusi
2011-12-22 16:38 ` [PATCH v2 2/9] OMAP4: 4430sdp: Register platform device for OMAP4 audio Peter Ujfalusi
2011-12-22 16:38 ` [PATCH v2 3/9] ASoC: omap-abe-twl6040: Convert to platform deriver Peter Ujfalusi
2011-12-22 16:38 ` [PATCH v2 4/9] ASoC: twl6040: Convert MICBIAS to SUPPLY widget Peter Ujfalusi
2011-12-22 17:32 ` Mark Brown
2011-12-22 18:02 ` Peter Ujfalusi
2011-12-22 18:13 ` Mark Brown
2011-12-22 16:38 ` [PATCH v2 5/9] ASoC: omap-abe-twl6040: Add complete DAPM routing Peter Ujfalusi
2011-12-22 16:38 ` [PATCH v2 6/9] ASoC: omap-abe-twl6040: DAI link selection based on platform data Peter Ujfalusi
2011-12-22 16:38 ` Peter Ujfalusi [this message]
2011-12-22 16:38 ` [PATCH v2 8/9] OMAP4: omap4panda: Enable audio support Peter Ujfalusi
2011-12-22 17:32 ` Tony Lindgren
2011-12-22 18:08 ` Peter Ujfalusi
2011-12-22 18:15 ` Tony Lindgren
2011-12-22 18:24 ` Peter Ujfalusi
2011-12-22 16:38 ` [PATCH v2 9/9] ASoC: Kconfig: OMAP4: Enable support for PandaBoards Peter Ujfalusi
2011-12-22 17:30 ` [PATCH v2 0/9] OMAP4: ASoC: Support for PandaBoard family Peter Ujfalusi
-- strict thread matches above, loose matches on Subject: below --
2011-12-22 12:42 Peter Ujfalusi
2011-12-22 12:42 ` [PATCH v2 7/9] ASoC: omap-abe-twl6040: Configure card according to platform data Peter Ujfalusi
2011-12-22 13:08 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1324571902-16918-8-git-send-email-peter.ujfalusi@ti.com \
--to=peter.ujfalusi@ti.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=jarkko.nikula@bitmer.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=lrg@ti.com \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).