Skip to content

Commit 2ee06ff

Browse files
Stefan Bindingtiwai
authored andcommitted
ALSA: hda: cs35l41: Force a software reset after hardware reset
To ensure the chip has correctly reset during probe and system suspend, we need to force a software reset, in case of systems where the hardware reset is not available. The software reset register was labelled as volatile but not readable, however, it is readable, (just returns 0x0). Adding it to readable registers means it will be correctly treated as volatile, and thus will not be cached. Signed-off-by: Stefan Binding <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 881b7bc commit 2ee06ff

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

include/sound/cs35l41.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,7 @@
735735
#define CS35L41_REVID_B2 0xB2
736736

737737
#define CS35L41_HALO_CORE_RESET 0x00000200
738+
#define CS35L41_SOFTWARE_RESET 0x5A000000
738739

739740
#define CS35L41_FS1_WINDOW_MASK 0x000007FF
740741
#define CS35L41_FS2_WINDOW_MASK 0x00FFF800

sound/pci/hda/cs35l41_hda.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,9 @@ static int cs35l41_system_resume(struct device *dev)
901901

902902
regcache_cache_only(cs35l41->regmap, false);
903903

904+
regmap_write(cs35l41->regmap, CS35L41_SFT_RESET, CS35L41_SOFTWARE_RESET);
905+
usleep_range(2000, 2100);
906+
904907
ret = cs35l41_wait_boot_done(cs35l41);
905908
if (ret)
906909
return ret;
@@ -1766,6 +1769,8 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
17661769
gpiod_set_value_cansleep(cs35l41->reset_gpio, 1);
17671770
}
17681771

1772+
usleep_range(2000, 2100);
1773+
regmap_write(cs35l41->regmap, CS35L41_SFT_RESET, CS35L41_SOFTWARE_RESET);
17691774
usleep_range(2000, 2100);
17701775

17711776
ret = cs35l41_wait_boot_done(cs35l41);

sound/soc/codecs/cs35l41-lib.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ static bool cs35l41_readable_reg(struct device *dev, unsigned int reg)
7474
case CS35L41_FABID:
7575
case CS35L41_RELID:
7676
case CS35L41_OTPID:
77+
case CS35L41_SFT_RESET:
7778
case CS35L41_TEST_KEY_CTL:
7879
case CS35L41_USER_KEY_CTL:
7980
case CS35L41_OTP_CTRL0:

0 commit comments

Comments
 (0)