drivers: audio: tlv320dac310x: Convert to the new GPIO API
Convert to the new GPIO API using logical access, including setting the GPIO line as active low in the Device Tree source. Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
7e5ca867de
commit
132bf05561
2 changed files with 5 additions and 9 deletions
|
@ -41,7 +41,7 @@
|
||||||
compatible = "ti,tlv320dac";
|
compatible = "ti,tlv320dac";
|
||||||
reg = <0x18>;
|
reg = <0x18>;
|
||||||
label = "TLV320DAC";
|
label = "TLV320DAC";
|
||||||
reset-gpios = <&gpio0 4 0>;
|
reset-gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,6 @@ LOG_MODULE_REGISTER(tlv320dac310x);
|
||||||
#define CODEC_OUTPUT_VOLUME_MAX 0
|
#define CODEC_OUTPUT_VOLUME_MAX 0
|
||||||
#define CODEC_OUTPUT_VOLUME_MIN (-78 * 2)
|
#define CODEC_OUTPUT_VOLUME_MIN (-78 * 2)
|
||||||
|
|
||||||
#define CODEC_RESET_PIN_ASSERT 0
|
|
||||||
#define CODEC_RESET_PIN_DEASSERT 1
|
|
||||||
|
|
||||||
struct codec_driver_config {
|
struct codec_driver_config {
|
||||||
struct device *i2c_device;
|
struct device *i2c_device;
|
||||||
const char *i2c_dev_name;
|
const char *i2c_dev_name;
|
||||||
|
@ -108,12 +105,11 @@ static int codec_configure(struct device *dev,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* configure reset GPIO */
|
/* Configure reset GPIO, and set the line to inactive, which will also
|
||||||
|
* de-assert the reset line and thus enable the codec.
|
||||||
|
*/
|
||||||
gpio_pin_configure(dev_cfg->gpio_device, dev_cfg->gpio_pin,
|
gpio_pin_configure(dev_cfg->gpio_device, dev_cfg->gpio_pin,
|
||||||
dev_cfg->gpio_flags | GPIO_DIR_OUT);
|
dev_cfg->gpio_flags | GPIO_OUTPUT_INACTIVE);
|
||||||
/* de-assert reset */
|
|
||||||
gpio_pin_write(dev_cfg->gpio_device, dev_cfg->gpio_pin,
|
|
||||||
CODEC_RESET_PIN_DEASSERT);
|
|
||||||
|
|
||||||
codec_soft_reset(dev);
|
codec_soft_reset(dev);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue