History

Merge tag 'sound-6.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai: "No surprise here, including only a collection of HD-audio device-specific small fixes" * tag 'sound-6.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda: Disable power-save on KONTRON SinglePC ALSA: hda/realtek: Add supported ALC257 for ChromeOS ALSA: hda/realtek: Headset Mic VREF to 100% ALSA: hda: intel-nhlt: Ignore vbps when looking for DMIC 32 bps format ALSA: hda: cs35l56: Enable low-power hibernation mode on SPI ALSA: cs35l41: Fix for old systems which do not support command ALSA: hda: cs35l41: Remove unnecessary boolean state variable firmware_running ALSA: hda - Fix speaker and headset mic pin config for CHUWI CoreBook XPro

Linus Torvalds committed 2 years ago

Commit 06a3c592 parents b1e5158 a337c358 files · +76 −25Browse files

Unified · Split

8 files
  1. include/sound/cs35l41.h +1 −1
  2. sound/hda/intel-nhlt.c +29 −4
  3. sound/pci/hda/cs35l41_hda.c +12 −16
  4. sound/pci/hda/cs35l56_hda_spi.c +4 −0
  5. sound/pci/hda/hda_intel.c +2 −0
  6. sound/pci/hda/patch_realtek.c +22 −0
  7. sound/soc/codecs/cs35l41-lib.c +4 −2
  8. sound/soc/codecs/cs35l41.c +2 −2
include/sound/cs35l41.h+1−1
@@ -906,6 +906,6 @@ int cs35l41_init_boost(struct device *dev, struct regmap *regmap, · 905 unmodified lines
906906 bool cs35l41_safe_reset(struct regmap *regmap, enum cs35l41_boost_type b_type);
907907 int cs35l41_mdsync_up(struct regmap *regmap);
908908 int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l41_boost_type b_type,
909− int enable, bool firmware_running);
909+ int enable, struct cs_dsp *dsp);
910910
911911 #endif /* __CS35L41_H */
sound/hda/intel-nhlt.c+29−4
@@ -238,7 +238,7 @@ EXPORT_SYMBOL(intel_nhlt_ssp_mclk_mask); · 237 unmodified lines
238238
239239 static struct nhlt_specific_cfg *
240240 nhlt_get_specific_cfg(struct device *dev, struct nhlt_fmt *fmt, u8 num_ch,
241− u32 rate, u8 vbps, u8 bps)
241+ u32 rate, u8 vbps, u8 bps, bool ignore_vbps)
242242 {
243243 struct nhlt_fmt_cfg *cfg = fmt->fmt_config;
244244 struct wav_fmt *wfmt;
@@ -255,8 +255,12 @@ nhlt_get_specific_cfg(struct device *dev, struct nhlt_fmt *fmt, u8 num_ch, · 10 unmodified lines
255255 dev_dbg(dev, "Endpoint format: ch=%d fmt=%d/%d rate=%d\n",
256256 wfmt->channels, _vbps, _bps, wfmt->samples_per_sec);
257257
258+ /*
259+ * When looking for exact match of configuration ignore the vbps
260+ * from NHLT table when ignore_vbps is true
261+ */
258262 if (wfmt->channels == num_ch && wfmt->samples_per_sec == rate &&
259− vbps == _vbps && bps == _bps)
263+ (ignore_vbps || vbps == _vbps) && bps == _bps)
260264 return &cfg->config;
261265
262266 cfg = (struct nhlt_fmt_cfg *)(cfg->config.caps + cfg->config.size);
@@ -289,6 +293,7 @@ intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt, · 26 unmodified lines
289293 {
290294 struct nhlt_specific_cfg *cfg;
291295 struct nhlt_endpoint *epnt;
296+ bool ignore_vbps = false;
292297 struct nhlt_fmt *fmt;
293298 int i;
294299
@@ -298,7 +303,26 @@ intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt, · 3 unmodified lines
298303 dev_dbg(dev, "Looking for configuration:\n");
299304 dev_dbg(dev, " vbus_id=%d link_type=%d dir=%d, dev_type=%d\n",
300305 bus_id, link_type, dir, dev_type);
301− dev_dbg(dev, " ch=%d fmt=%d/%d rate=%d\n", num_ch, vbps, bps, rate);
306+ if (link_type == NHLT_LINK_DMIC && bps == 32 && (vbps == 24 || vbps == 32)) {
307+ /*
308+ * The DMIC hardware supports only one type of 32 bits sample
309+ * size, which is 24 bit sampling on the MSB side and bits[1:0]
310+ * are used for indicating the channel number.
311+ * It has been observed that some NHLT tables have the vbps
312+ * specified as 32 while some uses 24.
313+ * The format these variations describe are identical, the
314+ * hardware is configured and behaves the same way.
315+ * Note: when the samples assumed to be vbps=32 then the 'noise'
316+ * introduced by the lower two bits (channel number) have no
317+ * real life implication on audio quality.
318+ */
319+ dev_dbg(dev,
320+ " ch=%d fmt=%d rate=%d (vbps is ignored for DMIC 32bit format)\n",
321+ num_ch, bps, rate);
322+ ignore_vbps = true;
323+ } else {
324+ dev_dbg(dev, " ch=%d fmt=%d/%d rate=%d\n", num_ch, vbps, bps, rate);
325+ }
302326 dev_dbg(dev, "Endpoint count=%d\n", nhlt->endpoint_count);
303327
304328 epnt = (struct nhlt_endpoint *)nhlt->desc;
@@ -307,7 +331,8 @@ intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt, · 2 unmodified lines
307331 if (nhlt_check_ep_match(dev, epnt, bus_id, link_type, dir, dev_type)) {
308332 fmt = (struct nhlt_fmt *)(epnt->config.caps + epnt->config.size);
309333
310− cfg = nhlt_get_specific_cfg(dev, fmt, num_ch, rate, vbps, bps);
334+ cfg = nhlt_get_specific_cfg(dev, fmt, num_ch, rate,
335+ vbps, bps, ignore_vbps);
311336 if (cfg)
312337 return cfg;
313338 }
sound/pci/hda/cs35l41_hda.c+12−16
@@ -504,7 +504,6 @@ static void cs35l41_shutdown_dsp(struct cs35l41_hda *cs35l41) · 503 unmodified lines
504504
505505 cs_dsp_stop(dsp);
506506 cs_dsp_power_down(dsp);
507− cs35l41->firmware_running = false;
508507 dev_dbg(cs35l41->dev, "Unloaded Firmware\n");
509508 }
510509
@@ -550,7 +549,7 @@ static void cs35l41_hda_play_start(struct device *dev) · 39 unmodified lines
550549
551550 cs35l41->playback_started = true;
552551
553− if (cs35l41->firmware_running) {
552+ if (cs35l41->cs_dsp.running) {
554553 regmap_multi_reg_write(reg, cs35l41_hda_config_dsp,
555554 ARRAY_SIZE(cs35l41_hda_config_dsp));
556555 regmap_update_bits(reg, CS35L41_PWR_CTRL2,
@@ -580,7 +579,7 @@ static void cs35l41_mute(struct device *dev, bool mute) · 23 unmodified lines
580579 regmap_multi_reg_write(reg, cs35l41_hda_mute, ARRAY_SIZE(cs35l41_hda_mute));
581580 } else {
582581 dev_dbg(dev, "Unmuting\n");
583− if (cs35l41->firmware_running) {
582+ if (cs35l41->cs_dsp.running) {
584583 regmap_multi_reg_write(reg, cs35l41_hda_unmute_dsp,
585584 ARRAY_SIZE(cs35l41_hda_unmute_dsp));
586585 } else {
@@ -599,7 +598,7 @@ static void cs35l41_hda_play_done(struct device *dev) · 12 unmodified lines
599598 dev_dbg(dev, "Play (Complete)\n");
600599
601600 cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 1,
602− cs35l41->firmware_running);
601+ &cs35l41->cs_dsp);
603602 cs35l41_mute(dev, false);
604603 }
605604
@@ -612,7 +611,7 @@ static void cs35l41_hda_pause_start(struct device *dev) · 6 unmodified lines
612611
613612 cs35l41_mute(dev, true);
614613 cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 0,
615− cs35l41->firmware_running);
614+ &cs35l41->cs_dsp);
616615 }
617616
618617 static void cs35l41_hda_pause_done(struct device *dev)
@@ -625,7 +624,7 @@ static void cs35l41_hda_pause_done(struct device *dev) · 6 unmodified lines
625624 regmap_update_bits(reg, CS35L41_PWR_CTRL2, CS35L41_AMP_EN_MASK, 0 << CS35L41_AMP_EN_SHIFT);
626625 if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST)
627626 regmap_write(reg, CS35L41_GPIO1_CTRL1, 0x00000001);
628− if (cs35l41->firmware_running) {
627+ if (cs35l41->cs_dsp.running) {
629628 cs35l41_set_cspl_mbox_cmd(dev, reg, CSPL_MBOX_CMD_PAUSE);
630629 regmap_update_bits(reg, CS35L41_PWR_CTRL2,
631630 CS35L41_VMON_EN_MASK | CS35L41_IMON_EN_MASK,
@@ -675,7 +674,7 @@ static void cs35l41_hda_playback_hook(struct device *dev, int action) · 43 unmodified lines
675674 break;
676675 case HDA_GEN_PCM_ACT_CLOSE:
677676 mutex_lock(&cs35l41->fw_mutex);
678− if (!cs35l41->firmware_running && cs35l41->request_fw_load &&
677+ if (!cs35l41->cs_dsp.running && cs35l41->request_fw_load &&
679678 !cs35l41->fw_request_ongoing) {
680679 dev_info(dev, "Requesting Firmware Load after HDA_GEN_PCM_ACT_CLOSE\n");
681680 cs35l41->fw_request_ongoing = true;
@@ -761,10 +760,9 @@ static int cs35l41_verify_id(struct cs35l41_hda *cs35l41, unsigned int *regid, u · 79 unmodified lines
761760 static int cs35l41_ready_for_reset(struct cs35l41_hda *cs35l41)
762761 {
763762 mutex_lock(&cs35l41->fw_mutex);
764− if (cs35l41->firmware_running) {
763+ if (cs35l41->cs_dsp.running) {
765764 cs35l41->cs_dsp.running = false;
766765 cs35l41->cs_dsp.booted = false;
767− cs35l41->firmware_running = false;
768766 }
769767 regcache_mark_dirty(cs35l41->regmap);
770768 mutex_unlock(&cs35l41->fw_mutex);
@@ -925,7 +923,7 @@ static int cs35l41_runtime_suspend(struct device *dev) · 154 unmodified lines
925923
926924 mutex_lock(&cs35l41->fw_mutex);
927925
928− if (cs35l41->firmware_running) {
926+ if (cs35l41->cs_dsp.running) {
929927 ret = cs35l41_enter_hibernate(cs35l41->dev, cs35l41->regmap,
930928 cs35l41->hw_cfg.bst_type);
931929 if (ret)
@@ -960,7 +958,7 @@ static int cs35l41_runtime_resume(struct device *dev) · 28 unmodified lines
960958
961959 regcache_cache_only(cs35l41->regmap, false);
962960
963− if (cs35l41->firmware_running) {
961+ if (cs35l41->cs_dsp.running) {
964962 ret = cs35l41_exit_hibernate(cs35l41->dev, cs35l41->regmap);
965963 if (ret) {
966964 dev_warn(cs35l41->dev, "Unable to exit Hibernate.");
@@ -1052,8 +1050,6 @@ static int cs35l41_smart_amp(struct cs35l41_hda *cs35l41) · 85 unmodified lines
10521050 goto clean_dsp;
10531051 }
10541052
1055− cs35l41->firmware_running = true;
1056−
10571053 return 0;
10581054
10591055 clean_dsp:
@@ -1063,10 +1059,10 @@ clean_dsp: · 3 unmodified lines
10631059
10641060 static void cs35l41_load_firmware(struct cs35l41_hda *cs35l41, bool load)
10651061 {
1066− if (cs35l41->firmware_running && !load) {
1062+ if (cs35l41->cs_dsp.running && !load) {
10671063 dev_dbg(cs35l41->dev, "Unloading Firmware\n");
10681064 cs35l41_shutdown_dsp(cs35l41);
1069− } else if (!cs35l41->firmware_running && load) {
1065+ } else if (!cs35l41->cs_dsp.running && load) {
10701066 dev_dbg(cs35l41->dev, "Loading Firmware\n");
10711067 cs35l41_smart_amp(cs35l41);
10721068 } else {
@@ -1346,7 +1342,7 @@ static int cs35l41_hda_bind(struct device *dev, struct device *master, void *mas · 273 unmodified lines
13461342 cs35l41->acpi_subsystem_id, cs35l41->hw_cfg.bst_type,
13471343 cs35l41->hw_cfg.gpio1.func == CS35l41_VSPK_SWITCH,
13481344 cs35l41->hw_cfg.spk_pos ? 'R' : 'L',
1349− cs35l41->firmware_running, cs35l41->speaker_id);
1345+ cs35l41->cs_dsp.running, cs35l41->speaker_id);
13501346
13511347 return ret;
13521348 }
sound/pci/hda/cs35l56_hda_spi.c+4−0
@@ -21,6 +21,10 @@ static int cs35l56_hda_spi_probe(struct spi_device *spi) · 20 unmodified lines
2121 return -ENOMEM;
2222
2323 cs35l56->base.dev = &spi->dev;
24+
25+#ifdef CS35L56_WAKE_HOLD_TIME_US
26+ cs35l56->base.can_hibernate = true;
27+#endif
2428 cs35l56->base.regmap = devm_regmap_init_spi(spi, &cs35l56_regmap_spi);
2529 if (IS_ERR(cs35l56->base.regmap)) {
2630 ret = PTR_ERR(cs35l56->base.regmap);
sound/pci/hda/hda_intel.c+2−0
@@ -2242,6 +2242,8 @@ static const struct snd_pci_quirk power_save_denylist[] = { · 2241 unmodified lines
22422242 SND_PCI_QUIRK(0x17aa, 0x36a7, "Lenovo C50 All in one", 0),
22432243 /* https://bugs.launchpad.net/bugs/1821663 */
22442244 SND_PCI_QUIRK(0x1631, 0xe017, "Packard Bell NEC IMEDIA 5204", 0),
2245+ /* KONTRON SinglePC may cause a stall at runtime resume */
2246+ SND_PCI_QUIRK(0x1734, 0x1232, "KONTRON SinglePC", 0),
22452247 {}
22462248 };
22472249 #endif /* CONFIG_PM */
sound/pci/hda/patch_realtek.c+22−0
@@ -1987,6 +1987,7 @@ enum { · 1986 unmodified lines
19871987 ALC887_FIXUP_ASUS_AUDIO,
19881988 ALC887_FIXUP_ASUS_HMIC,
19891989 ALCS1200A_FIXUP_MIC_VREF,
1990+ ALC888VD_FIXUP_MIC_100VREF,
19901991 };
19911992
19921993 static void alc889_fixup_coef(struct hda_codec *codec,
@@ -2540,6 +2541,13 @@ static const struct hda_fixup alc882_fixups[] = { · 547 unmodified lines
25402541 {}
25412542 }
25422543 },
2544+ [ALC888VD_FIXUP_MIC_100VREF] = {
2545+ .type = HDA_FIXUP_PINCTLS,
2546+ .v.pins = (const struct hda_pintbl[]) {
2547+ { 0x18, PIN_VREF100 }, /* headset mic */
2548+ {}
2549+ }
2550+ },
25432551 };
25442552
25452553 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
@@ -2609,6 +2617,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { · 63 unmodified lines
26092617 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
26102618
26112619 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2620+ SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
26122621 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
26132622 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
26142623 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
@@ -3256,6 +3265,7 @@ static void alc_disable_headset_jack_key(struct hda_codec *codec) · 641 unmodified lines
32563265 case 0x10ec0230:
32573266 case 0x10ec0236:
32583267 case 0x10ec0256:
3268+ case 0x10ec0257:
32593269 case 0x19e58326:
32603270 alc_write_coef_idx(codec, 0x48, 0x0);
32613271 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
@@ -3285,6 +3295,7 @@ static void alc_enable_headset_jack_key(struct hda_codec *codec) · 23 unmodified lines
32853295 case 0x10ec0230:
32863296 case 0x10ec0236:
32873297 case 0x10ec0256:
3298+ case 0x10ec0257:
32883299 case 0x19e58326:
32893300 alc_write_coef_idx(codec, 0x48, 0xd011);
32903301 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
@@ -6496,6 +6507,7 @@ static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec) · 3205 unmodified lines
64966507 case 0x10ec0236:
64976508 case 0x10ec0255:
64986509 case 0x10ec0256:
6510+ case 0x10ec0257:
64996511 case 0x19e58326:
65006512 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
65016513 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
@@ -7249,6 +7261,7 @@ enum { · 747 unmodified lines
72497261 ALC290_FIXUP_SUBWOOFER_HSJACK,
72507262 ALC269_FIXUP_THINKPAD_ACPI,
72517263 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7264+ ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
72527265 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
72537266 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
72547267 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
@@ -7601,6 +7614,14 @@ static const struct hda_fixup alc269_fixups[] = { · 346 unmodified lines
76017614 .type = HDA_FIXUP_FUNC,
76027615 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
76037616 },
7617+ [ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
7618+ .type = HDA_FIXUP_PINS,
7619+ .v.pins = (const struct hda_pintbl[]) {
7620+ { 0x18, 0x03a19020 }, /* headset mic */
7621+ { 0x1b, 0x90170150 }, /* speaker */
7622+ { }
7623+ },
7624+ },
76047625 [ALC269_FIXUP_AMIC] = {
76057626 .type = HDA_FIXUP_PINS,
76067627 .v.pins = (const struct hda_pintbl[]) {
@@ -10244,6 +10265,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 2637 unmodified lines
1024410265 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
1024510266 SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
1024610267 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10268+ SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
1024710269 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
1024810270 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
1024910271 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
sound/soc/codecs/cs35l41-lib.c+4−2
@@ -16,6 +16,8 @@ · 15 unmodified lines
1616
1717 #include <sound/cs35l41.h>
1818
19+#define CS35L41_FIRMWARE_OLD_VERSION 0x001C00 /* v0.28.0 */
20+
1921 static const struct reg_default cs35l41_reg[] = {
2022 { CS35L41_PWR_CTRL1, 0x00000000 },
2123 { CS35L41_PWR_CTRL2, 0x00000000 },
@@ -1214,7 +1216,7 @@ EXPORT_SYMBOL_GPL(cs35l41_safe_reset); · 1192 unmodified lines
12141216 * the PLL Lock interrupt, in the IRQ handler.
12151217 */
12161218 int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l41_boost_type b_type,
1217− int enable, bool firmware_running)
1219+ int enable, struct cs_dsp *dsp)
12181220 {
12191221 int ret;
12201222 unsigned int gpio1_func, pad_control, pwr_ctrl1, pwr_ctrl3, int_status, pup_pdn_mask;
@@ -1309,7 +1311,7 @@ int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l4 · 88 unmodified lines
13091311 }
13101312 regmap_write(regmap, CS35L41_IRQ1_STATUS1, CS35L41_PUP_DONE_MASK);
13111313
1312− if (firmware_running)
1314+ if (dsp->running && dsp->fw_id_version > CS35L41_FIRMWARE_OLD_VERSION)
13131315 ret = cs35l41_set_cspl_mbox_cmd(dev, regmap,
13141316 CSPL_MBOX_CMD_SPK_OUT_ENABLE);
13151317 else
sound/soc/codecs/cs35l41.c+2−2
@@ -519,11 +519,11 @@ static int cs35l41_main_amp_event(struct snd_soc_dapm_widget *w, · 518 unmodified lines
519519 ARRAY_SIZE(cs35l41_pup_patch));
520520
521521 ret = cs35l41_global_enable(cs35l41->dev, cs35l41->regmap, cs35l41->hw_cfg.bst_type,
522− 1, cs35l41->dsp.cs_dsp.running);
522+ 1, &cs35l41->dsp.cs_dsp);
523523 break;
524524 case SND_SOC_DAPM_POST_PMD:
525525 ret = cs35l41_global_enable(cs35l41->dev, cs35l41->regmap, cs35l41->hw_cfg.bst_type,
526− 0, cs35l41->dsp.cs_dsp.running);
526+ 0, &cs35l41->dsp.cs_dsp);
527527
528528 regmap_multi_reg_write_bypassed(cs35l41->regmap,
529529 cs35l41_pdn_patch,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t