|
@@ -16,6 +16,7 @@
|
|
#include <linux/slab.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/regulator/consumer.h>
|
|
#include <linux/regulator/consumer.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/delay.h>
|
|
|
|
+#include <linux/gpio/consumer.h>
|
|
|
|
|
|
#include <sound/pcm.h>
|
|
#include <sound/pcm.h>
|
|
#include <sound/pcm_params.h>
|
|
#include <sound/pcm_params.h>
|
|
@@ -43,6 +44,7 @@ struct tas6424_data {
|
|
unsigned int last_fault1;
|
|
unsigned int last_fault1;
|
|
unsigned int last_fault2;
|
|
unsigned int last_fault2;
|
|
unsigned int last_warn;
|
|
unsigned int last_warn;
|
|
|
|
+ struct gpio_desc *standby_gpio;
|
|
};
|
|
};
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -627,6 +629,22 @@ static int tas6424_i2c_probe(struct i2c_client *client,
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Get control of the standby pin and set it LOW to take the codec
|
|
|
|
+ * out of the stand-by mode.
|
|
|
|
+ * Note: The actual pin polarity is taken care of in the GPIO lib
|
|
|
|
+ * according the polarity specified in the DTS.
|
|
|
|
+ */
|
|
|
|
+ tas6424->standby_gpio = devm_gpiod_get_optional(dev, "standby",
|
|
|
|
+ GPIOD_OUT_LOW);
|
|
|
|
+ if (IS_ERR(tas6424->standby_gpio)) {
|
|
|
|
+ if (PTR_ERR(tas6424->standby_gpio) == -EPROBE_DEFER)
|
|
|
|
+ return -EPROBE_DEFER;
|
|
|
|
+ dev_info(dev, "failed to get standby GPIO: %ld\n",
|
|
|
|
+ PTR_ERR(tas6424->standby_gpio));
|
|
|
|
+ tas6424->standby_gpio = NULL;
|
|
|
|
+ }
|
|
|
|
+
|
|
for (i = 0; i < ARRAY_SIZE(tas6424->supplies); i++)
|
|
for (i = 0; i < ARRAY_SIZE(tas6424->supplies); i++)
|
|
tas6424->supplies[i].supply = tas6424_supply_names[i];
|
|
tas6424->supplies[i].supply = tas6424_supply_names[i];
|
|
ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(tas6424->supplies),
|
|
ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(tas6424->supplies),
|
|
@@ -671,6 +689,10 @@ static int tas6424_i2c_remove(struct i2c_client *client)
|
|
|
|
|
|
cancel_delayed_work_sync(&tas6424->fault_check_work);
|
|
cancel_delayed_work_sync(&tas6424->fault_check_work);
|
|
|
|
|
|
|
|
+ /* put the codec in stand-by */
|
|
|
|
+ if (tas6424->standby_gpio)
|
|
|
|
+ gpiod_set_value_cansleep(tas6424->standby_gpio, 1);
|
|
|
|
+
|
|
ret = regulator_bulk_disable(ARRAY_SIZE(tas6424->supplies),
|
|
ret = regulator_bulk_disable(ARRAY_SIZE(tas6424->supplies),
|
|
tas6424->supplies);
|
|
tas6424->supplies);
|
|
if (ret < 0) {
|
|
if (ret < 0) {
|