ALSA: hda: cs35l41: Support HP models without _DSD using dual Speaker ID

Laptops 103C8C66, 103C8C67, 103C8C68, 103C8C6A use a dual speaker id
system where each speaker has its own speaker id.
The generic configuration table doesn't support this, so it needs its
own function.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240126164005.367021-4-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Stefan Binding 2024-01-26 16:40:04 +00:00 committed by Takashi Iwai
parent 33e5e648e6
commit 92bf736785

View file

@ -335,6 +335,42 @@ static int generic_dsd_config(struct cs35l41_hda *cs35l41, struct device *physde
return 0;
}
/*
* Systems 103C8C66, 103C8C67, 103C8C68, 103C8C6A use a dual speaker id system - each speaker has
* its own speaker id.
*/
static int hp_i2c_int_2amp_dual_spkid(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
const char *hid)
{
struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
/* If _DSD exists for this laptop, we cannot support it through here */
if (acpi_dev_has_props(cs35l41->dacpi))
return -ENOENT;
/* check I2C address to assign the index */
cs35l41->index = id == 0x40 ? 0 : 1;
cs35l41->channel_index = 0;
cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
if (cs35l41->index == 0)
cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 1);
else
cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2);
hw_cfg->spk_pos = cs35l41->index;
hw_cfg->gpio2.func = CS35L41_INTERRUPT;
hw_cfg->gpio2.valid = true;
hw_cfg->valid = true;
hw_cfg->bst_type = CS35L41_INT_BOOST;
hw_cfg->bst_ind = 1000;
hw_cfg->bst_ipk = 4100;
hw_cfg->bst_cap = 24;
hw_cfg->gpio1.func = CS35L41_NOT_USED;
hw_cfg->gpio1.valid = true;
return 0;
}
/*
* Device CLSA010(0/1) doesn't have _DSD so a gpiod_get by the label reset won't work.
* And devices created by serial-multi-instantiate don't have their device struct
@ -414,6 +450,10 @@ static const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
{ "CSC3551", "103C8C4F", generic_dsd_config },
{ "CSC3551", "103C8C50", generic_dsd_config },
{ "CSC3551", "103C8C51", generic_dsd_config },
{ "CSC3551", "103C8C66", hp_i2c_int_2amp_dual_spkid },
{ "CSC3551", "103C8C67", hp_i2c_int_2amp_dual_spkid },
{ "CSC3551", "103C8C68", hp_i2c_int_2amp_dual_spkid },
{ "CSC3551", "103C8C6A", hp_i2c_int_2amp_dual_spkid },
{ "CSC3551", "103C8CDD", generic_dsd_config },
{ "CSC3551", "103C8CDE", generic_dsd_config },
{ "CSC3551", "104312AF", generic_dsd_config },