aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/oxygen.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2008-05-13 03:22:43 -0400
committerJaroslav Kysela <perex@perex.cz>2008-05-19 07:19:17 -0400
commit75146fc0f9368ea41419792ac8bfdd19273b4473 (patch)
tree73d3280052d0a1e63a38c3eaf42fe80cbd616a0c /sound/pci/oxygen/oxygen.c
parentbbbfb5526650cb9d01c5c230a4e3cbbc18474c41 (diff)
[ALSA] oxygen: separate out hardware initialization code
Create separate functions for the code that initializes the hardware, as opposed to initializing internal driver state, so that they can be reused for resume support. 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.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index ad8d950fddc6..800ae304a247 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -124,12 +124,11 @@ static void update_ak4396_volume(struct oxygen *chip)
124 } 124 }
125} 125}
126 126
127static void ak4396_init(struct oxygen *chip) 127static void ak4396_registers_init(struct oxygen *chip)
128{ 128{
129 struct generic_data *data = chip->model_data; 129 struct generic_data *data = chip->model_data;
130 unsigned int i; 130 unsigned int i;
131 131
132 data->ak4396_ctl2 = AK4396_SMUTE | AK4396_DEM_OFF | AK4396_DFS_NORMAL;
133 for (i = 0; i < 4; ++i) { 132 for (i = 0; i < 4; ++i) {
134 ak4396_write(chip, i, 133 ak4396_write(chip, i,
135 AK4396_CONTROL_1, AK4396_DIF_24_MSB | AK4396_RSTN); 134 AK4396_CONTROL_1, AK4396_DIF_24_MSB | AK4396_RSTN);
@@ -139,6 +138,14 @@ static void ak4396_init(struct oxygen *chip)
139 AK4396_CONTROL_3, AK4396_PCM); 138 AK4396_CONTROL_3, AK4396_PCM);
140 } 139 }
141 update_ak4396_volume(chip); 140 update_ak4396_volume(chip);
141}
142
143static void ak4396_init(struct oxygen *chip)
144{
145 struct generic_data *data = chip->model_data;
146
147 data->ak4396_ctl2 = AK4396_SMUTE | AK4396_DEM_OFF | AK4396_DFS_NORMAL;
148 ak4396_registers_init(chip);
142 snd_component_add(chip->card, "AK4396"); 149 snd_component_add(chip->card, "AK4396");
143} 150}
144 151
@@ -149,18 +156,23 @@ static void ak5385_init(struct oxygen *chip)
149 snd_component_add(chip->card, "AK5385"); 156 snd_component_add(chip->card, "AK5385");
150} 157}
151 158
152static void wm8785_init(struct oxygen *chip) 159static void wm8785_registers_init(struct oxygen *chip)
153{ 160{
154 struct generic_data *data = chip->model_data; 161 struct generic_data *data = chip->model_data;
155 162
156 data->saved_wm8785_registers[0] = WM8785_MCR_SLAVE |
157 WM8785_OSR_SINGLE | WM8785_FORMAT_LJUST;
158 data->saved_wm8785_registers[1] = WM8785_WL_24;
159
160 wm8785_write(chip, WM8785_R7, 0); 163 wm8785_write(chip, WM8785_R7, 0);
161 wm8785_write(chip, WM8785_R0, data->saved_wm8785_registers[0]); 164 wm8785_write(chip, WM8785_R0, data->saved_wm8785_registers[0]);
162 wm8785_write(chip, WM8785_R1, data->saved_wm8785_registers[1]); 165 wm8785_write(chip, WM8785_R1, data->saved_wm8785_registers[1]);
166}
163 167
168static void wm8785_init(struct oxygen *chip)
169{
170 struct generic_data *data = chip->model_data;
171
172 data->saved_wm8785_registers[0] = WM8785_MCR_SLAVE |
173 WM8785_OSR_SINGLE | WM8785_FORMAT_LJUST;
174 data->saved_wm8785_registers[1] = WM8785_WL_24;
175 wm8785_registers_init(chip);
164 snd_component_add(chip->card, "WM8785"); 176 snd_component_add(chip->card, "WM8785");
165} 177}
166 178