10a1bf553SMark Brown /* 20a1bf553SMark Brown * wm8974.c -- WM8974 ALSA Soc Audio driver 30a1bf553SMark Brown * 48b83a193SMark Brown * Copyright 2006-2009 Wolfson Microelectronics PLC. 50a1bf553SMark Brown * 69a185b9aSMark Brown * Author: Liam Girdwood <Liam.Girdwood@wolfsonmicro.com> 70a1bf553SMark Brown * 80a1bf553SMark Brown * This program is free software; you can redistribute it and/or modify 90a1bf553SMark Brown * it under the terms of the GNU General Public License version 2 as 100a1bf553SMark Brown * published by the Free Software Foundation. 110a1bf553SMark Brown */ 120a1bf553SMark Brown 130a1bf553SMark Brown #include <linux/module.h> 140a1bf553SMark Brown #include <linux/moduleparam.h> 150a1bf553SMark Brown #include <linux/kernel.h> 160a1bf553SMark Brown #include <linux/init.h> 170a1bf553SMark Brown #include <linux/delay.h> 180a1bf553SMark Brown #include <linux/pm.h> 190a1bf553SMark Brown #include <linux/i2c.h> 20e40e0b5dSMark Brown #include <linux/regmap.h> 215a0e3ad6STejun Heo #include <linux/slab.h> 220a1bf553SMark Brown #include <sound/core.h> 230a1bf553SMark Brown #include <sound/pcm.h> 240a1bf553SMark Brown #include <sound/pcm_params.h> 250a1bf553SMark Brown #include <sound/soc.h> 260a1bf553SMark Brown #include <sound/initval.h> 27a5f8d2f1SMark Brown #include <sound/tlv.h> 280a1bf553SMark Brown 290a1bf553SMark Brown #include "wm8974.h" 300a1bf553SMark Brown 31e40e0b5dSMark Brown static const struct reg_default wm8974_reg_defaults[] = { 32e40e0b5dSMark Brown { 0, 0x0000 }, { 1, 0x0000 }, { 2, 0x0000 }, { 3, 0x0000 }, 33e40e0b5dSMark Brown { 4, 0x0050 }, { 5, 0x0000 }, { 6, 0x0140 }, { 7, 0x0000 }, 34e40e0b5dSMark Brown { 8, 0x0000 }, { 9, 0x0000 }, { 10, 0x0000 }, { 11, 0x00ff }, 35e40e0b5dSMark Brown { 12, 0x0000 }, { 13, 0x0000 }, { 14, 0x0100 }, { 15, 0x00ff }, 36e40e0b5dSMark Brown { 16, 0x0000 }, { 17, 0x0000 }, { 18, 0x012c }, { 19, 0x002c }, 37e40e0b5dSMark Brown { 20, 0x002c }, { 21, 0x002c }, { 22, 0x002c }, { 23, 0x0000 }, 38e40e0b5dSMark Brown { 24, 0x0032 }, { 25, 0x0000 }, { 26, 0x0000 }, { 27, 0x0000 }, 39e40e0b5dSMark Brown { 28, 0x0000 }, { 29, 0x0000 }, { 30, 0x0000 }, { 31, 0x0000 }, 40e40e0b5dSMark Brown { 32, 0x0038 }, { 33, 0x000b }, { 34, 0x0032 }, { 35, 0x0000 }, 41e40e0b5dSMark Brown { 36, 0x0008 }, { 37, 0x000c }, { 38, 0x0093 }, { 39, 0x00e9 }, 42e40e0b5dSMark Brown { 40, 0x0000 }, { 41, 0x0000 }, { 42, 0x0000 }, { 43, 0x0000 }, 43e40e0b5dSMark Brown { 44, 0x0003 }, { 45, 0x0010 }, { 46, 0x0000 }, { 47, 0x0000 }, 44e40e0b5dSMark Brown { 48, 0x0000 }, { 49, 0x0002 }, { 50, 0x0000 }, { 51, 0x0000 }, 45e40e0b5dSMark Brown { 52, 0x0000 }, { 53, 0x0000 }, { 54, 0x0039 }, { 55, 0x0000 }, 46e40e0b5dSMark Brown { 56, 0x0000 }, 470a1bf553SMark Brown }; 480a1bf553SMark Brown 49df1ef7a3SMark Brown #define WM8974_POWER1_BIASEN 0x08 5048c03ce7SGuennadi Liakhovetski #define WM8974_POWER1_BUFIOEN 0x04 51df1ef7a3SMark Brown 521e97f50bSMark Brown #define wm8974_reset(c) snd_soc_write(c, WM8974_RESET, 0) 530a1bf553SMark Brown 540a1bf553SMark Brown static const char *wm8974_companding[] = {"Off", "NC", "u-law", "A-law" }; 550a1bf553SMark Brown static const char *wm8974_deemp[] = {"None", "32kHz", "44.1kHz", "48kHz" }; 560a1bf553SMark Brown static const char *wm8974_eqmode[] = {"Capture", "Playback" }; 570a1bf553SMark Brown static const char *wm8974_bw[] = {"Narrow", "Wide" }; 580a1bf553SMark Brown static const char *wm8974_eq1[] = {"80Hz", "105Hz", "135Hz", "175Hz" }; 590a1bf553SMark Brown static const char *wm8974_eq2[] = {"230Hz", "300Hz", "385Hz", "500Hz" }; 600a1bf553SMark Brown static const char *wm8974_eq3[] = {"650Hz", "850Hz", "1.1kHz", "1.4kHz" }; 610a1bf553SMark Brown static const char *wm8974_eq4[] = {"1.8kHz", "2.4kHz", "3.2kHz", "4.1kHz" }; 620a1bf553SMark Brown static const char *wm8974_eq5[] = {"5.3kHz", "6.9kHz", "9kHz", "11.7kHz" }; 630a1bf553SMark Brown static const char *wm8974_alc[] = {"ALC", "Limiter" }; 640a1bf553SMark Brown 650a1bf553SMark Brown static const struct soc_enum wm8974_enum[] = { 660a1bf553SMark Brown SOC_ENUM_SINGLE(WM8974_COMP, 1, 4, wm8974_companding), /* adc */ 670a1bf553SMark Brown SOC_ENUM_SINGLE(WM8974_COMP, 3, 4, wm8974_companding), /* dac */ 680a1bf553SMark Brown SOC_ENUM_SINGLE(WM8974_DAC, 4, 4, wm8974_deemp), 690a1bf553SMark Brown SOC_ENUM_SINGLE(WM8974_EQ1, 8, 2, wm8974_eqmode), 700a1bf553SMark Brown 710a1bf553SMark Brown SOC_ENUM_SINGLE(WM8974_EQ1, 5, 4, wm8974_eq1), 720a1bf553SMark Brown SOC_ENUM_SINGLE(WM8974_EQ2, 8, 2, wm8974_bw), 730a1bf553SMark Brown SOC_ENUM_SINGLE(WM8974_EQ2, 5, 4, wm8974_eq2), 740a1bf553SMark Brown SOC_ENUM_SINGLE(WM8974_EQ3, 8, 2, wm8974_bw), 750a1bf553SMark Brown 760a1bf553SMark Brown SOC_ENUM_SINGLE(WM8974_EQ3, 5, 4, wm8974_eq3), 770a1bf553SMark Brown SOC_ENUM_SINGLE(WM8974_EQ4, 8, 2, wm8974_bw), 780a1bf553SMark Brown SOC_ENUM_SINGLE(WM8974_EQ4, 5, 4, wm8974_eq4), 790a1bf553SMark Brown SOC_ENUM_SINGLE(WM8974_EQ5, 8, 2, wm8974_bw), 800a1bf553SMark Brown 810a1bf553SMark Brown SOC_ENUM_SINGLE(WM8974_EQ5, 5, 4, wm8974_eq5), 820a1bf553SMark Brown SOC_ENUM_SINGLE(WM8974_ALC3, 8, 2, wm8974_alc), 830a1bf553SMark Brown }; 840a1bf553SMark Brown 858a123ee2SMark Brown static const char *wm8974_auxmode_text[] = { "Buffer", "Mixer" }; 868a123ee2SMark Brown 87de461bd2STakashi Iwai static SOC_ENUM_SINGLE_DECL(wm8974_auxmode, 88de461bd2STakashi Iwai WM8974_INPUT, 3, wm8974_auxmode_text); 898a123ee2SMark Brown 90a5f8d2f1SMark Brown static const DECLARE_TLV_DB_SCALE(digital_tlv, -12750, 50, 1); 91a5f8d2f1SMark Brown static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); 92a5f8d2f1SMark Brown static const DECLARE_TLV_DB_SCALE(inpga_tlv, -1200, 75, 0); 93a5f8d2f1SMark Brown static const DECLARE_TLV_DB_SCALE(spk_tlv, -5700, 100, 0); 94a5f8d2f1SMark Brown 950a1bf553SMark Brown static const struct snd_kcontrol_new wm8974_snd_controls[] = { 960a1bf553SMark Brown 970a1bf553SMark Brown SOC_SINGLE("Digital Loopback Switch", WM8974_COMP, 0, 1, 0), 980a1bf553SMark Brown 990a1bf553SMark Brown SOC_ENUM("DAC Companding", wm8974_enum[1]), 1000a1bf553SMark Brown SOC_ENUM("ADC Companding", wm8974_enum[0]), 1010a1bf553SMark Brown 1020a1bf553SMark Brown SOC_ENUM("Playback De-emphasis", wm8974_enum[2]), 1030a1bf553SMark Brown SOC_SINGLE("DAC Inversion Switch", WM8974_DAC, 0, 1, 0), 1040a1bf553SMark Brown 105a5f8d2f1SMark Brown SOC_SINGLE_TLV("PCM Volume", WM8974_DACVOL, 0, 255, 0, digital_tlv), 1060a1bf553SMark Brown 1070a1bf553SMark Brown SOC_SINGLE("High Pass Filter Switch", WM8974_ADC, 8, 1, 0), 1080a1bf553SMark Brown SOC_SINGLE("High Pass Cut Off", WM8974_ADC, 4, 7, 0), 10925cbf465Sjavier Martin SOC_SINGLE("ADC Inversion Switch", WM8974_ADC, 0, 1, 0), 1100a1bf553SMark Brown 111a5f8d2f1SMark Brown SOC_SINGLE_TLV("Capture Volume", WM8974_ADCVOL, 0, 255, 0, digital_tlv), 1120a1bf553SMark Brown 1130a1bf553SMark Brown SOC_ENUM("Equaliser Function", wm8974_enum[3]), 1140a1bf553SMark Brown SOC_ENUM("EQ1 Cut Off", wm8974_enum[4]), 115a5f8d2f1SMark Brown SOC_SINGLE_TLV("EQ1 Volume", WM8974_EQ1, 0, 24, 1, eq_tlv), 1160a1bf553SMark Brown 117c46d5c04SMasanari Iida SOC_ENUM("Equaliser EQ2 Bandwidth", wm8974_enum[5]), 1180a1bf553SMark Brown SOC_ENUM("EQ2 Cut Off", wm8974_enum[6]), 119a5f8d2f1SMark Brown SOC_SINGLE_TLV("EQ2 Volume", WM8974_EQ2, 0, 24, 1, eq_tlv), 1200a1bf553SMark Brown 121c46d5c04SMasanari Iida SOC_ENUM("Equaliser EQ3 Bandwidth", wm8974_enum[7]), 1220a1bf553SMark Brown SOC_ENUM("EQ3 Cut Off", wm8974_enum[8]), 123a5f8d2f1SMark Brown SOC_SINGLE_TLV("EQ3 Volume", WM8974_EQ3, 0, 24, 1, eq_tlv), 1240a1bf553SMark Brown 125c46d5c04SMasanari Iida SOC_ENUM("Equaliser EQ4 Bandwidth", wm8974_enum[9]), 1260a1bf553SMark Brown SOC_ENUM("EQ4 Cut Off", wm8974_enum[10]), 127a5f8d2f1SMark Brown SOC_SINGLE_TLV("EQ4 Volume", WM8974_EQ4, 0, 24, 1, eq_tlv), 1280a1bf553SMark Brown 129a895d57dSMasanari Iida SOC_ENUM("Equaliser EQ5 Bandwidth", wm8974_enum[11]), 1300a1bf553SMark Brown SOC_ENUM("EQ5 Cut Off", wm8974_enum[12]), 131a5f8d2f1SMark Brown SOC_SINGLE_TLV("EQ5 Volume", WM8974_EQ5, 0, 24, 1, eq_tlv), 1320a1bf553SMark Brown 1330a1bf553SMark Brown SOC_SINGLE("DAC Playback Limiter Switch", WM8974_DACLIM1, 8, 1, 0), 1340a1bf553SMark Brown SOC_SINGLE("DAC Playback Limiter Decay", WM8974_DACLIM1, 4, 15, 0), 1350a1bf553SMark Brown SOC_SINGLE("DAC Playback Limiter Attack", WM8974_DACLIM1, 0, 15, 0), 1360a1bf553SMark Brown 1370a1bf553SMark Brown SOC_SINGLE("DAC Playback Limiter Threshold", WM8974_DACLIM2, 4, 7, 0), 1380a1bf553SMark Brown SOC_SINGLE("DAC Playback Limiter Boost", WM8974_DACLIM2, 0, 15, 0), 1390a1bf553SMark Brown 1400a1bf553SMark Brown SOC_SINGLE("ALC Enable Switch", WM8974_ALC1, 8, 1, 0), 1410a1bf553SMark Brown SOC_SINGLE("ALC Capture Max Gain", WM8974_ALC1, 3, 7, 0), 1420a1bf553SMark Brown SOC_SINGLE("ALC Capture Min Gain", WM8974_ALC1, 0, 7, 0), 1430a1bf553SMark Brown 1440a1bf553SMark Brown SOC_SINGLE("ALC Capture ZC Switch", WM8974_ALC2, 8, 1, 0), 1450a1bf553SMark Brown SOC_SINGLE("ALC Capture Hold", WM8974_ALC2, 4, 7, 0), 1460a1bf553SMark Brown SOC_SINGLE("ALC Capture Target", WM8974_ALC2, 0, 15, 0), 1470a1bf553SMark Brown 1480a1bf553SMark Brown SOC_ENUM("ALC Capture Mode", wm8974_enum[13]), 1490a1bf553SMark Brown SOC_SINGLE("ALC Capture Decay", WM8974_ALC3, 4, 15, 0), 1500a1bf553SMark Brown SOC_SINGLE("ALC Capture Attack", WM8974_ALC3, 0, 15, 0), 1510a1bf553SMark Brown 1520a1bf553SMark Brown SOC_SINGLE("ALC Capture Noise Gate Switch", WM8974_NGATE, 3, 1, 0), 1530a1bf553SMark Brown SOC_SINGLE("ALC Capture Noise Gate Threshold", WM8974_NGATE, 0, 7, 0), 1540a1bf553SMark Brown 1550a1bf553SMark Brown SOC_SINGLE("Capture PGA ZC Switch", WM8974_INPPGA, 7, 1, 0), 156a5f8d2f1SMark Brown SOC_SINGLE_TLV("Capture PGA Volume", WM8974_INPPGA, 0, 63, 0, inpga_tlv), 1570a1bf553SMark Brown 1580a1bf553SMark Brown SOC_SINGLE("Speaker Playback ZC Switch", WM8974_SPKVOL, 7, 1, 0), 1590a1bf553SMark Brown SOC_SINGLE("Speaker Playback Switch", WM8974_SPKVOL, 6, 1, 1), 1608a123ee2SMark Brown SOC_SINGLE_TLV("Speaker Playback Volume", WM8974_SPKVOL, 0, 63, 0, spk_tlv), 1618a123ee2SMark Brown 1628a123ee2SMark Brown SOC_ENUM("Aux Mode", wm8974_auxmode), 1630a1bf553SMark Brown 1640a1bf553SMark Brown SOC_SINGLE("Capture Boost(+20dB)", WM8974_ADCBOOST, 8, 1, 0), 1658a123ee2SMark Brown SOC_SINGLE("Mono Playback Switch", WM8974_MONOMIX, 6, 1, 1), 166b2c3e923SGuennadi Liakhovetski 167b2c3e923SGuennadi Liakhovetski /* DAC / ADC oversampling */ 168b2c3e923SGuennadi Liakhovetski SOC_SINGLE("DAC 128x Oversampling Switch", WM8974_DAC, 8, 1, 0), 169b2c3e923SGuennadi Liakhovetski SOC_SINGLE("ADC 128x Oversampling Switch", WM8974_ADC, 8, 1, 0), 1700a1bf553SMark Brown }; 1710a1bf553SMark Brown 1720a1bf553SMark Brown /* Speaker Output Mixer */ 1730a1bf553SMark Brown static const struct snd_kcontrol_new wm8974_speaker_mixer_controls[] = { 1740a1bf553SMark Brown SOC_DAPM_SINGLE("Line Bypass Switch", WM8974_SPKMIX, 1, 1, 0), 1750a1bf553SMark Brown SOC_DAPM_SINGLE("Aux Playback Switch", WM8974_SPKMIX, 5, 1, 0), 176759512fbSMark Brown SOC_DAPM_SINGLE("PCM Playback Switch", WM8974_SPKMIX, 0, 1, 0), 1770a1bf553SMark Brown }; 1780a1bf553SMark Brown 1790a1bf553SMark Brown /* Mono Output Mixer */ 1800a1bf553SMark Brown static const struct snd_kcontrol_new wm8974_mono_mixer_controls[] = { 1810a1bf553SMark Brown SOC_DAPM_SINGLE("Line Bypass Switch", WM8974_MONOMIX, 1, 1, 0), 1820a1bf553SMark Brown SOC_DAPM_SINGLE("Aux Playback Switch", WM8974_MONOMIX, 2, 1, 0), 1838a123ee2SMark Brown SOC_DAPM_SINGLE("PCM Playback Switch", WM8974_MONOMIX, 0, 1, 0), 1848a123ee2SMark Brown }; 1858a123ee2SMark Brown 1868a123ee2SMark Brown /* Boost mixer */ 1878a123ee2SMark Brown static const struct snd_kcontrol_new wm8974_boost_mixer[] = { 1888a123ee2SMark Brown SOC_DAPM_SINGLE("Aux Switch", WM8974_INPPGA, 6, 1, 0), 1898a123ee2SMark Brown }; 1908a123ee2SMark Brown 1918a123ee2SMark Brown /* Input PGA */ 1928a123ee2SMark Brown static const struct snd_kcontrol_new wm8974_inpga[] = { 1938a123ee2SMark Brown SOC_DAPM_SINGLE("Aux Switch", WM8974_INPUT, 2, 1, 0), 1948a123ee2SMark Brown SOC_DAPM_SINGLE("MicN Switch", WM8974_INPUT, 1, 1, 0), 1958a123ee2SMark Brown SOC_DAPM_SINGLE("MicP Switch", WM8974_INPUT, 0, 1, 0), 1960a1bf553SMark Brown }; 1970a1bf553SMark Brown 1980a1bf553SMark Brown /* AUX Input boost vol */ 1990a1bf553SMark Brown static const struct snd_kcontrol_new wm8974_aux_boost_controls = 2000a1bf553SMark Brown SOC_DAPM_SINGLE("Aux Volume", WM8974_ADCBOOST, 0, 7, 0); 2010a1bf553SMark Brown 2020a1bf553SMark Brown /* Mic Input boost vol */ 2030a1bf553SMark Brown static const struct snd_kcontrol_new wm8974_mic_boost_controls = 2040a1bf553SMark Brown SOC_DAPM_SINGLE("Mic Volume", WM8974_ADCBOOST, 4, 7, 0); 2050a1bf553SMark Brown 2060a1bf553SMark Brown static const struct snd_soc_dapm_widget wm8974_dapm_widgets[] = { 2070a1bf553SMark Brown SND_SOC_DAPM_MIXER("Speaker Mixer", WM8974_POWER3, 2, 0, 2080a1bf553SMark Brown &wm8974_speaker_mixer_controls[0], 2090a1bf553SMark Brown ARRAY_SIZE(wm8974_speaker_mixer_controls)), 2100a1bf553SMark Brown SND_SOC_DAPM_MIXER("Mono Mixer", WM8974_POWER3, 3, 0, 2110a1bf553SMark Brown &wm8974_mono_mixer_controls[0], 2120a1bf553SMark Brown ARRAY_SIZE(wm8974_mono_mixer_controls)), 2130a1bf553SMark Brown SND_SOC_DAPM_DAC("DAC", "HiFi Playback", WM8974_POWER3, 0, 0), 2148a123ee2SMark Brown SND_SOC_DAPM_ADC("ADC", "HiFi Capture", WM8974_POWER2, 0, 0), 2150a1bf553SMark Brown SND_SOC_DAPM_PGA("Aux Input", WM8974_POWER1, 6, 0, NULL, 0), 2160a1bf553SMark Brown SND_SOC_DAPM_PGA("SpkN Out", WM8974_POWER3, 5, 0, NULL, 0), 2170a1bf553SMark Brown SND_SOC_DAPM_PGA("SpkP Out", WM8974_POWER3, 6, 0, NULL, 0), 2180a1bf553SMark Brown SND_SOC_DAPM_PGA("Mono Out", WM8974_POWER3, 7, 0, NULL, 0), 2190a1bf553SMark Brown 2208a123ee2SMark Brown SND_SOC_DAPM_MIXER("Input PGA", WM8974_POWER2, 2, 0, wm8974_inpga, 2218a123ee2SMark Brown ARRAY_SIZE(wm8974_inpga)), 2228a123ee2SMark Brown SND_SOC_DAPM_MIXER("Boost Mixer", WM8974_POWER2, 4, 0, 2238a123ee2SMark Brown wm8974_boost_mixer, ARRAY_SIZE(wm8974_boost_mixer)), 2240a1bf553SMark Brown 22548dd231bSMark Brown SND_SOC_DAPM_SUPPLY("Mic Bias", WM8974_POWER1, 4, 0, NULL, 0), 2260a1bf553SMark Brown 2270a1bf553SMark Brown SND_SOC_DAPM_INPUT("MICN"), 2280a1bf553SMark Brown SND_SOC_DAPM_INPUT("MICP"), 2290a1bf553SMark Brown SND_SOC_DAPM_INPUT("AUX"), 2300a1bf553SMark Brown SND_SOC_DAPM_OUTPUT("MONOOUT"), 2310a1bf553SMark Brown SND_SOC_DAPM_OUTPUT("SPKOUTP"), 2320a1bf553SMark Brown SND_SOC_DAPM_OUTPUT("SPKOUTN"), 2330a1bf553SMark Brown }; 2340a1bf553SMark Brown 235a2bd691cSMark Brown static const struct snd_soc_dapm_route wm8974_dapm_routes[] = { 2360a1bf553SMark Brown /* Mono output mixer */ 2370a1bf553SMark Brown {"Mono Mixer", "PCM Playback Switch", "DAC"}, 2380a1bf553SMark Brown {"Mono Mixer", "Aux Playback Switch", "Aux Input"}, 2390a1bf553SMark Brown {"Mono Mixer", "Line Bypass Switch", "Boost Mixer"}, 2400a1bf553SMark Brown 2410a1bf553SMark Brown /* Speaker output mixer */ 2420a1bf553SMark Brown {"Speaker Mixer", "PCM Playback Switch", "DAC"}, 2430a1bf553SMark Brown {"Speaker Mixer", "Aux Playback Switch", "Aux Input"}, 2440a1bf553SMark Brown {"Speaker Mixer", "Line Bypass Switch", "Boost Mixer"}, 2450a1bf553SMark Brown 2460a1bf553SMark Brown /* Outputs */ 2470a1bf553SMark Brown {"Mono Out", NULL, "Mono Mixer"}, 2480a1bf553SMark Brown {"MONOOUT", NULL, "Mono Out"}, 2490a1bf553SMark Brown {"SpkN Out", NULL, "Speaker Mixer"}, 2500a1bf553SMark Brown {"SpkP Out", NULL, "Speaker Mixer"}, 2510a1bf553SMark Brown {"SPKOUTN", NULL, "SpkN Out"}, 2520a1bf553SMark Brown {"SPKOUTP", NULL, "SpkP Out"}, 2530a1bf553SMark Brown 2540a1bf553SMark Brown /* Boost Mixer */ 2558a123ee2SMark Brown {"ADC", NULL, "Boost Mixer"}, 2568a123ee2SMark Brown {"Boost Mixer", "Aux Switch", "Aux Input"}, 2578a123ee2SMark Brown {"Boost Mixer", NULL, "Input PGA"}, 2588a123ee2SMark Brown {"Boost Mixer", NULL, "MICP"}, 2598a123ee2SMark Brown 2608a123ee2SMark Brown /* Input PGA */ 2618a123ee2SMark Brown {"Input PGA", "Aux Switch", "Aux Input"}, 2628a123ee2SMark Brown {"Input PGA", "MicN Switch", "MICN"}, 2638a123ee2SMark Brown {"Input PGA", "MicP Switch", "MICP"}, 2640a1bf553SMark Brown 2650a1bf553SMark Brown /* Inputs */ 2668a123ee2SMark Brown {"Aux Input", NULL, "AUX"}, 2670a1bf553SMark Brown }; 2680a1bf553SMark Brown 2690a1bf553SMark Brown struct pll_ { 270c36b2fc7SMark Brown unsigned int pre_div:1; 2710a1bf553SMark Brown unsigned int n:4; 2720a1bf553SMark Brown unsigned int k; 2730a1bf553SMark Brown }; 2740a1bf553SMark Brown 27591d0c3ecSMark Brown /* The size in bits of the pll divide multiplied by 10 27691d0c3ecSMark Brown * to allow rounding later */ 27791d0c3ecSMark Brown #define FIXED_PLL_SIZE ((1 << 24) * 10) 27891d0c3ecSMark Brown 279c36b2fc7SMark Brown static void pll_factors(struct pll_ *pll_div, 280c36b2fc7SMark Brown unsigned int target, unsigned int source) 28191d0c3ecSMark Brown { 28291d0c3ecSMark Brown unsigned long long Kpart; 28391d0c3ecSMark Brown unsigned int K, Ndiv, Nmod; 28491d0c3ecSMark Brown 285c36b2fc7SMark Brown /* There is a fixed divide by 4 in the output path */ 286c36b2fc7SMark Brown target *= 4; 287c36b2fc7SMark Brown 28891d0c3ecSMark Brown Ndiv = target / source; 28991d0c3ecSMark Brown if (Ndiv < 6) { 290c36b2fc7SMark Brown source /= 2; 291c36b2fc7SMark Brown pll_div->pre_div = 1; 29291d0c3ecSMark Brown Ndiv = target / source; 29391d0c3ecSMark Brown } else 294c36b2fc7SMark Brown pll_div->pre_div = 0; 29591d0c3ecSMark Brown 29691d0c3ecSMark Brown if ((Ndiv < 6) || (Ndiv > 12)) 29791d0c3ecSMark Brown printk(KERN_WARNING 2988b83a193SMark Brown "WM8974 N value %u outwith recommended range!\n", 29991d0c3ecSMark Brown Ndiv); 30091d0c3ecSMark Brown 301c36b2fc7SMark Brown pll_div->n = Ndiv; 30291d0c3ecSMark Brown Nmod = target % source; 30391d0c3ecSMark Brown Kpart = FIXED_PLL_SIZE * (long long)Nmod; 30491d0c3ecSMark Brown 30591d0c3ecSMark Brown do_div(Kpart, source); 30691d0c3ecSMark Brown 30791d0c3ecSMark Brown K = Kpart & 0xFFFFFFFF; 30891d0c3ecSMark Brown 30991d0c3ecSMark Brown /* Check if we need to round */ 31091d0c3ecSMark Brown if ((K % 10) >= 5) 31191d0c3ecSMark Brown K += 5; 31291d0c3ecSMark Brown 31391d0c3ecSMark Brown /* Move down to proper range now rounding is done */ 31491d0c3ecSMark Brown K /= 10; 31591d0c3ecSMark Brown 316c36b2fc7SMark Brown pll_div->k = K; 31791d0c3ecSMark Brown } 3180a1bf553SMark Brown 31985488037SMark Brown static int wm8974_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, 32085488037SMark Brown int source, unsigned int freq_in, unsigned int freq_out) 3210a1bf553SMark Brown { 3220a1bf553SMark Brown struct snd_soc_codec *codec = codec_dai->codec; 323c36b2fc7SMark Brown struct pll_ pll_div; 3240a1bf553SMark Brown u16 reg; 3250a1bf553SMark Brown 3260a1bf553SMark Brown if (freq_in == 0 || freq_out == 0) { 32791d0c3ecSMark Brown /* Clock CODEC directly from MCLK */ 3281e97f50bSMark Brown reg = snd_soc_read(codec, WM8974_CLOCK); 3291e97f50bSMark Brown snd_soc_write(codec, WM8974_CLOCK, reg & 0x0ff); 33091d0c3ecSMark Brown 33191d0c3ecSMark Brown /* Turn off PLL */ 3321e97f50bSMark Brown reg = snd_soc_read(codec, WM8974_POWER1); 3331e97f50bSMark Brown snd_soc_write(codec, WM8974_POWER1, reg & 0x1df); 3340a1bf553SMark Brown return 0; 3350a1bf553SMark Brown } 3360a1bf553SMark Brown 337c36b2fc7SMark Brown pll_factors(&pll_div, freq_out, freq_in); 33891d0c3ecSMark Brown 3391e97f50bSMark Brown snd_soc_write(codec, WM8974_PLLN, (pll_div.pre_div << 4) | pll_div.n); 3401e97f50bSMark Brown snd_soc_write(codec, WM8974_PLLK1, pll_div.k >> 18); 3411e97f50bSMark Brown snd_soc_write(codec, WM8974_PLLK2, (pll_div.k >> 9) & 0x1ff); 3421e97f50bSMark Brown snd_soc_write(codec, WM8974_PLLK3, pll_div.k & 0x1ff); 3431e97f50bSMark Brown reg = snd_soc_read(codec, WM8974_POWER1); 3441e97f50bSMark Brown snd_soc_write(codec, WM8974_POWER1, reg | 0x020); 3451a55b3f6SMark Brown 34691d0c3ecSMark Brown /* Run CODEC from PLL instead of MCLK */ 3471e97f50bSMark Brown reg = snd_soc_read(codec, WM8974_CLOCK); 3481e97f50bSMark Brown snd_soc_write(codec, WM8974_CLOCK, reg | 0x100); 34991d0c3ecSMark Brown 35091d0c3ecSMark Brown return 0; 3510a1bf553SMark Brown } 3520a1bf553SMark Brown 3530a1bf553SMark Brown /* 3540a1bf553SMark Brown * Configure WM8974 clock dividers. 3550a1bf553SMark Brown */ 3560a1bf553SMark Brown static int wm8974_set_dai_clkdiv(struct snd_soc_dai *codec_dai, 3570a1bf553SMark Brown int div_id, int div) 3580a1bf553SMark Brown { 3590a1bf553SMark Brown struct snd_soc_codec *codec = codec_dai->codec; 3600a1bf553SMark Brown u16 reg; 3610a1bf553SMark Brown 3620a1bf553SMark Brown switch (div_id) { 3630a1bf553SMark Brown case WM8974_OPCLKDIV: 3641e97f50bSMark Brown reg = snd_soc_read(codec, WM8974_GPIO) & 0x1cf; 3651e97f50bSMark Brown snd_soc_write(codec, WM8974_GPIO, reg | div); 3660a1bf553SMark Brown break; 3670a1bf553SMark Brown case WM8974_MCLKDIV: 3681e97f50bSMark Brown reg = snd_soc_read(codec, WM8974_CLOCK) & 0x11f; 3691e97f50bSMark Brown snd_soc_write(codec, WM8974_CLOCK, reg | div); 3700a1bf553SMark Brown break; 3710a1bf553SMark Brown case WM8974_BCLKDIV: 3721e97f50bSMark Brown reg = snd_soc_read(codec, WM8974_CLOCK) & 0x1e3; 3731e97f50bSMark Brown snd_soc_write(codec, WM8974_CLOCK, reg | div); 3740a1bf553SMark Brown break; 3750a1bf553SMark Brown default: 3760a1bf553SMark Brown return -EINVAL; 3770a1bf553SMark Brown } 3780a1bf553SMark Brown 3790a1bf553SMark Brown return 0; 3800a1bf553SMark Brown } 3810a1bf553SMark Brown 3820a1bf553SMark Brown static int wm8974_set_dai_fmt(struct snd_soc_dai *codec_dai, 3830a1bf553SMark Brown unsigned int fmt) 3840a1bf553SMark Brown { 3850a1bf553SMark Brown struct snd_soc_codec *codec = codec_dai->codec; 3860a1bf553SMark Brown u16 iface = 0; 3871e97f50bSMark Brown u16 clk = snd_soc_read(codec, WM8974_CLOCK) & 0x1fe; 3880a1bf553SMark Brown 3890a1bf553SMark Brown /* set master/slave audio interface */ 3900a1bf553SMark Brown switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 3910a1bf553SMark Brown case SND_SOC_DAIFMT_CBM_CFM: 3920a1bf553SMark Brown clk |= 0x0001; 3930a1bf553SMark Brown break; 3940a1bf553SMark Brown case SND_SOC_DAIFMT_CBS_CFS: 3950a1bf553SMark Brown break; 3960a1bf553SMark Brown default: 3970a1bf553SMark Brown return -EINVAL; 3980a1bf553SMark Brown } 3990a1bf553SMark Brown 4000a1bf553SMark Brown /* interface format */ 4010a1bf553SMark Brown switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 4020a1bf553SMark Brown case SND_SOC_DAIFMT_I2S: 4030a1bf553SMark Brown iface |= 0x0010; 4040a1bf553SMark Brown break; 4050a1bf553SMark Brown case SND_SOC_DAIFMT_RIGHT_J: 4060a1bf553SMark Brown break; 4070a1bf553SMark Brown case SND_SOC_DAIFMT_LEFT_J: 4080a1bf553SMark Brown iface |= 0x0008; 4090a1bf553SMark Brown break; 4100a1bf553SMark Brown case SND_SOC_DAIFMT_DSP_A: 4110a1bf553SMark Brown iface |= 0x00018; 4120a1bf553SMark Brown break; 4130a1bf553SMark Brown default: 4140a1bf553SMark Brown return -EINVAL; 4150a1bf553SMark Brown } 4160a1bf553SMark Brown 4170a1bf553SMark Brown /* clock inversion */ 4180a1bf553SMark Brown switch (fmt & SND_SOC_DAIFMT_INV_MASK) { 4190a1bf553SMark Brown case SND_SOC_DAIFMT_NB_NF: 4200a1bf553SMark Brown break; 4210a1bf553SMark Brown case SND_SOC_DAIFMT_IB_IF: 4220a1bf553SMark Brown iface |= 0x0180; 4230a1bf553SMark Brown break; 4240a1bf553SMark Brown case SND_SOC_DAIFMT_IB_NF: 4250a1bf553SMark Brown iface |= 0x0100; 4260a1bf553SMark Brown break; 4270a1bf553SMark Brown case SND_SOC_DAIFMT_NB_IF: 4280a1bf553SMark Brown iface |= 0x0080; 4290a1bf553SMark Brown break; 4300a1bf553SMark Brown default: 4310a1bf553SMark Brown return -EINVAL; 4320a1bf553SMark Brown } 4330a1bf553SMark Brown 4341e97f50bSMark Brown snd_soc_write(codec, WM8974_IFACE, iface); 4351e97f50bSMark Brown snd_soc_write(codec, WM8974_CLOCK, clk); 4360a1bf553SMark Brown return 0; 4370a1bf553SMark Brown } 4380a1bf553SMark Brown 4390a1bf553SMark Brown static int wm8974_pcm_hw_params(struct snd_pcm_substream *substream, 4400a1bf553SMark Brown struct snd_pcm_hw_params *params, 4410a1bf553SMark Brown struct snd_soc_dai *dai) 4420a1bf553SMark Brown { 4430a1bf553SMark Brown struct snd_soc_codec *codec = dai->codec; 4441e97f50bSMark Brown u16 iface = snd_soc_read(codec, WM8974_IFACE) & 0x19f; 4451e97f50bSMark Brown u16 adn = snd_soc_read(codec, WM8974_ADD) & 0x1f1; 4460a1bf553SMark Brown 4470a1bf553SMark Brown /* bit size */ 448*6afdc9a0SMark Brown switch (params_width(params)) { 449*6afdc9a0SMark Brown case 16: 4500a1bf553SMark Brown break; 451*6afdc9a0SMark Brown case 20: 4520a1bf553SMark Brown iface |= 0x0020; 4530a1bf553SMark Brown break; 454*6afdc9a0SMark Brown case 24: 4550a1bf553SMark Brown iface |= 0x0040; 4560a1bf553SMark Brown break; 457*6afdc9a0SMark Brown case 32: 4580a1bf553SMark Brown iface |= 0x0060; 4590a1bf553SMark Brown break; 4600a1bf553SMark Brown } 4610a1bf553SMark Brown 4620a1bf553SMark Brown /* filter coefficient */ 4630a1bf553SMark Brown switch (params_rate(params)) { 464b3172f22SGuennadi Liakhovetski case 8000: 4650a1bf553SMark Brown adn |= 0x5 << 1; 4660a1bf553SMark Brown break; 467b3172f22SGuennadi Liakhovetski case 11025: 4680a1bf553SMark Brown adn |= 0x4 << 1; 4690a1bf553SMark Brown break; 470b3172f22SGuennadi Liakhovetski case 16000: 4710a1bf553SMark Brown adn |= 0x3 << 1; 4720a1bf553SMark Brown break; 473b3172f22SGuennadi Liakhovetski case 22050: 4740a1bf553SMark Brown adn |= 0x2 << 1; 4750a1bf553SMark Brown break; 476b3172f22SGuennadi Liakhovetski case 32000: 4770a1bf553SMark Brown adn |= 0x1 << 1; 4780a1bf553SMark Brown break; 479b3172f22SGuennadi Liakhovetski case 44100: 480b3172f22SGuennadi Liakhovetski case 48000: 4810a1bf553SMark Brown break; 4820a1bf553SMark Brown } 4830a1bf553SMark Brown 4841e97f50bSMark Brown snd_soc_write(codec, WM8974_IFACE, iface); 4851e97f50bSMark Brown snd_soc_write(codec, WM8974_ADD, adn); 4860a1bf553SMark Brown return 0; 4870a1bf553SMark Brown } 4880a1bf553SMark Brown 4890a1bf553SMark Brown static int wm8974_mute(struct snd_soc_dai *dai, int mute) 4900a1bf553SMark Brown { 4910a1bf553SMark Brown struct snd_soc_codec *codec = dai->codec; 4921e97f50bSMark Brown u16 mute_reg = snd_soc_read(codec, WM8974_DAC) & 0xffbf; 4930a1bf553SMark Brown 4940a1bf553SMark Brown if (mute) 4951e97f50bSMark Brown snd_soc_write(codec, WM8974_DAC, mute_reg | 0x40); 4960a1bf553SMark Brown else 4971e97f50bSMark Brown snd_soc_write(codec, WM8974_DAC, mute_reg); 4980a1bf553SMark Brown return 0; 4990a1bf553SMark Brown } 5000a1bf553SMark Brown 5010a1bf553SMark Brown /* liam need to make this lower power with dapm */ 5020a1bf553SMark Brown static int wm8974_set_bias_level(struct snd_soc_codec *codec, 5030a1bf553SMark Brown enum snd_soc_bias_level level) 5040a1bf553SMark Brown { 5051e97f50bSMark Brown u16 power1 = snd_soc_read(codec, WM8974_POWER1) & ~0x3; 506df1ef7a3SMark Brown 5070a1bf553SMark Brown switch (level) { 5080a1bf553SMark Brown case SND_SOC_BIAS_ON: 5090a1bf553SMark Brown case SND_SOC_BIAS_PREPARE: 510df1ef7a3SMark Brown power1 |= 0x1; /* VMID 50k */ 5111e97f50bSMark Brown snd_soc_write(codec, WM8974_POWER1, power1); 5120a1bf553SMark Brown break; 513df1ef7a3SMark Brown 5140a1bf553SMark Brown case SND_SOC_BIAS_STANDBY: 515df1ef7a3SMark Brown power1 |= WM8974_POWER1_BIASEN | WM8974_POWER1_BUFIOEN; 516df1ef7a3SMark Brown 517ce6120ccSLiam Girdwood if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { 518e40e0b5dSMark Brown regcache_sync(dev_get_regmap(codec->dev, NULL)); 5190bad3d84SAxel Lin 520df1ef7a3SMark Brown /* Initial cap charge at VMID 5k */ 5211e97f50bSMark Brown snd_soc_write(codec, WM8974_POWER1, power1 | 0x3); 522df1ef7a3SMark Brown mdelay(100); 523df1ef7a3SMark Brown } 524df1ef7a3SMark Brown 525df1ef7a3SMark Brown power1 |= 0x2; /* VMID 500k */ 5261e97f50bSMark Brown snd_soc_write(codec, WM8974_POWER1, power1); 5270a1bf553SMark Brown break; 528df1ef7a3SMark Brown 5290a1bf553SMark Brown case SND_SOC_BIAS_OFF: 5301e97f50bSMark Brown snd_soc_write(codec, WM8974_POWER1, 0); 5311e97f50bSMark Brown snd_soc_write(codec, WM8974_POWER2, 0); 5321e97f50bSMark Brown snd_soc_write(codec, WM8974_POWER3, 0); 5330a1bf553SMark Brown break; 5340a1bf553SMark Brown } 535df1ef7a3SMark Brown 536ce6120ccSLiam Girdwood codec->dapm.bias_level = level; 5370a1bf553SMark Brown return 0; 5380a1bf553SMark Brown } 5390a1bf553SMark Brown 5401a55b3f6SMark Brown #define WM8974_RATES (SNDRV_PCM_RATE_8000_48000) 5410a1bf553SMark Brown 5420a1bf553SMark Brown #define WM8974_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 5430a1bf553SMark Brown SNDRV_PCM_FMTBIT_S24_LE) 5440a1bf553SMark Brown 54585e7652dSLars-Peter Clausen static const struct snd_soc_dai_ops wm8974_ops = { 5460a1bf553SMark Brown .hw_params = wm8974_pcm_hw_params, 5470a1bf553SMark Brown .digital_mute = wm8974_mute, 5480a1bf553SMark Brown .set_fmt = wm8974_set_dai_fmt, 5490a1bf553SMark Brown .set_clkdiv = wm8974_set_dai_clkdiv, 5500a1bf553SMark Brown .set_pll = wm8974_set_dai_pll, 5510a1bf553SMark Brown }; 5520a1bf553SMark Brown 553f0fba2adSLiam Girdwood static struct snd_soc_dai_driver wm8974_dai = { 554f0fba2adSLiam Girdwood .name = "wm8974-hifi", 5550a1bf553SMark Brown .playback = { 5560a1bf553SMark Brown .stream_name = "Playback", 5570a1bf553SMark Brown .channels_min = 1, 55833d81af4SMark Brown .channels_max = 2, /* Only 1 channel of data */ 5590a1bf553SMark Brown .rates = WM8974_RATES, 5600a1bf553SMark Brown .formats = WM8974_FORMATS,}, 5610a1bf553SMark Brown .capture = { 5620a1bf553SMark Brown .stream_name = "Capture", 5630a1bf553SMark Brown .channels_min = 1, 56433d81af4SMark Brown .channels_max = 2, /* Only 1 channel of data */ 5650a1bf553SMark Brown .rates = WM8974_RATES, 5660a1bf553SMark Brown .formats = WM8974_FORMATS,}, 5670a1bf553SMark Brown .ops = &wm8974_ops, 568cb11d39eSMark Brown .symmetric_rates = 1, 5690a1bf553SMark Brown }; 5700a1bf553SMark Brown 57184b315eeSLars-Peter Clausen static int wm8974_suspend(struct snd_soc_codec *codec) 5720a1bf553SMark Brown { 5730a1bf553SMark Brown wm8974_set_bias_level(codec, SND_SOC_BIAS_OFF); 5740a1bf553SMark Brown return 0; 5750a1bf553SMark Brown } 5760a1bf553SMark Brown 577f0fba2adSLiam Girdwood static int wm8974_resume(struct snd_soc_codec *codec) 5780a1bf553SMark Brown { 5790a1bf553SMark Brown wm8974_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 5800a1bf553SMark Brown return 0; 5810a1bf553SMark Brown } 5820a1bf553SMark Brown 583e40e0b5dSMark Brown static const struct regmap_config wm8974_regmap = { 584e40e0b5dSMark Brown .reg_bits = 7, 585e40e0b5dSMark Brown .val_bits = 9, 586e40e0b5dSMark Brown 587e40e0b5dSMark Brown .max_register = WM8974_MONOMIX, 588e40e0b5dSMark Brown .reg_defaults = wm8974_reg_defaults, 589e40e0b5dSMark Brown .num_reg_defaults = ARRAY_SIZE(wm8974_reg_defaults), 590e40e0b5dSMark Brown }; 591e40e0b5dSMark Brown 592f0fba2adSLiam Girdwood static int wm8974_probe(struct snd_soc_codec *codec) 5930a1bf553SMark Brown { 5940a1bf553SMark Brown int ret = 0; 5950a1bf553SMark Brown 596f0fba2adSLiam Girdwood ret = wm8974_reset(codec); 597f0fba2adSLiam Girdwood if (ret < 0) { 598f0fba2adSLiam Girdwood dev_err(codec->dev, "Failed to issue reset\n"); 599f0fba2adSLiam Girdwood return ret; 600f0fba2adSLiam Girdwood } 601f0fba2adSLiam Girdwood 602f0fba2adSLiam Girdwood wm8974_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 6034fcbbb67SMark Brown 6040a1bf553SMark Brown return ret; 6050a1bf553SMark Brown } 6060a1bf553SMark Brown 6070a1bf553SMark Brown /* power down chip */ 608f0fba2adSLiam Girdwood static int wm8974_remove(struct snd_soc_codec *codec) 6090a1bf553SMark Brown { 610f0fba2adSLiam Girdwood wm8974_set_bias_level(codec, SND_SOC_BIAS_OFF); 6110a1bf553SMark Brown return 0; 6120a1bf553SMark Brown } 6130a1bf553SMark Brown 614f0fba2adSLiam Girdwood static struct snd_soc_codec_driver soc_codec_dev_wm8974 = { 6150a1bf553SMark Brown .probe = wm8974_probe, 6160a1bf553SMark Brown .remove = wm8974_remove, 6170a1bf553SMark Brown .suspend = wm8974_suspend, 6180a1bf553SMark Brown .resume = wm8974_resume, 619f0fba2adSLiam Girdwood .set_bias_level = wm8974_set_bias_level, 620a2bd691cSMark Brown 621a2bd691cSMark Brown .controls = wm8974_snd_controls, 622a2bd691cSMark Brown .num_controls = ARRAY_SIZE(wm8974_snd_controls), 623a2bd691cSMark Brown .dapm_widgets = wm8974_dapm_widgets, 624a2bd691cSMark Brown .num_dapm_widgets = ARRAY_SIZE(wm8974_dapm_widgets), 625a2bd691cSMark Brown .dapm_routes = wm8974_dapm_routes, 626a2bd691cSMark Brown .num_dapm_routes = ARRAY_SIZE(wm8974_dapm_routes), 6270a1bf553SMark Brown }; 6280a1bf553SMark Brown 6297a79e94eSBill Pemberton static int wm8974_i2c_probe(struct i2c_client *i2c, 6304fcbbb67SMark Brown const struct i2c_device_id *id) 6314fcbbb67SMark Brown { 632e40e0b5dSMark Brown struct regmap *regmap; 633f0fba2adSLiam Girdwood int ret; 6344fcbbb67SMark Brown 635e40e0b5dSMark Brown regmap = devm_regmap_init_i2c(i2c, &wm8974_regmap); 636e40e0b5dSMark Brown if (IS_ERR(regmap)) 637e40e0b5dSMark Brown return PTR_ERR(regmap); 638e40e0b5dSMark Brown 639f0fba2adSLiam Girdwood ret = snd_soc_register_codec(&i2c->dev, 640f0fba2adSLiam Girdwood &soc_codec_dev_wm8974, &wm8974_dai, 1); 641c2562a8eSMark Brown 642f0fba2adSLiam Girdwood return ret; 6434fcbbb67SMark Brown } 6444fcbbb67SMark Brown 6457a79e94eSBill Pemberton static int wm8974_i2c_remove(struct i2c_client *client) 6464fcbbb67SMark Brown { 647f0fba2adSLiam Girdwood snd_soc_unregister_codec(&client->dev); 648c2562a8eSMark Brown 6494fcbbb67SMark Brown return 0; 6504fcbbb67SMark Brown } 6514fcbbb67SMark Brown 6524fcbbb67SMark Brown static const struct i2c_device_id wm8974_i2c_id[] = { 6534fcbbb67SMark Brown { "wm8974", 0 }, 6544fcbbb67SMark Brown { } 6554fcbbb67SMark Brown }; 6564fcbbb67SMark Brown MODULE_DEVICE_TABLE(i2c, wm8974_i2c_id); 6574fcbbb67SMark Brown 6584fcbbb67SMark Brown static struct i2c_driver wm8974_i2c_driver = { 6594fcbbb67SMark Brown .driver = { 660091edccfSMark Brown .name = "wm8974", 6614fcbbb67SMark Brown .owner = THIS_MODULE, 6624fcbbb67SMark Brown }, 6634fcbbb67SMark Brown .probe = wm8974_i2c_probe, 6647a79e94eSBill Pemberton .remove = wm8974_i2c_remove, 6654fcbbb67SMark Brown .id_table = wm8974_i2c_id, 6664fcbbb67SMark Brown }; 6674fcbbb67SMark Brown 6682be59418SSachin Kamat module_i2c_driver(wm8974_i2c_driver); 6690a1bf553SMark Brown 6700a1bf553SMark Brown MODULE_DESCRIPTION("ASoC WM8974 driver"); 6710a1bf553SMark Brown MODULE_AUTHOR("Liam Girdwood"); 6720a1bf553SMark Brown MODULE_LICENSE("GPL"); 673