ASoC: tlv320aic3x: Add reset inverted DT property

Add reset inverted property to allow reset signal
as active high instead of the default active low
polarity.

Change-Id: I27ae32ba296f71b1d989837ada8b4ad8766ba8ba
Signed-off-by: Rajesha Kini <rkini@codeaurora.org>
Signed-off-by: Gustavo Solaira <gustavos@codeaurora.org>
tirimbino
Rajesha Kini 6 years ago committed by Gustavo Solaira
parent 07737f8aeb
commit e72948be4c
  1. 3
      Documentation/devicetree/bindings/sound/tlv320aic3x.txt
  2. 15
      sound/soc/codecs/tlv320aic3x.c

@ -17,7 +17,8 @@ Required properties:
Optional properties:
- gpio-reset - gpio pin number used for codec reset
- gpio-reset - gpio pin number used for codec reset, default active low
- reset-inverted - set the reset gpio mode as active high
- ai3x-gpio-func - <array of 2 int> - AIC3X_GPIO1 & AIC3X_GPIO2 Functionality
- Not supported on tlv320aic3104
- ai3x-micbias-vg - MicBias Voltage required.

@ -84,6 +84,7 @@ struct aic3x_priv {
struct list_head list;
int master;
int gpio_reset;
bool reset_inverted;
int power;
#define AIC3X_MODEL_3X 0
#define AIC3X_MODEL_33 1
@ -1355,7 +1356,8 @@ static int aic3x_regulator_event(struct notifier_block *nb,
* of the supplies was disabled
*/
if (gpio_is_valid(aic3x->gpio_reset))
gpio_set_value(aic3x->gpio_reset, 0);
gpio_set_value(aic3x->gpio_reset,
aic3x->reset_inverted);
regcache_mark_dirty(aic3x->regmap);
}
@ -1377,7 +1379,8 @@ static int aic3x_set_power(struct snd_soc_codec *codec, int power)
if (gpio_is_valid(aic3x->gpio_reset)) {
udelay(1);
gpio_set_value(aic3x->gpio_reset, 1);
gpio_set_value(aic3x->gpio_reset,
!aic3x->reset_inverted);
}
/* Sync reg_cache with the hardware */
@ -1810,6 +1813,9 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
else
aic3x->gpio_reset = -1;
aic3x->reset_inverted =
of_property_read_bool(np, "reset-inverted");
if (of_property_read_u32_array(np, "ai3x-gpio-func",
ai3x_setup->gpio_func, 2) >= 0) {
aic3x->setup = ai3x_setup;
@ -1846,7 +1852,8 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
ret = gpio_request(aic3x->gpio_reset, "tlv320aic3x reset");
if (ret != 0)
goto err;
gpio_direction_output(aic3x->gpio_reset, 0);
gpio_direction_output(aic3x->gpio_reset,
aic3x->reset_inverted);
}
for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++)
@ -1894,7 +1901,7 @@ static int aic3x_i2c_remove(struct i2c_client *client)
snd_soc_unregister_codec(&client->dev);
if (gpio_is_valid(aic3x->gpio_reset) &&
!aic3x_is_shared_reset(aic3x)) {
gpio_set_value(aic3x->gpio_reset, 0);
gpio_set_value(aic3x->gpio_reset, aic3x->reset_inverted);
gpio_free(aic3x->gpio_reset);
}
return 0;

Loading…
Cancel
Save