2 * wm8350.c -- WM8350 ALSA SoC audio driver
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
6 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/module.h>
14 #include <linux/moduleparam.h>
15 #include <linux/init.h>
16 #include <linux/slab.h>
17 #include <linux/delay.h>
19 #include <linux/platform_device.h>
20 #include <linux/mfd/wm8350/audio.h>
21 #include <linux/mfd/wm8350/core.h>
22 #include <linux/regulator/consumer.h>
23 #include <sound/core.h>
24 #include <sound/pcm.h>
25 #include <sound/pcm_params.h>
26 #include <sound/soc.h>
27 #include <sound/soc-dapm.h>
28 #include <sound/initval.h>
29 #include <sound/tlv.h>
33 #define WM8350_OUTn_0dB 0x39
35 #define WM8350_RAMP_NONE 0
36 #define WM8350_RAMP_UP 1
37 #define WM8350_RAMP_DOWN 2
39 /* We only include the analogue supplies here; the digital supplies
40 * need to be available well before this driver can be probed.
42 static const char *supply_names
[] = {
47 struct wm8350_output
{
55 struct wm8350_jack_data
{
56 struct snd_soc_jack
*jack
;
62 struct snd_soc_codec codec
;
63 struct wm8350_output out1
;
64 struct wm8350_output out2
;
65 struct wm8350_jack_data hpl
;
66 struct wm8350_jack_data hpr
;
67 struct wm8350_jack_data mic
;
68 struct regulator_bulk_data supplies
[ARRAY_SIZE(supply_names
)];
73 static unsigned int wm8350_codec_cache_read(struct snd_soc_codec
*codec
,
76 struct wm8350
*wm8350
= codec
->control_data
;
77 return wm8350
->reg_cache
[reg
];
80 static unsigned int wm8350_codec_read(struct snd_soc_codec
*codec
,
83 struct wm8350
*wm8350
= codec
->control_data
;
84 return wm8350_reg_read(wm8350
, reg
);
87 static int wm8350_codec_write(struct snd_soc_codec
*codec
, unsigned int reg
,
90 struct wm8350
*wm8350
= codec
->control_data
;
91 return wm8350_reg_write(wm8350
, reg
, value
);
95 * Ramp OUT1 PGA volume to minimise pops at stream startup and shutdown.
97 static inline int wm8350_out1_ramp_step(struct snd_soc_codec
*codec
)
99 struct wm8350_data
*wm8350_data
= snd_soc_codec_get_drvdata(codec
);
100 struct wm8350_output
*out1
= &wm8350_data
->out1
;
101 struct wm8350
*wm8350
= codec
->control_data
;
102 int left_complete
= 0, right_complete
= 0;
106 reg
= wm8350_reg_read(wm8350
, WM8350_LOUT1_VOLUME
);
107 val
= (reg
& WM8350_OUT1L_VOL_MASK
) >> WM8350_OUT1L_VOL_SHIFT
;
109 if (out1
->ramp
== WM8350_RAMP_UP
) {
111 if (val
< out1
->left_vol
) {
113 reg
&= ~WM8350_OUT1L_VOL_MASK
;
114 wm8350_reg_write(wm8350
, WM8350_LOUT1_VOLUME
,
115 reg
| (val
<< WM8350_OUT1L_VOL_SHIFT
));
118 } else if (out1
->ramp
== WM8350_RAMP_DOWN
) {
122 reg
&= ~WM8350_OUT1L_VOL_MASK
;
123 wm8350_reg_write(wm8350
, WM8350_LOUT1_VOLUME
,
124 reg
| (val
<< WM8350_OUT1L_VOL_SHIFT
));
131 reg
= wm8350_reg_read(wm8350
, WM8350_ROUT1_VOLUME
);
132 val
= (reg
& WM8350_OUT1R_VOL_MASK
) >> WM8350_OUT1R_VOL_SHIFT
;
133 if (out1
->ramp
== WM8350_RAMP_UP
) {
135 if (val
< out1
->right_vol
) {
137 reg
&= ~WM8350_OUT1R_VOL_MASK
;
138 wm8350_reg_write(wm8350
, WM8350_ROUT1_VOLUME
,
139 reg
| (val
<< WM8350_OUT1R_VOL_SHIFT
));
142 } else if (out1
->ramp
== WM8350_RAMP_DOWN
) {
146 reg
&= ~WM8350_OUT1R_VOL_MASK
;
147 wm8350_reg_write(wm8350
, WM8350_ROUT1_VOLUME
,
148 reg
| (val
<< WM8350_OUT1R_VOL_SHIFT
));
153 /* only hit the update bit if either volume has changed this step */
154 if (!left_complete
|| !right_complete
)
155 wm8350_set_bits(wm8350
, WM8350_LOUT1_VOLUME
, WM8350_OUT1_VU
);
157 return left_complete
& right_complete
;
161 * Ramp OUT2 PGA volume to minimise pops at stream startup and shutdown.
163 static inline int wm8350_out2_ramp_step(struct snd_soc_codec
*codec
)
165 struct wm8350_data
*wm8350_data
= snd_soc_codec_get_drvdata(codec
);
166 struct wm8350_output
*out2
= &wm8350_data
->out2
;
167 struct wm8350
*wm8350
= codec
->control_data
;
168 int left_complete
= 0, right_complete
= 0;
172 reg
= wm8350_reg_read(wm8350
, WM8350_LOUT2_VOLUME
);
173 val
= (reg
& WM8350_OUT2L_VOL_MASK
) >> WM8350_OUT1L_VOL_SHIFT
;
174 if (out2
->ramp
== WM8350_RAMP_UP
) {
176 if (val
< out2
->left_vol
) {
178 reg
&= ~WM8350_OUT2L_VOL_MASK
;
179 wm8350_reg_write(wm8350
, WM8350_LOUT2_VOLUME
,
180 reg
| (val
<< WM8350_OUT1L_VOL_SHIFT
));
183 } else if (out2
->ramp
== WM8350_RAMP_DOWN
) {
187 reg
&= ~WM8350_OUT2L_VOL_MASK
;
188 wm8350_reg_write(wm8350
, WM8350_LOUT2_VOLUME
,
189 reg
| (val
<< WM8350_OUT1L_VOL_SHIFT
));
196 reg
= wm8350_reg_read(wm8350
, WM8350_ROUT2_VOLUME
);
197 val
= (reg
& WM8350_OUT2R_VOL_MASK
) >> WM8350_OUT1R_VOL_SHIFT
;
198 if (out2
->ramp
== WM8350_RAMP_UP
) {
200 if (val
< out2
->right_vol
) {
202 reg
&= ~WM8350_OUT2R_VOL_MASK
;
203 wm8350_reg_write(wm8350
, WM8350_ROUT2_VOLUME
,
204 reg
| (val
<< WM8350_OUT1R_VOL_SHIFT
));
207 } else if (out2
->ramp
== WM8350_RAMP_DOWN
) {
211 reg
&= ~WM8350_OUT2R_VOL_MASK
;
212 wm8350_reg_write(wm8350
, WM8350_ROUT2_VOLUME
,
213 reg
| (val
<< WM8350_OUT1R_VOL_SHIFT
));
218 /* only hit the update bit if either volume has changed this step */
219 if (!left_complete
|| !right_complete
)
220 wm8350_set_bits(wm8350
, WM8350_LOUT2_VOLUME
, WM8350_OUT2_VU
);
222 return left_complete
& right_complete
;
226 * This work ramps both output PGAs at stream start/stop time to
227 * minimise pop associated with DAPM power switching.
228 * It's best to enable Zero Cross when ramping occurs to minimise any
231 static void wm8350_pga_work(struct work_struct
*work
)
233 struct snd_soc_codec
*codec
=
234 container_of(work
, struct snd_soc_codec
, delayed_work
.work
);
235 struct wm8350_data
*wm8350_data
= snd_soc_codec_get_drvdata(codec
);
236 struct wm8350_output
*out1
= &wm8350_data
->out1
,
237 *out2
= &wm8350_data
->out2
;
238 int i
, out1_complete
, out2_complete
;
240 /* do we need to ramp at all ? */
241 if (out1
->ramp
== WM8350_RAMP_NONE
&& out2
->ramp
== WM8350_RAMP_NONE
)
244 /* PGA volumes have 6 bits of resolution to ramp */
245 for (i
= 0; i
<= 63; i
++) {
246 out1_complete
= 1, out2_complete
= 1;
247 if (out1
->ramp
!= WM8350_RAMP_NONE
)
248 out1_complete
= wm8350_out1_ramp_step(codec
);
249 if (out2
->ramp
!= WM8350_RAMP_NONE
)
250 out2_complete
= wm8350_out2_ramp_step(codec
);
252 /* ramp finished ? */
253 if (out1_complete
&& out2_complete
)
256 /* we need to delay longer on the up ramp */
257 if (out1
->ramp
== WM8350_RAMP_UP
||
258 out2
->ramp
== WM8350_RAMP_UP
) {
259 /* delay is longer over 0dB as increases are larger */
260 if (i
>= WM8350_OUTn_0dB
)
261 schedule_timeout_interruptible(msecs_to_jiffies
264 schedule_timeout_interruptible(msecs_to_jiffies
267 udelay(50); /* doesn't matter if we delay longer */
270 out1
->ramp
= WM8350_RAMP_NONE
;
271 out2
->ramp
= WM8350_RAMP_NONE
;
278 static int pga_event(struct snd_soc_dapm_widget
*w
,
279 struct snd_kcontrol
*kcontrol
, int event
)
281 struct snd_soc_codec
*codec
= w
->codec
;
282 struct wm8350_data
*wm8350_data
= snd_soc_codec_get_drvdata(codec
);
283 struct wm8350_output
*out
;
288 out
= &wm8350_data
->out1
;
292 out
= &wm8350_data
->out2
;
301 case SND_SOC_DAPM_POST_PMU
:
302 out
->ramp
= WM8350_RAMP_UP
;
305 if (!delayed_work_pending(&codec
->delayed_work
))
306 schedule_delayed_work(&codec
->delayed_work
,
307 msecs_to_jiffies(1));
310 case SND_SOC_DAPM_PRE_PMD
:
311 out
->ramp
= WM8350_RAMP_DOWN
;
314 if (!delayed_work_pending(&codec
->delayed_work
))
315 schedule_delayed_work(&codec
->delayed_work
,
316 msecs_to_jiffies(1));
323 static int wm8350_put_volsw_2r_vu(struct snd_kcontrol
*kcontrol
,
324 struct snd_ctl_elem_value
*ucontrol
)
326 struct snd_soc_codec
*codec
= snd_kcontrol_chip(kcontrol
);
327 struct wm8350_data
*wm8350_priv
= snd_soc_codec_get_drvdata(codec
);
328 struct wm8350_output
*out
= NULL
;
329 struct soc_mixer_control
*mc
=
330 (struct soc_mixer_control
*)kcontrol
->private_value
;
332 unsigned int reg
= mc
->reg
;
335 /* For OUT1 and OUT2 we shadow the values and only actually write
336 * them out when active in order to ensure the amplifier comes on
337 * as quietly as possible. */
339 case WM8350_LOUT1_VOLUME
:
340 out
= &wm8350_priv
->out1
;
342 case WM8350_LOUT2_VOLUME
:
343 out
= &wm8350_priv
->out2
;
350 out
->left_vol
= ucontrol
->value
.integer
.value
[0];
351 out
->right_vol
= ucontrol
->value
.integer
.value
[1];
356 ret
= snd_soc_put_volsw_2r(kcontrol
, ucontrol
);
360 /* now hit the volume update bits (always bit 8) */
361 val
= wm8350_codec_read(codec
, reg
);
362 wm8350_codec_write(codec
, reg
, val
| WM8350_OUT1_VU
);
366 static int wm8350_get_volsw_2r(struct snd_kcontrol
*kcontrol
,
367 struct snd_ctl_elem_value
*ucontrol
)
369 struct snd_soc_codec
*codec
= snd_kcontrol_chip(kcontrol
);
370 struct wm8350_data
*wm8350_priv
= snd_soc_codec_get_drvdata(codec
);
371 struct wm8350_output
*out1
= &wm8350_priv
->out1
;
372 struct wm8350_output
*out2
= &wm8350_priv
->out2
;
373 struct soc_mixer_control
*mc
=
374 (struct soc_mixer_control
*)kcontrol
->private_value
;
375 unsigned int reg
= mc
->reg
;
377 /* If these are cached registers use the cache */
379 case WM8350_LOUT1_VOLUME
:
380 ucontrol
->value
.integer
.value
[0] = out1
->left_vol
;
381 ucontrol
->value
.integer
.value
[1] = out1
->right_vol
;
384 case WM8350_LOUT2_VOLUME
:
385 ucontrol
->value
.integer
.value
[0] = out2
->left_vol
;
386 ucontrol
->value
.integer
.value
[1] = out2
->right_vol
;
393 return snd_soc_get_volsw_2r(kcontrol
, ucontrol
);
396 /* double control with volume update */
397 #define SOC_WM8350_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, \
398 xinvert, tlv_array) \
399 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
400 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
401 SNDRV_CTL_ELEM_ACCESS_READWRITE | \
402 SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
403 .tlv.p = (tlv_array), \
404 .info = snd_soc_info_volsw_2r, \
405 .get = wm8350_get_volsw_2r, .put = wm8350_put_volsw_2r_vu, \
406 .private_value = (unsigned long)&(struct soc_mixer_control) \
407 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
408 .rshift = xshift, .max = xmax, .invert = xinvert}, }
410 static const char *wm8350_deemp
[] = { "None", "32kHz", "44.1kHz", "48kHz" };
411 static const char *wm8350_pol
[] = { "Normal", "Inv R", "Inv L", "Inv L & R" };
412 static const char *wm8350_dacmutem
[] = { "Normal", "Soft" };
413 static const char *wm8350_dacmutes
[] = { "Fast", "Slow" };
414 static const char *wm8350_adcfilter
[] = { "None", "High Pass" };
415 static const char *wm8350_adchp
[] = { "44.1kHz", "8kHz", "16kHz", "32kHz" };
416 static const char *wm8350_lr
[] = { "Left", "Right" };
418 static const struct soc_enum wm8350_enum
[] = {
419 SOC_ENUM_SINGLE(WM8350_DAC_CONTROL
, 4, 4, wm8350_deemp
),
420 SOC_ENUM_SINGLE(WM8350_DAC_CONTROL
, 0, 4, wm8350_pol
),
421 SOC_ENUM_SINGLE(WM8350_DAC_MUTE_VOLUME
, 14, 2, wm8350_dacmutem
),
422 SOC_ENUM_SINGLE(WM8350_DAC_MUTE_VOLUME
, 13, 2, wm8350_dacmutes
),
423 SOC_ENUM_SINGLE(WM8350_ADC_CONTROL
, 15, 2, wm8350_adcfilter
),
424 SOC_ENUM_SINGLE(WM8350_ADC_CONTROL
, 8, 4, wm8350_adchp
),
425 SOC_ENUM_SINGLE(WM8350_ADC_CONTROL
, 0, 4, wm8350_pol
),
426 SOC_ENUM_SINGLE(WM8350_INPUT_MIXER_VOLUME
, 15, 2, wm8350_lr
),
429 static DECLARE_TLV_DB_SCALE(pre_amp_tlv
, -1200, 3525, 0);
430 static DECLARE_TLV_DB_SCALE(out_pga_tlv
, -5700, 600, 0);
431 static DECLARE_TLV_DB_SCALE(dac_pcm_tlv
, -7163, 36, 1);
432 static DECLARE_TLV_DB_SCALE(adc_pcm_tlv
, -12700, 50, 1);
433 static DECLARE_TLV_DB_SCALE(out_mix_tlv
, -1500, 300, 1);
435 static const unsigned int capture_sd_tlv
[] = {
436 TLV_DB_RANGE_HEAD(2),
437 0, 12, TLV_DB_SCALE_ITEM(-3600, 300, 1),
438 13, 15, TLV_DB_SCALE_ITEM(0, 0, 0),
441 static const struct snd_kcontrol_new wm8350_snd_controls
[] = {
442 SOC_ENUM("Playback Deemphasis", wm8350_enum
[0]),
443 SOC_ENUM("Playback DAC Inversion", wm8350_enum
[1]),
444 SOC_WM8350_DOUBLE_R_TLV("Playback PCM Volume",
445 WM8350_DAC_DIGITAL_VOLUME_L
,
446 WM8350_DAC_DIGITAL_VOLUME_R
,
447 0, 255, 0, dac_pcm_tlv
),
448 SOC_ENUM("Playback PCM Mute Function", wm8350_enum
[2]),
449 SOC_ENUM("Playback PCM Mute Speed", wm8350_enum
[3]),
450 SOC_ENUM("Capture PCM Filter", wm8350_enum
[4]),
451 SOC_ENUM("Capture PCM HP Filter", wm8350_enum
[5]),
452 SOC_ENUM("Capture ADC Inversion", wm8350_enum
[6]),
453 SOC_WM8350_DOUBLE_R_TLV("Capture PCM Volume",
454 WM8350_ADC_DIGITAL_VOLUME_L
,
455 WM8350_ADC_DIGITAL_VOLUME_R
,
456 0, 255, 0, adc_pcm_tlv
),
457 SOC_DOUBLE_TLV("Capture Sidetone Volume",
459 8, 4, 15, 1, capture_sd_tlv
),
460 SOC_WM8350_DOUBLE_R_TLV("Capture Volume",
461 WM8350_LEFT_INPUT_VOLUME
,
462 WM8350_RIGHT_INPUT_VOLUME
,
463 2, 63, 0, pre_amp_tlv
),
464 SOC_DOUBLE_R("Capture ZC Switch",
465 WM8350_LEFT_INPUT_VOLUME
,
466 WM8350_RIGHT_INPUT_VOLUME
, 13, 1, 0),
467 SOC_SINGLE_TLV("Left Input Left Sidetone Volume",
468 WM8350_OUTPUT_LEFT_MIXER_VOLUME
, 1, 7, 0, out_mix_tlv
),
469 SOC_SINGLE_TLV("Left Input Right Sidetone Volume",
470 WM8350_OUTPUT_LEFT_MIXER_VOLUME
,
471 5, 7, 0, out_mix_tlv
),
472 SOC_SINGLE_TLV("Left Input Bypass Volume",
473 WM8350_OUTPUT_LEFT_MIXER_VOLUME
,
474 9, 7, 0, out_mix_tlv
),
475 SOC_SINGLE_TLV("Right Input Left Sidetone Volume",
476 WM8350_OUTPUT_RIGHT_MIXER_VOLUME
,
477 1, 7, 0, out_mix_tlv
),
478 SOC_SINGLE_TLV("Right Input Right Sidetone Volume",
479 WM8350_OUTPUT_RIGHT_MIXER_VOLUME
,
480 5, 7, 0, out_mix_tlv
),
481 SOC_SINGLE_TLV("Right Input Bypass Volume",
482 WM8350_OUTPUT_RIGHT_MIXER_VOLUME
,
483 13, 7, 0, out_mix_tlv
),
484 SOC_SINGLE("Left Input Mixer +20dB Switch",
485 WM8350_INPUT_MIXER_VOLUME_L
, 0, 1, 0),
486 SOC_SINGLE("Right Input Mixer +20dB Switch",
487 WM8350_INPUT_MIXER_VOLUME_R
, 0, 1, 0),
488 SOC_SINGLE_TLV("Out4 Capture Volume",
489 WM8350_INPUT_MIXER_VOLUME
,
490 1, 7, 0, out_mix_tlv
),
491 SOC_WM8350_DOUBLE_R_TLV("Out1 Playback Volume",
494 2, 63, 0, out_pga_tlv
),
495 SOC_DOUBLE_R("Out1 Playback ZC Switch",
497 WM8350_ROUT1_VOLUME
, 13, 1, 0),
498 SOC_WM8350_DOUBLE_R_TLV("Out2 Playback Volume",
501 2, 63, 0, out_pga_tlv
),
502 SOC_DOUBLE_R("Out2 Playback ZC Switch", WM8350_LOUT2_VOLUME
,
503 WM8350_ROUT2_VOLUME
, 13, 1, 0),
504 SOC_SINGLE("Out2 Right Invert Switch", WM8350_ROUT2_VOLUME
, 10, 1, 0),
505 SOC_SINGLE_TLV("Out2 Beep Volume", WM8350_BEEP_VOLUME
,
506 5, 7, 0, out_mix_tlv
),
508 SOC_DOUBLE_R("Out1 Playback Switch",
512 SOC_DOUBLE_R("Out2 Playback Switch",
522 /* Left Playback Mixer */
523 static const struct snd_kcontrol_new wm8350_left_play_mixer_controls
[] = {
524 SOC_DAPM_SINGLE("Playback Switch",
525 WM8350_LEFT_MIXER_CONTROL
, 11, 1, 0),
526 SOC_DAPM_SINGLE("Left Bypass Switch",
527 WM8350_LEFT_MIXER_CONTROL
, 2, 1, 0),
528 SOC_DAPM_SINGLE("Right Playback Switch",
529 WM8350_LEFT_MIXER_CONTROL
, 12, 1, 0),
530 SOC_DAPM_SINGLE("Left Sidetone Switch",
531 WM8350_LEFT_MIXER_CONTROL
, 0, 1, 0),
532 SOC_DAPM_SINGLE("Right Sidetone Switch",
533 WM8350_LEFT_MIXER_CONTROL
, 1, 1, 0),
536 /* Right Playback Mixer */
537 static const struct snd_kcontrol_new wm8350_right_play_mixer_controls
[] = {
538 SOC_DAPM_SINGLE("Playback Switch",
539 WM8350_RIGHT_MIXER_CONTROL
, 12, 1, 0),
540 SOC_DAPM_SINGLE("Right Bypass Switch",
541 WM8350_RIGHT_MIXER_CONTROL
, 3, 1, 0),
542 SOC_DAPM_SINGLE("Left Playback Switch",
543 WM8350_RIGHT_MIXER_CONTROL
, 11, 1, 0),
544 SOC_DAPM_SINGLE("Left Sidetone Switch",
545 WM8350_RIGHT_MIXER_CONTROL
, 0, 1, 0),
546 SOC_DAPM_SINGLE("Right Sidetone Switch",
547 WM8350_RIGHT_MIXER_CONTROL
, 1, 1, 0),
551 static const struct snd_kcontrol_new wm8350_out4_mixer_controls
[] = {
552 SOC_DAPM_SINGLE("Right Playback Switch",
553 WM8350_OUT4_MIXER_CONTROL
, 12, 1, 0),
554 SOC_DAPM_SINGLE("Left Playback Switch",
555 WM8350_OUT4_MIXER_CONTROL
, 11, 1, 0),
556 SOC_DAPM_SINGLE("Right Capture Switch",
557 WM8350_OUT4_MIXER_CONTROL
, 9, 1, 0),
558 SOC_DAPM_SINGLE("Out3 Playback Switch",
559 WM8350_OUT4_MIXER_CONTROL
, 2, 1, 0),
560 SOC_DAPM_SINGLE("Right Mixer Switch",
561 WM8350_OUT4_MIXER_CONTROL
, 1, 1, 0),
562 SOC_DAPM_SINGLE("Left Mixer Switch",
563 WM8350_OUT4_MIXER_CONTROL
, 0, 1, 0),
567 static const struct snd_kcontrol_new wm8350_out3_mixer_controls
[] = {
568 SOC_DAPM_SINGLE("Left Playback Switch",
569 WM8350_OUT3_MIXER_CONTROL
, 11, 1, 0),
570 SOC_DAPM_SINGLE("Left Capture Switch",
571 WM8350_OUT3_MIXER_CONTROL
, 8, 1, 0),
572 SOC_DAPM_SINGLE("Out4 Playback Switch",
573 WM8350_OUT3_MIXER_CONTROL
, 3, 1, 0),
574 SOC_DAPM_SINGLE("Left Mixer Switch",
575 WM8350_OUT3_MIXER_CONTROL
, 0, 1, 0),
578 /* Left Input Mixer */
579 static const struct snd_kcontrol_new wm8350_left_capt_mixer_controls
[] = {
580 SOC_DAPM_SINGLE_TLV("L2 Capture Volume",
581 WM8350_INPUT_MIXER_VOLUME_L
, 1, 7, 0, out_mix_tlv
),
582 SOC_DAPM_SINGLE_TLV("L3 Capture Volume",
583 WM8350_INPUT_MIXER_VOLUME_L
, 9, 7, 0, out_mix_tlv
),
584 SOC_DAPM_SINGLE("PGA Capture Switch",
585 WM8350_LEFT_INPUT_VOLUME
, 14, 1, 1),
588 /* Right Input Mixer */
589 static const struct snd_kcontrol_new wm8350_right_capt_mixer_controls
[] = {
590 SOC_DAPM_SINGLE_TLV("L2 Capture Volume",
591 WM8350_INPUT_MIXER_VOLUME_R
, 5, 7, 0, out_mix_tlv
),
592 SOC_DAPM_SINGLE_TLV("L3 Capture Volume",
593 WM8350_INPUT_MIXER_VOLUME_R
, 13, 7, 0, out_mix_tlv
),
594 SOC_DAPM_SINGLE("PGA Capture Switch",
595 WM8350_RIGHT_INPUT_VOLUME
, 14, 1, 1),
599 static const struct snd_kcontrol_new wm8350_left_mic_mixer_controls
[] = {
600 SOC_DAPM_SINGLE("INN Capture Switch", WM8350_INPUT_CONTROL
, 1, 1, 0),
601 SOC_DAPM_SINGLE("INP Capture Switch", WM8350_INPUT_CONTROL
, 0, 1, 0),
602 SOC_DAPM_SINGLE("IN2 Capture Switch", WM8350_INPUT_CONTROL
, 2, 1, 0),
605 /* Right Mic Mixer */
606 static const struct snd_kcontrol_new wm8350_right_mic_mixer_controls
[] = {
607 SOC_DAPM_SINGLE("INN Capture Switch", WM8350_INPUT_CONTROL
, 9, 1, 0),
608 SOC_DAPM_SINGLE("INP Capture Switch", WM8350_INPUT_CONTROL
, 8, 1, 0),
609 SOC_DAPM_SINGLE("IN2 Capture Switch", WM8350_INPUT_CONTROL
, 10, 1, 0),
613 static const struct snd_kcontrol_new wm8350_beep_switch_controls
=
614 SOC_DAPM_SINGLE("Switch", WM8350_BEEP_VOLUME
, 15, 1, 1);
616 /* Out4 Capture Mux */
617 static const struct snd_kcontrol_new wm8350_out4_capture_controls
=
618 SOC_DAPM_ENUM("Route", wm8350_enum
[7]);
620 static const struct snd_soc_dapm_widget wm8350_dapm_widgets
[] = {
622 SND_SOC_DAPM_PGA("IN3R PGA", WM8350_POWER_MGMT_2
, 11, 0, NULL
, 0),
623 SND_SOC_DAPM_PGA("IN3L PGA", WM8350_POWER_MGMT_2
, 10, 0, NULL
, 0),
624 SND_SOC_DAPM_PGA_E("Right Out2 PGA", WM8350_POWER_MGMT_3
, 3, 0, NULL
,
626 SND_SOC_DAPM_POST_PMU
| SND_SOC_DAPM_PRE_PMD
),
627 SND_SOC_DAPM_PGA_E("Left Out2 PGA", WM8350_POWER_MGMT_3
, 2, 0, NULL
, 0,
629 SND_SOC_DAPM_POST_PMU
| SND_SOC_DAPM_PRE_PMD
),
630 SND_SOC_DAPM_PGA_E("Right Out1 PGA", WM8350_POWER_MGMT_3
, 1, 0, NULL
,
632 SND_SOC_DAPM_POST_PMU
| SND_SOC_DAPM_PRE_PMD
),
633 SND_SOC_DAPM_PGA_E("Left Out1 PGA", WM8350_POWER_MGMT_3
, 0, 0, NULL
, 0,
635 SND_SOC_DAPM_POST_PMU
| SND_SOC_DAPM_PRE_PMD
),
637 SND_SOC_DAPM_MIXER("Right Capture Mixer", WM8350_POWER_MGMT_2
,
638 7, 0, &wm8350_right_capt_mixer_controls
[0],
639 ARRAY_SIZE(wm8350_right_capt_mixer_controls
)),
641 SND_SOC_DAPM_MIXER("Left Capture Mixer", WM8350_POWER_MGMT_2
,
642 6, 0, &wm8350_left_capt_mixer_controls
[0],
643 ARRAY_SIZE(wm8350_left_capt_mixer_controls
)),
645 SND_SOC_DAPM_MIXER("Out4 Mixer", WM8350_POWER_MGMT_2
, 5, 0,
646 &wm8350_out4_mixer_controls
[0],
647 ARRAY_SIZE(wm8350_out4_mixer_controls
)),
649 SND_SOC_DAPM_MIXER("Out3 Mixer", WM8350_POWER_MGMT_2
, 4, 0,
650 &wm8350_out3_mixer_controls
[0],
651 ARRAY_SIZE(wm8350_out3_mixer_controls
)),
653 SND_SOC_DAPM_MIXER("Right Playback Mixer", WM8350_POWER_MGMT_2
, 1, 0,
654 &wm8350_right_play_mixer_controls
[0],
655 ARRAY_SIZE(wm8350_right_play_mixer_controls
)),
657 SND_SOC_DAPM_MIXER("Left Playback Mixer", WM8350_POWER_MGMT_2
, 0, 0,
658 &wm8350_left_play_mixer_controls
[0],
659 ARRAY_SIZE(wm8350_left_play_mixer_controls
)),
661 SND_SOC_DAPM_MIXER("Left Mic Mixer", WM8350_POWER_MGMT_2
, 8, 0,
662 &wm8350_left_mic_mixer_controls
[0],
663 ARRAY_SIZE(wm8350_left_mic_mixer_controls
)),
665 SND_SOC_DAPM_MIXER("Right Mic Mixer", WM8350_POWER_MGMT_2
, 9, 0,
666 &wm8350_right_mic_mixer_controls
[0],
667 ARRAY_SIZE(wm8350_right_mic_mixer_controls
)),
669 /* virtual mixer for Beep and Out2R */
670 SND_SOC_DAPM_MIXER("Out2 Mixer", SND_SOC_NOPM
, 0, 0, NULL
, 0),
672 SND_SOC_DAPM_SWITCH("Beep", WM8350_POWER_MGMT_3
, 7, 0,
673 &wm8350_beep_switch_controls
),
675 SND_SOC_DAPM_ADC("Right ADC", "Right Capture",
676 WM8350_POWER_MGMT_4
, 3, 0),
677 SND_SOC_DAPM_ADC("Left ADC", "Left Capture",
678 WM8350_POWER_MGMT_4
, 2, 0),
679 SND_SOC_DAPM_DAC("Right DAC", "Right Playback",
680 WM8350_POWER_MGMT_4
, 5, 0),
681 SND_SOC_DAPM_DAC("Left DAC", "Left Playback",
682 WM8350_POWER_MGMT_4
, 4, 0),
684 SND_SOC_DAPM_MICBIAS("Mic Bias", WM8350_POWER_MGMT_1
, 4, 0),
686 SND_SOC_DAPM_MUX("Out4 Capture Channel", SND_SOC_NOPM
, 0, 0,
687 &wm8350_out4_capture_controls
),
689 SND_SOC_DAPM_OUTPUT("OUT1R"),
690 SND_SOC_DAPM_OUTPUT("OUT1L"),
691 SND_SOC_DAPM_OUTPUT("OUT2R"),
692 SND_SOC_DAPM_OUTPUT("OUT2L"),
693 SND_SOC_DAPM_OUTPUT("OUT3"),
694 SND_SOC_DAPM_OUTPUT("OUT4"),
696 SND_SOC_DAPM_INPUT("IN1RN"),
697 SND_SOC_DAPM_INPUT("IN1RP"),
698 SND_SOC_DAPM_INPUT("IN2R"),
699 SND_SOC_DAPM_INPUT("IN1LP"),
700 SND_SOC_DAPM_INPUT("IN1LN"),
701 SND_SOC_DAPM_INPUT("IN2L"),
702 SND_SOC_DAPM_INPUT("IN3R"),
703 SND_SOC_DAPM_INPUT("IN3L"),
706 static const struct snd_soc_dapm_route audio_map
[] = {
708 /* left playback mixer */
709 {"Left Playback Mixer", "Playback Switch", "Left DAC"},
710 {"Left Playback Mixer", "Left Bypass Switch", "IN3L PGA"},
711 {"Left Playback Mixer", "Right Playback Switch", "Right DAC"},
712 {"Left Playback Mixer", "Left Sidetone Switch", "Left Mic Mixer"},
713 {"Left Playback Mixer", "Right Sidetone Switch", "Right Mic Mixer"},
715 /* right playback mixer */
716 {"Right Playback Mixer", "Playback Switch", "Right DAC"},
717 {"Right Playback Mixer", "Right Bypass Switch", "IN3R PGA"},
718 {"Right Playback Mixer", "Left Playback Switch", "Left DAC"},
719 {"Right Playback Mixer", "Left Sidetone Switch", "Left Mic Mixer"},
720 {"Right Playback Mixer", "Right Sidetone Switch", "Right Mic Mixer"},
722 /* out4 playback mixer */
723 {"Out4 Mixer", "Right Playback Switch", "Right DAC"},
724 {"Out4 Mixer", "Left Playback Switch", "Left DAC"},
725 {"Out4 Mixer", "Right Capture Switch", "Right Capture Mixer"},
726 {"Out4 Mixer", "Out3 Playback Switch", "Out3 Mixer"},
727 {"Out4 Mixer", "Right Mixer Switch", "Right Playback Mixer"},
728 {"Out4 Mixer", "Left Mixer Switch", "Left Playback Mixer"},
729 {"OUT4", NULL
, "Out4 Mixer"},
731 /* out3 playback mixer */
732 {"Out3 Mixer", "Left Playback Switch", "Left DAC"},
733 {"Out3 Mixer", "Left Capture Switch", "Left Capture Mixer"},
734 {"Out3 Mixer", "Left Mixer Switch", "Left Playback Mixer"},
735 {"Out3 Mixer", "Out4 Playback Switch", "Out4 Mixer"},
736 {"OUT3", NULL
, "Out3 Mixer"},
739 {"Right Out2 PGA", NULL
, "Right Playback Mixer"},
740 {"Left Out2 PGA", NULL
, "Left Playback Mixer"},
741 {"OUT2L", NULL
, "Left Out2 PGA"},
742 {"OUT2R", NULL
, "Right Out2 PGA"},
745 {"Right Out1 PGA", NULL
, "Right Playback Mixer"},
746 {"Left Out1 PGA", NULL
, "Left Playback Mixer"},
747 {"OUT1L", NULL
, "Left Out1 PGA"},
748 {"OUT1R", NULL
, "Right Out1 PGA"},
751 {"Left ADC", NULL
, "Left Capture Mixer"},
752 {"Right ADC", NULL
, "Right Capture Mixer"},
754 /* Left capture mixer */
755 {"Left Capture Mixer", "L2 Capture Volume", "IN2L"},
756 {"Left Capture Mixer", "L3 Capture Volume", "IN3L PGA"},
757 {"Left Capture Mixer", "PGA Capture Switch", "Left Mic Mixer"},
758 {"Left Capture Mixer", NULL
, "Out4 Capture Channel"},
760 /* Right capture mixer */
761 {"Right Capture Mixer", "L2 Capture Volume", "IN2R"},
762 {"Right Capture Mixer", "L3 Capture Volume", "IN3R PGA"},
763 {"Right Capture Mixer", "PGA Capture Switch", "Right Mic Mixer"},
764 {"Right Capture Mixer", NULL
, "Out4 Capture Channel"},
767 {"IN3L PGA", NULL
, "IN3L"},
768 {"IN3R PGA", NULL
, "IN3R"},
771 {"Left Mic Mixer", "INN Capture Switch", "IN1LN"},
772 {"Left Mic Mixer", "INP Capture Switch", "IN1LP"},
773 {"Left Mic Mixer", "IN2 Capture Switch", "IN2L"},
775 /* Right Mic mixer */
776 {"Right Mic Mixer", "INN Capture Switch", "IN1RN"},
777 {"Right Mic Mixer", "INP Capture Switch", "IN1RP"},
778 {"Right Mic Mixer", "IN2 Capture Switch", "IN2R"},
781 {"Out4 Capture Channel", NULL
, "Out4 Mixer"},
784 {"Beep", NULL
, "IN3R PGA"},
787 static int wm8350_add_widgets(struct snd_soc_codec
*codec
)
791 ret
= snd_soc_dapm_new_controls(codec
,
793 ARRAY_SIZE(wm8350_dapm_widgets
));
795 dev_err(codec
->dev
, "dapm control register failed\n");
799 /* set up audio paths */
800 ret
= snd_soc_dapm_add_routes(codec
, audio_map
, ARRAY_SIZE(audio_map
));
802 dev_err(codec
->dev
, "DAPM route register failed\n");
809 static int wm8350_set_dai_sysclk(struct snd_soc_dai
*codec_dai
,
810 int clk_id
, unsigned int freq
, int dir
)
812 struct snd_soc_codec
*codec
= codec_dai
->codec
;
813 struct wm8350
*wm8350
= codec
->control_data
;
817 case WM8350_MCLK_SEL_MCLK
:
818 wm8350_clear_bits(wm8350
, WM8350_CLOCK_CONTROL_1
,
821 case WM8350_MCLK_SEL_PLL_MCLK
:
822 case WM8350_MCLK_SEL_PLL_DAC
:
823 case WM8350_MCLK_SEL_PLL_ADC
:
824 case WM8350_MCLK_SEL_PLL_32K
:
825 wm8350_set_bits(wm8350
, WM8350_CLOCK_CONTROL_1
,
827 fll_4
= wm8350_codec_read(codec
, WM8350_FLL_CONTROL_4
) &
828 ~WM8350_FLL_CLK_SRC_MASK
;
829 wm8350_codec_write(codec
, WM8350_FLL_CONTROL_4
, fll_4
| clk_id
);
834 if (dir
== WM8350_MCLK_DIR_OUT
)
835 wm8350_set_bits(wm8350
, WM8350_CLOCK_CONTROL_2
,
838 wm8350_clear_bits(wm8350
, WM8350_CLOCK_CONTROL_2
,
844 static int wm8350_set_clkdiv(struct snd_soc_dai
*codec_dai
, int div_id
, int div
)
846 struct snd_soc_codec
*codec
= codec_dai
->codec
;
850 case WM8350_ADC_CLKDIV
:
851 val
= wm8350_codec_read(codec
, WM8350_ADC_DIVIDER
) &
852 ~WM8350_ADC_CLKDIV_MASK
;
853 wm8350_codec_write(codec
, WM8350_ADC_DIVIDER
, val
| div
);
855 case WM8350_DAC_CLKDIV
:
856 val
= wm8350_codec_read(codec
, WM8350_DAC_CLOCK_CONTROL
) &
857 ~WM8350_DAC_CLKDIV_MASK
;
858 wm8350_codec_write(codec
, WM8350_DAC_CLOCK_CONTROL
, val
| div
);
860 case WM8350_BCLK_CLKDIV
:
861 val
= wm8350_codec_read(codec
, WM8350_CLOCK_CONTROL_1
) &
862 ~WM8350_BCLK_DIV_MASK
;
863 wm8350_codec_write(codec
, WM8350_CLOCK_CONTROL_1
, val
| div
);
865 case WM8350_OPCLK_CLKDIV
:
866 val
= wm8350_codec_read(codec
, WM8350_CLOCK_CONTROL_1
) &
867 ~WM8350_OPCLK_DIV_MASK
;
868 wm8350_codec_write(codec
, WM8350_CLOCK_CONTROL_1
, val
| div
);
870 case WM8350_SYS_CLKDIV
:
871 val
= wm8350_codec_read(codec
, WM8350_CLOCK_CONTROL_1
) &
872 ~WM8350_MCLK_DIV_MASK
;
873 wm8350_codec_write(codec
, WM8350_CLOCK_CONTROL_1
, val
| div
);
875 case WM8350_DACLR_CLKDIV
:
876 val
= wm8350_codec_read(codec
, WM8350_DAC_LR_RATE
) &
877 ~WM8350_DACLRC_RATE_MASK
;
878 wm8350_codec_write(codec
, WM8350_DAC_LR_RATE
, val
| div
);
880 case WM8350_ADCLR_CLKDIV
:
881 val
= wm8350_codec_read(codec
, WM8350_ADC_LR_RATE
) &
882 ~WM8350_ADCLRC_RATE_MASK
;
883 wm8350_codec_write(codec
, WM8350_ADC_LR_RATE
, val
| div
);
892 static int wm8350_set_dai_fmt(struct snd_soc_dai
*codec_dai
, unsigned int fmt
)
894 struct snd_soc_codec
*codec
= codec_dai
->codec
;
895 u16 iface
= wm8350_codec_read(codec
, WM8350_AI_FORMATING
) &
896 ~(WM8350_AIF_BCLK_INV
| WM8350_AIF_LRCLK_INV
| WM8350_AIF_FMT_MASK
);
897 u16 master
= wm8350_codec_read(codec
, WM8350_AI_DAC_CONTROL
) &
899 u16 dac_lrc
= wm8350_codec_read(codec
, WM8350_DAC_LR_RATE
) &
901 u16 adc_lrc
= wm8350_codec_read(codec
, WM8350_ADC_LR_RATE
) &
904 /* set master/slave audio interface */
905 switch (fmt
& SND_SOC_DAIFMT_MASTER_MASK
) {
906 case SND_SOC_DAIFMT_CBM_CFM
:
907 master
|= WM8350_BCLK_MSTR
;
908 dac_lrc
|= WM8350_DACLRC_ENA
;
909 adc_lrc
|= WM8350_ADCLRC_ENA
;
911 case SND_SOC_DAIFMT_CBS_CFS
:
917 /* interface format */
918 switch (fmt
& SND_SOC_DAIFMT_FORMAT_MASK
) {
919 case SND_SOC_DAIFMT_I2S
:
922 case SND_SOC_DAIFMT_RIGHT_J
:
924 case SND_SOC_DAIFMT_LEFT_J
:
927 case SND_SOC_DAIFMT_DSP_A
:
930 case SND_SOC_DAIFMT_DSP_B
:
931 iface
|= 0x3 << 8 | WM8350_AIF_LRCLK_INV
;
937 /* clock inversion */
938 switch (fmt
& SND_SOC_DAIFMT_INV_MASK
) {
939 case SND_SOC_DAIFMT_NB_NF
:
941 case SND_SOC_DAIFMT_IB_IF
:
942 iface
|= WM8350_AIF_LRCLK_INV
| WM8350_AIF_BCLK_INV
;
944 case SND_SOC_DAIFMT_IB_NF
:
945 iface
|= WM8350_AIF_BCLK_INV
;
947 case SND_SOC_DAIFMT_NB_IF
:
948 iface
|= WM8350_AIF_LRCLK_INV
;
954 wm8350_codec_write(codec
, WM8350_AI_FORMATING
, iface
);
955 wm8350_codec_write(codec
, WM8350_AI_DAC_CONTROL
, master
);
956 wm8350_codec_write(codec
, WM8350_DAC_LR_RATE
, dac_lrc
);
957 wm8350_codec_write(codec
, WM8350_ADC_LR_RATE
, adc_lrc
);
961 static int wm8350_pcm_trigger(struct snd_pcm_substream
*substream
,
962 int cmd
, struct snd_soc_dai
*codec_dai
)
964 struct snd_soc_codec
*codec
= codec_dai
->codec
;
965 int master
= wm8350_codec_cache_read(codec
, WM8350_AI_DAC_CONTROL
) &
969 /* Check that the DACs or ADCs are enabled since they are
970 * required for LRC in master mode. The DACs or ADCs need a
971 * valid audio path i.e. pin -> ADC or DAC -> pin before
972 * the LRC will be enabled in master mode. */
973 if (!master
|| cmd
!= SNDRV_PCM_TRIGGER_START
)
976 if (substream
->stream
== SNDRV_PCM_STREAM_CAPTURE
) {
977 enabled
= wm8350_codec_cache_read(codec
, WM8350_POWER_MGMT_4
) &
978 (WM8350_ADCR_ENA
| WM8350_ADCL_ENA
);
980 enabled
= wm8350_codec_cache_read(codec
, WM8350_POWER_MGMT_4
) &
981 (WM8350_DACR_ENA
| WM8350_DACL_ENA
);
986 "%s: invalid audio path - no clocks available\n",
993 static int wm8350_pcm_hw_params(struct snd_pcm_substream
*substream
,
994 struct snd_pcm_hw_params
*params
,
995 struct snd_soc_dai
*codec_dai
)
997 struct snd_soc_codec
*codec
= codec_dai
->codec
;
998 struct wm8350
*wm8350
= codec
->control_data
;
999 u16 iface
= wm8350_codec_read(codec
, WM8350_AI_FORMATING
) &
1000 ~WM8350_AIF_WL_MASK
;
1003 switch (params_format(params
)) {
1004 case SNDRV_PCM_FORMAT_S16_LE
:
1006 case SNDRV_PCM_FORMAT_S20_3LE
:
1009 case SNDRV_PCM_FORMAT_S24_LE
:
1012 case SNDRV_PCM_FORMAT_S32_LE
:
1017 wm8350_codec_write(codec
, WM8350_AI_FORMATING
, iface
);
1019 /* The sloping stopband filter is recommended for use with
1020 * lower sample rates to improve performance.
1022 if (substream
->stream
== SNDRV_PCM_STREAM_PLAYBACK
) {
1023 if (params_rate(params
) < 24000)
1024 wm8350_set_bits(wm8350
, WM8350_DAC_MUTE_VOLUME
,
1025 WM8350_DAC_SB_FILT
);
1027 wm8350_clear_bits(wm8350
, WM8350_DAC_MUTE_VOLUME
,
1028 WM8350_DAC_SB_FILT
);
1034 static int wm8350_mute(struct snd_soc_dai
*dai
, int mute
)
1036 struct snd_soc_codec
*codec
= dai
->codec
;
1037 struct wm8350
*wm8350
= codec
->control_data
;
1040 wm8350_set_bits(wm8350
, WM8350_DAC_MUTE
, WM8350_DAC_MUTE_ENA
);
1042 wm8350_clear_bits(wm8350
, WM8350_DAC_MUTE
, WM8350_DAC_MUTE_ENA
);
1048 int div
; /* FLL_OUTDIV */
1051 int ratio
; /* FLL_FRATIO */
1054 /* The size in bits of the fll divide multiplied by 10
1055 * to allow rounding later */
1056 #define FIXED_FLL_SIZE ((1 << 16) * 10)
1058 static inline int fll_factors(struct _fll_div
*fll_div
, unsigned int input
,
1059 unsigned int output
)
1062 unsigned int t1
, t2
, K
, Nmod
;
1064 if (output
>= 2815250 && output
<= 3125000)
1066 else if (output
>= 5625000 && output
<= 6250000)
1068 else if (output
>= 11250000 && output
<= 12500000)
1070 else if (output
>= 22500000 && output
<= 25000000)
1073 printk(KERN_ERR
"wm8350: fll freq %d out of range\n", output
);
1082 t1
= output
* (1 << (fll_div
->div
+ 1));
1083 t2
= input
* fll_div
->ratio
;
1085 fll_div
->n
= t1
/ t2
;
1089 Kpart
= FIXED_FLL_SIZE
* (long long)Nmod
;
1091 K
= Kpart
& 0xFFFFFFFF;
1093 /* Check if we need to round */
1097 /* Move down to proper range now rounding is done */
1106 static int wm8350_set_fll(struct snd_soc_dai
*codec_dai
,
1107 int pll_id
, int source
, unsigned int freq_in
,
1108 unsigned int freq_out
)
1110 struct snd_soc_codec
*codec
= codec_dai
->codec
;
1111 struct wm8350
*wm8350
= codec
->control_data
;
1112 struct wm8350_data
*priv
= snd_soc_codec_get_drvdata(codec
);
1113 struct _fll_div fll_div
;
1117 if (freq_in
== priv
->fll_freq_in
&& freq_out
== priv
->fll_freq_out
)
1120 /* power down FLL - we need to do this for reconfiguration */
1121 wm8350_clear_bits(wm8350
, WM8350_POWER_MGMT_4
,
1122 WM8350_FLL_ENA
| WM8350_FLL_OSC_ENA
);
1124 if (freq_out
== 0 || freq_in
== 0)
1127 ret
= fll_factors(&fll_div
, freq_in
, freq_out
);
1130 dev_dbg(wm8350
->dev
,
1131 "FLL in %u FLL out %u N 0x%x K 0x%x div %d ratio %d",
1132 freq_in
, freq_out
, fll_div
.n
, fll_div
.k
, fll_div
.div
,
1135 /* set up N.K & dividers */
1136 fll_1
= wm8350_codec_read(codec
, WM8350_FLL_CONTROL_1
) &
1137 ~(WM8350_FLL_OUTDIV_MASK
| WM8350_FLL_RSP_RATE_MASK
| 0xc000);
1138 wm8350_codec_write(codec
, WM8350_FLL_CONTROL_1
,
1139 fll_1
| (fll_div
.div
<< 8) | 0x50);
1140 wm8350_codec_write(codec
, WM8350_FLL_CONTROL_2
,
1141 (fll_div
.ratio
<< 11) | (fll_div
.
1142 n
& WM8350_FLL_N_MASK
));
1143 wm8350_codec_write(codec
, WM8350_FLL_CONTROL_3
, fll_div
.k
);
1144 fll_4
= wm8350_codec_read(codec
, WM8350_FLL_CONTROL_4
) &
1145 ~(WM8350_FLL_FRAC
| WM8350_FLL_SLOW_LOCK_REF
);
1146 wm8350_codec_write(codec
, WM8350_FLL_CONTROL_4
,
1147 fll_4
| (fll_div
.k
? WM8350_FLL_FRAC
: 0) |
1148 (fll_div
.ratio
== 8 ? WM8350_FLL_SLOW_LOCK_REF
: 0));
1151 wm8350_set_bits(wm8350
, WM8350_POWER_MGMT_4
, WM8350_FLL_OSC_ENA
);
1152 wm8350_set_bits(wm8350
, WM8350_POWER_MGMT_4
, WM8350_FLL_ENA
);
1154 priv
->fll_freq_out
= freq_out
;
1155 priv
->fll_freq_in
= freq_in
;
1160 static int wm8350_set_bias_level(struct snd_soc_codec
*codec
,
1161 enum snd_soc_bias_level level
)
1163 struct wm8350
*wm8350
= codec
->control_data
;
1164 struct wm8350_data
*priv
= snd_soc_codec_get_drvdata(codec
);
1165 struct wm8350_audio_platform_data
*platform
=
1166 wm8350
->codec
.platform_data
;
1171 case SND_SOC_BIAS_ON
:
1172 pm1
= wm8350_reg_read(wm8350
, WM8350_POWER_MGMT_1
) &
1173 ~(WM8350_VMID_MASK
| WM8350_CODEC_ISEL_MASK
);
1174 wm8350_reg_write(wm8350
, WM8350_POWER_MGMT_1
,
1175 pm1
| WM8350_VMID_50K
|
1176 platform
->codec_current_on
<< 14);
1179 case SND_SOC_BIAS_PREPARE
:
1180 pm1
= wm8350_reg_read(wm8350
, WM8350_POWER_MGMT_1
);
1181 pm1
&= ~WM8350_VMID_MASK
;
1182 wm8350_reg_write(wm8350
, WM8350_POWER_MGMT_1
,
1183 pm1
| WM8350_VMID_50K
);
1186 case SND_SOC_BIAS_STANDBY
:
1187 if (codec
->bias_level
== SND_SOC_BIAS_OFF
) {
1188 ret
= regulator_bulk_enable(ARRAY_SIZE(priv
->supplies
),
1193 /* Enable the system clock */
1194 wm8350_set_bits(wm8350
, WM8350_POWER_MGMT_4
,
1197 /* mute DAC & outputs */
1198 wm8350_set_bits(wm8350
, WM8350_DAC_MUTE
,
1199 WM8350_DAC_MUTE_ENA
);
1201 /* discharge cap memory */
1202 wm8350_reg_write(wm8350
, WM8350_ANTI_POP_CONTROL
,
1203 platform
->dis_out1
|
1204 (platform
->dis_out2
<< 2) |
1205 (platform
->dis_out3
<< 4) |
1206 (platform
->dis_out4
<< 6));
1208 /* wait for discharge */
1209 schedule_timeout_interruptible(msecs_to_jiffies
1211 cap_discharge_msecs
));
1213 /* enable antipop */
1214 wm8350_reg_write(wm8350
, WM8350_ANTI_POP_CONTROL
,
1215 (platform
->vmid_s_curve
<< 8));
1218 wm8350_reg_write(wm8350
, WM8350_POWER_MGMT_1
,
1220 codec_current_charge
<< 14) |
1221 WM8350_VMID_5K
| WM8350_VMIDEN
|
1225 schedule_timeout_interruptible(msecs_to_jiffies
1227 vmid_charge_msecs
));
1229 /* turn on vmid 300k */
1230 pm1
= wm8350_reg_read(wm8350
, WM8350_POWER_MGMT_1
) &
1231 ~(WM8350_VMID_MASK
| WM8350_CODEC_ISEL_MASK
);
1232 pm1
|= WM8350_VMID_300K
|
1233 (platform
->codec_current_standby
<< 14);
1234 wm8350_reg_write(wm8350
, WM8350_POWER_MGMT_1
,
1238 /* enable analogue bias */
1239 pm1
|= WM8350_BIASEN
;
1240 wm8350_reg_write(wm8350
, WM8350_POWER_MGMT_1
, pm1
);
1242 /* disable antipop */
1243 wm8350_reg_write(wm8350
, WM8350_ANTI_POP_CONTROL
, 0);
1246 /* turn on vmid 300k and reduce current */
1247 pm1
= wm8350_reg_read(wm8350
, WM8350_POWER_MGMT_1
) &
1248 ~(WM8350_VMID_MASK
| WM8350_CODEC_ISEL_MASK
);
1249 wm8350_reg_write(wm8350
, WM8350_POWER_MGMT_1
,
1250 pm1
| WM8350_VMID_300K
|
1252 codec_current_standby
<< 14));
1257 case SND_SOC_BIAS_OFF
:
1259 /* mute DAC & enable outputs */
1260 wm8350_set_bits(wm8350
, WM8350_DAC_MUTE
, WM8350_DAC_MUTE_ENA
);
1262 wm8350_set_bits(wm8350
, WM8350_POWER_MGMT_3
,
1263 WM8350_OUT1L_ENA
| WM8350_OUT1R_ENA
|
1264 WM8350_OUT2L_ENA
| WM8350_OUT2R_ENA
);
1266 /* enable anti pop S curve */
1267 wm8350_reg_write(wm8350
, WM8350_ANTI_POP_CONTROL
,
1268 (platform
->vmid_s_curve
<< 8));
1271 pm1
= wm8350_reg_read(wm8350
, WM8350_POWER_MGMT_1
) &
1273 wm8350_reg_write(wm8350
, WM8350_POWER_MGMT_1
, pm1
);
1276 schedule_timeout_interruptible(msecs_to_jiffies
1278 vmid_discharge_msecs
));
1280 wm8350_reg_write(wm8350
, WM8350_ANTI_POP_CONTROL
,
1281 (platform
->vmid_s_curve
<< 8) |
1282 platform
->dis_out1
|
1283 (platform
->dis_out2
<< 2) |
1284 (platform
->dis_out3
<< 4) |
1285 (platform
->dis_out4
<< 6));
1287 /* turn off VBuf and drain */
1288 pm1
= wm8350_reg_read(wm8350
, WM8350_POWER_MGMT_1
) &
1289 ~(WM8350_VBUFEN
| WM8350_VMID_MASK
);
1290 wm8350_reg_write(wm8350
, WM8350_POWER_MGMT_1
,
1291 pm1
| WM8350_OUTPUT_DRAIN_EN
);
1294 schedule_timeout_interruptible(msecs_to_jiffies
1295 (platform
->drain_msecs
));
1297 pm1
&= ~WM8350_BIASEN
;
1298 wm8350_reg_write(wm8350
, WM8350_POWER_MGMT_1
, pm1
);
1300 /* disable anti-pop */
1301 wm8350_reg_write(wm8350
, WM8350_ANTI_POP_CONTROL
, 0);
1303 wm8350_clear_bits(wm8350
, WM8350_LOUT1_VOLUME
,
1305 wm8350_clear_bits(wm8350
, WM8350_ROUT1_VOLUME
,
1307 wm8350_clear_bits(wm8350
, WM8350_LOUT2_VOLUME
,
1309 wm8350_clear_bits(wm8350
, WM8350_ROUT2_VOLUME
,
1312 /* disable clock gen */
1313 wm8350_clear_bits(wm8350
, WM8350_POWER_MGMT_4
,
1316 regulator_bulk_disable(ARRAY_SIZE(priv
->supplies
),
1320 codec
->bias_level
= level
;
1324 static int wm8350_suspend(struct platform_device
*pdev
, pm_message_t state
)
1326 struct snd_soc_device
*socdev
= platform_get_drvdata(pdev
);
1327 struct snd_soc_codec
*codec
= socdev
->card
->codec
;
1329 wm8350_set_bias_level(codec
, SND_SOC_BIAS_OFF
);
1333 static int wm8350_resume(struct platform_device
*pdev
)
1335 struct snd_soc_device
*socdev
= platform_get_drvdata(pdev
);
1336 struct snd_soc_codec
*codec
= socdev
->card
->codec
;
1338 wm8350_set_bias_level(codec
, SND_SOC_BIAS_STANDBY
);
1343 static irqreturn_t
wm8350_hp_jack_handler(int irq
, void *data
)
1345 struct wm8350_data
*priv
= data
;
1346 struct wm8350
*wm8350
= priv
->codec
.control_data
;
1350 struct wm8350_jack_data
*jack
= NULL
;
1352 switch (irq
- wm8350
->irq_base
) {
1353 case WM8350_IRQ_CODEC_JCK_DET_L
:
1355 mask
= WM8350_JACK_L_LVL
;
1358 case WM8350_IRQ_CODEC_JCK_DET_R
:
1360 mask
= WM8350_JACK_R_LVL
;
1368 dev_warn(wm8350
->dev
, "Jack interrupt called with no jack\n");
1375 reg
= wm8350_reg_read(wm8350
, WM8350_JACK_PIN_STATUS
);
1377 report
= jack
->report
;
1381 snd_soc_jack_report(jack
->jack
, report
, jack
->report
);
1387 * wm8350_hp_jack_detect - Enable headphone jack detection.
1389 * @codec: WM8350 codec
1390 * @which: left or right jack detect signal
1391 * @jack: jack to report detection events on
1392 * @report: value to report
1394 * Enables the headphone jack detection of the WM8350. If no report
1395 * is specified then detection is disabled.
1397 int wm8350_hp_jack_detect(struct snd_soc_codec
*codec
, enum wm8350_jack which
,
1398 struct snd_soc_jack
*jack
, int report
)
1400 struct wm8350_data
*priv
= snd_soc_codec_get_drvdata(codec
);
1401 struct wm8350
*wm8350
= codec
->control_data
;
1407 priv
->hpl
.jack
= jack
;
1408 priv
->hpl
.report
= report
;
1409 irq
= WM8350_IRQ_CODEC_JCK_DET_L
;
1410 ena
= WM8350_JDL_ENA
;
1414 priv
->hpr
.jack
= jack
;
1415 priv
->hpr
.report
= report
;
1416 irq
= WM8350_IRQ_CODEC_JCK_DET_R
;
1417 ena
= WM8350_JDR_ENA
;
1425 wm8350_set_bits(wm8350
, WM8350_POWER_MGMT_4
, WM8350_TOCLK_ENA
);
1426 wm8350_set_bits(wm8350
, WM8350_JACK_DETECT
, ena
);
1428 wm8350_clear_bits(wm8350
, WM8350_JACK_DETECT
, ena
);
1432 wm8350_hp_jack_handler(irq
+ wm8350
->irq_base
, priv
);
1436 EXPORT_SYMBOL_GPL(wm8350_hp_jack_detect
);
1438 static irqreturn_t
wm8350_mic_handler(int irq
, void *data
)
1440 struct wm8350_data
*priv
= data
;
1441 struct wm8350
*wm8350
= priv
->codec
.control_data
;
1445 reg
= wm8350_reg_read(wm8350
, WM8350_JACK_PIN_STATUS
);
1446 if (reg
& WM8350_JACK_MICSCD_LVL
)
1447 report
|= priv
->mic
.short_report
;
1448 if (reg
& WM8350_JACK_MICSD_LVL
)
1449 report
|= priv
->mic
.report
;
1451 snd_soc_jack_report(priv
->mic
.jack
, report
,
1452 priv
->mic
.report
| priv
->mic
.short_report
);
1458 * wm8350_mic_jack_detect - Enable microphone jack detection.
1460 * @codec: WM8350 codec
1461 * @jack: jack to report detection events on
1462 * @detect_report: value to report when presence detected
1463 * @short_report: value to report when microphone short detected
1465 * Enables the microphone jack detection of the WM8350. If both reports
1466 * are specified as zero then detection is disabled.
1468 int wm8350_mic_jack_detect(struct snd_soc_codec
*codec
,
1469 struct snd_soc_jack
*jack
,
1470 int detect_report
, int short_report
)
1472 struct wm8350_data
*priv
= snd_soc_codec_get_drvdata(codec
);
1473 struct wm8350
*wm8350
= codec
->control_data
;
1475 priv
->mic
.jack
= jack
;
1476 priv
->mic
.report
= detect_report
;
1477 priv
->mic
.short_report
= short_report
;
1479 if (detect_report
|| short_report
) {
1480 wm8350_set_bits(wm8350
, WM8350_POWER_MGMT_4
, WM8350_TOCLK_ENA
);
1481 wm8350_set_bits(wm8350
, WM8350_POWER_MGMT_1
,
1482 WM8350_MIC_DET_ENA
);
1484 wm8350_clear_bits(wm8350
, WM8350_POWER_MGMT_1
,
1485 WM8350_MIC_DET_ENA
);
1490 EXPORT_SYMBOL_GPL(wm8350_mic_jack_detect
);
1492 static struct snd_soc_codec
*wm8350_codec
;
1494 static int wm8350_probe(struct platform_device
*pdev
)
1496 struct snd_soc_device
*socdev
= platform_get_drvdata(pdev
);
1497 struct snd_soc_codec
*codec
;
1498 struct wm8350
*wm8350
;
1499 struct wm8350_data
*priv
;
1501 struct wm8350_output
*out1
;
1502 struct wm8350_output
*out2
;
1504 BUG_ON(!wm8350_codec
);
1506 socdev
->card
->codec
= wm8350_codec
;
1507 codec
= socdev
->card
->codec
;
1508 wm8350
= codec
->control_data
;
1509 priv
= snd_soc_codec_get_drvdata(codec
);
1511 /* Enable the codec */
1512 wm8350_set_bits(wm8350
, WM8350_POWER_MGMT_5
, WM8350_CODEC_ENA
);
1514 /* Enable robust clocking mode in ADC */
1515 wm8350_codec_write(codec
, WM8350_SECURITY
, 0xa7);
1516 wm8350_codec_write(codec
, 0xde, 0x13);
1517 wm8350_codec_write(codec
, WM8350_SECURITY
, 0);
1519 /* read OUT1 & OUT2 volumes */
1522 out1
->left_vol
= (wm8350_reg_read(wm8350
, WM8350_LOUT1_VOLUME
) &
1523 WM8350_OUT1L_VOL_MASK
) >> WM8350_OUT1L_VOL_SHIFT
;
1524 out1
->right_vol
= (wm8350_reg_read(wm8350
, WM8350_ROUT1_VOLUME
) &
1525 WM8350_OUT1R_VOL_MASK
) >> WM8350_OUT1R_VOL_SHIFT
;
1526 out2
->left_vol
= (wm8350_reg_read(wm8350
, WM8350_LOUT2_VOLUME
) &
1527 WM8350_OUT2L_VOL_MASK
) >> WM8350_OUT1L_VOL_SHIFT
;
1528 out2
->right_vol
= (wm8350_reg_read(wm8350
, WM8350_ROUT2_VOLUME
) &
1529 WM8350_OUT2R_VOL_MASK
) >> WM8350_OUT1R_VOL_SHIFT
;
1530 wm8350_reg_write(wm8350
, WM8350_LOUT1_VOLUME
, 0);
1531 wm8350_reg_write(wm8350
, WM8350_ROUT1_VOLUME
, 0);
1532 wm8350_reg_write(wm8350
, WM8350_LOUT2_VOLUME
, 0);
1533 wm8350_reg_write(wm8350
, WM8350_ROUT2_VOLUME
, 0);
1535 /* Latch VU bits & mute */
1536 wm8350_set_bits(wm8350
, WM8350_LOUT1_VOLUME
,
1537 WM8350_OUT1_VU
| WM8350_OUT1L_MUTE
);
1538 wm8350_set_bits(wm8350
, WM8350_LOUT2_VOLUME
,
1539 WM8350_OUT2_VU
| WM8350_OUT2L_MUTE
);
1540 wm8350_set_bits(wm8350
, WM8350_ROUT1_VOLUME
,
1541 WM8350_OUT1_VU
| WM8350_OUT1R_MUTE
);
1542 wm8350_set_bits(wm8350
, WM8350_ROUT2_VOLUME
,
1543 WM8350_OUT2_VU
| WM8350_OUT2R_MUTE
);
1545 /* Make sure jack detect is disabled to start off with */
1546 wm8350_clear_bits(wm8350
, WM8350_JACK_DETECT
,
1547 WM8350_JDL_ENA
| WM8350_JDR_ENA
);
1549 wm8350_register_irq(wm8350
, WM8350_IRQ_CODEC_JCK_DET_L
,
1550 wm8350_hp_jack_handler
, 0, "Left jack detect",
1552 wm8350_register_irq(wm8350
, WM8350_IRQ_CODEC_JCK_DET_R
,
1553 wm8350_hp_jack_handler
, 0, "Right jack detect",
1555 wm8350_register_irq(wm8350
, WM8350_IRQ_CODEC_MICSCD
,
1556 wm8350_mic_handler
, 0, "Microphone short", priv
);
1557 wm8350_register_irq(wm8350
, WM8350_IRQ_CODEC_MICD
,
1558 wm8350_mic_handler
, 0, "Microphone detect", priv
);
1560 ret
= snd_soc_new_pcms(socdev
, SNDRV_DEFAULT_IDX1
, SNDRV_DEFAULT_STR1
);
1562 dev_err(&pdev
->dev
, "failed to create pcms\n");
1566 snd_soc_add_controls(codec
, wm8350_snd_controls
,
1567 ARRAY_SIZE(wm8350_snd_controls
));
1568 wm8350_add_widgets(codec
);
1570 wm8350_set_bias_level(codec
, SND_SOC_BIAS_STANDBY
);
1575 static int wm8350_remove(struct platform_device
*pdev
)
1577 struct snd_soc_device
*socdev
= platform_get_drvdata(pdev
);
1578 struct snd_soc_codec
*codec
= socdev
->card
->codec
;
1579 struct wm8350
*wm8350
= codec
->control_data
;
1580 struct wm8350_data
*priv
= snd_soc_codec_get_drvdata(codec
);
1583 wm8350_clear_bits(wm8350
, WM8350_JACK_DETECT
,
1584 WM8350_JDL_ENA
| WM8350_JDR_ENA
);
1585 wm8350_clear_bits(wm8350
, WM8350_POWER_MGMT_4
, WM8350_TOCLK_ENA
);
1587 wm8350_free_irq(wm8350
, WM8350_IRQ_CODEC_MICD
, priv
);
1588 wm8350_free_irq(wm8350
, WM8350_IRQ_CODEC_MICSCD
, priv
);
1589 wm8350_free_irq(wm8350
, WM8350_IRQ_CODEC_JCK_DET_L
, priv
);
1590 wm8350_free_irq(wm8350
, WM8350_IRQ_CODEC_JCK_DET_R
, priv
);
1592 priv
->hpl
.jack
= NULL
;
1593 priv
->hpr
.jack
= NULL
;
1594 priv
->mic
.jack
= NULL
;
1596 /* cancel any work waiting to be queued. */
1597 ret
= cancel_delayed_work(&codec
->delayed_work
);
1599 /* if there was any work waiting then we run it now and
1600 * wait for its completion */
1602 schedule_delayed_work(&codec
->delayed_work
, 0);
1603 flush_scheduled_work();
1606 wm8350_set_bias_level(codec
, SND_SOC_BIAS_OFF
);
1608 wm8350_clear_bits(wm8350
, WM8350_POWER_MGMT_5
, WM8350_CODEC_ENA
);
1613 #define WM8350_RATES (SNDRV_PCM_RATE_8000_96000)
1615 #define WM8350_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
1616 SNDRV_PCM_FMTBIT_S20_3LE |\
1617 SNDRV_PCM_FMTBIT_S24_LE)
1619 static struct snd_soc_dai_ops wm8350_dai_ops
= {
1620 .hw_params
= wm8350_pcm_hw_params
,
1621 .digital_mute
= wm8350_mute
,
1622 .trigger
= wm8350_pcm_trigger
,
1623 .set_fmt
= wm8350_set_dai_fmt
,
1624 .set_sysclk
= wm8350_set_dai_sysclk
,
1625 .set_pll
= wm8350_set_fll
,
1626 .set_clkdiv
= wm8350_set_clkdiv
,
1629 struct snd_soc_dai wm8350_dai
= {
1632 .stream_name
= "Playback",
1635 .rates
= WM8350_RATES
,
1636 .formats
= WM8350_FORMATS
,
1639 .stream_name
= "Capture",
1642 .rates
= WM8350_RATES
,
1643 .formats
= WM8350_FORMATS
,
1645 .ops
= &wm8350_dai_ops
,
1647 EXPORT_SYMBOL_GPL(wm8350_dai
);
1649 struct snd_soc_codec_device soc_codec_dev_wm8350
= {
1650 .probe
= wm8350_probe
,
1651 .remove
= wm8350_remove
,
1652 .suspend
= wm8350_suspend
,
1653 .resume
= wm8350_resume
,
1655 EXPORT_SYMBOL_GPL(soc_codec_dev_wm8350
);
1657 static __devinit
int wm8350_codec_probe(struct platform_device
*pdev
)
1659 struct wm8350
*wm8350
= platform_get_drvdata(pdev
);
1660 struct wm8350_data
*priv
;
1661 struct snd_soc_codec
*codec
;
1664 if (wm8350
->codec
.platform_data
== NULL
) {
1665 dev_err(&pdev
->dev
, "No audio platform data supplied\n");
1669 priv
= kzalloc(sizeof(struct wm8350_data
), GFP_KERNEL
);
1673 for (i
= 0; i
< ARRAY_SIZE(supply_names
); i
++)
1674 priv
->supplies
[i
].supply
= supply_names
[i
];
1676 ret
= regulator_bulk_get(wm8350
->dev
, ARRAY_SIZE(priv
->supplies
),
1681 codec
= &priv
->codec
;
1682 wm8350
->codec
.codec
= codec
;
1684 wm8350_dai
.dev
= &pdev
->dev
;
1686 mutex_init(&codec
->mutex
);
1687 INIT_LIST_HEAD(&codec
->dapm_widgets
);
1688 INIT_LIST_HEAD(&codec
->dapm_paths
);
1689 codec
->dev
= &pdev
->dev
;
1690 codec
->name
= "WM8350";
1691 codec
->owner
= THIS_MODULE
;
1692 codec
->read
= wm8350_codec_read
;
1693 codec
->write
= wm8350_codec_write
;
1694 codec
->bias_level
= SND_SOC_BIAS_OFF
;
1695 codec
->set_bias_level
= wm8350_set_bias_level
;
1696 codec
->dai
= &wm8350_dai
;
1698 codec
->reg_cache_size
= WM8350_MAX_REGISTER
;
1699 snd_soc_codec_set_drvdata(codec
, priv
);
1700 codec
->control_data
= wm8350
;
1702 /* Put the codec into reset if it wasn't already */
1703 wm8350_clear_bits(wm8350
, WM8350_POWER_MGMT_5
, WM8350_CODEC_ENA
);
1705 INIT_DELAYED_WORK(&codec
->delayed_work
, wm8350_pga_work
);
1706 ret
= snd_soc_register_codec(codec
);
1710 wm8350_codec
= codec
;
1712 ret
= snd_soc_register_dai(&wm8350_dai
);
1718 snd_soc_unregister_codec(codec
);
1720 regulator_bulk_free(ARRAY_SIZE(priv
->supplies
), priv
->supplies
);
1723 wm8350_codec
= NULL
;
1727 static int __devexit
wm8350_codec_remove(struct platform_device
*pdev
)
1729 struct wm8350
*wm8350
= platform_get_drvdata(pdev
);
1730 struct snd_soc_codec
*codec
= wm8350
->codec
.codec
;
1731 struct wm8350_data
*priv
= snd_soc_codec_get_drvdata(codec
);
1733 snd_soc_unregister_dai(&wm8350_dai
);
1734 snd_soc_unregister_codec(codec
);
1735 regulator_bulk_free(ARRAY_SIZE(priv
->supplies
), priv
->supplies
);
1737 wm8350_codec
= NULL
;
1741 static struct platform_driver wm8350_codec_driver
= {
1743 .name
= "wm8350-codec",
1744 .owner
= THIS_MODULE
,
1746 .probe
= wm8350_codec_probe
,
1747 .remove
= __devexit_p(wm8350_codec_remove
),
1750 static __init
int wm8350_init(void)
1752 return platform_driver_register(&wm8350_codec_driver
);
1754 module_init(wm8350_init
);
1756 static __exit
void wm8350_exit(void)
1758 platform_driver_unregister(&wm8350_codec_driver
);
1760 module_exit(wm8350_exit
);
1762 MODULE_DESCRIPTION("ASoC WM8350 driver");
1763 MODULE_AUTHOR("Liam Girdwood");
1764 MODULE_LICENSE("GPL");
1765 MODULE_ALIAS("platform:wm8350-codec");