devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
To: Inha Song <ideal.song-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	patches-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org,
	cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	rf-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	pawel.moll-5wv7dgnIgG8@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org
Subject: Re: [alsa-devel] [PATCH v3 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection
Date: Sat, 25 Apr 2015 13:50:25 +0100	[thread overview]
Message-ID: <20150425125025.GI3480@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1429701801-25287-2-git-send-email-ideal.song-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

On Wed, Apr 22, 2015 at 08:23:20PM +0900, Inha Song wrote:
> This patch add support for select accessory detect mode to HPDETL or HPDETR.
> Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins
> to measure the impedance of an external load connected to the headphone.
> 
> Depending on board design, headphone detect pins can change to HPDETR or HPDETL.
> 
> Signed-off-by: Inha Song <ideal.song-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
>  
> +static int arizona_extcon_of_get_pdata(struct arizona *arizona)
> +{
> +	struct arizona_pdata *pdata = &arizona->pdata;
> +	unsigned int val;

I would rather this is "unsigned int val =
ARIZONA_ACCDET_MODE_HPL;".

> +
> +	of_property_read_u32(arizona->dev->of_node, "wlf,hpdet-channel", &val);

Because this won't fill val if the DT entry isn't present.

> +	switch (val) {

Which means we hit this with val uninitialised.

> +	case ARIZONA_ACCDET_MODE_HPL:
> +	case ARIZONA_ACCDET_MODE_HPR:

So we may select either channel at random.

> +		pdata->hpdet_channel = val;
> +		break;
> +	default:
> +		dev_err(arizona->dev,
> +			"Wrong wlf,hpdet-channel DT value %d\n", val);

Or most likely just print an error but the DT being missing
shouldn't really be an error it is an optional entry.

> +		pdata->hpdet_channel = ARIZONA_ACCDET_MODE_HPL;
> +	}
> +
> +	return 0;
> +}

Thanks,
Charles
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-04-25 12:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-22 11:23 [alsa-devel] [PATCH v3 0/2] Add support for select accessory detect mode to HPDETL or HPDETR Inha Song
2015-04-22 11:23 ` [alsa-devel] [PATCH v3 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection Inha Song
     [not found]   ` <1429701801-25287-2-git-send-email-ideal.song-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-04-25 12:50     ` Charles Keepax [this message]
2015-04-27  1:26       ` Inha Song
2015-04-22 11:23 ` [alsa-devel] [PATCH v3 2/2] mfd: arizona: Update DT binding to support hpdet channel Inha Song
     [not found]   ` <1429701801-25287-3-git-send-email-ideal.song-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-04-25 12:51     ` Charles Keepax

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=20150425125025.GI3480@opensource.wolfsonmicro.com \
    --to=ckeepax-yzvpicuk2aatku/dhu1wvuem+bqzidxxqq4iyu8u01e@public.gmane.org \
    --cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ideal.song-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=patches-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
    --cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
    --cc=rf-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /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).