diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2008-05-13 03:20:51 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-05-19 07:19:16 -0400 |
commit | e58aee95806c9d2bbcfc84cb85ce958e360165ef (patch) | |
tree | 8385cb486591002e7a9ddefff9a9477b9f9bf679 /sound/pci/oxygen/oxygen.c | |
parent | c13650079ba3bed1c0bdd9bf4a13274be7676ff6 (diff) |
[ALSA] oxygen: save register writes
Save the written values of all CMI8788 and AC97 registers and of some of
the DAC/ADC registers so that it is possible to restore the register
state later.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/oxygen/oxygen.c')
-rw-r--r-- | sound/pci/oxygen/oxygen.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c index c1b30cc75935..8287ac28fe78 100644 --- a/sound/pci/oxygen/oxygen.c +++ b/sound/pci/oxygen/oxygen.c | |||
@@ -80,6 +80,7 @@ MODULE_DEVICE_TABLE(pci, oxygen_ids); | |||
80 | 80 | ||
81 | struct generic_data { | 81 | struct generic_data { |
82 | u8 ak4396_ctl2; | 82 | u8 ak4396_ctl2; |
83 | u16 saved_wm8785_registers[2]; | ||
83 | }; | 84 | }; |
84 | 85 | ||
85 | static void ak4396_write(struct oxygen *chip, unsigned int codec, | 86 | static void ak4396_write(struct oxygen *chip, unsigned int codec, |
@@ -99,12 +100,16 @@ static void ak4396_write(struct oxygen *chip, unsigned int codec, | |||
99 | 100 | ||
100 | static void wm8785_write(struct oxygen *chip, u8 reg, unsigned int value) | 101 | static void wm8785_write(struct oxygen *chip, u8 reg, unsigned int value) |
101 | { | 102 | { |
103 | struct generic_data *data = chip->model_data; | ||
104 | |||
102 | oxygen_write_spi(chip, OXYGEN_SPI_TRIGGER | | 105 | oxygen_write_spi(chip, OXYGEN_SPI_TRIGGER | |
103 | OXYGEN_SPI_DATA_LENGTH_2 | | 106 | OXYGEN_SPI_DATA_LENGTH_2 | |
104 | OXYGEN_SPI_CLOCK_160 | | 107 | OXYGEN_SPI_CLOCK_160 | |
105 | (3 << OXYGEN_SPI_CODEC_SHIFT) | | 108 | (3 << OXYGEN_SPI_CODEC_SHIFT) | |
106 | OXYGEN_SPI_CEN_LATCH_CLOCK_LO, | 109 | OXYGEN_SPI_CEN_LATCH_CLOCK_LO, |
107 | (reg << 9) | value); | 110 | (reg << 9) | value); |
111 | if (reg < ARRAY_SIZE(data->saved_wm8785_registers)) | ||
112 | data->saved_wm8785_registers[reg] = value; | ||
108 | } | 113 | } |
109 | 114 | ||
110 | static void ak4396_init(struct oxygen *chip) | 115 | static void ak4396_init(struct oxygen *chip) |
@@ -135,10 +140,16 @@ static void ak5385_init(struct oxygen *chip) | |||
135 | 140 | ||
136 | static void wm8785_init(struct oxygen *chip) | 141 | static void wm8785_init(struct oxygen *chip) |
137 | { | 142 | { |
143 | struct generic_data *data = chip->model_data; | ||
144 | |||
145 | data->saved_wm8785_registers[0] = WM8785_MCR_SLAVE | | ||
146 | WM8785_OSR_SINGLE | WM8785_FORMAT_LJUST; | ||
147 | data->saved_wm8785_registers[1] = WM8785_WL_24; | ||
148 | |||
138 | wm8785_write(chip, WM8785_R7, 0); | 149 | wm8785_write(chip, WM8785_R7, 0); |
139 | wm8785_write(chip, WM8785_R0, WM8785_MCR_SLAVE | | 150 | wm8785_write(chip, WM8785_R0, data->saved_wm8785_registers[0]); |
140 | WM8785_OSR_SINGLE | WM8785_FORMAT_LJUST); | 151 | wm8785_write(chip, WM8785_R1, data->saved_wm8785_registers[1]); |
141 | wm8785_write(chip, WM8785_R1, WM8785_WL_24); | 152 | |
142 | snd_component_add(chip->card, "WM8785"); | 153 | snd_component_add(chip->card, "WM8785"); |
143 | } | 154 | } |
144 | 155 | ||