Skip to content

Commit 7ffe09e

Browse files
committed
Merge remote-tracking branch 'asoc/for-5.9' into asoc-linus
2 parents 549738f + ebb11d1 commit 7ffe09e

19 files changed

+292
-116
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4170,6 +4170,7 @@ CIRRUS LOGIC AUDIO CODEC DRIVERS
41704170
M: James Schulman <[email protected]>
41714171
M: David Rhodes <[email protected]>
41724172
L: [email protected] (moderated for non-subscribers)
4173+
41734174
S: Maintained
41744175
F: sound/soc/codecs/cs*
41754176

sound/soc/codecs/cs47l15.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,7 @@ static const struct snd_soc_dapm_route cs47l15_dapm_routes[] = {
10891089
{ "HPOUT1 Demux", NULL, "OUT1R" },
10901090

10911091
{ "OUT1R", NULL, "HPOUT1 Mono Mux" },
1092+
{ "HPOUT1 Mono Mux", "EPOUT", "OUT1L" },
10921093

10931094
{ "HPOUTL", "HPOUT", "HPOUT1 Demux" },
10941095
{ "HPOUTR", "HPOUT", "HPOUT1 Demux" },
@@ -1268,7 +1269,6 @@ static irqreturn_t cs47l15_adsp2_irq(int irq, void *data)
12681269

12691270
static const struct snd_soc_dapm_route cs47l15_mono_routes[] = {
12701271
{ "HPOUT1 Mono Mux", "HPOUT", "OUT1L" },
1271-
{ "HPOUT1 Mono Mux", "EPOUT", "OUT1L" },
12721272
};
12731273

12741274
static int cs47l15_component_probe(struct snd_soc_component *component)

sound/soc/codecs/cs47l35.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,7 @@ static const struct snd_soc_dapm_route cs47l35_dapm_routes[] = {
13051305
{ "SPKOUTP", NULL, "OUT4L" },
13061306

13071307
{ "OUT1R", NULL, "HPOUT1 Mono Mux" },
1308+
{ "HPOUT1 Mono Mux", "EPOUT", "OUT1L" },
13081309

13091310
{ "HPOUTL", "HPOUT", "HPOUT1 Demux" },
13101311
{ "HPOUTR", "HPOUT", "HPOUT1 Demux" },
@@ -1550,7 +1551,6 @@ static irqreturn_t cs47l35_adsp2_irq(int irq, void *data)
15501551

15511552
static const struct snd_soc_dapm_route cs47l35_mono_routes[] = {
15521553
{ "HPOUT1 Mono Mux", "HPOUT", "OUT1L" },
1553-
{ "HPOUT1 Mono Mux", "EPOUT", "OUT1L" },
15541554
};
15551555

15561556
static int cs47l35_component_probe(struct snd_soc_component *component)

sound/soc/codecs/rt1015.c

Lines changed: 90 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,33 @@ static int rt1015_bypass_boost_get(struct snd_kcontrol *kcontrol,
484484
return 0;
485485
}
486486

487+
static void rt1015_calibrate(struct rt1015_priv *rt1015)
488+
{
489+
struct snd_soc_component *component = rt1015->component;
490+
struct regmap *regmap = rt1015->regmap;
491+
492+
snd_soc_dapm_mutex_lock(&component->dapm);
493+
regcache_cache_bypass(regmap, true);
494+
495+
regmap_write(regmap, RT1015_PWR1, 0xd7df);
496+
regmap_write(regmap, RT1015_PWR4, 0x00b2);
497+
regmap_write(regmap, RT1015_CLSD_INTERNAL8, 0x2008);
498+
regmap_write(regmap, RT1015_CLSD_INTERNAL9, 0x0140);
499+
regmap_write(regmap, RT1015_GAT_BOOST, 0x0efe);
500+
regmap_write(regmap, RT1015_PWR_STATE_CTRL, 0x000d);
501+
regmap_write(regmap, RT1015_PWR_STATE_CTRL, 0x000e);
502+
regmap_write(regmap, RT1015_DC_CALIB_CLSD1, 0x5a00);
503+
regmap_write(regmap, RT1015_DC_CALIB_CLSD1, 0x5a01);
504+
regmap_write(regmap, RT1015_DC_CALIB_CLSD1, 0x5a05);
505+
msleep(500);
506+
regmap_write(regmap, RT1015_PWR1, 0x0);
507+
508+
regcache_cache_bypass(regmap, false);
509+
regcache_mark_dirty(regmap);
510+
regcache_sync(regmap);
511+
snd_soc_dapm_mutex_unlock(&component->dapm);
512+
}
513+
487514
static int rt1015_bypass_boost_put(struct snd_kcontrol *kcontrol,
488515
struct snd_ctl_elem_value *ucontrol)
489516
{
@@ -494,27 +521,45 @@ static int rt1015_bypass_boost_put(struct snd_kcontrol *kcontrol,
494521

495522
if (!rt1015->dac_is_used) {
496523
rt1015->bypass_boost = ucontrol->value.integer.value[0];
497-
if (rt1015->bypass_boost == RT1015_Bypass_Boost) {
498-
snd_soc_component_write(component,
499-
RT1015_PWR4, 0x00b2);
500-
snd_soc_component_write(component,
501-
RT1015_CLSD_INTERNAL8, 0x2008);
502-
snd_soc_component_write(component,
503-
RT1015_CLSD_INTERNAL9, 0x0140);
504-
snd_soc_component_write(component,
505-
RT1015_GAT_BOOST, 0x0efe);
506-
snd_soc_component_write(component,
507-
RT1015_PWR_STATE_CTRL, 0x000d);
508-
msleep(500);
509-
snd_soc_component_write(component,
510-
RT1015_PWR_STATE_CTRL, 0x000e);
524+
if (rt1015->bypass_boost == RT1015_Bypass_Boost &&
525+
!rt1015->cali_done) {
526+
rt1015_calibrate(rt1015);
527+
rt1015->cali_done = 1;
528+
529+
regmap_write(rt1015->regmap, RT1015_MONO_DYNA_CTRL, 0x0010);
511530
}
512531
} else
513532
dev_err(component->dev, "DAC is being used!\n");
514533

515534
return 0;
516535
}
517536

537+
static void rt1015_flush_work(struct work_struct *work)
538+
{
539+
struct rt1015_priv *rt1015 = container_of(work, struct rt1015_priv,
540+
flush_work.work);
541+
struct snd_soc_component *component = rt1015->component;
542+
unsigned int val, i = 0, count = 20;
543+
544+
while (i < count) {
545+
usleep_range(1000, 1500);
546+
dev_dbg(component->dev, "Flush DAC (retry:%u)\n", i);
547+
regmap_read(rt1015->regmap, RT1015_CLK_DET, &val);
548+
if (val & 0x800)
549+
break;
550+
i++;
551+
}
552+
553+
regmap_write(rt1015->regmap, RT1015_SYS_RST1, 0x0597);
554+
regmap_write(rt1015->regmap, RT1015_SYS_RST1, 0x05f7);
555+
regmap_write(rt1015->regmap, RT1015_MAN_I2C, 0x0028);
556+
557+
if (val & 0x800)
558+
dev_dbg(component->dev, "Flush DAC completed.\n");
559+
else
560+
dev_warn(component->dev, "Fail to flush DAC data.\n");
561+
}
562+
518563
static const struct snd_kcontrol_new rt1015_snd_controls[] = {
519564
SOC_SINGLE_TLV("DAC Playback Volume", RT1015_DAC1, RT1015_DAC_VOL_SFT,
520565
127, 0, dac_vol_tlv),
@@ -568,12 +613,7 @@ static int r1015_dac_event(struct snd_soc_dapm_widget *w,
568613
break;
569614

570615
case SND_SOC_DAPM_POST_PMU:
571-
if (rt1015->bypass_boost == RT1015_Bypass_Boost) {
572-
regmap_write(rt1015->regmap, RT1015_MAN_I2C, 0x00a8);
573-
regmap_write(rt1015->regmap, RT1015_SYS_RST1, 0x0597);
574-
regmap_write(rt1015->regmap, RT1015_SYS_RST1, 0x05f7);
575-
regmap_write(rt1015->regmap, RT1015_MAN_I2C, 0x0028);
576-
}
616+
regmap_write(rt1015->regmap, RT1015_MAN_I2C, 0x00a8);
577617
break;
578618

579619
case SND_SOC_DAPM_POST_PMD:
@@ -589,6 +629,8 @@ static int r1015_dac_event(struct snd_soc_dapm_widget *w,
589629
RT1015_SYS_RST1, 0x05f5);
590630
}
591631
rt1015->dac_is_used = 0;
632+
633+
cancel_delayed_work_sync(&rt1015->flush_work);
592634
break;
593635

594636
default:
@@ -597,6 +639,24 @@ static int r1015_dac_event(struct snd_soc_dapm_widget *w,
597639
return 0;
598640
}
599641

642+
static int rt1015_amp_drv_event(struct snd_soc_dapm_widget *w,
643+
struct snd_kcontrol *kcontrol, int event)
644+
{
645+
struct snd_soc_component *component =
646+
snd_soc_dapm_to_component(w->dapm);
647+
struct rt1015_priv *rt1015 = snd_soc_component_get_drvdata(component);
648+
649+
switch (event) {
650+
case SND_SOC_DAPM_POST_PMU:
651+
if (rt1015->hw_config == RT1015_HW_28)
652+
schedule_delayed_work(&rt1015->flush_work, msecs_to_jiffies(10));
653+
break;
654+
default:
655+
break;
656+
}
657+
return 0;
658+
}
659+
600660
static const struct snd_soc_dapm_widget rt1015_dapm_widgets[] = {
601661
SND_SOC_DAPM_SUPPLY("LDO2", RT1015_PWR1, RT1015_PWR_LDO2_BIT, 0,
602662
NULL, 0),
@@ -630,6 +690,8 @@ static const struct snd_soc_dapm_widget rt1015_dapm_widgets[] = {
630690
r1015_dac_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
631691
SND_SOC_DAPM_POST_PMD),
632692

693+
SND_SOC_DAPM_OUT_DRV_E("Amp Drv", SND_SOC_NOPM, 0, 0, NULL, 0,
694+
rt1015_amp_drv_event, SND_SOC_DAPM_POST_PMU),
633695
SND_SOC_DAPM_OUTPUT("SPO"),
634696
};
635697

@@ -648,7 +710,8 @@ static const struct snd_soc_dapm_route rt1015_dapm_routes[] = {
648710
{ "DAC", NULL, "MIXERV" },
649711
{ "DAC", NULL, "SUMV" },
650712
{ "DAC", NULL, "VREFLV" },
651-
{ "SPO", NULL, "DAC" },
713+
{ "Amp Drv", NULL, "DAC" },
714+
{ "SPO", NULL, "Amp Drv" },
652715
};
653716

654717
static int rt1015_hw_params(struct snd_pcm_substream *substream,
@@ -888,15 +951,19 @@ static int rt1015_probe(struct snd_soc_component *component)
888951

889952
rt1015->component = component;
890953
rt1015->bclk_ratio = 0;
954+
rt1015->cali_done = 0;
891955
snd_soc_component_write(component, RT1015_BAT_RPO_STEP1, 0x061c);
892956

957+
INIT_DELAYED_WORK(&rt1015->flush_work, rt1015_flush_work);
958+
893959
return 0;
894960
}
895961

896962
static void rt1015_remove(struct snd_soc_component *component)
897963
{
898964
struct rt1015_priv *rt1015 = snd_soc_component_get_drvdata(component);
899965

966+
cancel_delayed_work_sync(&rt1015->flush_work);
900967
regmap_write(rt1015->regmap, RT1015_RESET, 0);
901968
}
902969

@@ -1022,6 +1089,8 @@ static int rt1015_i2c_probe(struct i2c_client *i2c,
10221089
return ret;
10231090
}
10241091

1092+
rt1015->hw_config = (i2c->addr == 0x29) ? RT1015_HW_29 : RT1015_HW_28;
1093+
10251094
regmap_read(rt1015->regmap, RT1015_DEVICE_ID, &val);
10261095
if ((val != RT1015_DEVICE_ID_VAL) && (val != RT1015_DEVICE_ID_VAL2)) {
10271096
dev_err(&i2c->dev,

sound/soc/codecs/rt1015.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,11 @@ enum {
373373
RT1015_Bypass_Boost,
374374
};
375375

376+
enum {
377+
RT1015_HW_28 = 0,
378+
RT1015_HW_29,
379+
};
380+
376381
struct rt1015_priv {
377382
struct snd_soc_component *component;
378383
struct regmap *regmap;
@@ -389,6 +394,9 @@ struct rt1015_priv {
389394
int bypass_boost;
390395
int amp_ver;
391396
int dac_is_used;
397+
int cali_done;
398+
int hw_config;
399+
struct delayed_work flush_work;
392400
};
393401

394402
#endif /* __RT1015_H__ */

sound/soc/codecs/rt700-sdw.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,9 @@ static int __maybe_unused rt700_dev_suspend(struct device *dev)
490490
if (!rt700->hw_init)
491491
return 0;
492492

493+
cancel_delayed_work_sync(&rt700->jack_detect_work);
494+
cancel_delayed_work_sync(&rt700->jack_btn_check_work);
495+
493496
regcache_cache_only(rt700->regmap, true);
494497

495498
return 0;

sound/soc/codecs/rt711-sdw.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,10 @@ static int __maybe_unused rt711_dev_suspend(struct device *dev)
491491
if (!rt711->hw_init)
492492
return 0;
493493

494+
cancel_delayed_work_sync(&rt711->jack_detect_work);
495+
cancel_delayed_work_sync(&rt711->jack_btn_check_work);
496+
cancel_work_sync(&rt711->calibration_work);
497+
494498
regcache_cache_only(rt711->regmap, true);
495499

496500
return 0;

0 commit comments

Comments
 (0)