2 * Driver for the 1250-EV1 audio I/O module
4 * Copyright 2011 Wolfson Microelectronics plc
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
13 #include <linux/init.h>
14 #include <linux/module.h>
15 #include <linux/i2c.h>
17 #include <sound/soc.h>
18 #include <sound/soc-dapm.h>
20 static const struct snd_soc_dapm_widget wm1250_ev1_dapm_widgets
[] = {
21 SND_SOC_DAPM_ADC("ADC", "wm1250-ev1 Capture", SND_SOC_NOPM
, 0, 0),
22 SND_SOC_DAPM_DAC("DAC", "wm1250-ev1 Playback", SND_SOC_NOPM
, 0, 0),
24 SND_SOC_DAPM_INPUT("WM1250 Input"),
25 SND_SOC_DAPM_INPUT("WM1250 Output"),
28 static const struct snd_soc_dapm_route wm1250_ev1_dapm_routes
[] = {
29 { "ADC", NULL
, "WM1250 Input" },
30 { "WM1250 Output", NULL
, "DAC" },
33 static struct snd_soc_dai_driver wm1250_ev1_dai
= {
36 .stream_name
= "Playback",
39 .rates
= SNDRV_PCM_RATE_8000
,
40 .formats
= SNDRV_PCM_FMTBIT_S16_LE
,
43 .stream_name
= "Capture",
46 .rates
= SNDRV_PCM_RATE_8000
,
47 .formats
= SNDRV_PCM_FMTBIT_S16_LE
,
51 static struct snd_soc_codec_driver soc_codec_dev_wm1250_ev1
= {
52 .dapm_widgets
= wm1250_ev1_dapm_widgets
,
53 .num_dapm_widgets
= ARRAY_SIZE(wm1250_ev1_dapm_widgets
),
54 .dapm_routes
= wm1250_ev1_dapm_routes
,
55 .num_dapm_routes
= ARRAY_SIZE(wm1250_ev1_dapm_routes
),
58 static int __devinit
wm1250_ev1_probe(struct i2c_client
*i2c
,
59 const struct i2c_device_id
*id
)
61 return snd_soc_register_codec(&i2c
->dev
, &soc_codec_dev_wm1250_ev1
,
65 static int __devexit
wm1250_ev1_remove(struct i2c_client
*i2c
)
67 snd_soc_unregister_codec(&i2c
->dev
);
72 static const struct i2c_device_id wm1250_ev1_i2c_id
[] = {
76 MODULE_DEVICE_TABLE(i2c
, wm1250_ev1_i2c_id
);
78 static struct i2c_driver wm1250_ev1_i2c_driver
= {
83 .probe
= wm1250_ev1_probe
,
84 .remove
= __devexit_p(wm1250_ev1_remove
),
85 .id_table
= wm1250_ev1_i2c_id
,
88 static int __init
wm1250_ev1_modinit(void)
92 ret
= i2c_add_driver(&wm1250_ev1_i2c_driver
);
94 pr_err("Failed to register WM1250-EV1 I2C driver: %d\n", ret
);
98 module_init(wm1250_ev1_modinit
);
100 static void __exit
wm1250_ev1_exit(void)
102 i2c_del_driver(&wm1250_ev1_i2c_driver
);
104 module_exit(wm1250_ev1_exit
);
106 MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
107 MODULE_DESCRIPTION("WM1250-EV1 audio I/O module driver");
108 MODULE_LICENSE("GPL");