diff mbox series

[10/10] ASoC: Intel: soc-acpi: Add CS35L56 Soundwire to TGL

Message ID 20230217161410.915202-11-rf@opensource.cirrus.com (mailing list archive)
State New, archived
Headers show
Series ASoC: Initial support for Cirrus Logic CS35L56 | expand

Commit Message

Richard Fitzgerald Feb. 17, 2023, 4:14 p.m. UTC
This adds match entries for one or four CS35L56 on SDW0.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
 .../intel/common/soc-acpi-intel-tgl-match.c   | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)

Comments

Pierre-Louis Bossart Feb. 21, 2023, 4:52 p.m. UTC | #1
> +static const struct snd_soc_acpi_link_adr up_extreme_cs35l56_sdw0_one[] = {
> +	{
> +		.mask = BIT(0),
> +		.num_adr = 1,
> +		.adr_d = cs35l56_sdw0_adr,
> +	},
> +	{}
> +};
> +
> +static const struct snd_soc_acpi_link_adr up_extreme_cs35l56_sdw0_four[] = {
> +	{
> +		.mask = BIT(0),
> +		.num_adr = 4,
> +		.adr_d = cs35l56_sdw0_adr,
> +	},
> +	{}
> +};

If the machine driver has support for the 2-amplifier configuration,
shouldn't it be present here as well?

> +
>  /* this table is used when there is no I2S codec present */
>  struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_sdw_machines[] = {
>  	/* mockup tests need to be first */
> @@ -501,6 +546,18 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_sdw_machines[] = {
>  		.drv_name = "sof_sdw",
>  		.sof_tplg_filename = "sof-tgl-rt711.tplg",
>  	},
> +	{
> +		.link_mask = BIT(0),
> +		.links = up_extreme_cs35l56_sdw0_four,
> +		.drv_name = "sof_sdw",
> +		.sof_tplg_filename = "sof-tgl-cs35l56-sdw0.tplg"
> +	},
> +	{
> +		.link_mask = BIT(0),
> +		.links = up_extreme_cs35l56_sdw0_one,
> +		.drv_name = "sof_sdw",
> +		.sof_tplg_filename = "sof-tgl-cs35l56-sdw0.tplg"
> +	},
>  	{},
>  };
>  EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_tgl_sdw_machines);
Richard Fitzgerald Feb. 22, 2023, 11:48 a.m. UTC | #2
On 21/02/2023 16:52, Pierre-Louis Bossart wrote:
> 
>> +static const struct snd_soc_acpi_link_adr up_extreme_cs35l56_sdw0_one[] = {
>> +	{
>> +		.mask = BIT(0),
>> +		.num_adr = 1,
>> +		.adr_d = cs35l56_sdw0_adr,
>> +	},
>> +	{}
>> +};
>> +
>> +static const struct snd_soc_acpi_link_adr up_extreme_cs35l56_sdw0_four[] = {
>> +	{
>> +		.mask = BIT(0),
>> +		.num_adr = 4,
>> +		.adr_d = cs35l56_sdw0_adr,
>> +	},
>> +	{}
>> +};
> 
> If the machine driver has support for the 2-amplifier configuration,
> shouldn't it be present here as well?
> 

Not necessarily.
It's not a setup we're currently using on this initial TGL
configuration.

The machine driver we'd expect to work on multiple hardware. The
counting algorithm has to go through "2" anyway, and the code to
handle that is so trivial we may as well include it.

>> +
>>   /* this table is used when there is no I2S codec present */
>>   struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_sdw_machines[] = {
>>   	/* mockup tests need to be first */
>> @@ -501,6 +546,18 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_sdw_machines[] = {
>>   		.drv_name = "sof_sdw",
>>   		.sof_tplg_filename = "sof-tgl-rt711.tplg",
>>   	},
>> +	{
>> +		.link_mask = BIT(0),
>> +		.links = up_extreme_cs35l56_sdw0_four,
>> +		.drv_name = "sof_sdw",
>> +		.sof_tplg_filename = "sof-tgl-cs35l56-sdw0.tplg"
>> +	},
>> +	{
>> +		.link_mask = BIT(0),
>> +		.links = up_extreme_cs35l56_sdw0_one,
>> +		.drv_name = "sof_sdw",
>> +		.sof_tplg_filename = "sof-tgl-cs35l56-sdw0.tplg"
>> +	},
>>   	{},
>>   };
>>   EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_tgl_sdw_machines);
Pierre-Louis Bossart Feb. 22, 2023, 2:31 p.m. UTC | #3
On 2/22/23 06:48, Richard Fitzgerald wrote:
> On 21/02/2023 16:52, Pierre-Louis Bossart wrote:
>>
>>> +static const struct snd_soc_acpi_link_adr
>>> up_extreme_cs35l56_sdw0_one[] = {
>>> +    {
>>> +        .mask = BIT(0),
>>> +        .num_adr = 1,
>>> +        .adr_d = cs35l56_sdw0_adr,
>>> +    },
>>> +    {}
>>> +};
>>> +
>>> +static const struct snd_soc_acpi_link_adr
>>> up_extreme_cs35l56_sdw0_four[] = {
>>> +    {
>>> +        .mask = BIT(0),
>>> +        .num_adr = 4,
>>> +        .adr_d = cs35l56_sdw0_adr,
>>> +    },
>>> +    {}
>>> +};
>>
>> If the machine driver has support for the 2-amplifier configuration,
>> shouldn't it be present here as well?
>>
> 
> Not necessarily.
> It's not a setup we're currently using on this initial TGL
> configuration.
> 
> The machine driver we'd expect to work on multiple hardware. The
> counting algorithm has to go through "2" anyway, and the code to
> handle that is so trivial we may as well include it.

it's fine. usually we are more conservative and have a 1:1 match between
the soc-acpi tables and machine driver, but it doesn't hurt to add the
2-amp case in the machine driver.
diff mbox series

Patch

diff --git a/sound/soc/intel/common/soc-acpi-intel-tgl-match.c b/sound/soc/intel/common/soc-acpi-intel-tgl-match.c
index ef19150e7b2e..dae76c96d9fe 100644
--- a/sound/soc/intel/common/soc-acpi-intel-tgl-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-tgl-match.c
@@ -414,6 +414,51 @@  struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_machines[] = {
 };
 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_tgl_machines);
 
+static const struct snd_soc_acpi_adr_device cs35l56_sdw0_adr[] = {
+	{
+		.adr = 0x00003001fa355601,
+		.num_endpoints = 1,
+		.endpoints = &single_endpoint,
+		.name_prefix = "AMP1"
+	},
+	{
+		.adr = 0x00003101fa355601,
+		.num_endpoints = 1,
+		.endpoints = &single_endpoint,
+		.name_prefix = "AMP2"
+	},
+	{
+		.adr = 0x00003201fa355601,
+		.num_endpoints = 1,
+		.endpoints = &single_endpoint,
+		.name_prefix = "AMP3"
+	},
+	{
+		.adr = 0x00003301fa355601,
+		.num_endpoints = 1,
+		.endpoints = &single_endpoint,
+		.name_prefix = "AMP4"
+	},
+};
+
+static const struct snd_soc_acpi_link_adr up_extreme_cs35l56_sdw0_one[] = {
+	{
+		.mask = BIT(0),
+		.num_adr = 1,
+		.adr_d = cs35l56_sdw0_adr,
+	},
+	{}
+};
+
+static const struct snd_soc_acpi_link_adr up_extreme_cs35l56_sdw0_four[] = {
+	{
+		.mask = BIT(0),
+		.num_adr = 4,
+		.adr_d = cs35l56_sdw0_adr,
+	},
+	{}
+};
+
 /* this table is used when there is no I2S codec present */
 struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_sdw_machines[] = {
 	/* mockup tests need to be first */
@@ -501,6 +546,18 @@  struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_sdw_machines[] = {
 		.drv_name = "sof_sdw",
 		.sof_tplg_filename = "sof-tgl-rt711.tplg",
 	},
+	{
+		.link_mask = BIT(0),
+		.links = up_extreme_cs35l56_sdw0_four,
+		.drv_name = "sof_sdw",
+		.sof_tplg_filename = "sof-tgl-cs35l56-sdw0.tplg"
+	},
+	{
+		.link_mask = BIT(0),
+		.links = up_extreme_cs35l56_sdw0_one,
+		.drv_name = "sof_sdw",
+		.sof_tplg_filename = "sof-tgl-cs35l56-sdw0.tplg"
+	},
 	{},
 };
 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_tgl_sdw_machines);