34 #include <linux/module.h>
36 #include <linux/kernel.h>
40 #include <linux/i2c.h>
44 #include <linux/slab.h>
51 #include <asm/div64.h>
55 static int caps_charge = 2000;
69 static const struct reg_default wm8753_reg_defaults[] = {
136 static bool wm8753_volatile(
struct device *
dev,
unsigned int reg)
141 static bool wm8753_writeable(
struct device *
dev,
unsigned int reg)
158 #define wm8753_reset(c) snd_soc_write(c, WM8753_RESET, 0)
163 static const char *wm8753_base[] = {
"Linear Control",
"Adaptive Boost"};
164 static const char *wm8753_base_filter[] =
165 {
"130Hz @ 48kHz",
"200Hz @ 48kHz",
"100Hz @ 16kHz",
"400Hz @ 48kHz",
166 "100Hz @ 8kHz",
"200Hz @ 8kHz"};
167 static const char *wm8753_treble[] = {
"8kHz",
"4kHz"};
168 static const char *wm8753_alc_func[] = {
"Off",
"Right",
"Left",
"Stereo"};
169 static const char *wm8753_ng_type[] = {
"Constant PGA Gain",
"Mute ADC Output"};
170 static const char *wm8753_3d_func[] = {
"Capture",
"Playback"};
171 static const char *wm8753_3d_uc[] = {
"2.2kHz",
"1.5kHz"};
172 static const char *wm8753_3d_lc[] = {
"200Hz",
"500Hz"};
173 static const char *wm8753_deemp[] = {
"None",
"32kHz",
"44.1kHz",
"48kHz"};
174 static const char *wm8753_mono_mix[] = {
"Stereo",
"Left",
"Right",
"Mono"};
175 static const char *wm8753_dac_phase[] = {
"Non Inverted",
"Inverted"};
176 static const char *wm8753_line_mix[] = {
"Line 1 + 2",
"Line 1 - 2",
178 static const char *wm8753_mono_mux[] = {
"Line Mix",
"Rx Mix"};
179 static const char *wm8753_right_mux[] = {
"Line 2",
"Rx Mix"};
180 static const char *wm8753_left_mux[] = {
"Line 1",
"Rx Mix"};
181 static const char *wm8753_rxmsel[] = {
"RXP - RXN",
"RXP + RXN",
"RXP",
"RXN"};
182 static const char *wm8753_sidetone_mux[] = {
"Left PGA",
"Mic 1",
"Mic 2",
184 static const char *wm8753_mono2_src[] = {
"Inverted Mono 1",
"Left",
"Right",
186 static const char *wm8753_out3[] = {
"VREF",
"ROUT2",
"Left + Right"};
187 static const char *wm8753_out4[] = {
"VREF",
"Capture ST",
"LOUT2"};
188 static const char *wm8753_radcsel[] = {
"PGA",
"Line or RXP-RXN",
"Sidetone"};
189 static const char *wm8753_ladcsel[] = {
"PGA",
"Line or RXP-RXN",
"Line"};
190 static const char *wm8753_mono_adc[] = {
"Stereo",
"Analogue Mix Left",
191 "Analogue Mix Right",
"Digital Mono Mix"};
192 static const char *wm8753_adc_hp[] = {
"3.4Hz @ 48kHz",
"82Hz @ 16k",
193 "82Hz @ 8kHz",
"170Hz @ 8kHz"};
194 static const char *wm8753_adc_filter[] = {
"HiFi",
"Voice"};
195 static const char *wm8753_mic_sel[] = {
"Mic 1",
"Mic 2",
"Mic 3"};
196 static const char *wm8753_dai_mode[] = {
"DAI 0",
"DAI 1",
"DAI 2",
"DAI 3"};
197 static const char *wm8753_dat_sel[] = {
"Stereo",
"Left ADC",
"Right ADC",
199 static const char *wm8753_rout2_phase[] = {
"Non Inverted",
"Inverted"};
201 static const struct soc_enum wm8753_enum[] = {
234 static int wm8753_get_dai(
struct snd_kcontrol *kcontrol,
238 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
244 static int wm8753_set_dai(
struct snd_kcontrol *kcontrol,
248 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
261 if (((ioctl >> 2) & 0x3) == wm8753->
dai_func)
264 ioctl = (ioctl & 0x1f3) | (wm8753->
dai_func << 2);
268 wm8753_hifi_write_dai_fmt(codec, wm8753->
hifi_fmt);
269 wm8753_voice_write_dai_fmt(codec, wm8753->
voice_fmt);
278 static const unsigned int out_tlv[] = {
320 SOC_ENUM(
"Bass Boost", wm8753_enum[0]),
321 SOC_ENUM(
"Bass Filter", wm8753_enum[1]),
325 SOC_ENUM(
"Treble Cut-off", wm8753_enum[2]),
337 SOC_ENUM(
"Capture Filter Select", wm8753_enum[23]),
338 SOC_ENUM(
"Capture Filter Cut-off", wm8753_enum[24]),
343 SOC_ENUM(
"ALC Capture Function", wm8753_enum[3]),
349 SOC_ENUM(
"ALC Capture NG Type", wm8753_enum[4]),
352 SOC_ENUM(
"3D Function", wm8753_enum[5]),
353 SOC_ENUM(
"3D Upper Cut-off", wm8753_enum[6]),
354 SOC_ENUM(
"3D Lower Cut-off", wm8753_enum[7]),
361 SOC_ENUM(
"De-emphasis", wm8753_enum[8]),
362 SOC_ENUM(
"Playback Mono Mix", wm8753_enum[9]),
363 SOC_ENUM(
"Playback Phase", wm8753_enum[10]),
368 SOC_ENUM_EXT(
"DAI Mode", wm8753_enum[26], wm8753_get_dai, wm8753_set_dai),
370 SOC_ENUM(
"ADC Data Select", wm8753_enum[27]),
371 SOC_ENUM(
"ROUT2 Phase", wm8753_enum[28]),
473 &wm8753_left_mixer_controls[0],
ARRAY_SIZE(wm8753_left_mixer_controls)),
480 &wm8753_right_mixer_controls[0],
ARRAY_SIZE(wm8753_right_mixer_controls)),
487 &wm8753_mono_mixer_controls[0],
ARRAY_SIZE(wm8753_mono_mixer_controls)),
502 &wm8753_record_mixer_controls[0],
507 &wm8753_adc_mono_controls),
509 &wm8753_adc_mono_controls),
511 &wm8753_adc_left_controls),
513 &wm8753_adc_right_controls),
515 &wm8753_mic_mux_controls),
519 &wm8753_alc_mixer_controls[0],
ARRAY_SIZE(wm8753_alc_mixer_controls)),
521 &wm8753_line_left_controls),
523 &wm8753_line_right_controls),
525 &wm8753_line_mono_controls),
527 &wm8753_line_mux_mix_controls),
529 &wm8753_rx_mux_mix_controls),
533 &wm8753_mic_sel_mux_controls),
549 {
"Left Mixer",
"Left Playback Switch",
"Left DAC"},
550 {
"Left Mixer",
"Voice Playback Switch",
"Voice DAC"},
551 {
"Left Mixer",
"Sidetone Playback Switch",
"Mic Sidetone Mux"},
552 {
"Left Mixer",
"Bypass Playback Switch",
"Line Left Mux"},
555 {
"Right Mixer",
"Right Playback Switch",
"Right DAC"},
556 {
"Right Mixer",
"Voice Playback Switch",
"Voice DAC"},
557 {
"Right Mixer",
"Sidetone Playback Switch",
"Mic Sidetone Mux"},
558 {
"Right Mixer",
"Bypass Playback Switch",
"Line Right Mux"},
561 {
"Mono Mixer",
"Voice Playback Switch",
"Voice DAC"},
562 {
"Mono Mixer",
"Left Playback Switch",
"Left DAC"},
563 {
"Mono Mixer",
"Right Playback Switch",
"Right DAC"},
564 {
"Mono Mixer",
"Sidetone Playback Switch",
"Mic Sidetone Mux"},
565 {
"Mono Mixer",
"Bypass Playback Switch",
"Line Mono Mux"},
568 {
"Left Out 1",
NULL,
"Left Mixer"},
569 {
"Left Out 2",
NULL,
"Left Mixer"},
570 {
"LOUT1",
NULL,
"Left Out 1"},
571 {
"LOUT2",
NULL,
"Left Out 2"},
574 {
"Right Out 1",
NULL,
"Right Mixer"},
575 {
"Right Out 2",
NULL,
"Right Mixer"},
576 {
"ROUT1",
NULL,
"Right Out 1"},
577 {
"ROUT2",
NULL,
"Right Out 2"},
580 {
"Mono Out 1",
NULL,
"Mono Mixer"},
581 {
"MONO1",
NULL,
"Mono Out 1"},
584 {
"Mono 2 Mux",
"Left + Right",
"Out3 Left + Right"},
585 {
"Mono 2 Mux",
"Inverted Mono 1",
"MONO1"},
586 {
"Mono 2 Mux",
"Left",
"Left Mixer"},
587 {
"Mono 2 Mux",
"Right",
"Right Mixer"},
588 {
"Mono Out 2",
NULL,
"Mono 2 Mux"},
589 {
"MONO2",
NULL,
"Mono Out 2"},
592 {
"Out3 Left + Right",
NULL,
"Left Mixer"},
593 {
"Out3 Left + Right",
NULL,
"Right Mixer"},
594 {
"Out3 Mux",
"VREF",
"VREF"},
595 {
"Out3 Mux",
"Left + Right",
"Out3 Left + Right"},
596 {
"Out3 Mux",
"ROUT2",
"ROUT2"},
597 {
"Out 3",
NULL,
"Out3 Mux"},
598 {
"OUT3",
NULL,
"Out 3"},
601 {
"Out4 Mux",
"VREF",
"VREF"},
602 {
"Out4 Mux",
"Capture ST",
"Playback Mixer"},
603 {
"Out4 Mux",
"LOUT2",
"LOUT2"},
604 {
"Out 4",
NULL,
"Out4 Mux"},
605 {
"OUT4",
NULL,
"Out 4"},
608 {
"Playback Mixer",
"Left Capture Switch",
"Left Mixer"},
609 {
"Playback Mixer",
"Voice Capture Switch",
"Mono Mixer"},
610 {
"Playback Mixer",
"Right Capture Switch",
"Right Mixer"},
613 {
"Mic Sidetone Mux",
"Left PGA",
"Left Capture Volume"},
614 {
"Mic Sidetone Mux",
"Right PGA",
"Right Capture Volume"},
615 {
"Mic Sidetone Mux",
"Mic 1",
"Mic 1 Volume"},
616 {
"Mic Sidetone Mux",
"Mic 2",
"Mic 2 Volume"},
619 {
"Capture Left Mux",
"PGA",
"Left Capture Volume"},
620 {
"Capture Left Mux",
"Line or RXP-RXN",
"Line Left Mux"},
621 {
"Capture Left Mux",
"Line",
"LINE1"},
624 {
"Capture Right Mux",
"PGA",
"Right Capture Volume"},
625 {
"Capture Right Mux",
"Line or RXP-RXN",
"Line Right Mux"},
626 {
"Capture Right Mux",
"Sidetone",
"Playback Mixer"},
629 {
"Capture Right Mixer",
"Stereo",
"Capture Right Mux"},
630 {
"Capture Left Mixer",
"Stereo",
"Capture Left Mux"},
631 {
"Capture Left Mixer",
"Analogue Mix Left",
"Capture Left Mux"},
632 {
"Capture Left Mixer",
"Analogue Mix Left",
"Capture Right Mux"},
633 {
"Capture Right Mixer",
"Analogue Mix Right",
"Capture Left Mux"},
634 {
"Capture Right Mixer",
"Analogue Mix Right",
"Capture Right Mux"},
635 {
"Capture Left Mixer",
"Digital Mono Mix",
"Capture Left Mux"},
636 {
"Capture Left Mixer",
"Digital Mono Mix",
"Capture Right Mux"},
637 {
"Capture Right Mixer",
"Digital Mono Mix",
"Capture Left Mux"},
638 {
"Capture Right Mixer",
"Digital Mono Mix",
"Capture Right Mux"},
641 {
"Left ADC",
NULL,
"Capture Left Mixer"},
642 {
"Right ADC",
NULL,
"Capture Right Mixer"},
645 {
"Left Capture Volume",
NULL,
"ACIN"},
648 {
"Right Capture Volume",
NULL,
"Mic 2 Volume"},
651 {
"ALC Mixer",
"Line Capture Switch",
"Line Mixer"},
652 {
"ALC Mixer",
"Mic2 Capture Switch",
"Mic 2 Volume"},
653 {
"ALC Mixer",
"Mic1 Capture Switch",
"Mic 1 Volume"},
654 {
"ALC Mixer",
"Rx Capture Switch",
"Rx Mixer"},
657 {
"Line Left Mux",
"Line 1",
"LINE1"},
658 {
"Line Left Mux",
"Rx Mix",
"Rx Mixer"},
661 {
"Line Right Mux",
"Line 2",
"LINE2"},
662 {
"Line Right Mux",
"Rx Mix",
"Rx Mixer"},
665 {
"Line Mono Mux",
"Line Mix",
"Line Mixer"},
666 {
"Line Mono Mux",
"Rx Mix",
"Rx Mixer"},
669 {
"Line Mixer",
"Line 1 + 2",
"LINE1"},
670 {
"Line Mixer",
"Line 1 - 2",
"LINE1"},
671 {
"Line Mixer",
"Line 1 + 2",
"LINE2"},
672 {
"Line Mixer",
"Line 1 - 2",
"LINE2"},
673 {
"Line Mixer",
"Line 1",
"LINE1"},
674 {
"Line Mixer",
"Line 2",
"LINE2"},
677 {
"Rx Mixer",
"RXP - RXN",
"RXP"},
678 {
"Rx Mixer",
"RXP + RXN",
"RXP"},
679 {
"Rx Mixer",
"RXP - RXN",
"RXN"},
680 {
"Rx Mixer",
"RXP + RXN",
"RXN"},
681 {
"Rx Mixer",
"RXP",
"RXP"},
682 {
"Rx Mixer",
"RXN",
"RXN"},
685 {
"Mic 1 Volume",
NULL,
"MIC1N"},
686 {
"Mic 1 Volume",
NULL,
"Mic Selection Mux"},
689 {
"Mic 2 Volume",
NULL,
"MIC2N"},
690 {
"Mic 2 Volume",
NULL,
"MIC2"},
693 {
"Mic Selection Mux",
"Mic 1",
"MIC1"},
694 {
"Mic Selection Mux",
"Mic 2",
"MIC2N"},
695 {
"Mic Selection Mux",
"Mic 3",
"MIC2"},
698 {
"ACOP",
NULL,
"ALC Mixer"},
710 #define FIXED_PLL_SIZE ((1 << 22) * 10)
716 unsigned int K, Ndiv, Nmod;
726 if ((Ndiv < 6) || (Ndiv > 12))
728 "wm8753: unsupported N = %u\n", Ndiv);
736 K = Kpart & 0xFFFFFFFF;
748 static int wm8753_set_dai_pll(
struct snd_soc_dai *codec_dai,
int pll_id,
749 int source,
unsigned int freq_in,
unsigned int freq_out)
768 if (!freq_in || !freq_out) {
785 value = (
pll_div.
k & 0x03fe00) >> 9;
808 static const struct _coeff_div coeff_div[] = {
810 {12288000, 8000, 0x6, 0x0},
811 {11289600, 8000, 0x16, 0x0},
812 {18432000, 8000, 0x7, 0x0},
813 {16934400, 8000, 0x17, 0x0},
814 {12000000, 8000, 0x6, 0x1},
817 {11289600, 11025, 0x18, 0x0},
818 {16934400, 11025, 0x19, 0x0},
819 {12000000, 11025, 0x19, 0x1},
822 {12288000, 16000, 0xa, 0x0},
823 {18432000, 16000, 0xb, 0x0},
824 {12000000, 16000, 0xa, 0x1},
827 {11289600, 22050, 0x1a, 0x0},
828 {16934400, 22050, 0x1b, 0x0},
829 {12000000, 22050, 0x1b, 0x1},
832 {12288000, 32000, 0xc, 0x0},
833 {18432000, 32000, 0xd, 0x0},
834 {12000000, 32000, 0xa, 0x1},
837 {11289600, 44100, 0x10, 0x0},
838 {16934400, 44100, 0x11, 0x0},
839 {12000000, 44100, 0x11, 0x1},
842 {12288000, 48000, 0x0, 0x0},
843 {18432000, 48000, 0x1, 0x0},
844 {12000000, 48000, 0x0, 0x1},
847 {11289600, 88200, 0x1e, 0x0},
848 {16934400, 88200, 0x1f, 0x0},
849 {12000000, 88200, 0x1f, 0x1},
852 {12288000, 96000, 0xe, 0x0},
853 {18432000, 96000, 0xf, 0x0},
854 {12000000, 96000, 0xe, 0x1},
857 static int get_coeff(
int mclk,
int rate)
862 if (coeff_div[i].rate == rate && coeff_div[i].mclk == mclk)
871 static int wm8753_set_dai_sysclk(
struct snd_soc_dai *codec_dai,
872 int clk_id,
unsigned int freq,
int dir)
875 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
898 static int wm8753_vdac_adc_set_dai_fmt(
struct snd_soc_codec *codec,
935 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
966 static int wm8753_pcm_set_dai_fmt(
struct snd_soc_codec *codec,
1006 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
1031 static int wm8753_set_dai_clkdiv(
struct snd_soc_dai *codec_dai,
1032 int div_id,
int div)
1059 static int wm8753_hdac_set_dai_fmt(
struct snd_soc_codec *codec,
1065 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
1091 static int wm8753_i2s_set_dai_fmt(
struct snd_soc_codec *codec,
1100 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
1113 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
1131 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
1164 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
1176 coeff_div[coeff].
usb);
1197 static int wm8753_mode1v_set_dai_fmt(
struct snd_soc_codec *codec,
1206 return wm8753_vdac_adc_set_dai_fmt(codec, fmt);
1209 static int wm8753_mode1h_set_dai_fmt(
struct snd_soc_codec *codec,
1212 return wm8753_hdac_set_dai_fmt(codec, fmt);
1215 static int wm8753_mode2_set_dai_fmt(
struct snd_soc_codec *codec,
1224 return wm8753_vdac_adc_set_dai_fmt(codec, fmt);
1227 static int wm8753_mode3_4_set_dai_fmt(
struct snd_soc_codec *codec,
1236 if (wm8753_hdac_set_dai_fmt(codec, fmt) < 0)
1238 return wm8753_vdac_adc_set_dai_fmt(codec, fmt);
1241 static int wm8753_hifi_write_dai_fmt(
struct snd_soc_codec *codec,
1244 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
1249 ret = wm8753_mode1h_set_dai_fmt(codec, fmt);
1252 ret = wm8753_mode2_set_dai_fmt(codec, fmt);
1256 ret = wm8753_mode3_4_set_dai_fmt(codec, fmt);
1264 return wm8753_i2s_set_dai_fmt(codec, fmt);
1267 static int wm8753_hifi_set_dai_fmt(
struct snd_soc_dai *codec_dai,
1271 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
1275 return wm8753_hifi_write_dai_fmt(codec, fmt);
1278 static int wm8753_voice_write_dai_fmt(
struct snd_soc_codec *codec,
1281 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
1287 ret = wm8753_mode1v_set_dai_fmt(codec, fmt);
1290 ret = wm8753_pcm_set_dai_fmt(codec, fmt);
1297 static int wm8753_voice_set_dai_fmt(
struct snd_soc_dai *codec_dai,
1301 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
1305 return wm8753_voice_write_dai_fmt(codec, fmt);
1312 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
1316 if (mute && wm8753->
dai_func == 1) {
1329 static int wm8753_set_bias_level(
struct snd_soc_codec *codec,
1355 #define WM8753_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
1356 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |\
1357 SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\
1358 SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
1360 #define WM8753_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
1361 SNDRV_PCM_FMTBIT_S24_LE)
1375 .hw_params = wm8753_i2s_hw_params,
1376 .digital_mute = wm8753_mute,
1377 .set_fmt = wm8753_hifi_set_dai_fmt,
1378 .set_clkdiv = wm8753_set_dai_clkdiv,
1379 .set_pll = wm8753_set_dai_pll,
1380 .set_sysclk = wm8753_set_dai_sysclk,
1384 .hw_params = wm8753_pcm_hw_params,
1385 .digital_mute = wm8753_mute,
1386 .set_fmt = wm8753_voice_set_dai_fmt,
1387 .set_clkdiv = wm8753_set_dai_clkdiv,
1388 .set_pll = wm8753_set_dai_pll,
1389 .set_sysclk = wm8753_set_dai_sysclk,
1394 { .name =
"wm8753-hifi",
1396 .stream_name =
"HiFi Playback",
1403 .stream_name =
"Capture",
1409 .ops = &wm8753_dai_ops_hifi_mode,
1412 { .name =
"wm8753-voice",
1414 .stream_name =
"Voice Playback",
1421 .stream_name =
"Capture",
1427 .ops = &wm8753_dai_ops_voice_mode,
1437 wm8753_set_bias_level(codec, dapm->
bias_level);
1449 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
1468 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
1476 dev_err(codec->
dev,
"Failed to set cache I/O: %d\n", ret);
1482 dev_err(codec->
dev,
"Failed to issue reset: %d\n", ret);
1519 .probe = wm8753_probe,
1520 .remove = wm8753_remove,
1521 .suspend = wm8753_suspend,
1522 .resume = wm8753_resume,
1523 .set_bias_level = wm8753_set_bias_level,
1525 .controls = wm8753_snd_controls,
1526 .num_controls =
ARRAY_SIZE(wm8753_snd_controls),
1527 .dapm_widgets = wm8753_dapm_widgets,
1528 .num_dapm_widgets =
ARRAY_SIZE(wm8753_dapm_widgets),
1529 .dapm_routes = wm8753_dapm_routes,
1530 .num_dapm_routes =
ARRAY_SIZE(wm8753_dapm_routes),
1534 { .compatible =
"wlf,wm8753", },
1539 static const struct regmap_config wm8753_regmap = {
1544 .writeable_reg = wm8753_writeable,
1545 .volatile_reg = wm8753_volatile,
1548 .reg_defaults = wm8753_reg_defaults,
1549 .num_reg_defaults =
ARRAY_SIZE(wm8753_reg_defaults),
1552 #if defined(CONFIG_SPI_MASTER)
1563 spi_set_drvdata(spi, wm8753);
1566 if (IS_ERR(wm8753->
regmap)) {
1567 ret = PTR_ERR(wm8753->
regmap);
1568 dev_err(&spi->
dev,
"Failed to allocate register map: %d\n",
1576 dev_err(&spi->
dev,
"Failed to register CODEC: %d\n", ret);
1590 struct wm8753_priv *wm8753 = spi_get_drvdata(spi);
1598 static struct spi_driver wm8753_spi_driver = {
1602 .of_match_table = wm8753_of_match,
1604 .probe = wm8753_spi_probe,
1609 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1621 i2c_set_clientdata(i2c, wm8753);
1624 if (IS_ERR(wm8753->
regmap)) {
1625 ret = PTR_ERR(wm8753->
regmap);
1626 dev_err(&i2c->
dev,
"Failed to allocate register map: %d\n",
1634 dev_err(&i2c->
dev,
"Failed to register CODEC: %d\n", ret);
1648 struct wm8753_priv *wm8753 = i2c_get_clientdata(client);
1661 static struct i2c_driver wm8753_i2c_driver = {
1665 .of_match_table = wm8753_of_match,
1667 .probe = wm8753_i2c_probe,
1669 .id_table = wm8753_i2c_id,
1673 static int __init wm8753_modinit(
void)
1676 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1677 ret = i2c_add_driver(&wm8753_i2c_driver);
1683 #if defined(CONFIG_SPI_MASTER)
1694 static void __exit wm8753_exit(
void)
1696 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1699 #if defined(CONFIG_SPI_MASTER)
1700 spi_unregister_driver(&wm8753_spi_driver);