Sound: SOC: TAS571x: added missing register literals
Subsystems (3)
PATCH 1/5 Sound: SOC: TAS571x: added missing register literals
The list of TAS571x registers was incomplete. Added the missing register definitions up to register 0x25
--- sound/soc/codecs/tas571x.c | 4 ++++ sound/soc/codecs/tas571x.h | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+)
sound/soc/codecs/tas571x.c +4 -0
@@ -57,6 +57,10 @@ static int tas571x_register_size(struct tas571x_private *priv, unsigned int reg)case TAS571X_CH1_VOL_REG :case TAS571X_CH2_VOL_REG :return priv->chip->vol_reg_size; +case TAS571X_INPUT_MUX_REG : +case TAS571X_CH4_SRC_SELECT_REG : +case TAS571X_PWM_MUX_REG : +return 4 ;default :return 1 ; }
sound/soc/codecs/tas571x.h +22 -0
@@ -13,6 +13,10 @@#define _TAS571X_H/* device registers */ +#define TAS571X_CLK_CTRL_REG 0x00 +#define TAS571X_DEV_ID_REG 0x01 +#define TAS571X_ERR_STATUS_REG 0x02 +#define TAS571X_SYS_CTRL_1_REG 0x03#define TAS571X_SDI_REG 0x04#define TAS571X_SDI_FMT_MASK 0x0f
@@ -27,7 +31,25 @@#define TAS571X_MVOL_REG 0x07#define TAS571X_CH1_VOL_REG 0x08#define TAS571X_CH2_VOL_REG 0x09 +#define TAS571X_CH3_VOL_REG 0x0a +#define TAS571X_VOL_CFG_REG 0x0e +#define TAS571X_MODULATION_LIMIT_REG 0x10 +#define TAS571X_IC_DELAY_CH1_REG 0x11 +#define TAS571X_IC_DELAY_CH2_REG 0x12 +#define TAS571X_IC_DELAY_CH3_REG 0x13 +#define TAS571X_IC_DELAY_CH4_REG 0x14 +#define TAS571X_PWM_CH_SDN_GROUP_REG 0x19/* N/A on TAS5717, TAS5719 */ +#define TAS571X_PWM_CH1_SDN_MASK (1<<0) +#define TAS571X_PWM_CH2_SDN_SHIFT (1<<1) +#define TAS571X_PWM_CH3_SDN_SHIFT (1<<2) +#define TAS571X_PWM_CH4_SDN_SHIFT (1<<3) + +#define TAS571X_START_STOP_PERIOD_REG 0x1a#define TAS571X_OSC_TRIM_REG 0x1b +#define TAS571X_BKND_ERR_REG 0x1c +#define TAS571X_INPUT_MUX_REG 0x20 +#define TAS571X_CH4_SRC_SELECT_REG 0x21 +#define TAS571X_PWM_MUX_REG 0x25#endif /* _TAS571X_H */
Signature · 1 line
1.9.1
PATCH 2/5 Sound: SOC: TAS571x: chip type detection via I2C name
The chip selection was relying only on DT. It was not possible to use the driver without DT.
This adds the chip type detection from the I2C name, which allows to use the driver from the platform driver without DT.
--- sound/soc/codecs/tas571x.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
sound/soc/codecs/tas571x.c +7 -8
@@ -390,11 +390,10 @@ static int tas571x_i2c_probe(struct i2c_client *client,i2c_set_clientdata (client, priv); of_id =of_match_device (tas571x_of_match, dev); -if (!of_id) { -dev_err (dev,"Unknown device type\n" ); -return -EINVAL ; - } - priv->chip = of_id->data; +if (of_id) + priv->chip = of_id->data; +else + priv->chip = (void *) id->driver_data; priv->mclk =devm_clk_get (dev,"mclk" );if (IS_ERR (priv->mclk) &&PTR_ERR (priv->mclk) != -ENOENT ) {
@@ -495,9 +494,9 @@ static const struct of_device_id tas571x_of_match[] = {MODULE_DEVICE_TABLE (of, tas571x_of_match);static const struct i2c_device_id tas571x_i2c_id[] = { - {"tas5711" ,0 }, - {"tas5717" ,0 }, - {"tas5719" ,0 }, + {"tas5711" , (kernel_ulong_t) &tas5711_chip }, + {"tas5717" , (kernel_ulong_t) &tas5717_chip }, + {"tas5719" , (kernel_ulong_t) &tas5717_chip }, { } };MODULE_DEVICE_TABLE (i2c, tas571x_i2c_id);
Signature · 1 line
1.9.1
Mark Brown
maintainerApplied "ASoC: tas571x: chip type detection via I2C name" to the asoc tree
The patch
ASoC: tas571x: chip type detection via I2C name
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
f40d5ea2f48a3ad78f80b60f209507f160aa044bMon Sep 17 00:00:00 2001
From: Petr Kulhavy <[email protected]>
Date: Tue, 29 Mar 2016 09:39:35 +0200
Subject: [PATCH] ASoC: tas571x: chip type detection via I2C name
The chip selection was relying only on DT. It was not possible to use the driver without DT.
This adds the chip type detection from the I2C name, which allows to use the driver from the platform driver without DT.
--- sound/soc/codecs/tas571x.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
sound/soc/codecs/tas571x.c +7 -8
@@ -404,11 +404,10 @@ static int tas571x_i2c_probe(struct i2c_client *client,i2c_set_clientdata (client, priv); of_id =of_match_device (tas571x_of_match, dev); -if (!of_id) { -dev_err (dev,"Unknown device type\n" ); -return -EINVAL ; - } - priv->chip = of_id->data; +if (of_id) + priv->chip = of_id->data; +else + priv->chip = (void *) id->driver_data; priv->mclk =devm_clk_get (dev,"mclk" );if (IS_ERR (priv->mclk) &&PTR_ERR (priv->mclk) != -ENOENT ) {
@@ -505,9 +504,9 @@ static const struct of_device_id tas571x_of_match[] = {MODULE_DEVICE_TABLE (of, tas571x_of_match);static const struct i2c_device_id tas571x_i2c_id[] = { - {"tas5711" ,0 }, - {"tas5717" ,0 }, - {"tas5719" ,0 }, + {"tas5711" , (kernel_ulong_t) &tas5711_chip }, + {"tas5717" , (kernel_ulong_t) &tas5717_chip }, + {"tas5719" , (kernel_ulong_t) &tas5717_chip }, { } };MODULE_DEVICE_TABLE (i2c, tas571x_i2c_id);
Signature · 1 line
2.8.0.rc3
PATCH 3/5 Sound: SOC: TAS571x: implemented digital mute
In reply to Petr KulhavyThe driver did not have a mute function. The amplifier was brought out of shutdown mode (hard-mute) once for ever in probe(), which was causing clicks and pops when altering the I2C register configuration later.
This adds the digital_mute() function. The amplifier unmute in probe() was removed.
--- sound/soc/codecs/tas571x.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
sound/soc/codecs/tas571x.c +18 -4
@@ -171,6 +171,23 @@ static int tas571x_hw_params(struct snd_pcm_substream *substream, TAS571X_SDI_FMT_MASK, val); } +static int tas571x_mute (struct snd_soc_dai *dai,int mute) +{ +struct snd_soc_codec *codec = dai->codec; +u8 sysctl2; +int ret; + + sysctl2 = mute ?TAS571X_SYS_CTRL_2_SDN_MASK :0 ; + + ret =snd_soc_update_bits (codec, +TAS571X_SYS_CTRL_2_REG , +TAS571X_SYS_CTRL_2_SDN_MASK , + sysctl2); +usleep_range (1000 ,2000 ); + +return ret; +} +static int tas571x_set_bias_level (struct snd_soc_codec *codec,enum snd_soc_bias_level level) {
@@ -218,6 +235,7 @@ static int tas571x_set_bias_level(struct snd_soc_codec *codec,static const struct snd_soc_dai_ops tas571x_dai_ops = { .set_fmt = tas571x_set_dai_fmt, .hw_params = tas571x_hw_params, + .digital_mute = tas571x_mute, };static const char *const tas5711_supply_names[] = {
@@ -448,10 +466,6 @@ static int tas571x_i2c_probe(struct i2c_client *client,if (ret)return ret; - ret =regmap_update_bits (priv->regmap,TAS571X_SYS_CTRL_2_REG , -TAS571X_SYS_CTRL_2_SDN_MASK ,0 ); -if (ret) -return ret;memcpy (&priv->codec_driver, &tas571x_codec,sizeof (priv->codec_driver)); priv->codec_driver.controls = priv->chip->controls;
Signature · 1 line
1.9.1
Kevin Cernekee
maintainerRe: [PATCH 3/5] Sound: SOC: TAS571x: implemented digital mute
Quoted 42 lines · Petr Kulhavy
The driver did not have a mute function. The amplifier was brought out of shutdown mode (hard-mute) once for ever in
probe(), which was causing clicks and pops when altering the I2C register configuration later.This adds the
digital_mute()function. The amplifier unmute inprobe()was removed.Signed-off-by Petr Kulhavy <[email protected]>Tested-by Petr Kulhavy <[email protected]>--- sound/soc/codecs/tas571x.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)sound/soc/codecs/tas571x.c +17
-0@@ -171,6 +171,23 @@ static int tas571x_hw_params(struct snd_pcm_substream *substream, TAS571X_SDI_FMT_MASK, val); } +static int tas571x_mute (struct snd_soc_dai *dai,int mute) +{ +struct snd_soc_codec *codec = dai->codec; +u8 sysctl2; +int ret; + + sysctl2 = mute ?TAS571X_SYS_CTRL_2_SDN_MASK :0 ; + + ret =snd_soc_update_bits (codec, +TAS571X_SYS_CTRL_2_REG , +TAS571X_SYS_CTRL_2_SDN_MASK , + sysctl2); +usleep_range (1000 ,2000 ); + +return ret; +} +static int tas571x_set_bias_level (struct snd_soc_codec *codec,enum snd_soc_bias_level level) {
sound/soc/codecs/tas571x.c static int tas571x_set_bias_level(struct snd_soc_codec *codec, · line 239
Quoted 5 lines
sound/soc/codecs/tas571x.c +1
-0@@ -218,6 +235,7 @@ static int tas571x_set_bias_level(struct snd_soc_codec *codec,static const struct snd_soc_dai_ops tas571x_dai_ops = { .set_fmt = tas571x_set_dai_fmt, .hw_params = tas571x_hw_params, + .digital_mute = tas571x_mute, };
Hi Petr,
It is good to see that this driver is getting some use. :-)
An earlier iteration of the code implemented digital_mute, although it used a different register:
+ return regmap_update_bits(priv->regmap,
+ TAS571X_SOFT_MUTE_REG, + TAS571X_SOFT_MUTE_CH_MASK, + mute ? TAS571X_SOFT_MUTE_CH_MASK : 0);
This was removed here: https://chromium-review.googlesource.com/#/c/265878/
Are you able to test the modified code on 5711 and 5717 (or 5719)?
Re: [PATCH 3/5] Sound: SOC: TAS571x: implemented digital mute
Quoted 61 lines · Kevin Cernekee
Quoted 42 lines · Petr Kulhavy
The driver did not have a mute function. The amplifier was brought out of shutdown mode (hard-mute) once for ever in
probe(), which was causing clicks and pops when altering the I2C register configuration later.This adds the
digital_mute()function. The amplifier unmute inprobe()was removed.Signed-off-by Petr Kulhavy <[email protected]>Tested-by Petr Kulhavy <[email protected]>--- sound/soc/codecs/tas571x.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)sound/soc/codecs/tas571x.c +17
-0@@ -171,6 +171,23 @@ static int tas571x_hw_params(struct snd_pcm_substream *substream, TAS571X_SDI_FMT_MASK, val); } +static int tas571x_mute (struct snd_soc_dai *dai,int mute) +{ +struct snd_soc_codec *codec = dai->codec; +u8 sysctl2; +int ret; + + sysctl2 = mute ?TAS571X_SYS_CTRL_2_SDN_MASK :0 ; + + ret =snd_soc_update_bits (codec, +TAS571X_SYS_CTRL_2_REG , +TAS571X_SYS_CTRL_2_SDN_MASK , + sysctl2); +usleep_range (1000 ,2000 ); + +return ret; +} +static int tas571x_set_bias_level (struct snd_soc_codec *codec,enum snd_soc_bias_level level) {sound/soc/codecs/tas571x.c static int tas571x_set_bias_level(struct snd_soc_codec *codec, · line 239
Quoted 5 lines
sound/soc/codecs/tas571x.c +1
-0@@ -218,6 +235,7 @@ static int tas571x_set_bias_level(struct snd_soc_codec *codec,static const struct snd_soc_dai_ops tas571x_dai_ops = { .set_fmt = tas571x_set_dai_fmt, .hw_params = tas571x_hw_params, + .digital_mute = tas571x_mute, };Hi Petr,
It is good to see that this driver is getting some use. :-)
An earlier iteration of the code implemented
digital_mute, although it used a different register:(quoted diff) +4
-0+ return regmap_update_bits(priv->regmap, + TAS571X_SOFT_MUTE_REG, + TAS571X_SOFT_MUTE_CH_MASK, + mute ? TAS571X_SOFT_MUTE_CH_MASK : 0);
Quoted 3 lines
This was removed here: https://chromium-review.googlesource.com/#/c/265878/
Are you able to test the modified code on 5711 and 5717 (or 5719)?
Hi Kevin,
unfortunately I have only a board with TAS5721. But according to their datasheets all three types of amplifiers (11, 17 and 21) use the same bit 6 in register 0x05 for hard mute (all channels shut down). On TAS5721 it works well and using oscilloscope one can even see that the PWM is switched off.
The patch you are referring to is not correct since it mutes the input but not the power stage.
Another issue is that the channel mute is exported as a widget and therefore conflicting with what the user set.
The problem I was facing is that reconfiguration of the PWMs and/or output mapping (in the "soundcard" driver) was causing nasty pops in the speaker. Therefore the PWM shutdown (hard mute) is needed.
Regards
Petr
Mark Brown
maintainerApplied "ASoC: tas571x: implemented digital mute" to the asoc tree
In reply to Petr KulhavyThe patch
ASoC: tas571x: implemented digital mute
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
0400485076e8bb167d5f4b3eb5f6d05e4b4361b7Mon Sep 17 00:00:00 2001
From: Petr Kulhavy <[email protected]>
Date: Tue, 29 Mar 2016 09:39:36 +0200
Subject: [PATCH] ASoC: tas571x: implemented digital mute
The driver did not have a mute function. The amplifier was brought out of shutdown mode (hard-mute) once for ever in probe(), which was causing clicks and pops when altering the I2C register configuration later.
This adds the digital_mute() function. The amplifier unmute in probe() was removed.
--- sound/soc/codecs/tas571x.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
sound/soc/codecs/tas571x.c +18 -4
@@ -167,6 +167,23 @@ static int tas571x_hw_params(struct snd_pcm_substream *substream, TAS571X_SDI_FMT_MASK, val); } +static int tas571x_mute (struct snd_soc_dai *dai,int mute) +{ +struct snd_soc_codec *codec = dai->codec; +u8 sysctl2; +int ret; + + sysctl2 = mute ?TAS571X_SYS_CTRL_2_SDN_MASK :0 ; + + ret =snd_soc_update_bits (codec, +TAS571X_SYS_CTRL_2_REG , +TAS571X_SYS_CTRL_2_SDN_MASK , + sysctl2); +usleep_range (1000 ,2000 ); + +return ret; +} +static int tas571x_set_bias_level (struct snd_soc_codec *codec,enum snd_soc_bias_level level) {
@@ -214,6 +231,7 @@ static int tas571x_set_bias_level(struct snd_soc_codec *codec,static const struct snd_soc_dai_ops tas571x_dai_ops = { .set_fmt = tas571x_set_dai_fmt, .hw_params = tas571x_hw_params, + .digital_mute = tas571x_mute, };static const char *const tas5711_supply_names[] = {
@@ -445,10 +463,6 @@ static int tas571x_i2c_probe(struct i2c_client *client,if (ret)return ret; - ret =regmap_update_bits (priv->regmap,TAS571X_SYS_CTRL_2_REG , -TAS571X_SYS_CTRL_2_SDN_MASK ,0 ); -if (ret) -return ret;memcpy (&priv->codec_driver, &tas571x_codec,sizeof (priv->codec_driver)); priv->codec_driver.controls = priv->chip->controls;
Signature · 1 line
2.8.0.rc3
PATCH 4/5 Sound: SOC: TAS571x: added support for TAS5721
In reply to Petr KulhavyThis adds support for TAS5721.
--- sound/soc/codecs/Kconfig | 2 +- sound/soc/codecs/tas571x.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-)
sound/soc/codecs/Kconfig +1 -1
@@ -705,7 +705,7 @@ config SND_SOC_TAS5086 depends on I2C config SND_SOC_TAS571X - tristate "Texas Instruments TAS5711/TAS5717/TAS5719 power amplifiers" + tristate "Texas Instruments TAS5711/TAS5717/TAS5719/TAS5721 power amplifiers" depends on I2C config SND_SOC_TFA9879
sound/soc/codecs/tas571x.c +74 -0
98 lines not on this page · raw message
Signature · 1 line
1.9.1