ASoC: codecs: tc358749x: compatible with different power pin definitions

some boards do not define the power pin such as power18/power33
for tc358749x

Change-Id: I36914dc005e465c290f71df2483d1969f6d101ef
Signed-off-by: Xinhuang Li <buluess.li@rock-chips.com>
This commit is contained in:
Xinhuang Li
2017-11-21 16:25:55 +08:00
committed by Tao Huang
parent fec2710757
commit 059e614bdd

View File

@@ -189,11 +189,6 @@ static int tc358749x_parse_dts(struct i2c_client *i2c,
tc358749x->gpio_power18 = devm_gpiod_get_optional(dev, "power18",
GPIOD_OUT_LOW);
if (IS_ERR(tc358749x->gpio_power18)) {
ret = PTR_ERR(tc358749x->gpio_power18);
dev_err(&i2c->dev, "Unable to claim gpio \"power18\".\n");
return ret;
}
tc358749x->gpio_power = devm_gpiod_get_optional(dev, "power",
GPIOD_OUT_LOW);
@@ -205,11 +200,6 @@ static int tc358749x_parse_dts(struct i2c_client *i2c,
tc358749x->gpio_power33 = devm_gpiod_get_optional(dev, "power33",
GPIOD_OUT_LOW);
if (IS_ERR(tc358749x->gpio_power33)) {
ret = PTR_ERR(tc358749x->gpio_power33);
dev_err(&i2c->dev, "Unable to claim gpio \"power33\".\n");
return ret;
}
tc358749x->gpio_int = devm_gpiod_get_optional(dev, "int",
GPIOD_OUT_LOW);
@@ -232,7 +222,6 @@ static int tc358749x_parse_dts(struct i2c_client *i2c,
if (IS_ERR(tc358749x->gpio_csi_ctl)) {
ret = PTR_ERR(tc358749x->gpio_csi_ctl);
dev_err(&i2c->dev, "Unable to claim gpio \"csi-ctl\".\n");
return ret;
}
tc358749x->gpio_stanby = devm_gpiod_get_optional(dev, "stanby",
@@ -243,8 +232,20 @@ static int tc358749x_parse_dts(struct i2c_client *i2c,
return ret;
}
gpiod_direction_output(tc358749x->gpio_power18, 1);
gpiod_direction_output(tc358749x->gpio_power33, 1);
if (IS_ERR(tc358749x->gpio_power18)) {
ret = PTR_ERR(tc358749x->gpio_power18);
dev_err(&i2c->dev, "Unable to claim gpio \"power18\".\n");
} else {
gpiod_direction_output(tc358749x->gpio_power18, 1);
}
if (IS_ERR(tc358749x->gpio_power33)) {
ret = PTR_ERR(tc358749x->gpio_power33);
dev_err(&i2c->dev, "Unable to claim gpio \"power33\".\n");
} else {
gpiod_direction_output(tc358749x->gpio_power33, 1);
}
gpiod_direction_output(tc358749x->gpio_power, 1);
gpiod_direction_output(tc358749x->gpio_stanby, 1);
gpiod_direction_output(tc358749x->gpio_reset, 1);