Skip to content

Commit 769dca2

Browse files
simontrimmertiwai
authored andcommitted
ALSA: hda: cs35l56: Add support for CS35L54 and CS35L57
Add the HID for the CS35L54 and CS35L57 Boosted Smart Amplifiers. These have the same control interface as the CS35L56 so are handled by the cs35l56-hda driver. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Message-ID: <20240308135900.603192-3-rf@opensource.cirrus.com>
1 parent afd17e6 commit 769dca2

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

sound/pci/hda/cs35l56_hda.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,15 @@ static void cs35l56_hda_request_firmware_files(struct cs35l56_hda *cs35l56,
458458

459459
if (preloaded_fw_ver) {
460460
snprintf(base_name, sizeof(base_name),
461-
"cirrus/cs35l56-%02x%s-%06x-dsp1-misc",
461+
"cirrus/cs35l%02x-%02x%s-%06x-dsp1-misc",
462+
cs35l56->base.type,
462463
cs35l56->base.rev,
463464
cs35l56->base.secured ? "-s" : "",
464465
preloaded_fw_ver & 0xffffff);
465466
} else {
466467
snprintf(base_name, sizeof(base_name),
467-
"cirrus/cs35l56-%02x%s-dsp1-misc",
468+
"cirrus/cs35l%02x-%02x%s-dsp1-misc",
469+
cs35l56->base.type,
468470
cs35l56->base.rev,
469471
cs35l56->base.secured ? "-s" : "");
470472
}
@@ -834,9 +836,10 @@ static int cs35l56_hda_system_resume(struct device *dev)
834836
return 0;
835837
}
836838

837-
static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int id)
839+
static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int hid, int id)
838840
{
839841
u32 values[HDA_MAX_COMPONENTS];
842+
char hid_string[8];
840843
struct acpi_device *adev;
841844
const char *property, *sub;
842845
size_t nval;
@@ -847,7 +850,8 @@ static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int id)
847850
* the serial-multi-instantiate driver, so lookup the node by HID
848851
*/
849852
if (!ACPI_COMPANION(cs35l56->base.dev)) {
850-
adev = acpi_dev_get_first_match_dev("CSC3556", NULL, -1);
853+
snprintf(hid_string, sizeof(hid_string), "CSC%04X", hid);
854+
adev = acpi_dev_get_first_match_dev(hid_string, NULL, -1);
851855
if (!adev) {
852856
dev_err(cs35l56->base.dev, "Failed to find an ACPI device for %s\n",
853857
dev_name(cs35l56->base.dev));
@@ -935,14 +939,14 @@ static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int id)
935939
return ret;
936940
}
937941

938-
int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int id)
942+
int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int hid, int id)
939943
{
940944
int ret;
941945

942946
mutex_init(&cs35l56->base.irq_lock);
943947
dev_set_drvdata(cs35l56->base.dev, cs35l56);
944948

945-
ret = cs35l56_hda_read_acpi(cs35l56, id);
949+
ret = cs35l56_hda_read_acpi(cs35l56, hid, id);
946950
if (ret)
947951
goto err;
948952

sound/pci/hda/cs35l56_hda.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct cs35l56_hda {
4242

4343
extern const struct dev_pm_ops cs35l56_hda_pm_ops;
4444

45-
int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int id);
45+
int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int hid, int id);
4646
void cs35l56_hda_remove(struct device *dev);
4747

4848
#endif /*__CS35L56_HDA_H__*/

sound/pci/hda/cs35l56_hda_i2c.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
static int cs35l56_hda_i2c_probe(struct i2c_client *clt)
1515
{
16+
const struct i2c_device_id *id = i2c_client_get_device_id(clt);
1617
struct cs35l56_hda *cs35l56;
1718
int ret;
1819

@@ -33,7 +34,7 @@ static int cs35l56_hda_i2c_probe(struct i2c_client *clt)
3334
return ret;
3435
}
3536

36-
ret = cs35l56_hda_common_probe(cs35l56, clt->addr);
37+
ret = cs35l56_hda_common_probe(cs35l56, id->driver_data, clt->addr);
3738
if (ret)
3839
return ret;
3940
ret = cs35l56_irq_request(&cs35l56->base, clt->irq);
@@ -49,7 +50,9 @@ static void cs35l56_hda_i2c_remove(struct i2c_client *clt)
4950
}
5051

5152
static const struct i2c_device_id cs35l56_hda_i2c_id[] = {
52-
{ "cs35l56-hda", 0 },
53+
{ "cs35l54-hda", 0x3554 },
54+
{ "cs35l56-hda", 0x3556 },
55+
{ "cs35l57-hda", 0x3557 },
5356
{}
5457
};
5558

sound/pci/hda/cs35l56_hda_spi.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
static int cs35l56_hda_spi_probe(struct spi_device *spi)
1515
{
16+
const struct spi_device_id *id = spi_get_device_id(spi);
1617
struct cs35l56_hda *cs35l56;
1718
int ret;
1819

@@ -33,7 +34,7 @@ static int cs35l56_hda_spi_probe(struct spi_device *spi)
3334
return ret;
3435
}
3536

36-
ret = cs35l56_hda_common_probe(cs35l56, spi_get_chipselect(spi, 0));
37+
ret = cs35l56_hda_common_probe(cs35l56, id->driver_data, spi_get_chipselect(spi, 0));
3738
if (ret)
3839
return ret;
3940
ret = cs35l56_irq_request(&cs35l56->base, spi->irq);
@@ -49,7 +50,9 @@ static void cs35l56_hda_spi_remove(struct spi_device *spi)
4950
}
5051

5152
static const struct spi_device_id cs35l56_hda_spi_id[] = {
52-
{ "cs35l56-hda", 0 },
53+
{ "cs35l54-hda", 0x3554 },
54+
{ "cs35l56-hda", 0x3556 },
55+
{ "cs35l57-hda", 0x3557 },
5356
{}
5457
};
5558

0 commit comments

Comments
 (0)