From: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
To: Charles Keepax
<ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
Cc: cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
patches-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org
Subject: Re: [PATCH 1/2] extcon: arizona: Add device bindings for the micd configurations
Date: Sun, 24 Apr 2016 17:49:28 +0200 [thread overview]
Message-ID: <20160424154928.GB8880@amd> (raw)
In-Reply-To: <1449767299-29691-1-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
On Thu 2015-12-10 17:08:18, Charles Keepax wrote:
> Add device bindings to support configuring the jack detection
> configurations. Each configuration needs to specify the connection of
> the mic det pins, which micbias should be used and the value of the
> micd polarity GPIO required to activate that configuration.
>
> Signed-off-by: Charles Keepax <ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
Reviewed-by: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
> ---
> drivers/extcon/extcon-arizona.c | 53 +++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 51 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
> index 8647533..edbf2e1 100644
> --- a/drivers/extcon/extcon-arizona.c
> +++ b/drivers/extcon/extcon-arizona.c
> @@ -1201,7 +1201,54 @@ static void arizona_micd_set_level(struct arizona *arizona, int index,
> regmap_update_bits(arizona->regmap, reg, mask, level);
> }
>
> -static int arizona_extcon_device_get_pdata(struct arizona *arizona)
> +static int arizona_extcon_get_micd_configs(struct device *dev,
> + struct arizona *arizona)
> +{
> + const char * const prop = "wlf,micd-configs";
> + const int entries_per_config = 3;
> + struct arizona_micd_config *micd_configs;
> + int nconfs, ret;
> + int i, j;
> + u32 *vals;
> +
> + nconfs = device_property_read_u32_array(arizona->dev, prop, NULL, 0);
> + if (nconfs <= 0)
> + return 0;
> +
> + vals = kcalloc(nconfs, sizeof(u32), GFP_KERNEL);
> + if (!vals)
> + return -ENOMEM;
> +
> + ret = device_property_read_u32_array(arizona->dev, prop, vals, nconfs);
> + if (ret < 0)
> + goto out;
> +
> + nconfs /= entries_per_config;
> +
> + micd_configs = devm_kzalloc(dev,
> + nconfs * sizeof(struct arizona_micd_range),
> + GFP_KERNEL);
> + if (!micd_configs) {
> + ret = -ENOMEM;
> + goto out;
> + }
> +
> + for (i = 0, j = 0; i < nconfs; ++i) {
> + micd_configs[i].src = vals[j++] ? ARIZONA_ACCDET_SRC : 0;
> + micd_configs[i].bias = vals[j++];
> + micd_configs[i].gpio = vals[j++];
> + }
> +
> + arizona->pdata.micd_configs = micd_configs;
> + arizona->pdata.num_micd_configs = nconfs;
> +
> +out:
> + kfree(vals);
> + return ret;
> +}
> +
> +static int arizona_extcon_device_get_pdata(struct device *dev,
> + struct arizona *arizona)
> {
> struct arizona_pdata *pdata = &arizona->pdata;
> unsigned int val = ARIZONA_ACCDET_MODE_HPL;
> @@ -1249,6 +1296,8 @@ static int arizona_extcon_device_get_pdata(struct arizona *arizona)
> pdata->jd_gpio5_nopull = device_property_read_bool(arizona->dev,
> "wlf,use-jd2-nopull");
>
> + arizona_extcon_get_micd_configs(dev, arizona);
> +
> return 0;
> }
>
> @@ -1270,7 +1319,7 @@ static int arizona_extcon_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> if (!dev_get_platdata(arizona->dev))
> - arizona_extcon_device_get_pdata(arizona);
> + arizona_extcon_device_get_pdata(&pdev->dev, arizona);
>
> info->micvdd = devm_regulator_get(&pdev->dev, "MICVDD");
> if (IS_ERR(info->micvdd)) {
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
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
next prev parent reply other threads:[~2016-04-24 15:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-10 17:08 [PATCH 1/2] extcon: arizona: Add device bindings for the micd configurations Charles Keepax
[not found] ` <1449767299-29691-1-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2015-12-10 17:08 ` [PATCH 2/2] extcon: arizona: Update device tree binding for mic detect configurations Charles Keepax
[not found] ` <1449767299-29691-2-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2015-12-11 3:44 ` Rob Herring
2015-12-14 2:03 ` Chanwoo Choi
2015-12-14 9:18 ` Charles Keepax
2016-04-24 15:49 ` Pavel Machek [this message]
2015-12-14 4:11 ` [PATCH 1/2] extcon: arizona: Add device bindings for the micd configurations Chanwoo Choi
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=20160424154928.GB8880@amd \
--to=pavel-+zi9xunit7i@public.gmane.org \
--cc=ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
--cc=cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=patches-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@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).