[alsa-devel] [PATCH v2 0/4] ASoC: tas571x: fix of several issues for TAS5717
An extensive usage of the TAS571x driver with the TAS5717 chip revealed several issues which in the first place caused audio to fail to play. This set of one-line and trivial patches fixes them.
The issues were: * improper handling of the power-down signal * some timings not obeyed * channel mixer volume controls in the wrong chip structure ;-)
Petr Kulhavy (4): ASoC: tas571x: extend the t_i2c time to comply with TAS5721 ASoC: tas571x: remove improper PDN signal usage in set_bias_level ASoC: tas571x: wait 50ms after oscillator trim ASoC: tas571x: move mixer volume controls from TAS5711 to TAS5717
sound/soc/codecs/tas571x.c | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-)
TAS5721 datasheet recommends to wait at least 13.5ms after deasserting the RESET signal. For TAS5717 this time is only 12ms, which was the original value in the code.
Extend the wait time after deasserting RESET from 12 to 13.5ms to comply with the TAS5721 specification.
Signed-off-by: Petr Kulhavy brain@jikos.cz --- sound/soc/codecs/tas571x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c index e996313..4d61357 100644 --- a/sound/soc/codecs/tas571x.c +++ b/sound/soc/codecs/tas571x.c @@ -748,7 +748,7 @@ static int tas571x_i2c_probe(struct i2c_client *client, /* pulse the active low reset line for ~100us */ usleep_range(100, 200); gpiod_set_value(priv->reset_gpio, 0); - usleep_range(12000, 20000); + usleep_range(13500, 20000); }
ret = regmap_write(priv->regmap, TAS571X_OSC_TRIM_REG, 0);
The set_bias_level toggles the PDN signal when entering SND_SOC_BIAS_STANDBY and SND_SOC_BIAS_OFF. However this has no effect and actually breaks things down (tested with TAS5717) due to the following reasons:
1) holding down PDN does not save power but holding down RST does 2) now hard mute via register 0x5 is implemented and therefore it is no longer needed to toggle PDN to enter all channel shut down 3) in order to leave PDN it is required to toggle the RST signal (see TAS5721 datasheet), which was not implemented 4) toggling PDN as implemented actually mutes PWMs and there is no audio output (tested on TAS5717)
For these reasons remove the PDN signal toggling and just initialize it to inactive in probe().
Signed-off-by: Petr Kulhavy brain@jikos.cz --- sound/soc/codecs/tas571x.c | 14 -------------- 1 file changed, 14 deletions(-)
diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c index 4d61357..a8a3279 100644 --- a/sound/soc/codecs/tas571x.c +++ b/sound/soc/codecs/tas571x.c @@ -341,20 +341,9 @@ static int tas571x_set_bias_level(struct snd_soc_codec *codec, return ret; } } - - gpiod_set_value(priv->pdn_gpio, 0); - usleep_range(5000, 6000); - - regcache_cache_only(priv->regmap, false); - ret = regcache_sync(priv->regmap); - if (ret) - return ret; } break; case SND_SOC_BIAS_OFF: - regcache_cache_only(priv->regmap, true); - gpiod_set_value(priv->pdn_gpio, 1); - if (!IS_ERR(priv->mclk)) clk_disable_unprepare(priv->mclk); break; @@ -771,9 +760,6 @@ static int tas571x_i2c_probe(struct i2c_client *client, return ret; }
- regcache_cache_only(priv->regmap, true); - gpiod_set_value(priv->pdn_gpio, 1); - return snd_soc_register_codec(&client->dev, &priv->codec_driver, &tas571x_dai, 1); }
Wait extra 50ms after writing the oscillator trim register in probe(), as recommended by the TAS5721 and TAS5711 datasheets.
Signed-off-by: Petr Kulhavy brain@jikos.cz --- sound/soc/codecs/tas571x.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c index a8a3279..f3252af 100644 --- a/sound/soc/codecs/tas571x.c +++ b/sound/soc/codecs/tas571x.c @@ -744,6 +744,7 @@ static int tas571x_i2c_probe(struct i2c_client *client, if (ret) return ret;
+ usleep_range(50000, 60000);
memcpy(&priv->codec_driver, &tas571x_codec, sizeof(priv->codec_driver)); priv->codec_driver.component_driver.controls = priv->chip->controls;
Channel 1 and 2 Mixer Volume controls (registers 0x72/0x73 and 0x76/0x77) were wrongly assigned to tas5711_controls in commit f252d2346022 ("ASoC: tas571x: add input channel mixer for TAS5717/19")
Therefore move them to tas5717_controls.
Signed-off-by: Petr Kulhavy brain@jikos.cz --- sound/soc/codecs/tas571x.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c index f3252af..71790a1 100644 --- a/sound/soc/codecs/tas571x.c +++ b/sound/soc/codecs/tas571x.c @@ -391,16 +391,6 @@ static const struct snd_kcontrol_new tas5711_controls[] = { TAS571X_SOFT_MUTE_REG, TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT, 1, 1), - - SOC_DOUBLE_R_RANGE("CH1 Mixer Volume", - TAS5717_CH1_LEFT_CH_MIX_REG, - TAS5717_CH1_RIGHT_CH_MIX_REG, - 16, 0, 0x80, 0), - - SOC_DOUBLE_R_RANGE("CH2 Mixer Volume", - TAS5717_CH2_LEFT_CH_MIX_REG, - TAS5717_CH2_RIGHT_CH_MIX_REG, - 16, 0, 0x80, 0), };
static const struct regmap_range tas571x_readonly_regs_range[] = { @@ -478,6 +468,16 @@ static const struct snd_kcontrol_new tas5717_controls[] = { TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT, 1, 1),
+ SOC_DOUBLE_R_RANGE("CH1 Mixer Volume", + TAS5717_CH1_LEFT_CH_MIX_REG, + TAS5717_CH1_RIGHT_CH_MIX_REG, + 16, 0, 0x80, 0), + + SOC_DOUBLE_R_RANGE("CH2 Mixer Volume", + TAS5717_CH2_LEFT_CH_MIX_REG, + TAS5717_CH2_RIGHT_CH_MIX_REG, + 16, 0, 0x80, 0), + /* * The biquads are named according to the register names. * Please note that TI's TAS57xx Graphical Development Environment
On Wed, Oct 05, 2016 at 03:51:03PM +0200, Petr Kulhavy wrote:
An extensive usage of the TAS571x driver with the TAS5717 chip revealed several issues which in the first place caused audio to fail to play. This set of one-line and trivial patches fixes them.
Please do not submit new versions of already applied patches, please submit incremental updates to the existing code. Modifying existing commits creates problems for other users building on top of those commits so it's best practice to only change pubished git commits if absolutely essential.
participants (2)
-
Mark Brown
-
Petr Kulhavy