Skip to content

Commit 6a7ed7e

Browse files
Vitaly Rodionovtiwai
authored andcommitted
ALSA: hda/cirrus: Reduce codec resume time
This patch reduces the resume time by half and introduces an option to include a delay after a single write operation before continuing. Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com> Link: https://patch.msgid.link/20250214162354.2675652-2-vitalyr@opensource.cirrus.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 08b613b commit 6a7ed7e

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

sound/pci/hda/patch_cs8409-tables.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static const struct cs8409_i2c_param cs42l42_init_reg_seq[] = {
131131
{ CS42L42_RSENSE_CTL3, 0x00 },
132132
{ CS42L42_TSENSE_CTL, 0x80 },
133133
{ CS42L42_HS_BIAS_CTL, 0xC0 },
134-
{ CS42L42_PWR_CTL1, 0x02 },
134+
{ CS42L42_PWR_CTL1, 0x02, 10000 },
135135
{ CS42L42_ADC_OVFL_INT_MASK, 0xff },
136136
{ CS42L42_MIXER_INT_MASK, 0xff },
137137
{ CS42L42_SRC_INT_MASK, 0xff },
@@ -328,7 +328,7 @@ static const struct cs8409_i2c_param dolphin_c0_init_reg_seq[] = {
328328
{ CS42L42_RSENSE_CTL3, 0x00 },
329329
{ CS42L42_TSENSE_CTL, 0x80 },
330330
{ CS42L42_HS_BIAS_CTL, 0xC0 },
331-
{ CS42L42_PWR_CTL1, 0x02 },
331+
{ CS42L42_PWR_CTL1, 0x02, 10000 },
332332
{ CS42L42_ADC_OVFL_INT_MASK, 0xff },
333333
{ CS42L42_MIXER_INT_MASK, 0xff },
334334
{ CS42L42_SRC_INT_MASK, 0xff },
@@ -384,7 +384,7 @@ static const struct cs8409_i2c_param dolphin_c1_init_reg_seq[] = {
384384
{ CS42L42_RSENSE_CTL3, 0x00 },
385385
{ CS42L42_TSENSE_CTL, 0x80 },
386386
{ CS42L42_HS_BIAS_CTL, 0xC0 },
387-
{ CS42L42_PWR_CTL1, 0x06 },
387+
{ CS42L42_PWR_CTL1, 0x06, 10000 },
388388
{ CS42L42_ADC_OVFL_INT_MASK, 0xff },
389389
{ CS42L42_MIXER_INT_MASK, 0xff },
390390
{ CS42L42_SRC_INT_MASK, 0xff },

sound/pci/hda/patch_cs8409.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,11 @@ static int cs8409_i2c_bulk_write(struct sub_codec *scodec, const struct cs8409_i
346346

347347
if (cs8409_i2c_wait_complete(codec) < 0)
348348
goto error;
349+
/* Certain use cases may require a delay
350+
* after a write operation before proceeding.
351+
*/
352+
if (seq[i].delay)
353+
fsleep(seq[i].delay);
349354
}
350355

351356
mutex_unlock(&spec->i2c_mux);
@@ -888,7 +893,6 @@ static void cs42l42_resume(struct sub_codec *cs42l42)
888893

889894
/* Initialize CS42L42 companion codec */
890895
cs8409_i2c_bulk_write(cs42l42, cs42l42->init_seq, cs42l42->init_seq_num);
891-
msleep(CS42L42_INIT_TIMEOUT_MS);
892896

893897
/* Clear interrupts, by reading interrupt status registers */
894898
cs8409_i2c_bulk_read(cs42l42, irq_regs, ARRAY_SIZE(irq_regs));

sound/pci/hda/patch_cs8409.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ enum cs8409_coefficient_index_registers {
229229
#define CS42L42_I2C_SLEEP_US (2000)
230230
#define CS42L42_PDN_TIMEOUT_US (250000)
231231
#define CS42L42_PDN_SLEEP_US (2000)
232-
#define CS42L42_INIT_TIMEOUT_MS (45)
233232
#define CS42L42_ANA_MUTE_AB (0x0C)
234233
#define CS42L42_FULL_SCALE_VOL_MASK (2)
235234
#define CS42L42_FULL_SCALE_VOL_0DB (0)
@@ -291,6 +290,7 @@ enum {
291290
struct cs8409_i2c_param {
292291
unsigned int addr;
293292
unsigned int value;
293+
unsigned int delay;
294294
};
295295

296296
struct cs8409_cir_param {

0 commit comments

Comments
 (0)