alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Bard Liao <bardliao@realtek.com>,
	broonie@kernel.org, lgirdwood@gmail.com
Cc: oder_chiou@realtek.com, alsa-devel@alsa-project.org,
	zhengxing@rock-chips.com, yang.a.fang@intel.com,
	koro.chen@mediatek.com, john.lin@realtek.com,
	Leilk.Liu@mediatek.com, flove@realtek.com
Subject: Re: [PATCH v2 1/2] ASoC: rt5645: change gpio to gpiod APIs
Date: Fri, 29 May 2015 18:31:08 +0200	[thread overview]
Message-ID: <5568944C.2060509@metafoo.de> (raw)
In-Reply-To: <1432894607-28489-1-git-send-email-bardliao@realtek.com>

On 05/29/2015 12:16 PM, Bard Liao wrote:
> @@ -3253,19 +3247,17 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
>   	} else {
>   		if (dmi_check_system(dmi_platform_intel_braswell)) {
>   			rt5645->pdata = *rt5645_pdata;
> -			gpiod = devm_gpiod_get_index(&i2c->dev, "rt5645", 0);
> -
> -			if (IS_ERR(gpiod) || gpiod_direction_input(gpiod)) {
> -				rt5645->pdata.hp_det_gpio = -1;
> -				dev_err(&i2c->dev, "failed to initialize gpiod\n");
> -			} else {
> -				rt5645->pdata.hp_det_gpio = desc_to_gpio(gpiod);
> -				rt5645->pdata.gpio_hp_det_active_high
> -						= !gpiod_is_active_low(gpiod);
> -			}
>   		}
>   	}
>
> +	rt5645->gpiod_hp_det = devm_gpiod_get_index(&i2c->dev, "rt5645", 0);

Three things, don't use the _index API if there is only a single gpio for 
the property, either don't use a name at all or use a descriptive name 
something like "hp-detect" and use the new version of the API which has the 
flags parameter.

So this should be: devm_gpiod_get(&i2c->dev, NULL, GPIOD_IN);

and then drop the gpiod_direction_input()...

  parent reply	other threads:[~2015-05-29 16:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-29 10:16 [PATCH v2 1/2] ASoC: rt5645: change gpio to gpiod APIs Bard Liao
2015-05-29 10:16 ` [PATCH v2 2/2] ASoC: rt5645: add device tree support Bard Liao
2015-05-29 16:31   ` Lars-Peter Clausen
2015-05-29 14:23 ` [PATCH v2 1/2] ASoC: rt5645: change gpio to gpiod APIs Michele Curti
2015-05-29 16:31 ` Lars-Peter Clausen [this message]
2015-06-02 17:16   ` Mark Brown
2015-06-03 12:03     ` Bard Liao
2015-06-03 12:08       ` Lars-Peter Clausen
2015-06-03 12:13       ` 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=5568944C.2060509@metafoo.de \
    --to=lars@metafoo.de \
    --cc=Leilk.Liu@mediatek.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bardliao@realtek.com \
    --cc=broonie@kernel.org \
    --cc=flove@realtek.com \
    --cc=john.lin@realtek.com \
    --cc=koro.chen@mediatek.com \
    --cc=lgirdwood@gmail.com \
    --cc=oder_chiou@realtek.com \
    --cc=yang.a.fang@intel.com \
    --cc=zhengxing@rock-chips.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).