13 #include <linux/module.h>
18 #include <linux/i2c.h>
22 #include <linux/slab.h>
39 static const struct reg_default wm8728_reg_defaults[] = {
56 0, 255, 0, wm8728_tlv),
71 {
"VOUTL",
NULL,
"DAC"},
72 {
"VOUTR",
NULL,
"DAC"},
115 static int wm8728_set_dai_fmt(
struct snd_soc_dai *codec_dai,
163 static int wm8728_set_bias_level(
struct snd_soc_codec *codec,
166 struct wm8728_priv *wm8728 = snd_soc_codec_get_drvdata(codec);
192 #define WM8728_RATES (SNDRV_PCM_RATE_8000_192000)
194 #define WM8728_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
195 SNDRV_PCM_FMTBIT_S24_LE)
198 .hw_params = wm8728_hw_params,
199 .digital_mute = wm8728_mute,
200 .set_fmt = wm8728_set_dai_fmt,
204 .name =
"wm8728-hifi",
206 .stream_name =
"Playback",
212 .ops = &wm8728_dai_ops,
253 .probe = wm8728_probe,
254 .remove = wm8728_remove,
255 .suspend = wm8728_suspend,
256 .resume = wm8728_resume,
257 .set_bias_level = wm8728_set_bias_level,
258 .controls = wm8728_snd_controls,
259 .num_controls =
ARRAY_SIZE(wm8728_snd_controls),
260 .dapm_widgets = wm8728_dapm_widgets,
261 .num_dapm_widgets =
ARRAY_SIZE(wm8728_dapm_widgets),
262 .dapm_routes = wm8728_intercon,
263 .num_dapm_routes =
ARRAY_SIZE(wm8728_intercon),
267 { .compatible =
"wlf,wm8728", },
272 static const struct regmap_config wm8728_regmap = {
277 .reg_defaults = wm8728_reg_defaults,
278 .num_reg_defaults =
ARRAY_SIZE(wm8728_reg_defaults),
282 #if defined(CONFIG_SPI_MASTER)
294 if (IS_ERR(wm8728->
regmap))
295 return PTR_ERR(wm8728->
regmap);
297 spi_set_drvdata(spi, wm8728);
300 &soc_codec_dev_wm8728, &wm8728_dai, 1);
312 static struct spi_driver wm8728_spi_driver = {
316 .of_match_table = wm8728_of_match,
318 .probe = wm8728_spi_probe,
323 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
336 if (IS_ERR(wm8728->
regmap))
337 return PTR_ERR(wm8728->
regmap);
339 i2c_set_clientdata(i2c, wm8728);
342 &soc_codec_dev_wm8728, &wm8728_dai, 1);
359 static struct i2c_driver wm8728_i2c_driver = {
363 .of_match_table = wm8728_of_match,
365 .probe = wm8728_i2c_probe,
367 .id_table = wm8728_i2c_id,
371 static int __init wm8728_modinit(
void)
374 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
375 ret = i2c_add_driver(&wm8728_i2c_driver);
381 #if defined(CONFIG_SPI_MASTER)
392 static void __exit wm8728_exit(
void)
394 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
397 #if defined(CONFIG_SPI_MASTER)
398 spi_unregister_driver(&wm8728_spi_driver);