Introduces MDSYNC support for CS35L45
Subsystems (4)
cover Introduces MDSYNC support for CS35L45
The CS35L45 has SYNC pin that can be used as a multi device synchronization (MDSYNC) bus. This pin can send various message types between Cirrus devices.
This patch series adds support for long and short DSP messages between CS35L45 devices.
Each device on the SYNC bus must have a unique transmitter identifier per message type as the bus arbitrates message priority via this identifier. These identifiers are set by the introduced devicetree properties. The priority assignment is intended to be a static system integration decision.
The relevant receiver controls are introduced as mixer controls so they are exposed at runtime to be configured for the appropriate use cases.
Ricardo Rivera-Matos (2):
ASoC: dt-bindings: cs35l45: Adds SYNC properties
ASoC: cs35l45: Adds support for SYNC bus
.../bindings/sound/cirrus,cs35l45.yaml | 27 +++++++ sound/soc/codecs/cs35l45-tables.c | 4 + sound/soc/codecs/cs35l45.c | 77 ++++++++++++++++++- sound/soc/codecs/cs35l45.h | 23 ++++++ 4 files changed, 130 insertions(+), 1 deletion(-)
Signature · 1 line
2.43.0
PATCH 1/2 ASoC: dt-bindings: cs35l45: Adds SYNC properties
Introduces support for the multidevice synchronization (SYNC) bus. The properties introduced allow for the configuration of the device's transmitter IDs.
--- .../bindings/sound/cirrus,cs35l45.yaml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+)
Documentation/devicetree/bindings/sound/cirrus,cs35l45.yaml +27 -0
@@ -53,6 +53,29 @@ properties: maximum: 3 default: 2 + sync: + description: + Multidevice synchronization (SYNC) bus configuration + type: object + additionalProperties: false + properties: + cirrus,sync-lsw-txid: + description: | + Transmitter ID to use for long software (LSW) data packets + on the SYNC bus. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 7 + default: 0 + cirrus,sync-sw-txid: + description: | + Transmitter ID to use for short software (SW) data packets + on the SYNC bus. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 7 + default: 0 + patternProperties: "^cirrus,gpio-ctrl[1-3]$": description:
@@ -155,5 +178,9 @@ examples: gpio-ctrl = <0x1>; gpio-dir = <0x1>; }; + sync { + cirrus,sync-lsw-txid = <0x1>; + cirrus,sync-sw-txid = <0x1>; + }; }; };
Signature · 1 line
2.43.0
PATCH 2/2 ASoC: cs35l45: Adds support for SYNC bus
In reply to Ricardo Rivera-MatosAdds support for the multidevice synchronization (SYNC) bus. The SYNC bus is an opaque one wire bus that is shared between Cirrus devices. Initial support only includes software (SW) data packets.
--- sound/soc/codecs/cs35l45-tables.c | 4 ++ sound/soc/codecs/cs35l45.c | 77 ++++++++++++++++++++++++++++++- sound/soc/codecs/cs35l45.h | 23 +++++++++ 3 files changed, 103 insertions(+), 1 deletion(-)
sound/soc/codecs/cs35l45-tables.c +4 -0
@@ -51,6 +51,8 @@ static const struct reg_default cs35l45_defaults[] = { { CS35L45_WKI2C_CTL, 0x00000030 }, { CS35L45_REFCLK_INPUT, 0x00000510 }, { CS35L45_GLOBAL_SAMPLE_RATE, 0x00000003 }, + { CS35L45_SYNC_TX_RX_ENABLES, 0x00000200 }, + { CS35L45_SYNC_SW_TX_ID, 0x00000000 }, { CS35L45_ASP_ENABLES1, 0x00000000 }, { CS35L45_ASP_CONTROL1, 0x00000028 }, { CS35L45_ASP_CONTROL2, 0x18180200 },
@@ -134,6 +136,8 @@ static bool cs35l45_readable_reg(struct device *dev, unsigned int reg)case CS35L45_PWRMGT_STS :case CS35L45_REFCLK_INPUT :case CS35L45_GLOBAL_SAMPLE_RATE : +case CS35L45_SYNC_TX_RX_ENABLES : +case CS35L45_SYNC_SW_TX_ID :case CS35L45_ASP_ENABLES1 :case CS35L45_ASP_CONTROL1 :case CS35L45_ASP_CONTROL2 :
sound/soc/codecs/cs35l45.c +76 -1
116 lines not on this page · raw message
sound/soc/codecs/cs35l45.h +23 -0
@@ -35,6 +35,8 @@#define CS35L45_PWRMGT_STS 0x0000290C#define CS35L45_REFCLK_INPUT 0x00002C04#define CS35L45_GLOBAL_SAMPLE_RATE 0x00002C0C +#define CS35L45_SYNC_TX_RX_ENABLES 0x00003400 +#define CS35L45_SYNC_SW_TX_ID 0x00003408#define CS35L45_BOOST_CCM_CFG 0x00003808#define CS35L45_BOOST_DCM_CFG 0x0000380C#define CS35L45_BOOST_OV_CFG 0x0000382C
@@ -183,6 +185,8 @@#define CS35L45_ASP_EN_SHIFT 27#define CS35L45_AMP_DRE_EN_SHIFT 20#define CS35L45_AMP_DRE_EN_MASK BIT(20) +#define CS35L45_SYNC_EN_SHIFT 8 +#define CS35L45_SYNC_EN_MASK BIT(8)#define CS35L45_MEM_RDY_SHIFT 1#define CS35L45_MEM_RDY_MASK BIT(1)
@@ -220,6 +224,22 @@#define CS35L45_44P100_KHZ 0x0B#define CS35L45_88P200_KHZ 0x0C +/* SYNC_TX_RX_ENABLES */ +#define CS35L45_SYNC_LSW_RX_EN_SHIFT 19 +#define CS35L45_SYNC_LSW_RX_EN_MASK BIT(19) +#define CS35L45_SYNC_LSW_TX_EN_SHIFT 18 +#define CS35L45_SYNC_LSW_TX_EN_MASK BIT(18) +#define CS35L45_SYNC_SW_RX_EN_SHIFT 17 +#define CS35L45_SYNC_SW_RX_EN_MASK BIT(17) +#define CS35L45_SYNC_SW_TX_EN_SHIFT 16 +#define CS35L45_SYNC_SW_TX_EN_MASK BIT(16) + +/* SYNC_SW_TX_ID */ +#define CS35L45_SYNC_LSW_TXID_SHIFT 8 +#define CS35L45_SYNC_LSW_TXID_MASK GENMASK(10, 8) +#define CS35L45_SYNC_SW_TXID_SHIFT 0 +#define CS35L45_SYNC_SW_TXID_MASK GENMASK(2, 0) +/* ASP_ENABLES_1 */ #define CS35L45_ASP_RX2_EN_SHIFT 17#define CS35L45_ASP_RX1_EN_SHIFT 16
@@ -320,6 +340,7 @@#define CS35L45_GPIO_CTRL_MASK GENMASK(22, 20)#define CS35L45_GPIO_INVERT_SHIFT 19#define CS35L45_GPIO_INVERT_MASK BIT(19) +#define CS35L45_GP1_CTRL_MDSYNC 0x2/* CS35L45_IRQ1_EINT_1 */ #define CS35L45_BST_UVP_ERR_SHIFT 7
@@ -493,6 +514,8 @@ struct cs35l45_private {struct regulator *vdd_a;bool initialized;bool sysclk_set; +bool sync_en; +bool sync_pin_set;u8 slot_width;u8 slot_count;int amplifier_mode;
Signature · 1 line
2.43.0
Mark Brown
maintainerRe: [PATCH 2/2] ASoC: cs35l45: Adds support for SYNC bus
Quoted 4 lines · Ricardo Rivera-Matos
Adds support for the multidevice synchronization (SYNC) bus. The SYNC bus is an opaque one wire bus that is shared between Cirrus devices. Initial support only includes software (SW) data packets.
Given this description...
sound/soc/codecs/cs35l45.c static const struct snd_kcontrol_new cs35l45_controls[] = { · line 656
Quoted 9 lines
sound/soc/codecs/cs35l45.c +9
-0+SOC_SINGLE_BOOL_EXT ("SYNC Enable" ,0 , cs35l45_sync_en_get, cs35l45_sync_en_put), +SOC_SINGLE ("SYNC LSW RX Enable" ,CS35L45_SYNC_TX_RX_ENABLES , +CS35L45_SYNC_LSW_RX_EN_SHIFT ,1 ,0 ), +SOC_SINGLE ("SYNC LSW TX Enable" ,CS35L45_SYNC_TX_RX_ENABLES , +CS35L45_SYNC_LSW_TX_EN_SHIFT ,1 ,0 ), +SOC_SINGLE ("SYNC SW RX Enable" ,CS35L45_SYNC_TX_RX_ENABLES , +CS35L45_SYNC_SW_RX_EN_SHIFT ,1 ,0 ), +SOC_SINGLE ("SYNC SW TX Enable" ,CS35L45_SYNC_TX_RX_ENABLES , + CS35L45_SYNC_SW_TX_EN_SHIFT, 1, 0),
...it's not clear to me why this would be user controllable.
Re: [PATCH 2/2] ASoC: cs35l45: Adds support for SYNC bus
Quoted 8 lines · Mark Brown
Quoted 4 lines · Ricardo Rivera-Matos
Adds support for the multidevice synchronization (SYNC) bus. The SYNC bus is an opaque one wire bus that is shared between Cirrus devices. Initial support only includes software (SW) data packets.
Given this description...
Quoted 11 lines
sound/soc/codecs/cs35l45.c static const struct snd_kcontrol_new cs35l45_controls[] = { · line 656
Quoted 9 lines
sound/soc/codecs/cs35l45.c +9
-0+SOC_SINGLE_BOOL_EXT ("SYNC Enable" ,0 , cs35l45_sync_en_get, cs35l45_sync_en_put), +SOC_SINGLE ("SYNC LSW RX Enable" ,CS35L45_SYNC_TX_RX_ENABLES , +CS35L45_SYNC_LSW_RX_EN_SHIFT ,1 ,0 ), +SOC_SINGLE ("SYNC LSW TX Enable" ,CS35L45_SYNC_TX_RX_ENABLES , +CS35L45_SYNC_LSW_TX_EN_SHIFT ,1 ,0 ), +SOC_SINGLE ("SYNC SW RX Enable" ,CS35L45_SYNC_TX_RX_ENABLES , +CS35L45_SYNC_SW_RX_EN_SHIFT ,1 ,0 ), +SOC_SINGLE ("SYNC SW TX Enable" ,CS35L45_SYNC_TX_RX_ENABLES , + CS35L45_SYNC_SW_TX_EN_SHIFT, 1, 0),...it's not clear to me why this would be user controllable.
This can be use-case dependent. An example that comes to mind is keeping similar transducers linked during a posture switch.
That is to say, on a four speaker system in landscape orientation, two particular amps are acting as linked tweeters and two amps are acting as unlinked woofers. When rotated into portrait orientation the linking over the SYNC bus needs to be reconfigured to match the new pairings in the portrait use-case.
Ricardo
Mark Brown
maintainerRe: [PATCH 2/2] ASoC: cs35l45: Adds support for SYNC bus
In reply to Ricardo Rivera-MatosQuoted 5 lines · Ricardo Rivera-Matos
Adds support for the multidevice synchronization (SYNC) bus. The SYNC bus is an opaque one wire bus that is shared between Cirrus devices. Initial support only includes software (SW) data packets.
sound/soc/codecs/cs35l45.c static int cs35l45_sys_resume(struct device *dev) · line 1128
Quoted 9 lines
sound/soc/codecs/cs35l45.c +9
-0+ ret =of_property_read_u32 (child,"sync-lsw-txid" , &val); +if (!ret) +regmap_update_bits (cs35l45->regmap,CS35L45_SYNC_SW_TX_ID , +CS35L45_SYNC_LSW_TXID_MASK , val <<CS35L45_SYNC_LSW_TXID_SHIFT ); + + ret =of_property_read_u32 (child,"sync-sw-txid" , &val); +if (!ret) +regmap_update_bits (cs35l45->regmap,CS35L45_SYNC_SW_TX_ID , +CS35L45_SYNC_SW_TXID_MASK , val);
These are namespace cirrus, in the binding.
Re: [PATCH 2/2] ASoC: cs35l45: Adds support for SYNC bus
Quoted 6 lines · Mark Brown
Quoted 4 lines · Ricardo Rivera-Matos
Adds support for the multidevice synchronization (SYNC) bus. The SYNC bus is an opaque one wire bus that is shared between Cirrus devices. Initial support only includes software (SW) data packets.
Quoted 11 lines
sound/soc/codecs/cs35l45.c static int cs35l45_sys_resume(struct device *dev) · line 1128
Quoted 9 lines
sound/soc/codecs/cs35l45.c +9
-0+ ret =of_property_read_u32 (child,"sync-lsw-txid" , &val); +if (!ret) +regmap_update_bits (cs35l45->regmap,CS35L45_SYNC_SW_TX_ID , +CS35L45_SYNC_LSW_TXID_MASK , val <<CS35L45_SYNC_LSW_TXID_SHIFT ); + + ret =of_property_read_u32 (child,"sync-sw-txid" , &val); +if (!ret) +regmap_update_bits (cs35l45->regmap,CS35L45_SYNC_SW_TX_ID , +CS35L45_SYNC_SW_TXID_MASK , val);These are namespace cirrus, in the binding.
ACK. The binding is correct, the driver and my test dtb are stale. This will get fixed in v2.