提交 1f40caa0 编写于 作者: L Linus Torvalds

Merge tag 'sound-fix-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "A small set of HD-audio and USB-audio fixes as well as a couple of
  ALSA core fixes. Most of them are fix-ups for the newly added CS35L41
  codec"

* tag 'sound-fix-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda/cs8409: Add new Warlock SKUs to patch_cs8409
  ALSA: core: Simplify snd_power_ref_and_wait() with the standard macro
  ALSA: hda: cs35l41: Make cs35l41_hda_remove() return void
  ALSA: hda: cs35l41: Tidyup code
  ALSA: hda: cs35l41: Make use of the helper function dev_err_probe()
  ALSA: hda: cs35l41: Add missing default cases
  ALSA: hda: cs35l41: Move cs35l41* calls to its own symbol namespace
  ALSA: hda: cs35l41: Add calls to newly added test key function
  ALSA: hda: cs35l41: Avoid overwriting register patch
  ALSA: core: Fix SSID quirk lookup for subvendor=0
  ALSA: usb-audio: add mapping for MSI MPG X570S Carbon Max Wifi.
  ALSA: hda/realtek: fix speakers and micmute on HP 855 G8
...@@ -1111,29 +1111,14 @@ EXPORT_SYMBOL(snd_card_file_remove); ...@@ -1111,29 +1111,14 @@ EXPORT_SYMBOL(snd_card_file_remove);
*/ */
int snd_power_ref_and_wait(struct snd_card *card) int snd_power_ref_and_wait(struct snd_card *card)
{ {
wait_queue_entry_t wait;
int result = 0;
snd_power_ref(card); snd_power_ref(card);
/* fastpath */
if (snd_power_get_state(card) == SNDRV_CTL_POWER_D0) if (snd_power_get_state(card) == SNDRV_CTL_POWER_D0)
return 0; return 0;
init_waitqueue_entry(&wait, current); wait_event_cmd(card->power_sleep,
add_wait_queue(&card->power_sleep, &wait); card->shutdown ||
while (1) { snd_power_get_state(card) == SNDRV_CTL_POWER_D0,
if (card->shutdown) { snd_power_unref(card), snd_power_ref(card));
result = -ENODEV; return card->shutdown ? -ENODEV : 0;
break;
}
if (snd_power_get_state(card) == SNDRV_CTL_POWER_D0)
break;
snd_power_unref(card);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(30 * HZ);
snd_power_ref(card);
}
remove_wait_queue(&card->power_sleep, &wait);
return result;
} }
EXPORT_SYMBOL_GPL(snd_power_ref_and_wait); EXPORT_SYMBOL_GPL(snd_power_ref_and_wait);
......
...@@ -112,7 +112,7 @@ snd_pci_quirk_lookup_id(u16 vendor, u16 device, ...@@ -112,7 +112,7 @@ snd_pci_quirk_lookup_id(u16 vendor, u16 device,
{ {
const struct snd_pci_quirk *q; const struct snd_pci_quirk *q;
for (q = list; q->subvendor; q++) { for (q = list; q->subvendor || q->subdevice; q++) {
if (q->subvendor != vendor) if (q->subvendor != vendor)
continue; continue;
if (!q->subdevice || if (!q->subdevice ||
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
// //
// cs35l41.c -- CS35l41 ALSA HDA audio driver // CS35l41 ALSA HDA audio driver
// //
// Copyright 2021 Cirrus Logic, Inc. // Copyright 2021 Cirrus Logic, Inc.
// //
...@@ -17,19 +17,19 @@ ...@@ -17,19 +17,19 @@
#include "cs35l41_hda.h" #include "cs35l41_hda.h"
static const struct reg_sequence cs35l41_hda_config[] = { static const struct reg_sequence cs35l41_hda_config[] = {
{ CS35L41_PLL_CLK_CTRL, 0x00000430 }, //3200000Hz, BCLK Input, PLL_REFCLK_EN = 1 { CS35L41_PLL_CLK_CTRL, 0x00000430 }, // 3200000Hz, BCLK Input, PLL_REFCLK_EN = 1
{ CS35L41_GLOBAL_CLK_CTRL, 0x00000003 }, //GLOBAL_FS = 48 kHz { CS35L41_GLOBAL_CLK_CTRL, 0x00000003 }, // GLOBAL_FS = 48 kHz
{ CS35L41_SP_ENABLES, 0x00010000 }, //ASP_RX1_EN = 1 { CS35L41_SP_ENABLES, 0x00010000 }, // ASP_RX1_EN = 1
{ CS35L41_SP_RATE_CTRL, 0x00000021 }, //ASP_BCLK_FREQ = 3.072 MHz { CS35L41_SP_RATE_CTRL, 0x00000021 }, // ASP_BCLK_FREQ = 3.072 MHz
{ CS35L41_SP_FORMAT, 0x20200200 }, //24 bits, I2S, BCLK Slave, FSYNC Slave { CS35L41_SP_FORMAT, 0x20200200 }, // 24 bits, I2S, BCLK Slave, FSYNC Slave
{ CS35L41_DAC_PCM1_SRC, 0x00000008 }, //DACPCM1_SRC = ASPRX1 { CS35L41_DAC_PCM1_SRC, 0x00000008 }, // DACPCM1_SRC = ASPRX1
{ CS35L41_AMP_DIG_VOL_CTRL, 0x00000000 }, //AMP_VOL_PCM 0.0 dB { CS35L41_AMP_DIG_VOL_CTRL, 0x00000000 }, // AMP_VOL_PCM 0.0 dB
{ CS35L41_AMP_GAIN_CTRL, 0x00000084 }, //AMP_GAIN_PCM 4.5 dB { CS35L41_AMP_GAIN_CTRL, 0x00000084 }, // AMP_GAIN_PCM 4.5 dB
{ CS35L41_PWR_CTRL2, 0x00000001 }, //AMP_EN = 1 { CS35L41_PWR_CTRL2, 0x00000001 }, // AMP_EN = 1
}; };
static const struct reg_sequence cs35l41_hda_start_bst[] = { static const struct reg_sequence cs35l41_hda_start_bst[] = {
{ CS35L41_PWR_CTRL2, 0x00000021 }, //BST_EN = 10, AMP_EN = 1 { CS35L41_PWR_CTRL2, 0x00000021 }, // BST_EN = 10, AMP_EN = 1
{ CS35L41_PWR_CTRL1, 0x00000001, 3000}, // set GLOBAL_EN = 1 { CS35L41_PWR_CTRL1, 0x00000001, 3000}, // set GLOBAL_EN = 1
}; };
...@@ -60,7 +60,7 @@ static const struct reg_sequence cs35l41_stop_ext_vspk[] = { ...@@ -60,7 +60,7 @@ static const struct reg_sequence cs35l41_stop_ext_vspk[] = {
{ 0x00000040, 0x00000055 }, { 0x00000040, 0x00000055 },
{ 0x00000040, 0x000000AA }, { 0x00000040, 0x000000AA },
{ 0x00007438, 0x00585941 }, { 0x00007438, 0x00585941 },
{ 0x00002014, 0x00000000, 3000}, //set GLOBAL_EN = 0 { 0x00002014, 0x00000000, 3000}, // set GLOBAL_EN = 0
{ 0x0000742C, 0x00000009 }, { 0x0000742C, 0x00000009 },
{ 0x00007438, 0x00580941 }, { 0x00007438, 0x00580941 },
{ 0x00011008, 0x00000001 }, { 0x00011008, 0x00000001 },
...@@ -78,7 +78,7 @@ static const struct reg_sequence cs35l41_safe_to_active[] = { ...@@ -78,7 +78,7 @@ static const struct reg_sequence cs35l41_safe_to_active[] = {
{ 0x0000742C, 0x0000000F }, { 0x0000742C, 0x0000000F },
{ 0x0000742C, 0x00000079 }, { 0x0000742C, 0x00000079 },
{ 0x00007438, 0x00585941 }, { 0x00007438, 0x00585941 },
{ CS35L41_PWR_CTRL1, 0x00000001, 2000 }, //GLOBAL_EN = 1 { CS35L41_PWR_CTRL1, 0x00000001, 2000 }, // GLOBAL_EN = 1
{ 0x0000742C, 0x000000F9 }, { 0x0000742C, 0x000000F9 },
{ 0x00007438, 0x00580941 }, { 0x00007438, 0x00580941 },
{ 0x00000040, 0x000000CC }, { 0x00000040, 0x000000CC },
...@@ -89,8 +89,8 @@ static const struct reg_sequence cs35l41_active_to_safe[] = { ...@@ -89,8 +89,8 @@ static const struct reg_sequence cs35l41_active_to_safe[] = {
{ 0x00000040, 0x00000055 }, { 0x00000040, 0x00000055 },
{ 0x00000040, 0x000000AA }, { 0x00000040, 0x000000AA },
{ 0x00007438, 0x00585941 }, { 0x00007438, 0x00585941 },
{ CS35L41_AMP_DIG_VOL_CTRL, 0x0000A678 }, //AMP_VOL_PCM Mute { CS35L41_AMP_DIG_VOL_CTRL, 0x0000A678 }, // AMP_VOL_PCM Mute
{ CS35L41_PWR_CTRL2, 0x00000000 }, //AMP_EN = 0 { CS35L41_PWR_CTRL2, 0x00000000 }, // AMP_EN = 0
{ CS35L41_PWR_CTRL1, 0x00000000 }, { CS35L41_PWR_CTRL1, 0x00000000 },
{ 0x0000742C, 0x00000009, 2000 }, { 0x0000742C, 0x00000009, 2000 },
{ 0x00007438, 0x00580941 }, { 0x00007438, 0x00580941 },
...@@ -161,11 +161,13 @@ static void cs35l41_hda_playback_hook(struct device *dev, int action) ...@@ -161,11 +161,13 @@ static void cs35l41_hda_playback_hook(struct device *dev, int action)
if (reg_seq->close) if (reg_seq->close)
ret = regmap_multi_reg_write(reg, reg_seq->close, reg_seq->num_close); ret = regmap_multi_reg_write(reg, reg_seq->close, reg_seq->num_close);
break; break;
default:
ret = -EINVAL;
break;
} }
if (ret) if (ret)
dev_warn(cs35l41->dev, "Failed to apply multi reg write: %d\n", ret); dev_warn(cs35l41->dev, "Failed to apply multi reg write: %d\n", ret);
} }
static int cs35l41_hda_channel_map(struct device *dev, unsigned int tx_num, unsigned int *tx_slot, static int cs35l41_hda_channel_map(struct device *dev, unsigned int tx_num, unsigned int *tx_slot,
...@@ -182,20 +184,19 @@ static int cs35l41_hda_bind(struct device *dev, struct device *master, void *mas ...@@ -182,20 +184,19 @@ static int cs35l41_hda_bind(struct device *dev, struct device *master, void *mas
struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev); struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
struct hda_component *comps = master_data; struct hda_component *comps = master_data;
if (comps && cs35l41->index >= 0 && cs35l41->index < HDA_MAX_COMPONENTS) if (!comps || cs35l41->index < 0 || cs35l41->index >= HDA_MAX_COMPONENTS)
comps = &comps[cs35l41->index];
else
return -EINVAL; return -EINVAL;
if (!comps->dev) { comps = &comps[cs35l41->index];
comps->dev = dev; if (comps->dev)
strscpy(comps->name, dev_name(dev), sizeof(comps->name)); return -EBUSY;
comps->playback_hook = cs35l41_hda_playback_hook;
comps->set_channel_map = cs35l41_hda_channel_map; comps->dev = dev;
return 0; strscpy(comps->name, dev_name(dev), sizeof(comps->name));
} comps->playback_hook = cs35l41_hda_playback_hook;
comps->set_channel_map = cs35l41_hda_channel_map;
return -EBUSY; return 0;
} }
static void cs35l41_hda_unbind(struct device *dev, struct device *master, void *master_data) static void cs35l41_hda_unbind(struct device *dev, struct device *master, void *master_data)
...@@ -227,6 +228,8 @@ static int cs35l41_hda_apply_properties(struct cs35l41_hda *cs35l41, ...@@ -227,6 +228,8 @@ static int cs35l41_hda_apply_properties(struct cs35l41_hda *cs35l41,
internal_boost = true; internal_boost = true;
switch (hw_cfg->gpio1_func) { switch (hw_cfg->gpio1_func) {
case CS35L41_NOT_USED:
break;
case CS35l41_VSPK_SWITCH: case CS35l41_VSPK_SWITCH:
regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL, regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL,
CS35L41_GPIO1_CTRL_MASK, 1 << CS35L41_GPIO1_CTRL_SHIFT); CS35L41_GPIO1_CTRL_MASK, 1 << CS35L41_GPIO1_CTRL_SHIFT);
...@@ -235,13 +238,21 @@ static int cs35l41_hda_apply_properties(struct cs35l41_hda *cs35l41, ...@@ -235,13 +238,21 @@ static int cs35l41_hda_apply_properties(struct cs35l41_hda *cs35l41,
regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL, regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL,
CS35L41_GPIO1_CTRL_MASK, 2 << CS35L41_GPIO1_CTRL_SHIFT); CS35L41_GPIO1_CTRL_MASK, 2 << CS35L41_GPIO1_CTRL_SHIFT);
break; break;
default:
dev_err(cs35l41->dev, "Invalid function %d for GPIO1\n", hw_cfg->gpio1_func);
return -EINVAL;
} }
switch (hw_cfg->gpio2_func) { switch (hw_cfg->gpio2_func) {
case CS35L41_NOT_USED:
break;
case CS35L41_INTERRUPT: case CS35L41_INTERRUPT:
regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL, regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL,
CS35L41_GPIO2_CTRL_MASK, 2 << CS35L41_GPIO2_CTRL_SHIFT); CS35L41_GPIO2_CTRL_MASK, 2 << CS35L41_GPIO2_CTRL_SHIFT);
break; break;
default:
dev_err(cs35l41->dev, "Invalid function %d for GPIO2\n", hw_cfg->gpio2_func);
return -EINVAL;
} }
if (internal_boost) { if (internal_boost) {
...@@ -256,11 +267,7 @@ static int cs35l41_hda_apply_properties(struct cs35l41_hda *cs35l41, ...@@ -256,11 +267,7 @@ static int cs35l41_hda_apply_properties(struct cs35l41_hda *cs35l41,
cs35l41->reg_seq = &cs35l41_hda_reg_seq_ext_bst; cs35l41->reg_seq = &cs35l41_hda_reg_seq_ext_bst;
} }
ret = cs35l41_hda_channel_map(cs35l41->dev, 0, NULL, 1, (unsigned int *)&hw_cfg->spk_pos); return cs35l41_hda_channel_map(cs35l41->dev, 0, NULL, 1, (unsigned int *)&hw_cfg->spk_pos);
if (ret)
return ret;
return 0;
} }
static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41,
...@@ -269,7 +276,7 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c ...@@ -269,7 +276,7 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c
struct cs35l41_hda_hw_config *hw_cfg; struct cs35l41_hda_hw_config *hw_cfg;
u32 values[HDA_MAX_COMPONENTS]; u32 values[HDA_MAX_COMPONENTS];
struct acpi_device *adev; struct acpi_device *adev;
struct device *acpi_dev; struct device *physdev;
char *property; char *property;
size_t nval; size_t nval;
int i, ret; int i, ret;
...@@ -280,11 +287,11 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c ...@@ -280,11 +287,11 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
} }
acpi_dev = get_device(acpi_get_first_physical_node(adev)); physdev = get_device(acpi_get_first_physical_node(adev));
acpi_dev_put(adev); acpi_dev_put(adev);
property = "cirrus,dev-index"; property = "cirrus,dev-index";
ret = device_property_count_u32(acpi_dev, property); ret = device_property_count_u32(physdev, property);
if (ret <= 0) if (ret <= 0)
goto no_acpi_dsd; goto no_acpi_dsd;
...@@ -294,7 +301,7 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c ...@@ -294,7 +301,7 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c
} }
nval = ret; nval = ret;
ret = device_property_read_u32_array(acpi_dev, property, values, nval); ret = device_property_read_u32_array(physdev, property, values, nval);
if (ret) if (ret)
goto err; goto err;
...@@ -311,7 +318,9 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c ...@@ -311,7 +318,9 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c
goto err; goto err;
} }
/* No devm_ version as CLSA0100, in no_acpi_dsd case, can't use devm version */ /* To use the same release code for all laptop variants we can't use devm_ version of
* gpiod_get here, as CLSA010* don't have a fully functional bios with an _DSD node
*/
cs35l41->reset_gpio = fwnode_gpiod_get_index(&adev->fwnode, "reset", cs35l41->index, cs35l41->reset_gpio = fwnode_gpiod_get_index(&adev->fwnode, "reset", cs35l41->index,
GPIOD_OUT_LOW, "cs35l41-reset"); GPIOD_OUT_LOW, "cs35l41-reset");
...@@ -322,46 +331,46 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c ...@@ -322,46 +331,46 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c
} }
property = "cirrus,speaker-position"; property = "cirrus,speaker-position";
ret = device_property_read_u32_array(acpi_dev, property, values, nval); ret = device_property_read_u32_array(physdev, property, values, nval);
if (ret) if (ret)
goto err_free; goto err_free;
hw_cfg->spk_pos = values[cs35l41->index]; hw_cfg->spk_pos = values[cs35l41->index];
property = "cirrus,gpio1-func"; property = "cirrus,gpio1-func";
ret = device_property_read_u32_array(acpi_dev, property, values, nval); ret = device_property_read_u32_array(physdev, property, values, nval);
if (ret) if (ret)
goto err_free; goto err_free;
hw_cfg->gpio1_func = values[cs35l41->index]; hw_cfg->gpio1_func = values[cs35l41->index];
property = "cirrus,gpio2-func"; property = "cirrus,gpio2-func";
ret = device_property_read_u32_array(acpi_dev, property, values, nval); ret = device_property_read_u32_array(physdev, property, values, nval);
if (ret) if (ret)
goto err_free; goto err_free;
hw_cfg->gpio2_func = values[cs35l41->index]; hw_cfg->gpio2_func = values[cs35l41->index];
property = "cirrus,boost-peak-milliamp"; property = "cirrus,boost-peak-milliamp";
ret = device_property_read_u32_array(acpi_dev, property, values, nval); ret = device_property_read_u32_array(physdev, property, values, nval);
if (ret == 0) if (ret == 0)
hw_cfg->bst_ipk = values[cs35l41->index]; hw_cfg->bst_ipk = values[cs35l41->index];
property = "cirrus,boost-ind-nanohenry"; property = "cirrus,boost-ind-nanohenry";
ret = device_property_read_u32_array(acpi_dev, property, values, nval); ret = device_property_read_u32_array(physdev, property, values, nval);
if (ret == 0) if (ret == 0)
hw_cfg->bst_ind = values[cs35l41->index]; hw_cfg->bst_ind = values[cs35l41->index];
property = "cirrus,boost-cap-microfarad"; property = "cirrus,boost-cap-microfarad";
ret = device_property_read_u32_array(acpi_dev, property, values, nval); ret = device_property_read_u32_array(physdev, property, values, nval);
if (ret == 0) if (ret == 0)
hw_cfg->bst_cap = values[cs35l41->index]; hw_cfg->bst_cap = values[cs35l41->index];
put_device(acpi_dev); put_device(physdev);
return hw_cfg; return hw_cfg;
err_free: err_free:
kfree(hw_cfg); kfree(hw_cfg);
err: err:
put_device(acpi_dev); put_device(physdev);
dev_err(cs35l41->dev, "Failed property %s: %d\n", property, ret); dev_err(cs35l41->dev, "Failed property %s: %d\n", property, ret);
return ERR_PTR(ret); return ERR_PTR(ret);
...@@ -370,18 +379,18 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c ...@@ -370,18 +379,18 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c
/* /*
* Device CLSA0100 doesn't have _DSD so a gpiod_get by the label reset won't work. * Device CLSA0100 doesn't have _DSD so a gpiod_get by the label reset won't work.
* And devices created by i2c-multi-instantiate don't have their device struct pointing to * And devices created by i2c-multi-instantiate don't have their device struct pointing to
* the correct fwnode, so acpi_dev must be used here * the correct fwnode, so acpi_dev must be used here.
* And devm functions expect that the device requesting the resource has the correct * And devm functions expect that the device requesting the resource has the correct
* fwnode * fwnode.
*/ */
if (strncmp(hid, "CLSA0100", 8) != 0) if (strncmp(hid, "CLSA0100", 8) != 0)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
/* check I2C address to assign the index */ /* check I2C address to assign the index */
cs35l41->index = id == 0x40 ? 0 : 1; cs35l41->index = id == 0x40 ? 0 : 1;
cs35l41->reset_gpio = gpiod_get_index(acpi_dev, NULL, 0, GPIOD_OUT_HIGH); cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
cs35l41->vspk_always_on = true; cs35l41->vspk_always_on = true;
put_device(acpi_dev); put_device(physdev);
return NULL; return NULL;
} }
...@@ -416,8 +425,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i ...@@ -416,8 +425,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
if (ret == -EBUSY) { if (ret == -EBUSY) {
dev_info(cs35l41->dev, "Reset line busy, assuming shared reset\n"); dev_info(cs35l41->dev, "Reset line busy, assuming shared reset\n");
} else { } else {
if (ret != -EPROBE_DEFER) dev_err_probe(cs35l41->dev, ret, "Failed to get reset GPIO: %d\n", ret);
dev_err(cs35l41->dev, "Failed to get reset GPIO: %d\n", ret);
goto err; goto err;
} }
} }
...@@ -437,7 +445,8 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i ...@@ -437,7 +445,8 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
ret = regmap_read(cs35l41->regmap, CS35L41_IRQ1_STATUS3, &int_sts); ret = regmap_read(cs35l41->regmap, CS35L41_IRQ1_STATUS3, &int_sts);
if (ret || (int_sts & CS35L41_OTP_BOOT_ERR)) { if (ret || (int_sts & CS35L41_OTP_BOOT_ERR)) {
dev_err(cs35l41->dev, "OTP Boot error\n"); dev_err(cs35l41->dev, "OTP Boot status %x error: %d\n",
int_sts & CS35L41_OTP_BOOT_ERR, ret);
ret = -EIO; ret = -EIO;
goto err; goto err;
} }
...@@ -463,6 +472,10 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i ...@@ -463,6 +472,10 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
goto err; goto err;
} }
ret = cs35l41_test_key_unlock(cs35l41->dev, cs35l41->regmap);
if (ret)
goto err;
ret = cs35l41_register_errata_patch(cs35l41->dev, cs35l41->regmap, reg_revid); ret = cs35l41_register_errata_patch(cs35l41->dev, cs35l41->regmap, reg_revid);
if (ret) if (ret)
goto err; goto err;
...@@ -473,6 +486,10 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i ...@@ -473,6 +486,10 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
goto err; goto err;
} }
ret = cs35l41_test_key_lock(cs35l41->dev, cs35l41->regmap);
if (ret)
goto err;
ret = cs35l41_hda_apply_properties(cs35l41, acpi_hw_cfg); ret = cs35l41_hda_apply_properties(cs35l41, acpi_hw_cfg);
if (ret) if (ret)
goto err; goto err;
...@@ -480,8 +497,8 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i ...@@ -480,8 +497,8 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
acpi_hw_cfg = NULL; acpi_hw_cfg = NULL;
if (cs35l41->reg_seq->probe) { if (cs35l41->reg_seq->probe) {
ret = regmap_register_patch(cs35l41->regmap, cs35l41->reg_seq->probe, ret = regmap_multi_reg_write(cs35l41->regmap, cs35l41->reg_seq->probe,
cs35l41->reg_seq->num_probe); cs35l41->reg_seq->num_probe);
if (ret) { if (ret) {
dev_err(cs35l41->dev, "Fail to apply probe reg patch: %d\n", ret); dev_err(cs35l41->dev, "Fail to apply probe reg patch: %d\n", ret);
goto err; goto err;
...@@ -506,9 +523,9 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i ...@@ -506,9 +523,9 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(cs35l41_hda_probe); EXPORT_SYMBOL_NS_GPL(cs35l41_hda_probe, SND_HDA_SCODEC_CS35L41);
int cs35l41_hda_remove(struct device *dev) void cs35l41_hda_remove(struct device *dev)
{ {
struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev); struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
...@@ -517,11 +534,8 @@ int cs35l41_hda_remove(struct device *dev) ...@@ -517,11 +534,8 @@ int cs35l41_hda_remove(struct device *dev)
if (!cs35l41->vspk_always_on) if (!cs35l41->vspk_always_on)
gpiod_set_value_cansleep(cs35l41->reset_gpio, 0); gpiod_set_value_cansleep(cs35l41->reset_gpio, 0);
gpiod_put(cs35l41->reset_gpio); gpiod_put(cs35l41->reset_gpio);
return 0;
} }
EXPORT_SYMBOL_GPL(cs35l41_hda_remove); EXPORT_SYMBOL_NS_GPL(cs35l41_hda_remove, SND_HDA_SCODEC_CS35L41);
MODULE_DESCRIPTION("CS35L41 HDA Driver"); MODULE_DESCRIPTION("CS35L41 HDA Driver");
MODULE_AUTHOR("Lucas Tanure, Cirrus Logic Inc, <tanureal@opensource.cirrus.com>"); MODULE_AUTHOR("Lucas Tanure, Cirrus Logic Inc, <tanureal@opensource.cirrus.com>");
......
/* SPDX-License-Identifier: GPL-2.0 /* SPDX-License-Identifier: GPL-2.0
* *
* cs35l41_hda.h -- CS35L41 ALSA HDA audio driver * CS35L41 ALSA HDA audio driver
* *
* Copyright 2021 Cirrus Logic, Inc. * Copyright 2021 Cirrus Logic, Inc.
* *
...@@ -64,6 +64,6 @@ struct cs35l41_hda { ...@@ -64,6 +64,6 @@ struct cs35l41_hda {
int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int irq, int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int irq,
struct regmap *regmap); struct regmap *regmap);
int cs35l41_hda_remove(struct device *dev); void cs35l41_hda_remove(struct device *dev);
#endif /*__CS35L41_HDA_H__*/ #endif /*__CS35L41_HDA_H__*/
...@@ -32,7 +32,9 @@ static int cs35l41_hda_i2c_probe(struct i2c_client *clt, const struct i2c_device ...@@ -32,7 +32,9 @@ static int cs35l41_hda_i2c_probe(struct i2c_client *clt, const struct i2c_device
static int cs35l41_hda_i2c_remove(struct i2c_client *clt) static int cs35l41_hda_i2c_remove(struct i2c_client *clt)
{ {
return cs35l41_hda_remove(&clt->dev); cs35l41_hda_remove(&clt->dev);
return 0;
} }
static const struct i2c_device_id cs35l41_hda_i2c_id[] = { static const struct i2c_device_id cs35l41_hda_i2c_id[] = {
...@@ -58,9 +60,9 @@ static struct i2c_driver cs35l41_i2c_driver = { ...@@ -58,9 +60,9 @@ static struct i2c_driver cs35l41_i2c_driver = {
.probe = cs35l41_hda_i2c_probe, .probe = cs35l41_hda_i2c_probe,
.remove = cs35l41_hda_i2c_remove, .remove = cs35l41_hda_i2c_remove,
}; };
module_i2c_driver(cs35l41_i2c_driver); module_i2c_driver(cs35l41_i2c_driver);
MODULE_DESCRIPTION("HDA CS35L41 driver"); MODULE_DESCRIPTION("HDA CS35L41 driver");
MODULE_IMPORT_NS(SND_HDA_SCODEC_CS35L41);
MODULE_AUTHOR("Lucas Tanure <tanureal@opensource.cirrus.com>"); MODULE_AUTHOR("Lucas Tanure <tanureal@opensource.cirrus.com>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -30,7 +30,9 @@ static int cs35l41_hda_spi_probe(struct spi_device *spi) ...@@ -30,7 +30,9 @@ static int cs35l41_hda_spi_probe(struct spi_device *spi)
static int cs35l41_hda_spi_remove(struct spi_device *spi) static int cs35l41_hda_spi_remove(struct spi_device *spi)
{ {
return cs35l41_hda_remove(&spi->dev); cs35l41_hda_remove(&spi->dev);
return 0;
} }
static const struct spi_device_id cs35l41_hda_spi_id[] = { static const struct spi_device_id cs35l41_hda_spi_id[] = {
...@@ -55,9 +57,9 @@ static struct spi_driver cs35l41_spi_driver = { ...@@ -55,9 +57,9 @@ static struct spi_driver cs35l41_spi_driver = {
.probe = cs35l41_hda_spi_probe, .probe = cs35l41_hda_spi_probe,
.remove = cs35l41_hda_spi_remove, .remove = cs35l41_hda_spi_remove,
}; };
module_spi_driver(cs35l41_spi_driver); module_spi_driver(cs35l41_spi_driver);
MODULE_DESCRIPTION("HDA CS35L41 driver"); MODULE_DESCRIPTION("HDA CS35L41 driver");
MODULE_IMPORT_NS(SND_HDA_SCODEC_CS35L41);
MODULE_AUTHOR("Lucas Tanure <tanureal@opensource.cirrus.com>"); MODULE_AUTHOR("Lucas Tanure <tanureal@opensource.cirrus.com>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -490,6 +490,8 @@ const struct snd_pci_quirk cs8409_fixup_tbl[] = { ...@@ -490,6 +490,8 @@ const struct snd_pci_quirk cs8409_fixup_tbl[] = {
SND_PCI_QUIRK(0x1028, 0x0ADC, "Warlock", CS8409_WARLOCK), SND_PCI_QUIRK(0x1028, 0x0ADC, "Warlock", CS8409_WARLOCK),
SND_PCI_QUIRK(0x1028, 0x0AF4, "Warlock", CS8409_WARLOCK), SND_PCI_QUIRK(0x1028, 0x0AF4, "Warlock", CS8409_WARLOCK),
SND_PCI_QUIRK(0x1028, 0x0AF5, "Warlock", CS8409_WARLOCK), SND_PCI_QUIRK(0x1028, 0x0AF5, "Warlock", CS8409_WARLOCK),
SND_PCI_QUIRK(0x1028, 0x0BB5, "Warlock N3 15 TGL-U Nuvoton EC", CS8409_WARLOCK),
SND_PCI_QUIRK(0x1028, 0x0BB6, "Warlock V3 15 TGL-U Nuvoton EC", CS8409_WARLOCK),
SND_PCI_QUIRK(0x1028, 0x0A77, "Cyborg", CS8409_CYBORG), SND_PCI_QUIRK(0x1028, 0x0A77, "Cyborg", CS8409_CYBORG),
SND_PCI_QUIRK(0x1028, 0x0A78, "Cyborg", CS8409_CYBORG), SND_PCI_QUIRK(0x1028, 0x0A78, "Cyborg", CS8409_CYBORG),
SND_PCI_QUIRK(0x1028, 0x0A79, "Cyborg", CS8409_CYBORG), SND_PCI_QUIRK(0x1028, 0x0A79, "Cyborg", CS8409_CYBORG),
......
...@@ -6948,6 +6948,7 @@ enum { ...@@ -6948,6 +6948,7 @@ enum {
ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE, ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
ALC287_FIXUP_LEGION_16ACHG6, ALC287_FIXUP_LEGION_16ACHG6,
ALC287_FIXUP_CS35L41_I2C_2, ALC287_FIXUP_CS35L41_I2C_2,
ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
}; };
static const struct hda_fixup alc269_fixups[] = { static const struct hda_fixup alc269_fixups[] = {
...@@ -8698,6 +8699,16 @@ static const struct hda_fixup alc269_fixups[] = { ...@@ -8698,6 +8699,16 @@ static const struct hda_fixup alc269_fixups[] = {
.type = HDA_FIXUP_FUNC, .type = HDA_FIXUP_FUNC,
.v.func = cs35l41_fixup_i2c_two, .v.func = cs35l41_fixup_i2c_two,
}, },
[ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
.type = HDA_FIXUP_VERBS,
.v.verbs = (const struct hda_verb[]) {
{ 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
{ 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
{ }
},
.chained = true,
.chain_id = ALC285_FIXUP_HP_MUTE_LED,
},
}; };
static const struct snd_pci_quirk alc269_fixup_tbl[] = { static const struct snd_pci_quirk alc269_fixup_tbl[] = {
...@@ -8911,6 +8922,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { ...@@ -8911,6 +8922,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT), SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT), SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED), SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST), SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
......
...@@ -431,6 +431,14 @@ static const struct usbmix_name_map aorus_master_alc1220vb_map[] = { ...@@ -431,6 +431,14 @@ static const struct usbmix_name_map aorus_master_alc1220vb_map[] = {
{} {}
}; };
/* MSI MPG X570S Carbon Max Wifi with ALC4080 */
static const struct usbmix_name_map msi_mpg_x570s_carbon_max_wifi_alc4080_map[] = {
{ 29, "Speaker Playback" },
{ 30, "Front Headphone Playback" },
{ 32, "IEC958 Playback" },
{}
};
/* /*
* Control map entries * Control map entries
*/ */
...@@ -577,6 +585,10 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = { ...@@ -577,6 +585,10 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = {
.map = trx40_mobo_map, .map = trx40_mobo_map,
.connector_map = trx40_mobo_connector_map, .connector_map = trx40_mobo_connector_map,
}, },
{ /* MSI MPG X570S Carbon Max Wifi */
.id = USB_ID(0x0db0, 0x419c),
.map = msi_mpg_x570s_carbon_max_wifi_alc4080_map,
},
{ /* MSI TRX40 */ { /* MSI TRX40 */
.id = USB_ID(0x0db0, 0x543d), .id = USB_ID(0x0db0, 0x543d),
.map = trx40_mobo_map, .map = trx40_mobo_map,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册