29 May
2015
29 May
'15
6:31 p.m.
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()...