Commit 769dca23 authored by Simon Trimmer's avatar Simon Trimmer Committed by Takashi Iwai

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: default avatarSimon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Message-ID: <20240308135900.603192-3-rf@opensource.cirrus.com>
parent afd17e6d
......@@ -458,13 +458,15 @@ static void cs35l56_hda_request_firmware_files(struct cs35l56_hda *cs35l56,
if (preloaded_fw_ver) {
snprintf(base_name, sizeof(base_name),
"cirrus/cs35l56-%02x%s-%06x-dsp1-misc",
"cirrus/cs35l%02x-%02x%s-%06x-dsp1-misc",
cs35l56->base.type,
cs35l56->base.rev,
cs35l56->base.secured ? "-s" : "",
preloaded_fw_ver & 0xffffff);
} else {
snprintf(base_name, sizeof(base_name),
"cirrus/cs35l56-%02x%s-dsp1-misc",
"cirrus/cs35l%02x-%02x%s-dsp1-misc",
cs35l56->base.type,
cs35l56->base.rev,
cs35l56->base.secured ? "-s" : "");
}
......@@ -834,9 +836,10 @@ static int cs35l56_hda_system_resume(struct device *dev)
return 0;
}
static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int id)
static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int hid, int id)
{
u32 values[HDA_MAX_COMPONENTS];
char hid_string[8];
struct acpi_device *adev;
const char *property, *sub;
size_t nval;
......@@ -847,7 +850,8 @@ static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int id)
* the serial-multi-instantiate driver, so lookup the node by HID
*/
if (!ACPI_COMPANION(cs35l56->base.dev)) {
adev = acpi_dev_get_first_match_dev("CSC3556", NULL, -1);
snprintf(hid_string, sizeof(hid_string), "CSC%04X", hid);
adev = acpi_dev_get_first_match_dev(hid_string, NULL, -1);
if (!adev) {
dev_err(cs35l56->base.dev, "Failed to find an ACPI device for %s\n",
dev_name(cs35l56->base.dev));
......@@ -935,14 +939,14 @@ static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int id)
return ret;
}
int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int id)
int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int hid, int id)
{
int ret;
mutex_init(&cs35l56->base.irq_lock);
dev_set_drvdata(cs35l56->base.dev, cs35l56);
ret = cs35l56_hda_read_acpi(cs35l56, id);
ret = cs35l56_hda_read_acpi(cs35l56, hid, id);
if (ret)
goto err;
......
......@@ -42,7 +42,7 @@ struct cs35l56_hda {
extern const struct dev_pm_ops cs35l56_hda_pm_ops;
int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int id);
int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int hid, int id);
void cs35l56_hda_remove(struct device *dev);
#endif /*__CS35L56_HDA_H__*/
......@@ -13,6 +13,7 @@
static int cs35l56_hda_i2c_probe(struct i2c_client *clt)
{
const struct i2c_device_id *id = i2c_client_get_device_id(clt);
struct cs35l56_hda *cs35l56;
int ret;
......@@ -33,7 +34,7 @@ static int cs35l56_hda_i2c_probe(struct i2c_client *clt)
return ret;
}
ret = cs35l56_hda_common_probe(cs35l56, clt->addr);
ret = cs35l56_hda_common_probe(cs35l56, id->driver_data, clt->addr);
if (ret)
return ret;
ret = cs35l56_irq_request(&cs35l56->base, clt->irq);
......@@ -49,7 +50,9 @@ static void cs35l56_hda_i2c_remove(struct i2c_client *clt)
}
static const struct i2c_device_id cs35l56_hda_i2c_id[] = {
{ "cs35l56-hda", 0 },
{ "cs35l54-hda", 0x3554 },
{ "cs35l56-hda", 0x3556 },
{ "cs35l57-hda", 0x3557 },
{}
};
......
......@@ -13,6 +13,7 @@
static int cs35l56_hda_spi_probe(struct spi_device *spi)
{
const struct spi_device_id *id = spi_get_device_id(spi);
struct cs35l56_hda *cs35l56;
int ret;
......@@ -33,7 +34,7 @@ static int cs35l56_hda_spi_probe(struct spi_device *spi)
return ret;
}
ret = cs35l56_hda_common_probe(cs35l56, spi_get_chipselect(spi, 0));
ret = cs35l56_hda_common_probe(cs35l56, id->driver_data, spi_get_chipselect(spi, 0));
if (ret)
return ret;
ret = cs35l56_irq_request(&cs35l56->base, spi->irq);
......@@ -49,7 +50,9 @@ static void cs35l56_hda_spi_remove(struct spi_device *spi)
}
static const struct spi_device_id cs35l56_hda_spi_id[] = {
{ "cs35l56-hda", 0 },
{ "cs35l54-hda", 0x3554 },
{ "cs35l56-hda", 0x3556 },
{ "cs35l57-hda", 0x3557 },
{}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment