Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 206504
b: refs/heads/master
c: a3a29b5
h: refs/heads/master
v: v3
  • Loading branch information
Peter Ujfalusi authored and Liam Girdwood committed May 31, 2010
1 parent 3a1ef61 commit ead4aa9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2046f175bc7b4d37e33dbce6a867be3bacf685cc
refs/heads/master: a3a29b55c70cefaac0d6fda170ccc85bd10e78bf
17 changes: 17 additions & 0 deletions trunk/sound/soc/codecs/twl4030.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,17 @@ static inline void twl4030_check_defaults(struct snd_soc_codec *codec)
difference, difference ? "Not OK" : "OK");
}

static inline void twl4030_reset_registers(struct snd_soc_codec *codec)
{
int i;

/* set all audio section registers to reasonable defaults */
for (i = TWL4030_REG_OPTION; i <= TWL4030_REG_MISC_SET_2; i++)
if (i != TWL4030_REG_APLL_CTL)
twl4030_write(codec, i, twl4030_reg[i]);

}

static void twl4030_init_chip(struct platform_device *pdev)
{
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
Expand All @@ -275,6 +286,10 @@ static void twl4030_init_chip(struct platform_device *pdev)
if (setup && setup->check_defaults)
twl4030_check_defaults(codec);

/* Reset registers, if no setup data or if instructed to do so */
if (!setup || (setup && setup->reset_registers))
twl4030_reset_registers(codec);

/* Refresh APLL_CTL register from HW */
twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &byte,
TWL4030_REG_APLL_CTL);
Expand Down Expand Up @@ -2271,6 +2286,8 @@ static int twl4030_soc_remove(struct platform_device *pdev)
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
struct snd_soc_codec *codec = socdev->card->codec;

/* Reset registers to their chip default before leaving */
twl4030_reset_registers(codec);
twl4030_set_bias_level(codec, SND_SOC_BIAS_OFF);
snd_soc_free_pcms(socdev);
snd_soc_dapm_free(socdev);
Expand Down
1 change: 1 addition & 0 deletions trunk/sound/soc/codecs/twl4030.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct twl4030_setup_data {
unsigned int sysclk;
unsigned int offset_cncl_path;
unsigned int check_defaults:1;
unsigned int reset_registers:1;
unsigned int hs_extmute:1;
void (*set_hs_extmute)(int mute);
};
Expand Down

0 comments on commit ead4aa9

Please sign in to comment.