On 06/03/2015 02:03 PM, Bard Liao wrote:
-----Original Message----- From: Mark Brown [mailto:broonie@kernel.org] Sent: Wednesday, June 03, 2015 1:17 AM To: Lars-Peter Clausen Cc: Bard Liao; lgirdwood@gmail.com; Oder Chiou; alsa-devel@alsa-project.org; zhengxing@rock-chips.com; yang.a.fang@intel.com; koro.chen@mediatek.com; John Lin; Leilk.Liu@mediatek.com; Flove Subject: Re: [alsa-devel] [PATCH v2 1/2] ASoC: rt5645: change gpio to gpiod APIs
On Fri, May 29, 2015 at 06:31:08PM +0200, Lars-Peter Clausen wrote:
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()...
It seems better if people use names where possible if there's any chance that we could add support for other GPIOs in the future, that avoids confusion further down the line with extension.
Do you mean use a well-described gpio name such as "hp-detect" so that we can use another name if we need to add other gpios in the future?
Yes, kind of. The name of the GPIO should be its function. Having a GPIO with the name rt5645 on a rt5645 does not really describe anything since we already know that it is a rt5645.