From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Rhyland Klein <rklein@nvidia.com>
Cc: Liam Girdwood <lrg@ti.com>,
alsa-devel@alsa-project.org, Peter Hsiang <cdefgab1288@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: max98095: add jack detection
Date: Tue, 13 Mar 2012 23:09:39 +0000 [thread overview]
Message-ID: <20120313230939.GO3177@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1331667848-8168-1-git-send-email-rklein@nvidia.com>
[-- Attachment #1: Type: text/plain, Size: 1518 bytes --]
On Tue, Mar 13, 2012 at 12:44:08PM -0700, Rhyland Klein wrote:
> This change adds the logic to support using the jack detect mechanism built
> in to the codec to detect both when a jack was inserted and what type of
> jack is present.
This looks mostly good, a few things below.
> @@ -51,6 +52,9 @@ struct max98095_priv {
> u8 lin_state;
> unsigned int mic1pre;
> unsigned int mic2pre;
> + int irq;
You can just get the irq from the I2C device.
> + if (max98095->headphone_jack == max98095->mic_jack)
> + snd_soc_jack_report(max98095->headphone_jack,
> + hp_report | mic_report,
> + SND_JACK_HEADSET);
> + else {
Braces on both sides of the if for clarity.
> +static irqreturn_t max98095_jack_handler(int irq, void *data)
> +{
> + struct snd_soc_codec *codec = data;
> + int ret;
> +
> + ret = max98095_report_jack(codec);
> +
> + return ret ? IRQ_NONE : IRQ_HANDLED;
There is no point in having a separate function here, this function has
no contents. Just inline it. Please also avoid the use of the ternery
operator.
> + /* configure jack detection: slew is calculated as 4 * (delay + 1)
> + * The default is 24 (0x18) to get 100ms delay.
> + */
> + ret = snd_soc_write(codec, M98095_08E_JACK_DC_SLEW,
> + M98095_DEFAULT_SLEW_DELAY);
> + if (ret < 0) {
> + dev_err(codec->dev, "Failed to cfg auto detect %d\n", ret);
> + return ret;
> + }
Platform data?
> + enable_irq(max98095->irq);
You shouldn't be fiddling around with enable_irq() and disable_irq().
Why are you doing this?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-03-13 23:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 19:44 [PATCH] ASoC: max98095: add jack detection Rhyland Klein
2012-03-13 22:12 ` Mark Brown
2012-03-13 22:18 ` Rhyland Klein
2012-03-13 23:09 ` Mark Brown [this message]
2012-03-13 23:15 ` Rhyland Klein
-- strict thread matches above, loose matches on Subject: below --
2012-03-13 19:40 Rhyland Klein
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=20120313230939.GO3177@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=cdefgab1288@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
--cc=rklein@nvidia.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