Skip to content

Commit ea9b9d3

Browse files
committed
ASoC: cs42l42: Set a faster digital ramp-up rate
With the default ramp-up rate, there is a noticeable fade-in when streams start. This can be undesirable with aggressive muting for power saving, since the beginning of the stream is lost. Lower the digital output ramp-up time from 8 samples per period to 2 samples per period. This still leaves some fade-in to avoid pops, but it is a lot less noticeable and no longer feels like the stream is fading in. Signed-off-by: Hector Martin <[email protected]>
1 parent 0d8ae77 commit ea9b9d3

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

include/sound/cs42l42.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@
6262
#define CS42L42_INTERNAL_FS_MASK (1 << CS42L42_INTERNAL_FS_SHIFT)
6363

6464
#define CS42L42_SFTRAMP_RATE (CS42L42_PAGE_10 + 0x0A)
65+
#define CS42L42_SFTRAMP_ASR_RATE_MASK GENMASK(7, 4)
66+
#define CS42L42_SFTRAMP_ASR_RATE_SHIFT 4
67+
#define CS42L42_SFTRAMP_DSR_RATE_MASK GENMASK(3, 0)
68+
#define CS42L42_SFTRAMP_DSR_RATE_SHIFT 0
6569
#define CS42L42_SLOW_START_ENABLE (CS42L42_PAGE_10 + 0x0B)
6670
#define CS42L42_SLOW_START_EN_MASK GENMASK(6, 4)
6771
#define CS42L42_SLOW_START_EN_SHIFT 4

sound/soc/codecs/cs42l42.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2397,6 +2397,16 @@ int cs42l42_init(struct cs42l42_private *cs42l42)
23972397
(1 << CS42L42_ADC_PDN_SHIFT) |
23982398
(0 << CS42L42_PDN_ALL_SHIFT));
23992399

2400+
/*
2401+
* Configure a faster digital ramp time, to avoid an audible
2402+
* fade-in when streams start.
2403+
*/
2404+
regmap_update_bits(cs42l42->regmap, CS42L42_SFTRAMP_RATE,
2405+
CS42L42_SFTRAMP_ASR_RATE_MASK |
2406+
CS42L42_SFTRAMP_DSR_RATE_MASK,
2407+
(10 << CS42L42_SFTRAMP_ASR_RATE_SHIFT) |
2408+
(1 << CS42L42_SFTRAMP_DSR_RATE_SHIFT));
2409+
24002410
ret = cs42l42_handle_device_data(cs42l42->dev, cs42l42);
24012411
if (ret != 0)
24022412
goto err_shutdown;

0 commit comments

Comments
 (0)