blob: b6b95c8c7f6e043760657a629bbded1c113110fb [file] [log] [blame]
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001/*
2* alc5632.c -- ALC5632 ALSA SoC Audio Codec
3*
4* Copyright (C) 2011 The AC100 Kernel Team <ac100@lists.lauchpad.net>
5*
6* Authors: Leon Romanovsky <leon@leon.nu>
7* Andrey Danin <danindrey@mail.ru>
8* Ilya Petrov <ilya.muromec@gmail.com>
9* Marc Dietrich <marvin24@gmx.de>
10*
11* Based on alc5623.c by Arnaud Patard
12*
13* This program is free software; you can redistribute it and/or modify
14* it under the terms of the GNU General Public License version 2 as
15* published by the Free Software Foundation.
16*/
17
18#include <linux/module.h>
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/delay.h>
22#include <linux/pm.h>
23#include <linux/i2c.h>
24#include <linux/slab.h>
Leon Romanovskybb397532011-11-16 12:06:58 +020025#include <linux/regmap.h>
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +020026#include <sound/core.h>
27#include <sound/pcm.h>
28#include <sound/pcm_params.h>
29#include <sound/tlv.h>
30#include <sound/soc.h>
31#include <sound/initval.h>
32
33#include "alc5632.h"
34
35/*
36 * ALC5632 register cache
37 */
Leon Romanovskybb397532011-11-16 12:06:58 +020038static struct reg_default alc5632_reg_defaults[] = {
Leon Romanovsky43fa8e52011-11-17 12:01:28 +020039 { 2, 0x8080 }, /* R2 - Speaker Output Volume */
40 { 4, 0x8080 }, /* R4 - Headphone Output Volume */
41 { 6, 0x8080 }, /* R6 - AUXOUT Volume */
42 { 8, 0xC800 }, /* R8 - Phone Input */
43 { 10, 0xE808 }, /* R10 - LINE_IN Volume */
44 { 12, 0x1010 }, /* R12 - STEREO DAC Input Volume */
45 { 14, 0x0808 }, /* R14 - MIC Input Volume */
46 { 16, 0xEE0F }, /* R16 - Stereo DAC and MIC Routing Control */
47 { 18, 0xCBCB }, /* R18 - ADC Record Gain */
48 { 20, 0x7F7F }, /* R20 - ADC Record Mixer Control */
49 { 24, 0xE010 }, /* R24 - Voice DAC Volume */
50 { 28, 0x8008 }, /* R28 - Output Mixer Control */
51 { 34, 0x0000 }, /* R34 - Microphone Control */
52 { 36, 0x00C0 }, /* R36 - Codec Digital MIC/Digital Boost
53 Control */
Leon Romanovsky43fa8e52011-11-17 12:01:28 +020054 { 46, 0x0000 }, /* R46 - Stereo DAC/Voice DAC/Stereo ADC
55 Function Select */
56 { 52, 0x8000 }, /* R52 - Main Serial Data Port Control
57 (Stereo I2S) */
58 { 54, 0x0000 }, /* R54 - Extend Serial Data Port Control
59 (VoDAC_I2S/PCM) */
60 { 58, 0x0000 }, /* R58 - Power Management Addition 1 */
61 { 60, 0x0000 }, /* R60 - Power Management Addition 2 */
62 { 62, 0x8000 }, /* R62 - Power Management Addition 3 */
63 { 64, 0x0C0A }, /* R64 - General Purpose Control Register 1 */
64 { 66, 0x0000 }, /* R66 - General Purpose Control Register 2 */
65 { 68, 0x0000 }, /* R68 - PLL1 Control */
66 { 70, 0x0000 }, /* R70 - PLL2 Control */
67 { 76, 0xBE3E }, /* R76 - GPIO Pin Configuration */
68 { 78, 0xBE3E }, /* R78 - GPIO Pin Polarity */
69 { 80, 0x0000 }, /* R80 - GPIO Pin Sticky */
70 { 82, 0x0000 }, /* R82 - GPIO Pin Wake Up */
Leon Romanovsky43fa8e52011-11-17 12:01:28 +020071 { 86, 0x0000 }, /* R86 - Pin Sharing */
Leon Romanovsky43fa8e52011-11-17 12:01:28 +020072 { 90, 0x0009 }, /* R90 - Soft Volume Control Setting */
73 { 92, 0x0000 }, /* R92 - GPIO_Output Pin Control */
74 { 94, 0x3000 }, /* R94 - MISC Control */
75 { 96, 0x3075 }, /* R96 - Stereo DAC Clock Control_1 */
76 { 98, 0x1010 }, /* R98 - Stereo DAC Clock Control_2 */
77 { 100, 0x3110 }, /* R100 - VoDAC_PCM Clock Control_1 */
78 { 104, 0x0553 }, /* R104 - Pseudo Stereo and Spatial Effect
79 Block Control */
80 { 106, 0x0000 }, /* R106 - Private Register Address */
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +020081};
82
83/* codec private data */
84struct alc5632_priv {
Leon Romanovskybb397532011-11-16 12:06:58 +020085 struct regmap *regmap;
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +020086 u8 id;
87 unsigned int sysclk;
88};
89
Leon Romanovskybb397532011-11-16 12:06:58 +020090static bool alc5632_volatile_register(struct device *dev,
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +020091 unsigned int reg)
92{
93 switch (reg) {
94 case ALC5632_RESET:
95 case ALC5632_PWR_DOWN_CTRL_STATUS:
96 case ALC5632_GPIO_PIN_STATUS:
97 case ALC5632_OVER_CURR_STATUS:
98 case ALC5632_HID_CTRL_DATA:
99 case ALC5632_EQ_CTRL:
Leon Romanovsky9b4156c2011-11-17 12:01:29 +0200100 case ALC5632_VENDOR_ID1:
101 case ALC5632_VENDOR_ID2:
Leon Romanovskybb397532011-11-16 12:06:58 +0200102 return true;
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200103
104 default:
105 break;
106 }
107
Leon Romanovskybb397532011-11-16 12:06:58 +0200108 return false;
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200109}
110
Leon Romanovskybb397532011-11-16 12:06:58 +0200111static inline int alc5632_reset(struct regmap *map)
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200112{
Leon Romanovskybb397532011-11-16 12:06:58 +0200113 return regmap_write(map, ALC5632_RESET, 0x59B4);
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200114}
115
116static int amp_mixer_event(struct snd_soc_dapm_widget *w,
117 struct snd_kcontrol *kcontrol, int event)
118{
119 /* to power-on/off class-d amp generators/speaker */
120 /* need to write to 'index-46h' register : */
121 /* so write index num (here 0x46) to reg 0x6a */
122 /* and then 0xffff/0 to reg 0x6c */
123 snd_soc_write(w->codec, ALC5632_HID_CTRL_INDEX, 0x46);
124
125 switch (event) {
126 case SND_SOC_DAPM_PRE_PMU:
127 snd_soc_write(w->codec, ALC5632_HID_CTRL_DATA, 0xFFFF);
128 break;
129 case SND_SOC_DAPM_POST_PMD:
130 snd_soc_write(w->codec, ALC5632_HID_CTRL_DATA, 0);
131 break;
132 }
133
134 return 0;
135}
136
137/*
138 * ALC5632 Controls
139 */
140
141/* -34.5db min scale, 1.5db steps, no mute */
142static const DECLARE_TLV_DB_SCALE(vol_tlv, -3450, 150, 0);
143/* -46.5db min scale, 1.5db steps, no mute */
144static const DECLARE_TLV_DB_SCALE(hp_tlv, -4650, 150, 0);
145/* -16.5db min scale, 1.5db steps, no mute */
146static const DECLARE_TLV_DB_SCALE(adc_rec_tlv, -1650, 150, 0);
147static const unsigned int boost_tlv[] = {
148 TLV_DB_RANGE_HEAD(3),
149 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
150 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0),
151 2, 2, TLV_DB_SCALE_ITEM(3000, 0, 0),
152};
153/* 0db min scale, 6 db steps, no mute */
154static const DECLARE_TLV_DB_SCALE(dig_tlv, 0, 600, 0);
155/* 0db min scalem 0.75db steps, no mute */
Andrey Danin39be1af2012-02-11 23:26:28 +0200156static const DECLARE_TLV_DB_SCALE(vdac_tlv, -3525, 75, 0);
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200157
158static const struct snd_kcontrol_new alc5632_vol_snd_controls[] = {
159 /* left starts at bit 8, right at bit 0 */
160 /* 31 steps (5 bit), -46.5db scale */
Andrey Danin1a083252011-11-13 21:53:13 +0200161 SOC_DOUBLE_TLV("Speaker Playback Volume",
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200162 ALC5632_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv),
163 /* bit 15 mutes left, bit 7 right */
Andrey Danin1a083252011-11-13 21:53:13 +0200164 SOC_DOUBLE("Speaker Playback Switch",
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200165 ALC5632_SPK_OUT_VOL, 15, 7, 1, 1),
166 SOC_DOUBLE_TLV("Headphone Playback Volume",
167 ALC5632_HP_OUT_VOL, 8, 0, 31, 1, hp_tlv),
168 SOC_DOUBLE("Headphone Playback Switch",
169 ALC5632_HP_OUT_VOL, 15, 7, 1, 1),
170};
171
172static const struct snd_kcontrol_new alc5632_snd_controls[] = {
173 SOC_DOUBLE_TLV("Auxout Playback Volume",
174 ALC5632_AUX_OUT_VOL, 8, 0, 31, 1, hp_tlv),
175 SOC_DOUBLE("Auxout Playback Switch",
176 ALC5632_AUX_OUT_VOL, 15, 7, 1, 1),
177 SOC_SINGLE_TLV("Voice DAC Playback Volume",
178 ALC5632_VOICE_DAC_VOL, 0, 63, 0, vdac_tlv),
Andrey Danin0a2c0562012-02-11 23:26:29 +0200179 SOC_SINGLE("Voice DAC Playback Switch",
180 ALC5632_VOICE_DAC_VOL, 12, 1, 1),
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200181 SOC_SINGLE_TLV("Phone Capture Volume",
182 ALC5632_PHONE_IN_VOL, 8, 31, 1, vol_tlv),
183 SOC_DOUBLE_TLV("LineIn Capture Volume",
184 ALC5632_LINE_IN_VOL, 8, 0, 31, 1, vol_tlv),
Andrey Danin1a083252011-11-13 21:53:13 +0200185 SOC_DOUBLE_TLV("Master Playback Volume",
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200186 ALC5632_STEREO_DAC_IN_VOL, 8, 0, 63, 1, vdac_tlv),
Andrey Danin1a083252011-11-13 21:53:13 +0200187 SOC_DOUBLE("Master Playback Switch",
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200188 ALC5632_STEREO_DAC_IN_VOL, 15, 7, 1, 1),
189 SOC_SINGLE_TLV("Mic1 Capture Volume",
190 ALC5632_MIC_VOL, 8, 31, 1, vol_tlv),
191 SOC_SINGLE_TLV("Mic2 Capture Volume",
192 ALC5632_MIC_VOL, 0, 31, 1, vol_tlv),
193 SOC_DOUBLE_TLV("Rec Capture Volume",
194 ALC5632_ADC_REC_GAIN, 8, 0, 31, 0, adc_rec_tlv),
195 SOC_SINGLE_TLV("Mic 1 Boost Volume",
196 ALC5632_MIC_CTRL, 10, 2, 0, boost_tlv),
197 SOC_SINGLE_TLV("Mic 2 Boost Volume",
198 ALC5632_MIC_CTRL, 8, 2, 0, boost_tlv),
Andrey Danin5e4e94a2012-02-11 23:26:33 +0200199 SOC_SINGLE_TLV("DMIC Boost Volume",
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200200 ALC5632_DIGI_BOOST_CTRL, 0, 7, 0, dig_tlv),
Andrey Danin5e4e94a2012-02-11 23:26:33 +0200201 SOC_SINGLE("DMIC En Capture Switch",
202 ALC5632_DIGI_BOOST_CTRL, 15, 1, 0),
203 SOC_SINGLE("DMIC PreFilter Capture Switch",
204 ALC5632_DIGI_BOOST_CTRL, 12, 1, 0),
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200205};
206
207/*
208 * DAPM Controls
209 */
210static const struct snd_kcontrol_new alc5632_hp_mixer_controls[] = {
211SOC_DAPM_SINGLE("LI2HP Playback Switch", ALC5632_LINE_IN_VOL, 15, 1, 1),
212SOC_DAPM_SINGLE("PHONE2HP Playback Switch", ALC5632_PHONE_IN_VOL, 15, 1, 1),
213SOC_DAPM_SINGLE("MIC12HP Playback Switch", ALC5632_MIC_ROUTING_CTRL, 15, 1, 1),
214SOC_DAPM_SINGLE("MIC22HP Playback Switch", ALC5632_MIC_ROUTING_CTRL, 11, 1, 1),
215SOC_DAPM_SINGLE("VOICE2HP Playback Switch", ALC5632_VOICE_DAC_VOL, 15, 1, 1),
216};
217
218static const struct snd_kcontrol_new alc5632_hpl_mixer_controls[] = {
219SOC_DAPM_SINGLE("ADC2HP_L Playback Switch", ALC5632_ADC_REC_GAIN, 15, 1, 1),
220SOC_DAPM_SINGLE("DACL2HP Playback Switch", ALC5632_MIC_ROUTING_CTRL, 3, 1, 1),
221};
222
223static const struct snd_kcontrol_new alc5632_hpr_mixer_controls[] = {
224SOC_DAPM_SINGLE("ADC2HP_R Playback Switch", ALC5632_ADC_REC_GAIN, 7, 1, 1),
225SOC_DAPM_SINGLE("DACR2HP Playback Switch", ALC5632_MIC_ROUTING_CTRL, 2, 1, 1),
226};
227
228static const struct snd_kcontrol_new alc5632_mono_mixer_controls[] = {
229SOC_DAPM_SINGLE("ADC2MONO_L Playback Switch", ALC5632_ADC_REC_GAIN, 14, 1, 1),
230SOC_DAPM_SINGLE("ADC2MONO_R Playback Switch", ALC5632_ADC_REC_GAIN, 6, 1, 1),
231SOC_DAPM_SINGLE("LI2MONO Playback Switch", ALC5632_LINE_IN_VOL, 13, 1, 1),
232SOC_DAPM_SINGLE("MIC12MONO Playback Switch",
233 ALC5632_MIC_ROUTING_CTRL, 13, 1, 1),
234SOC_DAPM_SINGLE("MIC22MONO Playback Switch",
235 ALC5632_MIC_ROUTING_CTRL, 9, 1, 1),
236SOC_DAPM_SINGLE("DAC2MONO Playback Switch", ALC5632_MIC_ROUTING_CTRL, 0, 1, 1),
237SOC_DAPM_SINGLE("VOICE2MONO Playback Switch", ALC5632_VOICE_DAC_VOL, 13, 1, 1),
238};
239
240static const struct snd_kcontrol_new alc5632_speaker_mixer_controls[] = {
241SOC_DAPM_SINGLE("LI2SPK Playback Switch", ALC5632_LINE_IN_VOL, 14, 1, 1),
242SOC_DAPM_SINGLE("PHONE2SPK Playback Switch", ALC5632_PHONE_IN_VOL, 14, 1, 1),
243SOC_DAPM_SINGLE("MIC12SPK Playback Switch",
244 ALC5632_MIC_ROUTING_CTRL, 14, 1, 1),
245SOC_DAPM_SINGLE("MIC22SPK Playback Switch",
246 ALC5632_MIC_ROUTING_CTRL, 10, 1, 1),
247SOC_DAPM_SINGLE("DAC2SPK Playback Switch", ALC5632_MIC_ROUTING_CTRL, 1, 1, 1),
248SOC_DAPM_SINGLE("VOICE2SPK Playback Switch", ALC5632_VOICE_DAC_VOL, 14, 1, 1),
249};
250
251/* Left Record Mixer */
252static const struct snd_kcontrol_new alc5632_captureL_mixer_controls[] = {
Andrey Danina15a9af2012-02-11 23:26:30 +0200253SOC_DAPM_SINGLE("MIC12REC_L Capture Switch", ALC5632_ADC_REC_MIXER, 14, 1, 1),
254SOC_DAPM_SINGLE("MIC22REC_L Capture Switch", ALC5632_ADC_REC_MIXER, 13, 1, 1),
255SOC_DAPM_SINGLE("LIL2REC Capture Switch", ALC5632_ADC_REC_MIXER, 12, 1, 1),
256SOC_DAPM_SINGLE("PH2REC_L Capture Switch", ALC5632_ADC_REC_MIXER, 11, 1, 1),
257SOC_DAPM_SINGLE("HPL2REC Capture Switch", ALC5632_ADC_REC_MIXER, 10, 1, 1),
258SOC_DAPM_SINGLE("SPK2REC_L Capture Switch", ALC5632_ADC_REC_MIXER, 9, 1, 1),
259SOC_DAPM_SINGLE("MONO2REC_L Capture Switch", ALC5632_ADC_REC_MIXER, 8, 1, 1),
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200260};
261
262/* Right Record Mixer */
263static const struct snd_kcontrol_new alc5632_captureR_mixer_controls[] = {
Andrey Danina15a9af2012-02-11 23:26:30 +0200264SOC_DAPM_SINGLE("MIC12REC_R Capture Switch", ALC5632_ADC_REC_MIXER, 6, 1, 1),
265SOC_DAPM_SINGLE("MIC22REC_R Capture Switch", ALC5632_ADC_REC_MIXER, 5, 1, 1),
266SOC_DAPM_SINGLE("LIR2REC Capture Switch", ALC5632_ADC_REC_MIXER, 4, 1, 1),
267SOC_DAPM_SINGLE("PH2REC_R Capture Switch", ALC5632_ADC_REC_MIXER, 3, 1, 1),
268SOC_DAPM_SINGLE("HPR2REC Capture Switch", ALC5632_ADC_REC_MIXER, 2, 1, 1),
269SOC_DAPM_SINGLE("SPK2REC_R Capture Switch", ALC5632_ADC_REC_MIXER, 1, 1, 1),
270SOC_DAPM_SINGLE("MONO2REC_R Capture Switch", ALC5632_ADC_REC_MIXER, 0, 1, 1),
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200271};
272
Andrey Danin5e4e94a2012-02-11 23:26:33 +0200273/* Dmic Mixer */
274static const struct snd_kcontrol_new alc5632_dmicl_mixer_controls[] = {
275SOC_DAPM_SINGLE("DMICL2ADC Capture Switch", ALC5632_DIGI_BOOST_CTRL, 7, 1, 1),
276};
277static const struct snd_kcontrol_new alc5632_dmicr_mixer_controls[] = {
278SOC_DAPM_SINGLE("DMICR2ADC Capture Switch", ALC5632_DIGI_BOOST_CTRL, 6, 1, 1),
279};
280
Andrey Danin75b35662012-02-11 23:26:32 +0200281static const char * const alc5632_spk_n_sour_sel[] = {
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200282 "RN/-R", "RP/+R", "LN/-R", "Mute"};
Andrey Danin75b35662012-02-11 23:26:32 +0200283static const char * const alc5632_hpl_out_input_sel[] = {
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200284 "Vmid", "HP Left Mix"};
Andrey Danin75b35662012-02-11 23:26:32 +0200285static const char * const alc5632_hpr_out_input_sel[] = {
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200286 "Vmid", "HP Right Mix"};
Andrey Danin75b35662012-02-11 23:26:32 +0200287static const char * const alc5632_spkout_input_sel[] = {
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200288 "Vmid", "HPOut Mix", "Speaker Mix", "Mono Mix"};
Andrey Danin75b35662012-02-11 23:26:32 +0200289static const char * const alc5632_aux_out_input_sel[] = {
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200290 "Vmid", "HPOut Mix", "Speaker Mix", "Mono Mix"};
Andrey Danin75b35662012-02-11 23:26:32 +0200291static const char * const alc5632_adcr_func_sel[] = {
292 "Stereo ADC", "Voice ADC"};
293static const char * const alc5632_i2s_out_sel[] = {
294 "ADC LR", "Voice Stereo Digital"};
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200295
296/* auxout output mux */
297static const struct soc_enum alc5632_aux_out_input_enum =
298SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 6, 4, alc5632_aux_out_input_sel);
299static const struct snd_kcontrol_new alc5632_auxout_mux_controls =
300SOC_DAPM_ENUM("AuxOut Mux", alc5632_aux_out_input_enum);
301
302/* speaker output mux */
303static const struct soc_enum alc5632_spkout_input_enum =
304SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 10, 4, alc5632_spkout_input_sel);
305static const struct snd_kcontrol_new alc5632_spkout_mux_controls =
306SOC_DAPM_ENUM("SpeakerOut Mux", alc5632_spkout_input_enum);
307
308/* headphone left output mux */
309static const struct soc_enum alc5632_hpl_out_input_enum =
310SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 9, 2, alc5632_hpl_out_input_sel);
311static const struct snd_kcontrol_new alc5632_hpl_out_mux_controls =
312SOC_DAPM_ENUM("Left Headphone Mux", alc5632_hpl_out_input_enum);
313
314/* headphone right output mux */
315static const struct soc_enum alc5632_hpr_out_input_enum =
316SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 8, 2, alc5632_hpr_out_input_sel);
317static const struct snd_kcontrol_new alc5632_hpr_out_mux_controls =
318SOC_DAPM_ENUM("Right Headphone Mux", alc5632_hpr_out_input_enum);
319
320/* speaker output N select */
321static const struct soc_enum alc5632_spk_n_sour_enum =
322SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 14, 4, alc5632_spk_n_sour_sel);
323static const struct snd_kcontrol_new alc5632_spkoutn_mux_controls =
324SOC_DAPM_ENUM("SpeakerOut N Mux", alc5632_spk_n_sour_enum);
325
326/* speaker amplifier */
327static const char *alc5632_amp_names[] = {"AB Amp", "D Amp"};
328static const struct soc_enum alc5632_amp_enum =
329 SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 13, 2, alc5632_amp_names);
330static const struct snd_kcontrol_new alc5632_amp_mux_controls =
331 SOC_DAPM_ENUM("AB-D Amp Mux", alc5632_amp_enum);
332
Andrey Danin75b35662012-02-11 23:26:32 +0200333/* ADC output select */
334static const struct soc_enum alc5632_adcr_func_enum =
335 SOC_ENUM_SINGLE(ALC5632_DAC_FUNC_SELECT, 5, 2, alc5632_adcr_func_sel);
336static const struct snd_kcontrol_new alc5632_adcr_func_controls =
337 SOC_DAPM_ENUM("ADCR Mux", alc5632_adcr_func_enum);
338
339/* I2S out select */
340static const struct soc_enum alc5632_i2s_out_enum =
341 SOC_ENUM_SINGLE(ALC5632_I2S_OUT_CTL, 5, 2, alc5632_i2s_out_sel);
342static const struct snd_kcontrol_new alc5632_i2s_out_controls =
343 SOC_DAPM_ENUM("I2SOut Mux", alc5632_i2s_out_enum);
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200344
345static const struct snd_soc_dapm_widget alc5632_dapm_widgets[] = {
346/* Muxes */
347SND_SOC_DAPM_MUX("AuxOut Mux", SND_SOC_NOPM, 0, 0,
348 &alc5632_auxout_mux_controls),
349SND_SOC_DAPM_MUX("SpeakerOut Mux", SND_SOC_NOPM, 0, 0,
350 &alc5632_spkout_mux_controls),
351SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0,
352 &alc5632_hpl_out_mux_controls),
353SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0,
354 &alc5632_hpr_out_mux_controls),
355SND_SOC_DAPM_MUX("SpeakerOut N Mux", SND_SOC_NOPM, 0, 0,
356 &alc5632_spkoutn_mux_controls),
Andrey Danin75b35662012-02-11 23:26:32 +0200357SND_SOC_DAPM_MUX("ADCR Mux", SND_SOC_NOPM, 0, 0,
358 &alc5632_adcr_func_controls),
359SND_SOC_DAPM_MUX("I2SOut Mux", SND_SOC_NOPM, 0, 0,
360 &alc5632_i2s_out_controls),
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200361
362/* output mixers */
363SND_SOC_DAPM_MIXER("HP Mix", SND_SOC_NOPM, 0, 0,
364 &alc5632_hp_mixer_controls[0],
365 ARRAY_SIZE(alc5632_hp_mixer_controls)),
366SND_SOC_DAPM_MIXER("HPR Mix", ALC5632_PWR_MANAG_ADD2, 4, 0,
367 &alc5632_hpr_mixer_controls[0],
368 ARRAY_SIZE(alc5632_hpr_mixer_controls)),
369SND_SOC_DAPM_MIXER("HPL Mix", ALC5632_PWR_MANAG_ADD2, 5, 0,
370 &alc5632_hpl_mixer_controls[0],
371 ARRAY_SIZE(alc5632_hpl_mixer_controls)),
372SND_SOC_DAPM_MIXER("HPOut Mix", SND_SOC_NOPM, 0, 0, NULL, 0),
373SND_SOC_DAPM_MIXER("Mono Mix", ALC5632_PWR_MANAG_ADD2, 2, 0,
374 &alc5632_mono_mixer_controls[0],
375 ARRAY_SIZE(alc5632_mono_mixer_controls)),
376SND_SOC_DAPM_MIXER("Speaker Mix", ALC5632_PWR_MANAG_ADD2, 3, 0,
377 &alc5632_speaker_mixer_controls[0],
378 ARRAY_SIZE(alc5632_speaker_mixer_controls)),
Andrey Danin5e4e94a2012-02-11 23:26:33 +0200379SND_SOC_DAPM_MIXER("DMICL Mix", SND_SOC_NOPM, 0, 0,
380 &alc5632_dmicl_mixer_controls[0],
381 ARRAY_SIZE(alc5632_dmicl_mixer_controls)),
382SND_SOC_DAPM_MIXER("DMICR Mix", SND_SOC_NOPM, 0, 0,
383 &alc5632_dmicr_mixer_controls[0],
384 ARRAY_SIZE(alc5632_dmicr_mixer_controls)),
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200385
386/* input mixers */
387SND_SOC_DAPM_MIXER("Left Capture Mix", ALC5632_PWR_MANAG_ADD2, 1, 0,
388 &alc5632_captureL_mixer_controls[0],
389 ARRAY_SIZE(alc5632_captureL_mixer_controls)),
390SND_SOC_DAPM_MIXER("Right Capture Mix", ALC5632_PWR_MANAG_ADD2, 0, 0,
391 &alc5632_captureR_mixer_controls[0],
392 ARRAY_SIZE(alc5632_captureR_mixer_controls)),
393
Andrey Danin75b35662012-02-11 23:26:32 +0200394SND_SOC_DAPM_AIF_IN("AIFRXL", "Left HiFi Playback", 0, SND_SOC_NOPM, 0, 0),
395SND_SOC_DAPM_AIF_IN("AIFRXR", "Right HiFi Playback", 0, SND_SOC_NOPM, 0, 0),
396SND_SOC_DAPM_AIF_OUT("AIFTXL", "Left HiFi Capture", 0, SND_SOC_NOPM, 0, 0),
397SND_SOC_DAPM_AIF_OUT("AIFTXR", "Right HiFi Capture", 0, SND_SOC_NOPM, 0, 0),
398SND_SOC_DAPM_AIF_IN("VAIFRX", "Voice Playback", 0, SND_SOC_NOPM, 0, 0),
399SND_SOC_DAPM_AIF_OUT("VAIFTX", "Voice Capture", 0, SND_SOC_NOPM, 0, 0),
400
401SND_SOC_DAPM_DAC("Voice DAC", NULL, ALC5632_PWR_MANAG_ADD2, 10, 0),
402SND_SOC_DAPM_DAC("Left DAC", NULL, ALC5632_PWR_MANAG_ADD2, 9, 0),
403SND_SOC_DAPM_DAC("Right DAC", NULL, ALC5632_PWR_MANAG_ADD2, 8, 0),
404SND_SOC_DAPM_ADC("Left ADC", NULL, ALC5632_PWR_MANAG_ADD2, 7, 0),
405SND_SOC_DAPM_ADC("Right ADC", NULL, ALC5632_PWR_MANAG_ADD2, 6, 0),
406
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200407SND_SOC_DAPM_MIXER("DAC Left Channel", ALC5632_PWR_MANAG_ADD1, 15, 0, NULL, 0),
408SND_SOC_DAPM_MIXER("DAC Right Channel",
409 ALC5632_PWR_MANAG_ADD1, 14, 0, NULL, 0),
410SND_SOC_DAPM_MIXER("I2S Mix", ALC5632_PWR_MANAG_ADD1, 11, 0, NULL, 0),
411SND_SOC_DAPM_MIXER("Phone Mix", SND_SOC_NOPM, 0, 0, NULL, 0),
412SND_SOC_DAPM_MIXER("Line Mix", SND_SOC_NOPM, 0, 0, NULL, 0),
Andrey Danin75b35662012-02-11 23:26:32 +0200413SND_SOC_DAPM_MIXER("Voice Mix", SND_SOC_NOPM, 0, 0, NULL, 0),
414SND_SOC_DAPM_MIXER("ADCLR", SND_SOC_NOPM, 0, 0, NULL, 0),
415
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200416SND_SOC_DAPM_PGA("Left Headphone", ALC5632_PWR_MANAG_ADD3, 11, 0, NULL, 0),
417SND_SOC_DAPM_PGA("Right Headphone", ALC5632_PWR_MANAG_ADD3, 10, 0, NULL, 0),
418SND_SOC_DAPM_PGA("Left Speaker", ALC5632_PWR_MANAG_ADD3, 13, 0, NULL, 0),
419SND_SOC_DAPM_PGA("Right Speaker", ALC5632_PWR_MANAG_ADD3, 12, 0, NULL, 0),
420SND_SOC_DAPM_PGA("Aux Out", ALC5632_PWR_MANAG_ADD3, 14, 0, NULL, 0),
421SND_SOC_DAPM_PGA("Left LineIn", ALC5632_PWR_MANAG_ADD3, 7, 0, NULL, 0),
422SND_SOC_DAPM_PGA("Right LineIn", ALC5632_PWR_MANAG_ADD3, 6, 0, NULL, 0),
423SND_SOC_DAPM_PGA("Phone", ALC5632_PWR_MANAG_ADD3, 5, 0, NULL, 0),
424SND_SOC_DAPM_PGA("Phone ADMix", ALC5632_PWR_MANAG_ADD3, 4, 0, NULL, 0),
425SND_SOC_DAPM_PGA("MIC1 PGA", ALC5632_PWR_MANAG_ADD3, 3, 0, NULL, 0),
426SND_SOC_DAPM_PGA("MIC2 PGA", ALC5632_PWR_MANAG_ADD3, 2, 0, NULL, 0),
427SND_SOC_DAPM_PGA("MIC1 Pre Amp", ALC5632_PWR_MANAG_ADD3, 1, 0, NULL, 0),
428SND_SOC_DAPM_PGA("MIC2 Pre Amp", ALC5632_PWR_MANAG_ADD3, 0, 0, NULL, 0),
Leon Romanovsky9215aa42011-12-12 21:43:45 +0200429SND_SOC_DAPM_SUPPLY("MICBIAS1", ALC5632_PWR_MANAG_ADD1, 3, 0, NULL, 0),
430SND_SOC_DAPM_SUPPLY("MICBIAS2", ALC5632_PWR_MANAG_ADD1, 2, 0, NULL, 0),
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200431
432SND_SOC_DAPM_PGA_E("D Amp", ALC5632_PWR_MANAG_ADD2, 14, 0, NULL, 0,
433 amp_mixer_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
434SND_SOC_DAPM_PGA("AB Amp", ALC5632_PWR_MANAG_ADD2, 15, 0, NULL, 0),
435SND_SOC_DAPM_MUX("AB-D Amp Mux", ALC5632_PWR_MANAG_ADD1, 10, 0,
436 &alc5632_amp_mux_controls),
437
438SND_SOC_DAPM_OUTPUT("AUXOUT"),
439SND_SOC_DAPM_OUTPUT("HPL"),
440SND_SOC_DAPM_OUTPUT("HPR"),
441SND_SOC_DAPM_OUTPUT("SPKOUT"),
442SND_SOC_DAPM_OUTPUT("SPKOUTN"),
Andrey Danin75b35662012-02-11 23:26:32 +0200443
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200444SND_SOC_DAPM_INPUT("LINEINL"),
445SND_SOC_DAPM_INPUT("LINEINR"),
446SND_SOC_DAPM_INPUT("PHONEP"),
447SND_SOC_DAPM_INPUT("PHONEN"),
Andrey Danin75b35662012-02-11 23:26:32 +0200448SND_SOC_DAPM_INPUT("DMICDAT"),
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200449SND_SOC_DAPM_INPUT("MIC1"),
450SND_SOC_DAPM_INPUT("MIC2"),
451SND_SOC_DAPM_VMID("Vmid"),
452};
453
454
455static const struct snd_soc_dapm_route alc5632_dapm_routes[] = {
Andrey Danin75b35662012-02-11 23:26:32 +0200456 /* Playback streams */
457 {"Left DAC", NULL, "AIFRXL"},
458 {"Right DAC", NULL, "AIFRXR"},
459
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200460 /* virtual mixer - mixes left & right channels */
461 {"I2S Mix", NULL, "Left DAC"},
462 {"I2S Mix", NULL, "Right DAC"},
463 {"Line Mix", NULL, "Right LineIn"},
464 {"Line Mix", NULL, "Left LineIn"},
465 {"Phone Mix", NULL, "Phone"},
466 {"Phone Mix", NULL, "Phone ADMix"},
467 {"AUXOUT", NULL, "Aux Out"},
468
469 /* DAC */
470 {"DAC Right Channel", NULL, "I2S Mix"},
471 {"DAC Left Channel", NULL, "I2S Mix"},
472
473 /* HP mixer */
474 {"HPL Mix", "ADC2HP_L Playback Switch", "Left Capture Mix"},
475 {"HPL Mix", NULL, "HP Mix"},
476 {"HPR Mix", "ADC2HP_R Playback Switch", "Right Capture Mix"},
477 {"HPR Mix", NULL, "HP Mix"},
478 {"HP Mix", "LI2HP Playback Switch", "Line Mix"},
479 {"HP Mix", "PHONE2HP Playback Switch", "Phone Mix"},
480 {"HP Mix", "MIC12HP Playback Switch", "MIC1 PGA"},
481 {"HP Mix", "MIC22HP Playback Switch", "MIC2 PGA"},
Andrey Danin75b35662012-02-11 23:26:32 +0200482 {"HP Mix", "VOICE2HP Playback Switch", "Voice Mix"},
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200483 {"HPR Mix", "DACR2HP Playback Switch", "DAC Right Channel"},
484 {"HPL Mix", "DACL2HP Playback Switch", "DAC Left Channel"},
485
486 /* speaker mixer */
487 {"Speaker Mix", "LI2SPK Playback Switch", "Line Mix"},
488 {"Speaker Mix", "PHONE2SPK Playback Switch", "Phone Mix"},
489 {"Speaker Mix", "MIC12SPK Playback Switch", "MIC1 PGA"},
490 {"Speaker Mix", "MIC22SPK Playback Switch", "MIC2 PGA"},
491 {"Speaker Mix", "DAC2SPK Playback Switch", "DAC Left Channel"},
Andrey Danin75b35662012-02-11 23:26:32 +0200492 {"Speaker Mix", "VOICE2SPK Playback Switch", "Voice Mix"},
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200493
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200494 /* mono mixer */
495 {"Mono Mix", "ADC2MONO_L Playback Switch", "Left Capture Mix"},
496 {"Mono Mix", "ADC2MONO_R Playback Switch", "Right Capture Mix"},
497 {"Mono Mix", "LI2MONO Playback Switch", "Line Mix"},
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200498 {"Mono Mix", "MIC12MONO Playback Switch", "MIC1 PGA"},
499 {"Mono Mix", "MIC22MONO Playback Switch", "MIC2 PGA"},
500 {"Mono Mix", "DAC2MONO Playback Switch", "DAC Left Channel"},
Andrey Danin75b35662012-02-11 23:26:32 +0200501 {"Mono Mix", "VOICE2MONO Playback Switch", "Voice Mix"},
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200502
503 /* Left record mixer */
Andrey Danina15a9af2012-02-11 23:26:30 +0200504 {"Left Capture Mix", "LIL2REC Capture Switch", "LINEINL"},
505 {"Left Capture Mix", "PH2REC_L Capture Switch", "PHONEN"},
506 {"Left Capture Mix", "MIC12REC_L Capture Switch", "MIC1 Pre Amp"},
507 {"Left Capture Mix", "MIC22REC_L Capture Switch", "MIC2 Pre Amp"},
508 {"Left Capture Mix", "HPL2REC Capture Switch", "HPL Mix"},
509 {"Left Capture Mix", "SPK2REC_L Capture Switch", "Speaker Mix"},
510 {"Left Capture Mix", "MONO2REC_L Capture Switch", "Mono Mix"},
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200511
512 /*Right record mixer */
Andrey Danina15a9af2012-02-11 23:26:30 +0200513 {"Right Capture Mix", "LIR2REC Capture Switch", "LINEINR"},
514 {"Right Capture Mix", "PH2REC_R Capture Switch", "PHONEP"},
515 {"Right Capture Mix", "MIC12REC_R Capture Switch", "MIC1 Pre Amp"},
516 {"Right Capture Mix", "MIC22REC_R Capture Switch", "MIC2 Pre Amp"},
517 {"Right Capture Mix", "HPR2REC Capture Switch", "HPR Mix"},
518 {"Right Capture Mix", "SPK2REC_R Capture Switch", "Speaker Mix"},
519 {"Right Capture Mix", "MONO2REC_R Capture Switch", "Mono Mix"},
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200520
521 /* headphone left mux */
522 {"Left Headphone Mux", "HP Left Mix", "HPL Mix"},
523 {"Left Headphone Mux", "Vmid", "Vmid"},
524
525 /* headphone right mux */
526 {"Right Headphone Mux", "HP Right Mix", "HPR Mix"},
527 {"Right Headphone Mux", "Vmid", "Vmid"},
528
529 /* speaker out mux */
530 {"SpeakerOut Mux", "Vmid", "Vmid"},
531 {"SpeakerOut Mux", "HPOut Mix", "HPOut Mix"},
532 {"SpeakerOut Mux", "Speaker Mix", "Speaker Mix"},
533 {"SpeakerOut Mux", "Mono Mix", "Mono Mix"},
534
535 /* Mono/Aux Out mux */
536 {"AuxOut Mux", "Vmid", "Vmid"},
537 {"AuxOut Mux", "HPOut Mix", "HPOut Mix"},
538 {"AuxOut Mux", "Speaker Mix", "Speaker Mix"},
539 {"AuxOut Mux", "Mono Mix", "Mono Mix"},
540
541 /* output pga */
542 {"HPL", NULL, "Left Headphone"},
543 {"Left Headphone", NULL, "Left Headphone Mux"},
544 {"HPR", NULL, "Right Headphone"},
545 {"Right Headphone", NULL, "Right Headphone Mux"},
546 {"Aux Out", NULL, "AuxOut Mux"},
547
548 /* input pga */
549 {"Left LineIn", NULL, "LINEINL"},
550 {"Right LineIn", NULL, "LINEINR"},
551 {"Phone", NULL, "PHONEP"},
552 {"MIC1 Pre Amp", NULL, "MIC1"},
553 {"MIC2 Pre Amp", NULL, "MIC2"},
554 {"MIC1 PGA", NULL, "MIC1 Pre Amp"},
555 {"MIC2 PGA", NULL, "MIC2 Pre Amp"},
556
557 /* left ADC */
558 {"Left ADC", NULL, "Left Capture Mix"},
Andrey Danin5e4e94a2012-02-11 23:26:33 +0200559 {"DMICL Mix", "DMICL2ADC Capture Switch", "DMICDAT"},
560 {"Left ADC", NULL, "DMICL Mix"},
Andrey Danin75b35662012-02-11 23:26:32 +0200561 {"ADCLR", NULL, "Left ADC"},
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200562
563 /* right ADC */
Andrey Danin75b35662012-02-11 23:26:32 +0200564 {"Right ADC", NULL, "Right Capture Mix"},
Andrey Danin5e4e94a2012-02-11 23:26:33 +0200565 {"DMICR Mix", "DMICR2ADC Capture Switch", "DMICDAT"},
566 {"Right ADC", NULL, "DMICR Mix"},
Andrey Danin75b35662012-02-11 23:26:32 +0200567 {"ADCR Mux", "Stereo ADC", "Right ADC"},
568 {"ADCR Mux", "Voice ADC", "Right ADC"},
569 {"ADCLR", NULL, "ADCR Mux"},
570 {"VAIFTX", NULL, "ADCR Mux"},
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200571
Andrey Danin75b35662012-02-11 23:26:32 +0200572 /* Digital I2S out */
573 {"I2SOut Mux", "ADC LR", "ADCLR"},
574 {"I2SOut Mux", "Voice Stereo Digital", "VAIFRX"},
575 {"AIFTXL", NULL, "I2SOut Mux"},
576 {"AIFTXR", NULL, "I2SOut Mux"},
577
578 /* Voice Mix */
579 {"Voice DAC", NULL, "VAIFRX"},
580 {"Voice Mix", NULL, "Voice DAC"},
581
582 /* Speaker Output */
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200583 {"SpeakerOut N Mux", "RN/-R", "Left Speaker"},
584 {"SpeakerOut N Mux", "RP/+R", "Left Speaker"},
585 {"SpeakerOut N Mux", "LN/-R", "Left Speaker"},
586 {"SpeakerOut N Mux", "Mute", "Vmid"},
587
588 {"SpeakerOut N Mux", "RN/-R", "Right Speaker"},
589 {"SpeakerOut N Mux", "RP/+R", "Right Speaker"},
590 {"SpeakerOut N Mux", "LN/-R", "Right Speaker"},
591 {"SpeakerOut N Mux", "Mute", "Vmid"},
592
593 {"AB Amp", NULL, "SpeakerOut Mux"},
594 {"D Amp", NULL, "SpeakerOut Mux"},
595 {"AB-D Amp Mux", "AB Amp", "AB Amp"},
596 {"AB-D Amp Mux", "D Amp", "D Amp"},
597 {"Left Speaker", NULL, "AB-D Amp Mux"},
598 {"Right Speaker", NULL, "AB-D Amp Mux"},
599
600 {"SPKOUT", NULL, "Left Speaker"},
601 {"SPKOUT", NULL, "Right Speaker"},
602
603 {"SPKOUTN", NULL, "SpeakerOut N Mux"},
604
605};
606
607/* PLL divisors */
608struct _pll_div {
609 u32 pll_in;
610 u32 pll_out;
611 u16 regvalue;
612};
613
614/* Note : pll code from original alc5632 driver. Not sure of how good it is */
615/* usefull only for master mode */
616static const struct _pll_div codec_master_pll_div[] = {
617
618 { 2048000, 8192000, 0x0ea0},
619 { 3686400, 8192000, 0x4e27},
620 { 12000000, 8192000, 0x456b},
621 { 13000000, 8192000, 0x495f},
622 { 13100000, 8192000, 0x0320},
623 { 2048000, 11289600, 0xf637},
624 { 3686400, 11289600, 0x2f22},
625 { 12000000, 11289600, 0x3e2f},
626 { 13000000, 11289600, 0x4d5b},
627 { 13100000, 11289600, 0x363b},
628 { 2048000, 16384000, 0x1ea0},
629 { 3686400, 16384000, 0x9e27},
630 { 12000000, 16384000, 0x452b},
631 { 13000000, 16384000, 0x542f},
632 { 13100000, 16384000, 0x03a0},
633 { 2048000, 16934400, 0xe625},
634 { 3686400, 16934400, 0x9126},
635 { 12000000, 16934400, 0x4d2c},
636 { 13000000, 16934400, 0x742f},
637 { 13100000, 16934400, 0x3c27},
638 { 2048000, 22579200, 0x2aa0},
639 { 3686400, 22579200, 0x2f20},
640 { 12000000, 22579200, 0x7e2f},
641 { 13000000, 22579200, 0x742f},
642 { 13100000, 22579200, 0x3c27},
643 { 2048000, 24576000, 0x2ea0},
644 { 3686400, 24576000, 0xee27},
645 { 12000000, 24576000, 0x2915},
646 { 13000000, 24576000, 0x772e},
647 { 13100000, 24576000, 0x0d20},
648};
649
650/* FOUT = MCLK*(N+2)/((M+2)*(K+2))
651 N: bit 15:8 (div 2 .. div 257)
652 K: bit 6:4 typical 2
653 M: bit 3:0 (div 2 .. div 17)
654
655 same as for 5623 - thanks!
656*/
657
658static const struct _pll_div codec_slave_pll_div[] = {
659
660 { 1024000, 16384000, 0x3ea0},
661 { 1411200, 22579200, 0x3ea0},
662 { 1536000, 24576000, 0x3ea0},
663 { 2048000, 16384000, 0x1ea0},
664 { 2822400, 22579200, 0x1ea0},
665 { 3072000, 24576000, 0x1ea0},
666
667};
668
669static int alc5632_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
670 int source, unsigned int freq_in, unsigned int freq_out)
671{
672 int i;
673 struct snd_soc_codec *codec = codec_dai->codec;
674 int gbl_clk = 0, pll_div = 0;
675 u16 reg;
676
677 if (pll_id < ALC5632_PLL_FR_MCLK || pll_id > ALC5632_PLL_FR_VBCLK)
678 return -EINVAL;
679
680 /* Disable PLL power */
681 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
682 ALC5632_PWR_ADD2_PLL1,
683 0);
684 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
685 ALC5632_PWR_ADD2_PLL2,
686 0);
687
688 /* pll is not used in slave mode */
689 reg = snd_soc_read(codec, ALC5632_DAI_CONTROL);
690 if (reg & ALC5632_DAI_SDP_SLAVE_MODE)
691 return 0;
692
693 if (!freq_in || !freq_out)
694 return 0;
695
696 switch (pll_id) {
697 case ALC5632_PLL_FR_MCLK:
698 for (i = 0; i < ARRAY_SIZE(codec_master_pll_div); i++) {
699 if (codec_master_pll_div[i].pll_in == freq_in
700 && codec_master_pll_div[i].pll_out == freq_out) {
701 /* PLL source from MCLK */
702 pll_div = codec_master_pll_div[i].regvalue;
703 break;
704 }
705 }
706 break;
707 case ALC5632_PLL_FR_BCLK:
708 for (i = 0; i < ARRAY_SIZE(codec_slave_pll_div); i++) {
709 if (codec_slave_pll_div[i].pll_in == freq_in
710 && codec_slave_pll_div[i].pll_out == freq_out) {
711 /* PLL source from Bitclk */
712 gbl_clk = ALC5632_PLL_FR_BCLK;
713 pll_div = codec_slave_pll_div[i].regvalue;
714 break;
715 }
716 }
717 break;
718 case ALC5632_PLL_FR_VBCLK:
719 for (i = 0; i < ARRAY_SIZE(codec_slave_pll_div); i++) {
720 if (codec_slave_pll_div[i].pll_in == freq_in
721 && codec_slave_pll_div[i].pll_out == freq_out) {
722 /* PLL source from voice clock */
723 gbl_clk = ALC5632_PLL_FR_VBCLK;
724 pll_div = codec_slave_pll_div[i].regvalue;
725 break;
726 }
727 }
728 break;
729 default:
730 return -EINVAL;
731 }
732
733 if (!pll_div)
734 return -EINVAL;
735
736 /* choose MCLK/BCLK/VBCLK */
737 snd_soc_write(codec, ALC5632_GPCR2, gbl_clk);
738 /* choose PLL1 clock rate */
739 snd_soc_write(codec, ALC5632_PLL1_CTRL, pll_div);
740 /* enable PLL1 */
741 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
742 ALC5632_PWR_ADD2_PLL1,
743 ALC5632_PWR_ADD2_PLL1);
744 /* enable PLL2 */
745 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
746 ALC5632_PWR_ADD2_PLL2,
747 ALC5632_PWR_ADD2_PLL2);
748 /* use PLL1 as main SYSCLK */
749 snd_soc_update_bits(codec, ALC5632_GPCR1,
750 ALC5632_GPCR1_CLK_SYS_SRC_SEL_PLL1,
751 ALC5632_GPCR1_CLK_SYS_SRC_SEL_PLL1);
752
753 return 0;
754}
755
756struct _coeff_div {
757 u16 fs;
758 u16 regvalue;
759};
760
761/* codec hifi mclk (after PLL) clock divider coefficients */
762/* values inspired from column BCLK=32Fs of Appendix A table */
763static const struct _coeff_div coeff_div[] = {
764 {512*1, 0x3075},
765};
766
767static int get_coeff(struct snd_soc_codec *codec, int rate)
768{
769 struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
770 int i;
771
772 for (i = 0; i < ARRAY_SIZE(coeff_div); i++) {
773 if (coeff_div[i].fs * rate == alc5632->sysclk)
774 return i;
775 }
776 return -EINVAL;
777}
778
779/*
780 * Clock after PLL and dividers
781 */
782static int alc5632_set_dai_sysclk(struct snd_soc_dai *codec_dai,
783 int clk_id, unsigned int freq, int dir)
784{
785 struct snd_soc_codec *codec = codec_dai->codec;
786 struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
787
788 switch (freq) {
789 case 8192000:
790 case 11289600:
791 case 12288000:
792 case 16384000:
793 case 16934400:
794 case 18432000:
795 case 22579200:
796 case 24576000:
797 alc5632->sysclk = freq;
798 return 0;
799 }
800 return -EINVAL;
801}
802
803static int alc5632_set_dai_fmt(struct snd_soc_dai *codec_dai,
804 unsigned int fmt)
805{
806 struct snd_soc_codec *codec = codec_dai->codec;
807 u16 iface = 0;
808
809 /* set master/slave audio interface */
810 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
811 case SND_SOC_DAIFMT_CBM_CFM:
812 iface = ALC5632_DAI_SDP_MASTER_MODE;
813 break;
814 case SND_SOC_DAIFMT_CBS_CFS:
815 iface = ALC5632_DAI_SDP_SLAVE_MODE;
816 break;
817 default:
818 return -EINVAL;
819 }
820
821 /* interface format */
822 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
823 case SND_SOC_DAIFMT_I2S:
824 iface |= ALC5632_DAI_I2S_DF_I2S;
825 break;
826 case SND_SOC_DAIFMT_LEFT_J:
827 iface |= ALC5632_DAI_I2S_DF_LEFT;
828 break;
829 case SND_SOC_DAIFMT_DSP_A:
830 iface |= ALC5632_DAI_I2S_DF_PCM_A;
831 break;
832 case SND_SOC_DAIFMT_DSP_B:
833 iface |= ALC5632_DAI_I2S_DF_PCM_B;
834 break;
835 default:
836 return -EINVAL;
837 }
838
839 /* clock inversion */
840 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
841 case SND_SOC_DAIFMT_NB_NF:
842 break;
843 case SND_SOC_DAIFMT_IB_IF:
844 iface |= ALC5632_DAI_MAIN_I2S_BCLK_POL_CTRL;
845 break;
846 case SND_SOC_DAIFMT_IB_NF:
847 iface |= ALC5632_DAI_MAIN_I2S_BCLK_POL_CTRL;
848 break;
849 case SND_SOC_DAIFMT_NB_IF:
850 break;
851 default:
852 return -EINVAL;
853 }
854
855 return snd_soc_write(codec, ALC5632_DAI_CONTROL, iface);
856}
857
858static int alc5632_pcm_hw_params(struct snd_pcm_substream *substream,
859 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
860{
861 struct snd_soc_pcm_runtime *rtd = substream->private_data;
862 struct snd_soc_codec *codec = rtd->codec;
863 int coeff, rate;
864 u16 iface;
865
866 iface = snd_soc_read(codec, ALC5632_DAI_CONTROL);
867 iface &= ~ALC5632_DAI_I2S_DL_MASK;
868
869 /* bit size */
870 switch (params_format(params)) {
871 case SNDRV_PCM_FORMAT_S16_LE:
872 iface |= ALC5632_DAI_I2S_DL_16;
873 break;
874 case SNDRV_PCM_FORMAT_S20_3LE:
875 iface |= ALC5632_DAI_I2S_DL_20;
876 break;
877 case SNDRV_PCM_FORMAT_S24_LE:
878 iface |= ALC5632_DAI_I2S_DL_24;
879 break;
880 default:
881 return -EINVAL;
882 }
883
884 /* set iface & srate */
885 snd_soc_write(codec, ALC5632_DAI_CONTROL, iface);
886 rate = params_rate(params);
887 coeff = get_coeff(codec, rate);
888 if (coeff < 0)
889 return -EINVAL;
890
891 coeff = coeff_div[coeff].regvalue;
892 snd_soc_write(codec, ALC5632_DAC_CLK_CTRL1, coeff);
893
894 return 0;
895}
896
897static int alc5632_mute(struct snd_soc_dai *dai, int mute)
898{
899 struct snd_soc_codec *codec = dai->codec;
Leon Romanovsky88c494b2011-11-10 21:22:16 +0200900 u16 hp_mute = ALC5632_MISC_HP_DEPOP_MUTE_L
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +0200901 |ALC5632_MISC_HP_DEPOP_MUTE_R;
902 u16 mute_reg = snd_soc_read(codec, ALC5632_MISC_CTRL) & ~hp_mute;
903
904 if (mute)
905 mute_reg |= hp_mute;
906
907 return snd_soc_write(codec, ALC5632_MISC_CTRL, mute_reg);
908}
909
910#define ALC5632_ADD2_POWER_EN (ALC5632_PWR_ADD2_VREF)
911
912#define ALC5632_ADD3_POWER_EN (ALC5632_PWR_ADD3_MIC1_BOOST_AD)
913
914#define ALC5632_ADD1_POWER_EN \
915 (ALC5632_PWR_ADD1_DAC_REF \
916 | ALC5632_PWR_ADD1_SOFTGEN_EN \
917 | ALC5632_PWR_ADD1_HP_OUT_AMP \
918 | ALC5632_PWR_ADD1_HP_OUT_ENH_AMP \
919 | ALC5632_PWR_ADD1_MAIN_BIAS)
920
921static void enable_power_depop(struct snd_soc_codec *codec)
922{
923 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1,
924 ALC5632_PWR_ADD1_SOFTGEN_EN,
925 ALC5632_PWR_ADD1_SOFTGEN_EN);
926
927 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD3,
928 ALC5632_ADD3_POWER_EN,
929 ALC5632_ADD3_POWER_EN);
930
931 snd_soc_update_bits(codec, ALC5632_MISC_CTRL,
932 ALC5632_MISC_HP_DEPOP_MODE2_EN,
933 ALC5632_MISC_HP_DEPOP_MODE2_EN);
934
935 /* "normal" mode: 0 @ 26 */
936 /* set all PR0-7 mixers to 0 */
937 snd_soc_update_bits(codec, ALC5632_PWR_DOWN_CTRL_STATUS,
938 ALC5632_PWR_DOWN_CTRL_STATUS_MASK,
939 0);
940
941 msleep(500);
942
943 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
944 ALC5632_ADD2_POWER_EN,
945 ALC5632_ADD2_POWER_EN);
946
947 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1,
948 ALC5632_ADD1_POWER_EN,
949 ALC5632_ADD1_POWER_EN);
950
951 /* disable HP Depop2 */
952 snd_soc_update_bits(codec, ALC5632_MISC_CTRL,
953 ALC5632_MISC_HP_DEPOP_MODE2_EN,
954 0);
955
956}
957
958static int alc5632_set_bias_level(struct snd_soc_codec *codec,
959 enum snd_soc_bias_level level)
960{
961 switch (level) {
962 case SND_SOC_BIAS_ON:
963 enable_power_depop(codec);
964 break;
965 case SND_SOC_BIAS_PREPARE:
966 break;
967 case SND_SOC_BIAS_STANDBY:
968 /* everything off except vref/vmid, */
969 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1,
970 ALC5632_PWR_MANAG_ADD1_MASK,
971 ALC5632_PWR_ADD1_MAIN_BIAS);
972 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
973 ALC5632_PWR_MANAG_ADD2_MASK,
974 ALC5632_PWR_ADD2_VREF);
975 /* "normal" mode: 0 @ 26 */
976 snd_soc_update_bits(codec, ALC5632_PWR_DOWN_CTRL_STATUS,
977 ALC5632_PWR_DOWN_CTRL_STATUS_MASK,
978 0xffff ^ (ALC5632_PWR_VREF_PR3
979 | ALC5632_PWR_VREF_PR2));
980 break;
981 case SND_SOC_BIAS_OFF:
982 /* everything off, dac mute, inactive */
983 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
984 ALC5632_PWR_MANAG_ADD2_MASK, 0);
985 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD3,
986 ALC5632_PWR_MANAG_ADD3_MASK, 0);
987 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1,
988 ALC5632_PWR_MANAG_ADD1_MASK, 0);
989 break;
990 }
991 codec->dapm.bias_level = level;
992 return 0;
993}
994
995#define ALC5632_FORMATS (SNDRV_PCM_FMTBIT_S16_LE \
996 | SNDRV_PCM_FMTBIT_S24_LE \
997 | SNDRV_PCM_FMTBIT_S32_LE)
998
Lars-Peter Clausen85e76522011-11-23 11:40:40 +0100999static const struct snd_soc_dai_ops alc5632_dai_ops = {
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001000 .hw_params = alc5632_pcm_hw_params,
1001 .digital_mute = alc5632_mute,
1002 .set_fmt = alc5632_set_dai_fmt,
1003 .set_sysclk = alc5632_set_dai_sysclk,
1004 .set_pll = alc5632_set_dai_pll,
1005};
1006
1007static struct snd_soc_dai_driver alc5632_dai = {
1008 .name = "alc5632-hifi",
1009 .playback = {
1010 .stream_name = "HiFi Playback",
1011 .channels_min = 1,
1012 .channels_max = 2,
1013 .rate_min = 8000,
1014 .rate_max = 48000,
1015 .rates = SNDRV_PCM_RATE_8000_48000,
1016 .formats = ALC5632_FORMATS,},
1017 .capture = {
1018 .stream_name = "HiFi Capture",
1019 .channels_min = 1,
1020 .channels_max = 2,
1021 .rate_min = 8000,
1022 .rate_max = 48000,
1023 .rates = SNDRV_PCM_RATE_8000_48000,
1024 .formats = ALC5632_FORMATS,},
1025
1026 .ops = &alc5632_dai_ops,
1027 .symmetric_rates = 1,
1028};
1029
Leon Romanovskyc9be8422011-11-16 12:07:00 +02001030#ifdef CONFIG_PM
Lars-Peter Clausen84b315e2011-12-02 10:18:28 +01001031static int alc5632_suspend(struct snd_soc_codec *codec)
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001032{
1033 alc5632_set_bias_level(codec, SND_SOC_BIAS_OFF);
1034 return 0;
1035}
1036
1037static int alc5632_resume(struct snd_soc_codec *codec)
1038{
Leon Romanovskybb397532011-11-16 12:06:58 +02001039 struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001040
Leon Romanovskybb397532011-11-16 12:06:58 +02001041 regcache_sync(alc5632->regmap);
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001042
1043 alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1044 return 0;
1045}
Leon Romanovskyc9be8422011-11-16 12:07:00 +02001046#else
1047#define alc5632_suspend NULL
1048#define alc5632_resume NULL
1049#endif
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001050
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001051static int alc5632_probe(struct snd_soc_codec *codec)
1052{
1053 struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
1054 int ret;
1055
Leon Romanovskybb397532011-11-16 12:06:58 +02001056 codec->control_data = alc5632->regmap;
1057
1058 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
1059 if (ret != 0) {
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001060 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1061 return ret;
1062 }
1063
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001064 /* power on device */
1065 alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1066
1067 switch (alc5632->id) {
1068 case 0x5c:
Liam Girdwood022658b2012-02-03 17:43:09 +00001069 snd_soc_add_codec_controls(codec, alc5632_vol_snd_controls,
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001070 ARRAY_SIZE(alc5632_vol_snd_controls));
1071 break;
1072 default:
1073 return -EINVAL;
1074 }
1075
1076 return ret;
1077}
1078
1079/* power down chip */
1080static int alc5632_remove(struct snd_soc_codec *codec)
1081{
1082 alc5632_set_bias_level(codec, SND_SOC_BIAS_OFF);
1083 return 0;
1084}
1085
1086static struct snd_soc_codec_driver soc_codec_device_alc5632 = {
1087 .probe = alc5632_probe,
1088 .remove = alc5632_remove,
1089 .suspend = alc5632_suspend,
1090 .resume = alc5632_resume,
1091 .set_bias_level = alc5632_set_bias_level,
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001092 .controls = alc5632_snd_controls,
1093 .num_controls = ARRAY_SIZE(alc5632_snd_controls),
1094 .dapm_widgets = alc5632_dapm_widgets,
1095 .num_dapm_widgets = ARRAY_SIZE(alc5632_dapm_widgets),
1096 .dapm_routes = alc5632_dapm_routes,
1097 .num_dapm_routes = ARRAY_SIZE(alc5632_dapm_routes),
1098};
1099
Leon Romanovskybb397532011-11-16 12:06:58 +02001100static struct regmap_config alc5632_regmap = {
1101 .reg_bits = 8,
1102 .val_bits = 16,
1103
1104 .max_register = ALC5632_MAX_REGISTER,
1105 .reg_defaults = alc5632_reg_defaults,
1106 .num_reg_defaults = ARRAY_SIZE(alc5632_reg_defaults),
1107 .volatile_reg = alc5632_volatile_register,
1108 .cache_type = REGCACHE_RBTREE,
1109};
1110
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001111/*
1112 * alc5632 2 wire address is determined by A1 pin
1113 * state during powerup.
1114 * low = 0x1a
1115 * high = 0x1b
1116 */
Leon Romanovskybb397532011-11-16 12:06:58 +02001117static __devinit int alc5632_i2c_probe(struct i2c_client *client,
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001118 const struct i2c_device_id *id)
1119{
1120 struct alc5632_priv *alc5632;
Leon Romanovsky277c01b2011-11-17 12:01:30 +02001121 int ret, ret1, ret2;
1122 unsigned int vid1, vid2;
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001123
1124 alc5632 = devm_kzalloc(&client->dev,
1125 sizeof(struct alc5632_priv), GFP_KERNEL);
1126 if (alc5632 == NULL)
1127 return -ENOMEM;
1128
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001129 i2c_set_clientdata(client, alc5632);
Leon Romanovskybb397532011-11-16 12:06:58 +02001130
1131 alc5632->regmap = regmap_init_i2c(client, &alc5632_regmap);
1132 if (IS_ERR(alc5632->regmap)) {
1133 ret = PTR_ERR(alc5632->regmap);
1134 dev_err(&client->dev, "regmap_init() failed: %d\n", ret);
1135 return ret;
1136 }
1137
Leon Romanovsky277c01b2011-11-17 12:01:30 +02001138 ret1 = regmap_read(alc5632->regmap, ALC5632_VENDOR_ID1, &vid1);
1139 ret2 = regmap_read(alc5632->regmap, ALC5632_VENDOR_ID2, &vid2);
1140 if (ret1 != 0 || ret2 != 0) {
1141 dev_err(&client->dev,
1142 "Failed to read chip ID: ret1=%d, ret2=%d\n", ret1, ret2);
1143 regmap_exit(alc5632->regmap);
1144 return -EIO;
1145 }
1146
1147 vid2 >>= 8;
1148
1149 if ((vid1 != 0x10EC) || (vid2 != id->driver_data)) {
1150 dev_err(&client->dev,
1151 "Device is not a ALC5632: VID1=0x%x, VID2=0x%x\n", vid1, vid2);
1152 regmap_exit(alc5632->regmap);
1153 return -EINVAL;
1154 }
1155
Leon Romanovskybb397532011-11-16 12:06:58 +02001156 ret = alc5632_reset(alc5632->regmap);
1157 if (ret < 0) {
1158 dev_err(&client->dev, "Failed to issue reset\n");
1159 regmap_exit(alc5632->regmap);
1160 return ret;
1161 }
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001162
Leon Romanovsky277c01b2011-11-17 12:01:30 +02001163 alc5632->id = vid2;
1164 switch (alc5632->id) {
1165 case 0x5c:
1166 alc5632_dai.name = "alc5632-hifi";
1167 break;
1168 default:
1169 return -EINVAL;
1170 }
1171
1172 ret = snd_soc_register_codec(&client->dev,
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001173 &soc_codec_device_alc5632, &alc5632_dai, 1);
Leon Romanovskybb397532011-11-16 12:06:58 +02001174
1175 if (ret < 0) {
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001176 dev_err(&client->dev, "Failed to register codec: %d\n", ret);
Leon Romanovskybb397532011-11-16 12:06:58 +02001177 regmap_exit(alc5632->regmap);
1178 return ret;
1179 }
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001180
1181 return ret;
1182}
1183
Axel Lin5091f5b2012-01-23 11:18:17 +08001184static __devexit int alc5632_i2c_remove(struct i2c_client *client)
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001185{
Leon Romanovskybb397532011-11-16 12:06:58 +02001186 struct alc5632_priv *alc5632 = i2c_get_clientdata(client);
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001187 snd_soc_unregister_codec(&client->dev);
Leon Romanovskybb397532011-11-16 12:06:58 +02001188 regmap_exit(alc5632->regmap);
Leon Romanovsky94d5f7c2011-11-05 12:38:02 +02001189 return 0;
1190}
1191
1192static const struct i2c_device_id alc5632_i2c_table[] = {
1193 {"alc5632", 0x5c},
1194 {}
1195};
1196MODULE_DEVICE_TABLE(i2c, alc5632_i2c_table);
1197
1198/* i2c codec control layer */
1199static struct i2c_driver alc5632_i2c_driver = {
1200 .driver = {
1201 .name = "alc5632",
1202 .owner = THIS_MODULE,
1203 },
1204 .probe = alc5632_i2c_probe,
1205 .remove = __devexit_p(alc5632_i2c_remove),
1206 .id_table = alc5632_i2c_table,
1207};
1208
1209static int __init alc5632_modinit(void)
1210{
1211 int ret;
1212
1213 ret = i2c_add_driver(&alc5632_i2c_driver);
1214 if (ret != 0) {
1215 printk(KERN_ERR "%s: can't add i2c driver", __func__);
1216 return ret;
1217 }
1218
1219 return ret;
1220}
1221module_init(alc5632_modinit);
1222
1223static void __exit alc5632_modexit(void)
1224{
1225 i2c_del_driver(&alc5632_i2c_driver);
1226}
1227module_exit(alc5632_modexit);
1228
1229MODULE_DESCRIPTION("ASoC ALC5632 driver");
1230MODULE_AUTHOR("Leon Romanovsky <leon@leon.nu>");
1231MODULE_LICENSE("GPL");