mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
ASoC: es8311: add support 'delay-pa-drv-ms' property
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com> Change-Id: I3a7827fec9815ee407106d43d364e9c33975cb97
This commit is contained in:
@@ -45,6 +45,7 @@ struct es8311_priv {
|
||||
int adc_volume;
|
||||
int dac_volume;
|
||||
int aec_mode;
|
||||
int delay_pa_drv_ms;
|
||||
};
|
||||
|
||||
static const DECLARE_TLV_DB_SCALE(vdac_tlv,
|
||||
@@ -489,8 +490,11 @@ static int es8311_mute(struct snd_soc_dai *dai, int mute)
|
||||
} else {
|
||||
snd_soc_component_update_bits(component, ES8311_DAC_REG31, 0x60, 0x00);
|
||||
snd_soc_component_write(component, ES8311_SYSTEM_REG12, 0x00);
|
||||
if (es8311->spk_ctl_gpio)
|
||||
if (es8311->spk_ctl_gpio) {
|
||||
gpiod_direction_output(es8311->spk_ctl_gpio, 1);
|
||||
if (es8311->delay_pa_drv_ms)
|
||||
msleep(es8311->delay_pa_drv_ms);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -615,11 +619,31 @@ static int es8311_parse_dt(struct i2c_client *client,
|
||||
struct device_node *np;
|
||||
const char *str;
|
||||
u32 v;
|
||||
int ret;
|
||||
|
||||
np = client->dev.of_node;
|
||||
if (!np)
|
||||
return -EINVAL;
|
||||
|
||||
es8311->delay_pa_drv_ms = 0;
|
||||
es8311->spk_ctl_gpio = devm_gpiod_get_optional(&client->dev, "spk-ctl",
|
||||
GPIOD_OUT_LOW);
|
||||
if (!es8311->spk_ctl_gpio) {
|
||||
dev_info(&client->dev, "Don't need spk-ctl gpio\n");
|
||||
} else if (IS_ERR(es8311->spk_ctl_gpio)) {
|
||||
ret = PTR_ERR(es8311->spk_ctl_gpio);
|
||||
dev_err(&client->dev, "Unable to claim gpio spk-ctl\n");
|
||||
return ret;
|
||||
}
|
||||
ret = of_property_read_s32(np, "delay-pa-drv-ms",
|
||||
&es8311->delay_pa_drv_ms);
|
||||
if (ret < 0 && ret != -EINVAL) {
|
||||
dev_err(&client->dev,
|
||||
"Failed to read 'rockchip,delay-pa-drv-ms': %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
es8311->adc_pga_gain = 0; /* ADC PGA Gain is 0dB by default reset. */
|
||||
if (!of_property_read_u32(np, "adc-pga-gain", &v)) {
|
||||
if (v >= 0 && v <= 10)
|
||||
@@ -684,16 +708,6 @@ static int es8311_i2c_probe(struct i2c_client *i2c_client,
|
||||
if (IS_ERR(es8311->mclk_in))
|
||||
return PTR_ERR(es8311->mclk_in);
|
||||
|
||||
es8311->spk_ctl_gpio = devm_gpiod_get_optional(&i2c_client->dev, "spk-ctl",
|
||||
GPIOD_OUT_LOW);
|
||||
if (!es8311->spk_ctl_gpio) {
|
||||
dev_info(&i2c_client->dev, "Don't need spk-ctl gpio\n");
|
||||
} else if (IS_ERR(es8311->spk_ctl_gpio)) {
|
||||
ret = PTR_ERR(es8311->spk_ctl_gpio);
|
||||
dev_err(&i2c_client->dev, "Unable to claim gpio spk-ctl\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = es8311_parse_dt(i2c_client, es8311);
|
||||
if (ret < 0) {
|
||||
dev_err(&i2c_client->dev, "Parse DT failed: %d\n", ret);
|
||||
|
||||
Reference in New Issue
Block a user