TAS2562 issue fixes and slot programming
v6 cover TAS2562 issue fixes and slot programming
Hello
This series fixes issues tih the shut-down gpio device tree allocation and a code format issue found.
While working on a project slot programming for the tx and rx paths needed to be enabled. In addition the vsense slot programming needed to be configurable and not directly a simpler adder to the isense slot.
Finally the yaml conversion patch was moved to be the last patch in the series so that the fixes can be applied and the yaml can be reviewed appropriately and does not hold up the rest of the fixes.
Dan
Dan Murphy (7):
dt-bindings: tas2562: Fix shut-down gpio property
ASoC: tas2562: Update shutdown GPIO property
ASoC: tas2562: Fix format issue for extra space before a comma
ASoC: tas2562: Add rx and tx slot programming
dt-bindings: tas2562: Add voltage sense slot property
ASoC: tas2562: Add voltage sense slot configuration
dt-bindings: tas2562: Convert the tas2562 binding to yaml
.../devicetree/bindings/sound/tas2562.txt | 34 ------- .../devicetree/bindings/sound/tas2562.yaml | 77 ++++++++++++++++ sound/soc/codecs/tas2562.c | 88 +++++++++++++++---- sound/soc/codecs/tas2562.h | 4 + 4 files changed, 151 insertions(+), 52 deletions(-) delete mode 100644 Documentation/devicetree/bindings/sound/tas2562.txt create mode 100644 Documentation/devicetree/bindings/sound/tas2562.yaml
Signature · 1 line
2.26.2
PATCH v6 1/7 dt-bindings: tas2562: Fix shut-down gpio property
Fix the shut-down gpio property to be shut-down-gpio and fix the example.
--- Documentation/devicetree/bindings/sound/tas2562.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/sound/tas2562.txt +2 -2
@@ -16,7 +16,7 @@ Optional properties: - interrupt-parent: phandle to the interrupt controller which provides the interrupt. - interrupts: (GPIO) interrupt to which the chip is connected. -- shut-down: GPIO used to control the state of the device. +- shut-down-gpio: GPIO used to control the state of the device. Examples: tas2562@4c {
@@ -28,7 +28,7 @@ tas2562@4c { interrupt-parent = <&gpio1>; interrupts = <14>; - shut-down = <&gpio1 15 0>; + shut-down-gpio = <&gpio1 15 0>; ti,imon-slot-no = <0>; };
Signature · 1 line
2.26.2
PATCH v6 2/7 ASoC: tas2562: Update shutdown GPIO property
In reply to Dan MurphyUpdate the shutdown GPIO property to be shutdown from shut-down.
--- sound/soc/codecs/tas2562.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/tas2562.c +2 -2
@@ -619,8 +619,8 @@ static int tas2562_parse_dt(struct tas2562_data *tas2562)struct device *dev = tas2562->dev;int ret =0 ; - tas2562->sdz_gpio =devm_gpiod_get_optional (dev,"shut-down-gpio" , -GPIOD_OUT_HIGH ); + tas2562->sdz_gpio =devm_gpiod_get_optional (dev,"shut-down" , +GPIOD_OUT_HIGH );if (IS_ERR (tas2562->sdz_gpio)) {if (PTR_ERR (tas2562->sdz_gpio) == -EPROBE_DEFER ) { tas2562->sdz_gpio =NULL ;
Signature · 1 line
2.26.2
PATCH v6 3/7 ASoC: tas2562: Fix format issue for extra space before a comma
In reply to Dan MurphyFix the issue found that there is an extra space before a comma in the volume control.
--- sound/soc/codecs/tas2562.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/tas2562.c +1 -1
@@ -504,7 +504,7 @@ static const struct snd_kcontrol_new tas2562_snd_controls[] = { .info = snd_soc_info_volsw, .get = tas2562_volume_control_get, .put = tas2562_volume_control_put, - .private_value = SOC_SINGLE_VALUE(TAS2562_DVC_CFG1, 0, 110, 0, 0) , + .private_value = SOC_SINGLE_VALUE(TAS2562_DVC_CFG1, 0, 110, 0, 0), }, };
Signature · 1 line
2.26.2
PATCH v6 4/7 ASoC: tas2562: Add rx and tx slot programming
In reply to Dan MurphyAdd programming for the tdm slots for both tx and rx offsets.
--- sound/soc/codecs/tas2562.c | 17 ++++++++++++++++- sound/soc/codecs/tas2562.h | 4 ++++ 2 files changed, 20 insertions(+), 1 deletion(-)
sound/soc/codecs/tas2562.c +16 -1
@@ -208,6 +208,22 @@ static int tas2562_set_dai_tdm_slot(struct snd_soc_dai *dai,if (ret <0 )return ret; +if (tx_mask >TAS2562_TX_OFF_MAX ) { +dev_err (tas2562->dev,"TX slot is larger then %d" , +TAS2562_TX_OFF_MAX ); +return -EINVAL ; + } + + ret =snd_soc_component_update_bits (component,TAS2562_TDM_CFG1 , +TAS2562_RX_OFF_MASK , rx_mask <<1 ); +if (ret <0 ) +return ret; + + ret =snd_soc_component_update_bits (component,TAS2562_TDM_CFG4 , +TAS2562_TX_OFF_MASK , tx_mask <<1 ); +if (ret <0 ) +return ret; +return 0 ; }
@@ -327,7 +343,6 @@ static int tas2562_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) ret =snd_soc_component_update_bits (component,TAS2562_TDM_CFG1 ,TAS2562_TDM_CFG1_RX_OFFSET_MASK , tdm_rx_start_slot); -if (ret <0 )return ret;
sound/soc/codecs/tas2562.h +4 -0
@@ -34,6 +34,10 @@#define TAS2562_TDM_DET TAS2562_REG(0, 0x11)#define TAS2562_REV_ID TAS2562_REG(0, 0x7d) +#define TAS2562_RX_OFF_MASK GENMASK(5, 1) +#define TAS2562_TX_OFF_MASK GENMASK(3, 1) +#define TAS2562_TX_OFF_MAX 7 +/* Page 2 */ #define TAS2562_DVC_CFG1 TAS2562_REG(2, 0x0c)#define TAS2562_DVC_CFG2 TAS2562_REG(2, 0x0d)
Signature · 1 line
2.26.2
Re: [PATCH v6 4/7] ASoC: tas2562: Add rx and tx slot programming
Hello
Quoted 22 lines · Dan Murphy
Add programming for the tdm slots for both tx and rx offsets.
Signed-off-by Dan Murphy <[email protected]>--- sound/soc/codecs/tas2562.c | 17 ++++++++++++++++- sound/soc/codecs/tas2562.h | 4 ++++ 2 files changed, 20 insertions(+), 1 deletion(-)sound/soc/codecs/tas2562.c +6
-0@@ -208,6 +208,22 @@ static int tas2562_set_dai_tdm_slot(struct snd_soc_dai *dai,if (ret <0 )return ret; +if (tx_mask >TAS2562_TX_OFF_MAX ) { +dev_err (tas2562->dev,"TX slot is larger then %d" , +TAS2562_TX_OFF_MAX ); +return -EINVAL ; + } +
sound/soc/codecs/tas2562.c static int tas2562_set_dai_tdm_slot(struct snd_soc_dai *dai, · line 226
Quoted 10 lines
sound/soc/codecs/tas2562.c +10
-0+ ret =snd_soc_component_update_bits (component,TAS2562_TDM_CFG1 , +TAS2562_RX_OFF_MASK , rx_mask <<1 ); +if (ret <0 ) +return ret; + + ret =snd_soc_component_update_bits (component,TAS2562_TDM_CFG4 , +TAS2562_TX_OFF_MASK , tx_mask <<1 ); +if (ret <0 ) +return ret; +
I need to fix this patch to remove the slot programming during dai_fmt as the code is not correct and resets the slots
Dan
PATCH v6 5/7 dt-bindings: tas2562: Add voltage sense slot property
In reply to Dan MurphyAdd a property to configure the slot for the voltage sense monitoring of the device. Vsense data will be sent to the processor via the slot defined by the property
--- Documentation/devicetree/bindings/sound/tas2562.txt | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/sound/tas2562.txt +3 -0
@@ -11,6 +11,8 @@ Required properties: - compatible: - Should contain "ti,tas2562", "ti,tas2563". - reg: - The i2c address. Should be 0x4c, 0x4d, 0x4e or 0x4f. - ti,imon-slot-no:- TDM TX current sense time slot. + - ti,vmon-slot-no:- TDM TX voltage sense time slot. This slot must always be + greater then ti,imon-slot-no. Optional properties: - interrupt-parent: phandle to the interrupt controller which provides
@@ -30,5 +32,6 @@ tas2562@4c { shut-down-gpio = <&gpio1 15 0>; ti,imon-slot-no = <0>; + ti,vmon-slot-no = <1>; };
Signature · 1 line
2.26.2
PATCH v6 6/7 ASoC: tas2562: Add voltage sense slot configuration
In reply to Dan MurphyAdd Vsense slot configuration based on the device tree. Adding this property enables the slot programming to be moved to the tdm_set_slot callback. This in affect sets the slots for the Isense and Vsense and enabling this these modes are now based on whether these features were powered on or not.
--- sound/soc/codecs/tas2562.c | 65 ++++++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 14 deletions(-)
sound/soc/codecs/tas2562.c +51 -14
@@ -224,12 +224,26 @@ static int tas2562_set_dai_tdm_slot(struct snd_soc_dai *dai,if (ret <0 )return ret; + ret =snd_soc_component_update_bits (component,TAS2562_TDM_CFG5 , +TAS2562_TDM_CFG5_VSNS_SLOT_MASK , + tas2562->v_sense_slot); +if (ret <0 ) +return ret; + + ret =snd_soc_component_update_bits (component,TAS2562_TDM_CFG6 , +TAS2562_TDM_CFG6_ISNS_SLOT_MASK , + tas2562->i_sense_slot); +if (ret <0 ) +return ret; +return 0 ; }static int tas2562_set_bitwidth (struct tas2562_data *tas2562,int bitwidth) {int ret; +int val; +int sense_en;switch (bitwidth) {case SNDRV_PCM_FORMAT_S16_LE :
@@ -237,21 +251,18 @@ static int tas2562_set_bitwidth(struct tas2562_data *tas2562, int bitwidth)TAS2562_TDM_CFG2 ,TAS2562_TDM_CFG2_RXWLEN_MASK , TAS2562_TDM_CFG2_RXWLEN_16B); - tas2562->v_sense_slot = tas2562->i_sense_slot +2 ;break ;case SNDRV_PCM_FORMAT_S24_LE :snd_soc_component_update_bits (tas2562->component,TAS2562_TDM_CFG2 ,TAS2562_TDM_CFG2_RXWLEN_MASK ,TAS2562_TDM_CFG2_RXWLEN_24B ); - tas2562->v_sense_slot = tas2562->i_sense_slot +4 ;break ;case SNDRV_PCM_FORMAT_S32_LE :snd_soc_component_update_bits (tas2562->component,TAS2562_TDM_CFG2 ,TAS2562_TDM_CFG2_RXWLEN_MASK ,TAS2562_TDM_CFG2_RXWLEN_32B ); - tas2562->v_sense_slot = tas2562->i_sense_slot +4 ;break ;default :
@@ -259,17 +270,27 @@ static int tas2562_set_bitwidth(struct tas2562_data *tas2562, int bitwidth)return -EINVAL ; } - ret =snd_soc_component_update_bits (tas2562->component, -TAS2562_TDM_CFG5 , -TAS2562_TDM_CFG5_VSNS_EN |TAS2562_TDM_CFG5_VSNS_SLOT_MASK , -TAS2562_TDM_CFG5_VSNS_EN | tas2562->v_sense_slot); + val =snd_soc_component_read (tas2562->component,TAS2562_PWR_CTRL ); +if (val <0 ) +return val; + +if (val & (1 <<TAS2562_VSENSE_POWER_EN )) + sense_en =0 ; +else + sense_en =TAS2562_TDM_CFG5_VSNS_EN ; + + ret =snd_soc_component_update_bits (tas2562->component,TAS2562_TDM_CFG5 , +TAS2562_TDM_CFG5_VSNS_EN , sense_en);if (ret <0 )return ret; - ret =snd_soc_component_update_bits (tas2562->component, -TAS2562_TDM_CFG6 , -TAS2562_TDM_CFG6_ISNS_EN |TAS2562_TDM_CFG6_ISNS_SLOT_MASK , -TAS2562_TDM_CFG6_ISNS_EN | tas2562->i_sense_slot); +if (val & (1 <<TAS2562_ISENSE_POWER_EN )) + sense_en =0 ; +else + sense_en =TAS2562_TDM_CFG6_ISNS_EN ; + + ret =snd_soc_component_update_bits (tas2562->component,TAS2562_TDM_CFG6 , +TAS2562_TDM_CFG6_ISNS_EN , sense_en);if (ret <0 )return ret;
@@ -645,9 +666,25 @@ static int tas2562_parse_dt(struct tas2562_data *tas2562) ret =fwnode_property_read_u32 (dev->fwnode,"ti,imon-slot-no" , &tas2562->i_sense_slot); -if (ret) -dev_err (dev,"Looking up %s property failed %d\n" , -"ti,imon-slot-no" , ret); +if (ret) { +dev_err (dev,"Property %s is missing setting default slot\n" , +"ti,imon-slot-no" ); + tas2562->i_sense_slot =0 ; + } + + + ret =fwnode_property_read_u32 (dev->fwnode,"ti,vmon-slot-no" , + &tas2562->v_sense_slot); +if (ret) { +dev_info (dev,"Property %s is missing setting default slot\n" , +"ti,vmon-slot-no" ); + tas2562->v_sense_slot =2 ; + } + +if (tas2562->v_sense_slot < tas2562->i_sense_slot) { +dev_err (dev,"Vsense slot must be greater than Isense slot\n" ); +return -EINVAL ; + }return ret; }
Signature · 1 line
2.26.2
PATCH v6 7/7 dt-bindings: tas2562: Convert the tas2562 binding to yaml
In reply to Dan MurphyConvert the TAS2562 text file to yaml format.
--- .../devicetree/bindings/sound/tas2562.txt | 37 --------- .../devicetree/bindings/sound/tas2562.yaml | 77 +++++++++++++++++++ 2 files changed, 77 insertions(+), 37 deletions(-) delete mode 100644 Documentation/devicetree/bindings/sound/tas2562.txt create mode 100644 Documentation/devicetree/bindings/sound/tas2562.yaml
Documentation/devicetree/bindings/sound/tas2562.txt deleted +0 -37
@@ -1,37 +0,0 @@ -Texas Instruments TAS2562 Smart PA - -The TAS2562 is a mono, digital input Class-D audio amplifier optimized for -efficiently driving high peak power into small loudspeakers. -Integrated speaker voltage and current sense provides for -real time monitoring of loudspeaker behavior. - -Required properties: - - #address-cells - Should be <1>. - - #size-cells - Should be <0>. - - compatible: - Should contain "ti,tas2562", "ti,tas2563". - - reg: - The i2c address. Should be 0x4c, 0x4d, 0x4e or 0x4f. - - ti,imon-slot-no:- TDM TX current sense time slot. - - ti,vmon-slot-no:- TDM TX voltage sense time slot. This slot must always be - greater then ti,imon-slot-no. - -Optional properties: -- interrupt-parent: phandle to the interrupt controller which provides - the interrupt. -- interrupts: (GPIO) interrupt to which the chip is connected. -- shut-down-gpio: GPIO used to control the state of the device. - -Examples: -tas2562@4c { - #address-cells = <1>; - #size-cells = <0>; - compatible = "ti,tas2562"; - reg = <0x4c>; - - interrupt-parent = <&gpio1>; - interrupts = <14>; - - shut-down-gpio = <&gpio1 15 0>; - ti,imon-slot-no = <0>; - ti,vmon-slot-no = <1>; -}; -
Documentation/devicetree/bindings/sound/tas2562.yaml new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
2.26.2
Mark Brown
maintainerQuoted 8 lines · Dan Murphy
This series fixes issues tih the shut-down gpio device tree allocation and a code format issue found.
While working on a project slot programming for the tx and rx paths needed to be enabled. In addition the vsense slot programming needed to be configurable and not directly a simpler adder to the isense slot.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/6] ASoC: tas2562: Fix shut-down gpio property
commit: 6f81e520b2906258a063f09b8d1dd9d0cc6a3172
[2/6] ASoC: tas2562: Update shutdown GPIO property
commit: bc07b54459cbb3a572a78b5c200ff79ef11b8158
[3/6] ASoC: tas2562: Fix format issue for extra space before a comma
commit: c8294da2ed0be726bb87019eba3a6367c7f1c922[4/6] ASoC: tas2562: Add rx and tx slot programming
(no commit info)
[5/6] dt-bindings: tas2562: Add voltage sense slot property
(no commit info)
[6/6] ASoC: tas2562: Add voltage sense slot configuration
(no commit info)
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