Skip to content

Commit d0d642a

Browse files
committed
Merge tag 'sound-fix-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "Just a few fixes that have been gathered since the previous pull: - An additional fix for potential PCM deadlocks - A series of HD-audio CS8409 codec patches for new models - Other device specific fixes for HD-audio, ASoC mediatek, Intel, fsl, rockchip" * tag 'sound-fix-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: pcm: Fix potential AB/BA lock with buffer_mutex and mmap_lock ALSA: hda: Avoid unsol event during RPM suspending ALSA: hda/realtek: Fix audio regression on Mi Notebook Pro 2020 ALSA: hda/cs8409: Add new Dolphin HW variants ALSA: hda/cs8409: Disable HSBIAS_SENSE_EN for Cyborg ALSA: hda/cs8409: Support new Warlock MLK Variants ALSA: hda/cs8409: Fix Full Scale Volume setting for all variants ALSA: hda/cs8409: Re-order quirk table into ascending order ALSA: hda/cs8409: Fix Warlock to use mono mic configuration ALSA: cs4236: fix an incorrect NULL check on list iterator ALSA: hda/realtek: Enable headset mic on Lenovo P360 ASoC: SOF: Intel: Fix build error without SND_SOC_SOF_PCI_DEV ALSA: hda/realtek: Add mute and micmut LED support for Zbook Fury 17 G9 ASoC: rockchip: i2s_tdm: Fixup config for SND_SOC_DAIFMT_DSP_A/B ASoC: fsl-asoc-card: Fix jack_event() always return 0 ASoC: mediatek: mt6358: add missing EXPORT_SYMBOLs
2 parents 26803ba + bc55cfd commit d0d642a

14 files changed

Lines changed: 159 additions & 68 deletions

File tree

include/sound/pcm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ struct snd_pcm_runtime {
402402
struct fasync_struct *fasync;
403403
bool stop_operating; /* sync_stop will be called */
404404
struct mutex buffer_mutex; /* protect for buffer changes */
405+
atomic_t buffer_accessing; /* >0: in r/w operation, <0: blocked */
405406

406407
/* -- private section -- */
407408
void *private_data;

sound/core/pcm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
970970

971971
runtime->status->state = SNDRV_PCM_STATE_OPEN;
972972
mutex_init(&runtime->buffer_mutex);
973+
atomic_set(&runtime->buffer_accessing, 0);
973974

974975
substream->runtime = runtime;
975976
substream->private_data = pcm->private_data;

sound/core/pcm_lib.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,11 +1906,9 @@ static int wait_for_avail(struct snd_pcm_substream *substream,
19061906
if (avail >= runtime->twake)
19071907
break;
19081908
snd_pcm_stream_unlock_irq(substream);
1909-
mutex_unlock(&runtime->buffer_mutex);
19101909

19111910
tout = schedule_timeout(wait_time);
19121911

1913-
mutex_lock(&runtime->buffer_mutex);
19141912
snd_pcm_stream_lock_irq(substream);
19151913
set_current_state(TASK_INTERRUPTIBLE);
19161914
switch (runtime->status->state) {
@@ -2221,7 +2219,6 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
22212219

22222220
nonblock = !!(substream->f_flags & O_NONBLOCK);
22232221

2224-
mutex_lock(&runtime->buffer_mutex);
22252222
snd_pcm_stream_lock_irq(substream);
22262223
err = pcm_accessible_state(runtime);
22272224
if (err < 0)
@@ -2276,6 +2273,10 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
22762273
err = -EINVAL;
22772274
goto _end_unlock;
22782275
}
2276+
if (!atomic_inc_unless_negative(&runtime->buffer_accessing)) {
2277+
err = -EBUSY;
2278+
goto _end_unlock;
2279+
}
22792280
snd_pcm_stream_unlock_irq(substream);
22802281
if (!is_playback)
22812282
snd_pcm_dma_buffer_sync(substream, SNDRV_DMA_SYNC_CPU);
@@ -2284,6 +2285,7 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
22842285
if (is_playback)
22852286
snd_pcm_dma_buffer_sync(substream, SNDRV_DMA_SYNC_DEVICE);
22862287
snd_pcm_stream_lock_irq(substream);
2288+
atomic_dec(&runtime->buffer_accessing);
22872289
if (err < 0)
22882290
goto _end_unlock;
22892291
err = pcm_accessible_state(runtime);
@@ -2313,7 +2315,6 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
23132315
if (xfer > 0 && err >= 0)
23142316
snd_pcm_update_state(substream, runtime);
23152317
snd_pcm_stream_unlock_irq(substream);
2316-
mutex_unlock(&runtime->buffer_mutex);
23172318
return xfer > 0 ? (snd_pcm_sframes_t)xfer : err;
23182319
}
23192320
EXPORT_SYMBOL(__snd_pcm_lib_xfer);

sound/core/pcm_native.c

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,24 @@ static int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm,
685685
return 0;
686686
}
687687

688+
/* acquire buffer_mutex; if it's in r/w operation, return -EBUSY, otherwise
689+
* block the further r/w operations
690+
*/
691+
static int snd_pcm_buffer_access_lock(struct snd_pcm_runtime *runtime)
692+
{
693+
if (!atomic_dec_unless_positive(&runtime->buffer_accessing))
694+
return -EBUSY;
695+
mutex_lock(&runtime->buffer_mutex);
696+
return 0; /* keep buffer_mutex, unlocked by below */
697+
}
698+
699+
/* release buffer_mutex and clear r/w access flag */
700+
static void snd_pcm_buffer_access_unlock(struct snd_pcm_runtime *runtime)
701+
{
702+
mutex_unlock(&runtime->buffer_mutex);
703+
atomic_inc(&runtime->buffer_accessing);
704+
}
705+
688706
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
689707
#define is_oss_stream(substream) ((substream)->oss.oss)
690708
#else
@@ -695,14 +713,16 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
695713
struct snd_pcm_hw_params *params)
696714
{
697715
struct snd_pcm_runtime *runtime;
698-
int err = 0, usecs;
716+
int err, usecs;
699717
unsigned int bits;
700718
snd_pcm_uframes_t frames;
701719

702720
if (PCM_RUNTIME_CHECK(substream))
703721
return -ENXIO;
704722
runtime = substream->runtime;
705-
mutex_lock(&runtime->buffer_mutex);
723+
err = snd_pcm_buffer_access_lock(runtime);
724+
if (err < 0)
725+
return err;
706726
snd_pcm_stream_lock_irq(substream);
707727
switch (runtime->status->state) {
708728
case SNDRV_PCM_STATE_OPEN:
@@ -820,7 +840,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
820840
snd_pcm_lib_free_pages(substream);
821841
}
822842
unlock:
823-
mutex_unlock(&runtime->buffer_mutex);
843+
snd_pcm_buffer_access_unlock(runtime);
824844
return err;
825845
}
826846

@@ -865,7 +885,9 @@ static int snd_pcm_hw_free(struct snd_pcm_substream *substream)
865885
if (PCM_RUNTIME_CHECK(substream))
866886
return -ENXIO;
867887
runtime = substream->runtime;
868-
mutex_lock(&runtime->buffer_mutex);
888+
result = snd_pcm_buffer_access_lock(runtime);
889+
if (result < 0)
890+
return result;
869891
snd_pcm_stream_lock_irq(substream);
870892
switch (runtime->status->state) {
871893
case SNDRV_PCM_STATE_SETUP:
@@ -884,7 +906,7 @@ static int snd_pcm_hw_free(struct snd_pcm_substream *substream)
884906
snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);
885907
cpu_latency_qos_remove_request(&substream->latency_pm_qos_req);
886908
unlock:
887-
mutex_unlock(&runtime->buffer_mutex);
909+
snd_pcm_buffer_access_unlock(runtime);
888910
return result;
889911
}
890912

@@ -1369,12 +1391,15 @@ static int snd_pcm_action_nonatomic(const struct action_ops *ops,
13691391

13701392
/* Guarantee the group members won't change during non-atomic action */
13711393
down_read(&snd_pcm_link_rwsem);
1372-
mutex_lock(&substream->runtime->buffer_mutex);
1394+
res = snd_pcm_buffer_access_lock(substream->runtime);
1395+
if (res < 0)
1396+
goto unlock;
13731397
if (snd_pcm_stream_linked(substream))
13741398
res = snd_pcm_action_group(ops, substream, state, false);
13751399
else
13761400
res = snd_pcm_action_single(ops, substream, state);
1377-
mutex_unlock(&substream->runtime->buffer_mutex);
1401+
snd_pcm_buffer_access_unlock(substream->runtime);
1402+
unlock:
13781403
up_read(&snd_pcm_link_rwsem);
13791404
return res;
13801405
}

sound/isa/cs423x/cs4236.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ static int snd_cs423x_pnpbios_detect(struct pnp_dev *pdev,
494494
static int dev;
495495
int err;
496496
struct snd_card *card;
497-
struct pnp_dev *cdev;
497+
struct pnp_dev *cdev, *iter;
498498
char cid[PNP_ID_LEN];
499499

500500
if (pnp_device_is_isapnp(pdev))
@@ -510,9 +510,11 @@ static int snd_cs423x_pnpbios_detect(struct pnp_dev *pdev,
510510
strcpy(cid, pdev->id[0].id);
511511
cid[5] = '1';
512512
cdev = NULL;
513-
list_for_each_entry(cdev, &(pdev->protocol->devices), protocol_list) {
514-
if (!strcmp(cdev->id[0].id, cid))
513+
list_for_each_entry(iter, &(pdev->protocol->devices), protocol_list) {
514+
if (!strcmp(iter->id[0].id, cid)) {
515+
cdev = iter;
515516
break;
517+
}
516518
}
517519
err = snd_cs423x_card_new(&pdev->dev, dev, &card);
518520
if (err < 0)

sound/pci/hda/patch_cs8409-tables.c

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -478,28 +478,29 @@ const struct snd_pci_quirk cs8409_fixup_tbl[] = {
478478
SND_PCI_QUIRK(0x1028, 0x0A29, "Bullseye", CS8409_BULLSEYE),
479479
SND_PCI_QUIRK(0x1028, 0x0A2A, "Bullseye", CS8409_BULLSEYE),
480480
SND_PCI_QUIRK(0x1028, 0x0A2B, "Bullseye", CS8409_BULLSEYE),
481+
SND_PCI_QUIRK(0x1028, 0x0A77, "Cyborg", CS8409_CYBORG),
482+
SND_PCI_QUIRK(0x1028, 0x0A78, "Cyborg", CS8409_CYBORG),
483+
SND_PCI_QUIRK(0x1028, 0x0A79, "Cyborg", CS8409_CYBORG),
484+
SND_PCI_QUIRK(0x1028, 0x0A7A, "Cyborg", CS8409_CYBORG),
485+
SND_PCI_QUIRK(0x1028, 0x0A7D, "Cyborg", CS8409_CYBORG),
486+
SND_PCI_QUIRK(0x1028, 0x0A7E, "Cyborg", CS8409_CYBORG),
487+
SND_PCI_QUIRK(0x1028, 0x0A7F, "Cyborg", CS8409_CYBORG),
488+
SND_PCI_QUIRK(0x1028, 0x0A80, "Cyborg", CS8409_CYBORG),
481489
SND_PCI_QUIRK(0x1028, 0x0AB0, "Warlock", CS8409_WARLOCK),
482490
SND_PCI_QUIRK(0x1028, 0x0AB2, "Warlock", CS8409_WARLOCK),
483491
SND_PCI_QUIRK(0x1028, 0x0AB1, "Warlock", CS8409_WARLOCK),
484492
SND_PCI_QUIRK(0x1028, 0x0AB3, "Warlock", CS8409_WARLOCK),
485493
SND_PCI_QUIRK(0x1028, 0x0AB4, "Warlock", CS8409_WARLOCK),
486494
SND_PCI_QUIRK(0x1028, 0x0AB5, "Warlock", CS8409_WARLOCK),
495+
SND_PCI_QUIRK(0x1028, 0x0ACF, "Dolphin", CS8409_DOLPHIN),
496+
SND_PCI_QUIRK(0x1028, 0x0AD0, "Dolphin", CS8409_DOLPHIN),
497+
SND_PCI_QUIRK(0x1028, 0x0AD1, "Dolphin", CS8409_DOLPHIN),
498+
SND_PCI_QUIRK(0x1028, 0x0AD2, "Dolphin", CS8409_DOLPHIN),
499+
SND_PCI_QUIRK(0x1028, 0x0AD3, "Dolphin", CS8409_DOLPHIN),
487500
SND_PCI_QUIRK(0x1028, 0x0AD9, "Warlock", CS8409_WARLOCK),
488501
SND_PCI_QUIRK(0x1028, 0x0ADA, "Warlock", CS8409_WARLOCK),
489502
SND_PCI_QUIRK(0x1028, 0x0ADB, "Warlock", CS8409_WARLOCK),
490503
SND_PCI_QUIRK(0x1028, 0x0ADC, "Warlock", CS8409_WARLOCK),
491-
SND_PCI_QUIRK(0x1028, 0x0AF4, "Warlock", CS8409_WARLOCK),
492-
SND_PCI_QUIRK(0x1028, 0x0AF5, "Warlock", CS8409_WARLOCK),
493-
SND_PCI_QUIRK(0x1028, 0x0BB5, "Warlock N3 15 TGL-U Nuvoton EC", CS8409_WARLOCK),
494-
SND_PCI_QUIRK(0x1028, 0x0BB6, "Warlock V3 15 TGL-U Nuvoton EC", CS8409_WARLOCK),
495-
SND_PCI_QUIRK(0x1028, 0x0A77, "Cyborg", CS8409_CYBORG),
496-
SND_PCI_QUIRK(0x1028, 0x0A78, "Cyborg", CS8409_CYBORG),
497-
SND_PCI_QUIRK(0x1028, 0x0A79, "Cyborg", CS8409_CYBORG),
498-
SND_PCI_QUIRK(0x1028, 0x0A7A, "Cyborg", CS8409_CYBORG),
499-
SND_PCI_QUIRK(0x1028, 0x0A7D, "Cyborg", CS8409_CYBORG),
500-
SND_PCI_QUIRK(0x1028, 0x0A7E, "Cyborg", CS8409_CYBORG),
501-
SND_PCI_QUIRK(0x1028, 0x0A7F, "Cyborg", CS8409_CYBORG),
502-
SND_PCI_QUIRK(0x1028, 0x0A80, "Cyborg", CS8409_CYBORG),
503504
SND_PCI_QUIRK(0x1028, 0x0ADF, "Cyborg", CS8409_CYBORG),
504505
SND_PCI_QUIRK(0x1028, 0x0AE0, "Cyborg", CS8409_CYBORG),
505506
SND_PCI_QUIRK(0x1028, 0x0AE1, "Cyborg", CS8409_CYBORG),
@@ -512,18 +513,39 @@ const struct snd_pci_quirk cs8409_fixup_tbl[] = {
512513
SND_PCI_QUIRK(0x1028, 0x0AEE, "Cyborg", CS8409_CYBORG),
513514
SND_PCI_QUIRK(0x1028, 0x0AEF, "Cyborg", CS8409_CYBORG),
514515
SND_PCI_QUIRK(0x1028, 0x0AF0, "Cyborg", CS8409_CYBORG),
515-
SND_PCI_QUIRK(0x1028, 0x0AD0, "Dolphin", CS8409_DOLPHIN),
516-
SND_PCI_QUIRK(0x1028, 0x0AD1, "Dolphin", CS8409_DOLPHIN),
517-
SND_PCI_QUIRK(0x1028, 0x0AD2, "Dolphin", CS8409_DOLPHIN),
518-
SND_PCI_QUIRK(0x1028, 0x0AD3, "Dolphin", CS8409_DOLPHIN),
519-
SND_PCI_QUIRK(0x1028, 0x0ACF, "Dolphin", CS8409_DOLPHIN),
516+
SND_PCI_QUIRK(0x1028, 0x0AF4, "Warlock", CS8409_WARLOCK),
517+
SND_PCI_QUIRK(0x1028, 0x0AF5, "Warlock", CS8409_WARLOCK),
518+
SND_PCI_QUIRK(0x1028, 0x0B92, "Warlock MLK", CS8409_WARLOCK_MLK),
519+
SND_PCI_QUIRK(0x1028, 0x0B93, "Warlock MLK Dual Mic", CS8409_WARLOCK_MLK_DUAL_MIC),
520+
SND_PCI_QUIRK(0x1028, 0x0B94, "Warlock MLK", CS8409_WARLOCK_MLK),
521+
SND_PCI_QUIRK(0x1028, 0x0B95, "Warlock MLK Dual Mic", CS8409_WARLOCK_MLK_DUAL_MIC),
522+
SND_PCI_QUIRK(0x1028, 0x0B96, "Warlock MLK", CS8409_WARLOCK_MLK),
523+
SND_PCI_QUIRK(0x1028, 0x0B97, "Warlock MLK Dual Mic", CS8409_WARLOCK_MLK_DUAL_MIC),
524+
SND_PCI_QUIRK(0x1028, 0x0BB2, "Warlock MLK", CS8409_WARLOCK_MLK),
525+
SND_PCI_QUIRK(0x1028, 0x0BB3, "Warlock MLK", CS8409_WARLOCK_MLK),
526+
SND_PCI_QUIRK(0x1028, 0x0BB4, "Warlock MLK", CS8409_WARLOCK_MLK),
527+
SND_PCI_QUIRK(0x1028, 0x0BB5, "Warlock N3 15 TGL-U Nuvoton EC", CS8409_WARLOCK),
528+
SND_PCI_QUIRK(0x1028, 0x0BB6, "Warlock V3 15 TGL-U Nuvoton EC", CS8409_WARLOCK),
529+
SND_PCI_QUIRK(0x1028, 0x0BB8, "Warlock MLK", CS8409_WARLOCK_MLK),
530+
SND_PCI_QUIRK(0x1028, 0x0BB9, "Warlock MLK Dual Mic", CS8409_WARLOCK_MLK_DUAL_MIC),
531+
SND_PCI_QUIRK(0x1028, 0x0BBA, "Warlock MLK", CS8409_WARLOCK_MLK),
532+
SND_PCI_QUIRK(0x1028, 0x0BBB, "Warlock MLK Dual Mic", CS8409_WARLOCK_MLK_DUAL_MIC),
533+
SND_PCI_QUIRK(0x1028, 0x0BBC, "Warlock MLK", CS8409_WARLOCK_MLK),
534+
SND_PCI_QUIRK(0x1028, 0x0BBD, "Warlock MLK Dual Mic", CS8409_WARLOCK_MLK_DUAL_MIC),
535+
SND_PCI_QUIRK(0x1028, 0x0BD4, "Dolphin", CS8409_DOLPHIN),
536+
SND_PCI_QUIRK(0x1028, 0x0BD5, "Dolphin", CS8409_DOLPHIN),
537+
SND_PCI_QUIRK(0x1028, 0x0BD6, "Dolphin", CS8409_DOLPHIN),
538+
SND_PCI_QUIRK(0x1028, 0x0BD7, "Dolphin", CS8409_DOLPHIN),
539+
SND_PCI_QUIRK(0x1028, 0x0BD8, "Dolphin", CS8409_DOLPHIN),
520540
{} /* terminator */
521541
};
522542

523543
/* Dell Inspiron models with cs8409/cs42l42 */
524544
const struct hda_model_fixup cs8409_models[] = {
525545
{ .id = CS8409_BULLSEYE, .name = "bullseye" },
526546
{ .id = CS8409_WARLOCK, .name = "warlock" },
547+
{ .id = CS8409_WARLOCK_MLK, .name = "warlock mlk" },
548+
{ .id = CS8409_WARLOCK_MLK_DUAL_MIC, .name = "warlock mlk dual mic" },
527549
{ .id = CS8409_CYBORG, .name = "cyborg" },
528550
{ .id = CS8409_DOLPHIN, .name = "dolphin" },
529551
{}
@@ -542,6 +564,18 @@ const struct hda_fixup cs8409_fixups[] = {
542564
.chained = true,
543565
.chain_id = CS8409_FIXUPS,
544566
},
567+
[CS8409_WARLOCK_MLK] = {
568+
.type = HDA_FIXUP_PINS,
569+
.v.pins = cs8409_cs42l42_pincfgs,
570+
.chained = true,
571+
.chain_id = CS8409_FIXUPS,
572+
},
573+
[CS8409_WARLOCK_MLK_DUAL_MIC] = {
574+
.type = HDA_FIXUP_PINS,
575+
.v.pins = cs8409_cs42l42_pincfgs,
576+
.chained = true,
577+
.chain_id = CS8409_FIXUPS,
578+
},
545579
[CS8409_CYBORG] = {
546580
.type = HDA_FIXUP_PINS,
547581
.v.pins = cs8409_cs42l42_pincfgs,

sound/pci/hda/patch_cs8409.c

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,7 @@ static void cs42l42_resume(struct sub_codec *cs42l42)
733733
{ 0x130A, 0x00 },
734734
{ 0x130F, 0x00 },
735735
};
736+
int fsv_old, fsv_new;
736737

737738
/* Bring CS42L42 out of Reset */
738739
gpio_data = snd_hda_codec_read(codec, CS8409_PIN_AFG, 0, AC_VERB_GET_GPIO_DATA, 0);
@@ -749,8 +750,13 @@ static void cs42l42_resume(struct sub_codec *cs42l42)
749750
/* Clear interrupts, by reading interrupt status registers */
750751
cs8409_i2c_bulk_read(cs42l42, irq_regs, ARRAY_SIZE(irq_regs));
751752

752-
if (cs42l42->full_scale_vol)
753-
cs8409_i2c_write(cs42l42, 0x2001, 0x01);
753+
fsv_old = cs8409_i2c_read(cs42l42, 0x2001);
754+
if (cs42l42->full_scale_vol == CS42L42_FULL_SCALE_VOL_0DB)
755+
fsv_new = fsv_old & ~CS42L42_FULL_SCALE_VOL_MASK;
756+
else
757+
fsv_new = fsv_old & CS42L42_FULL_SCALE_VOL_MASK;
758+
if (fsv_new != fsv_old)
759+
cs8409_i2c_write(cs42l42, 0x2001, fsv_new);
754760

755761
/* we have to explicitly allow unsol event handling even during the
756762
* resume phase so that the jack event is processed properly
@@ -906,9 +912,15 @@ static void cs8409_cs42l42_hw_init(struct hda_codec *codec)
906912
cs8409_vendor_coef_set(codec, seq_bullseye->cir, seq_bullseye->coeff);
907913
}
908914

909-
/* DMIC1_MO=00b, DMIC1/2_SR=1 */
910-
if (codec->fixup_id == CS8409_WARLOCK || codec->fixup_id == CS8409_CYBORG)
911-
cs8409_vendor_coef_set(codec, 0x09, 0x0003);
915+
switch (codec->fixup_id) {
916+
case CS8409_CYBORG:
917+
case CS8409_WARLOCK_MLK_DUAL_MIC:
918+
/* DMIC1_MO=00b, DMIC1/2_SR=1 */
919+
cs8409_vendor_coef_set(codec, CS8409_DMIC_CFG, 0x0003);
920+
break;
921+
default:
922+
break;
923+
}
912924

913925
cs42l42_resume(cs42l42);
914926

@@ -993,25 +1005,17 @@ void cs8409_cs42l42_fixups(struct hda_codec *codec, const struct hda_fixup *fix,
9931005
cs8409_fix_caps(codec, CS8409_CS42L42_HP_PIN_NID);
9941006
cs8409_fix_caps(codec, CS8409_CS42L42_AMIC_PIN_NID);
9951007

996-
/* Set TIP_SENSE_EN for analog front-end of tip sense.
997-
* Additionally set HSBIAS_SENSE_EN and Full Scale volume for some variants.
998-
*/
1008+
/* Set HSBIAS_SENSE_EN and Full Scale volume for some variants. */
9991009
switch (codec->fixup_id) {
1000-
case CS8409_WARLOCK:
1010+
case CS8409_WARLOCK_MLK:
1011+
case CS8409_WARLOCK_MLK_DUAL_MIC:
10011012
spec->scodecs[CS8409_CODEC0]->hsbias_hiz = 0x0020;
1002-
spec->scodecs[CS8409_CODEC0]->full_scale_vol = 1;
1003-
break;
1004-
case CS8409_BULLSEYE:
1005-
spec->scodecs[CS8409_CODEC0]->hsbias_hiz = 0x0020;
1006-
spec->scodecs[CS8409_CODEC0]->full_scale_vol = 0;
1007-
break;
1008-
case CS8409_CYBORG:
1009-
spec->scodecs[CS8409_CODEC0]->hsbias_hiz = 0x00a0;
1010-
spec->scodecs[CS8409_CODEC0]->full_scale_vol = 1;
1013+
spec->scodecs[CS8409_CODEC0]->full_scale_vol = CS42L42_FULL_SCALE_VOL_0DB;
10111014
break;
10121015
default:
1013-
spec->scodecs[CS8409_CODEC0]->hsbias_hiz = 0x0003;
1014-
spec->scodecs[CS8409_CODEC0]->full_scale_vol = 1;
1016+
spec->scodecs[CS8409_CODEC0]->hsbias_hiz = 0x0020;
1017+
spec->scodecs[CS8409_CODEC0]->full_scale_vol =
1018+
CS42L42_FULL_SCALE_VOL_MINUS6DB;
10151019
break;
10161020
}
10171021

@@ -1222,6 +1226,9 @@ void dolphin_fixups(struct hda_codec *codec, const struct hda_fixup *fix, int ac
12221226
cs8409_fix_caps(codec, DOLPHIN_LO_PIN_NID);
12231227
cs8409_fix_caps(codec, DOLPHIN_AMIC_PIN_NID);
12241228

1229+
spec->scodecs[CS8409_CODEC0]->full_scale_vol = CS42L42_FULL_SCALE_VOL_MINUS6DB;
1230+
spec->scodecs[CS8409_CODEC1]->full_scale_vol = CS42L42_FULL_SCALE_VOL_MINUS6DB;
1231+
12251232
break;
12261233
case HDA_FIXUP_ACT_PROBE:
12271234
/* Fix Sample Rate to 48kHz */

sound/pci/hda/patch_cs8409.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ enum cs8409_coefficient_index_registers {
235235
#define CS42L42_I2C_SLEEP_US (2000)
236236
#define CS42L42_PDN_TIMEOUT_US (250000)
237237
#define CS42L42_PDN_SLEEP_US (2000)
238+
#define CS42L42_FULL_SCALE_VOL_MASK (2)
239+
#define CS42L42_FULL_SCALE_VOL_0DB (1)
240+
#define CS42L42_FULL_SCALE_VOL_MINUS6DB (0)
238241

239242
/* Dell BULLSEYE / WARLOCK / CYBORG Specific Definitions */
240243

@@ -264,6 +267,8 @@ enum cs8409_coefficient_index_registers {
264267
enum {
265268
CS8409_BULLSEYE,
266269
CS8409_WARLOCK,
270+
CS8409_WARLOCK_MLK,
271+
CS8409_WARLOCK_MLK_DUAL_MIC,
267272
CS8409_CYBORG,
268273
CS8409_FIXUPS,
269274
CS8409_DOLPHIN,

0 commit comments

Comments
 (0)