aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/radio/Kconfig18
-rw-r--r--drivers/media/radio/Makefile1
-rw-r--r--drivers/media/radio/radio-miropcm20.c270
-rw-r--r--drivers/mfd/Kconfig6
-rw-r--r--drivers/mfd/Makefile1
-rw-r--r--drivers/mfd/twl4030-codec.c276
-rw-r--r--drivers/mfd/twl4030-core.c16
7 files changed, 587 insertions, 1 deletions
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index a87a477c87f2..b134553eb3b5 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -195,6 +195,24 @@ config RADIO_MAESTRO
195 To compile this driver as a module, choose M here: the 195 To compile this driver as a module, choose M here: the
196 module will be called radio-maestro. 196 module will be called radio-maestro.
197 197
198config RADIO_MIROPCM20
199 tristate "miroSOUND PCM20 radio"
200 depends on ISA && VIDEO_V4L2
201 select SND_MIRO
202 ---help---
203 Choose Y here if you have this FM radio card. You also need to enable
204 the ALSA sound system. This choice automatically selects the ALSA
205 sound card driver "Miro miroSOUND PCM1pro/PCM12/PCM20radio" as this
206 is required for the radio-miropcm20.
207
208 In order to control your radio card, you will need to use programs
209 that are compatible with the Video For Linux API. Information on
210 this API and pointers to "v4l" programs may be found at
211 <file:Documentation/video4linux/API.html>.
212
213 To compile this driver as a module, choose M here: the
214 module will be called radio-miropcm20.
215
198config RADIO_SF16FMI 216config RADIO_SF16FMI
199 tristate "SF16FMI Radio" 217 tristate "SF16FMI Radio"
200 depends on ISA && VIDEO_V4L2 218 depends on ISA && VIDEO_V4L2
diff --git a/drivers/media/radio/Makefile b/drivers/media/radio/Makefile
index 2a1be3bf4f7c..8a63d543ae41 100644
--- a/drivers/media/radio/Makefile
+++ b/drivers/media/radio/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_RADIO_TRUST) += radio-trust.o
18obj-$(CONFIG_I2C_SI4713) += si4713-i2c.o 18obj-$(CONFIG_I2C_SI4713) += si4713-i2c.o
19obj-$(CONFIG_RADIO_SI4713) += radio-si4713.o 19obj-$(CONFIG_RADIO_SI4713) += radio-si4713.o
20obj-$(CONFIG_RADIO_MAESTRO) += radio-maestro.o 20obj-$(CONFIG_RADIO_MAESTRO) += radio-maestro.o
21obj-$(CONFIG_RADIO_MIROPCM20) += radio-miropcm20.o
21obj-$(CONFIG_USB_DSBR) += dsbr100.o 22obj-$(CONFIG_USB_DSBR) += dsbr100.o
22obj-$(CONFIG_RADIO_SI470X) += si470x/ 23obj-$(CONFIG_RADIO_SI470X) += si470x/
23obj-$(CONFIG_USB_MR800) += radio-mr800.o 24obj-$(CONFIG_USB_MR800) += radio-mr800.o
diff --git a/drivers/media/radio/radio-miropcm20.c b/drivers/media/radio/radio-miropcm20.c
new file mode 100644
index 000000000000..4ff885445fd4
--- /dev/null
+++ b/drivers/media/radio/radio-miropcm20.c
@@ -0,0 +1,270 @@
1/* Miro PCM20 radio driver for Linux radio support
2 * (c) 1998 Ruurd Reitsma <R.A.Reitsma@wbmt.tudelft.nl>
3 * Thanks to Norberto Pellici for the ACI device interface specification
4 * The API part is based on the radiotrack driver by M. Kirkwood
5 * This driver relies on the aci mixer provided by the snd-miro
6 * ALSA driver.
7 * Look there for further info...
8 */
9
10/* What ever you think about the ACI, version 0x07 is not very well!
11 * I can't get frequency, 'tuner status', 'tuner flags' or mute/mono
12 * conditions... Robert
13 */
14
15#include <linux/module.h>
16#include <linux/init.h>
17#include <linux/videodev2.h>
18#include <media/v4l2-device.h>
19#include <media/v4l2-ioctl.h>
20#include <sound/aci.h>
21
22static int radio_nr = -1;
23module_param(radio_nr, int, 0);
24MODULE_PARM_DESC(radio_nr, "Set radio device number (/dev/radioX). Default: -1 (autodetect)");
25
26static int mono;
27module_param(mono, bool, 0);
28MODULE_PARM_DESC(mono, "Force tuner into mono mode.");
29
30struct pcm20 {
31 struct v4l2_device v4l2_dev;
32 struct video_device vdev;
33 unsigned long freq;
34 int muted;
35 struct snd_miro_aci *aci;
36};
37
38static struct pcm20 pcm20_card = {
39 .freq = 87*16000,
40 .muted = 1,
41};
42
43static int pcm20_mute(struct pcm20 *dev, unsigned char mute)
44{
45 dev->muted = mute;
46 return snd_aci_cmd(dev->aci, ACI_SET_TUNERMUTE, mute, -1);
47}
48
49static int pcm20_stereo(struct pcm20 *dev, unsigned char stereo)
50{
51 return snd_aci_cmd(dev->aci, ACI_SET_TUNERMONO, !stereo, -1);
52}
53
54static int pcm20_setfreq(struct pcm20 *dev, unsigned long freq)
55{
56 unsigned char freql;
57 unsigned char freqh;
58 struct snd_miro_aci *aci = dev->aci;
59
60 dev->freq = freq;
61
62 freq /= 160;
63 if (!(aci->aci_version == 0x07 || aci->aci_version >= 0xb0))
64 freq /= 10; /* I don't know exactly which version
65 * needs this hack */
66 freql = freq & 0xff;
67 freqh = freq >> 8;
68
69 pcm20_stereo(dev, !mono);
70 return snd_aci_cmd(aci, ACI_WRITE_TUNE, freql, freqh);
71}
72
73static const struct v4l2_file_operations pcm20_fops = {
74 .owner = THIS_MODULE,
75 .ioctl = video_ioctl2,
76};
77
78static int vidioc_querycap(struct file *file, void *priv,
79 struct v4l2_capability *v)
80{
81 strlcpy(v->driver, "Miro PCM20", sizeof(v->driver));
82 strlcpy(v->card, "Miro PCM20", sizeof(v->card));
83 strlcpy(v->bus_info, "ISA", sizeof(v->bus_info));
84 v->version = 0x1;
85 v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
86 return 0;
87}
88
89static int vidioc_g_tuner(struct file *file, void *priv,
90 struct v4l2_tuner *v)
91{
92 if (v->index) /* Only 1 tuner */
93 return -EINVAL;
94 strlcpy(v->name, "FM", sizeof(v->name));
95 v->type = V4L2_TUNER_RADIO;
96 v->rangelow = 87*16000;
97 v->rangehigh = 108*16000;
98 v->signal = 0xffff;
99 v->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
100 v->capability = V4L2_TUNER_CAP_LOW;
101 v->audmode = V4L2_TUNER_MODE_MONO;
102 return 0;
103}
104
105static int vidioc_s_tuner(struct file *file, void *priv,
106 struct v4l2_tuner *v)
107{
108 return v->index ? -EINVAL : 0;
109}
110
111static int vidioc_g_frequency(struct file *file, void *priv,
112 struct v4l2_frequency *f)
113{
114 struct pcm20 *dev = video_drvdata(file);
115
116 if (f->tuner != 0)
117 return -EINVAL;
118
119 f->type = V4L2_TUNER_RADIO;
120 f->frequency = dev->freq;
121 return 0;
122}
123
124
125static int vidioc_s_frequency(struct file *file, void *priv,
126 struct v4l2_frequency *f)
127{
128 struct pcm20 *dev = video_drvdata(file);
129
130 if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
131 return -EINVAL;
132
133 dev->freq = f->frequency;
134 pcm20_setfreq(dev, f->frequency);
135 return 0;
136}
137
138static int vidioc_queryctrl(struct file *file, void *priv,
139 struct v4l2_queryctrl *qc)
140{
141 switch (qc->id) {
142 case V4L2_CID_AUDIO_MUTE:
143 return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1);
144 }
145 return -EINVAL;
146}
147
148static int vidioc_g_ctrl(struct file *file, void *priv,
149 struct v4l2_control *ctrl)
150{
151 struct pcm20 *dev = video_drvdata(file);
152
153 switch (ctrl->id) {
154 case V4L2_CID_AUDIO_MUTE:
155 ctrl->value = dev->muted;
156 break;
157 default:
158 return -EINVAL;
159 }
160 return 0;
161}
162
163static int vidioc_s_ctrl(struct file *file, void *priv,
164 struct v4l2_control *ctrl)
165{
166 struct pcm20 *dev = video_drvdata(file);
167
168 switch (ctrl->id) {
169 case V4L2_CID_AUDIO_MUTE:
170 pcm20_mute(dev, ctrl->value);
171 break;
172 default:
173 return -EINVAL;
174 }
175 return 0;
176}
177
178static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i)
179{
180 *i = 0;
181 return 0;
182}
183
184static int vidioc_s_input(struct file *filp, void *priv, unsigned int i)
185{
186 return i ? -EINVAL : 0;
187}
188
189static int vidioc_g_audio(struct file *file, void *priv,
190 struct v4l2_audio *a)
191{
192 a->index = 0;
193 strlcpy(a->name, "Radio", sizeof(a->name));
194 a->capability = V4L2_AUDCAP_STEREO;
195 return 0;
196}
197
198static int vidioc_s_audio(struct file *file, void *priv,
199 struct v4l2_audio *a)
200{
201 return a->index ? -EINVAL : 0;
202}
203
204static const struct v4l2_ioctl_ops pcm20_ioctl_ops = {
205 .vidioc_querycap = vidioc_querycap,
206 .vidioc_g_tuner = vidioc_g_tuner,
207 .vidioc_s_tuner = vidioc_s_tuner,
208 .vidioc_g_frequency = vidioc_g_frequency,
209 .vidioc_s_frequency = vidioc_s_frequency,
210 .vidioc_queryctrl = vidioc_queryctrl,
211 .vidioc_g_ctrl = vidioc_g_ctrl,
212 .vidioc_s_ctrl = vidioc_s_ctrl,
213 .vidioc_g_audio = vidioc_g_audio,
214 .vidioc_s_audio = vidioc_s_audio,
215 .vidioc_g_input = vidioc_g_input,
216 .vidioc_s_input = vidioc_s_input,
217};
218
219static int __init pcm20_init(void)
220{
221 struct pcm20 *dev = &pcm20_card;
222 struct v4l2_device *v4l2_dev = &dev->v4l2_dev;
223 int res;
224
225 dev->aci = snd_aci_get_aci();
226 if (dev->aci == NULL) {
227 v4l2_err(v4l2_dev,
228 "you must load the snd-miro driver first!\n");
229 return -ENODEV;
230 }
231 strlcpy(v4l2_dev->name, "miropcm20", sizeof(v4l2_dev->name));
232
233
234 res = v4l2_device_register(NULL, v4l2_dev);
235 if (res < 0) {
236 v4l2_err(v4l2_dev, "could not register v4l2_device\n");
237 return -EINVAL;
238 }
239
240 strlcpy(dev->vdev.name, v4l2_dev->name, sizeof(dev->vdev.name));
241 dev->vdev.v4l2_dev = v4l2_dev;
242 dev->vdev.fops = &pcm20_fops;
243 dev->vdev.ioctl_ops = &pcm20_ioctl_ops;
244 dev->vdev.release = video_device_release_empty;
245 video_set_drvdata(&dev->vdev, dev);
246
247 if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0)
248 goto fail;
249
250 v4l2_info(v4l2_dev, "Mirosound PCM20 Radio tuner\n");
251 return 0;
252fail:
253 v4l2_device_unregister(v4l2_dev);
254 return -EINVAL;
255}
256
257MODULE_AUTHOR("Ruurd Reitsma, Krzysztof Helt");
258MODULE_DESCRIPTION("A driver for the Miro PCM20 radio card.");
259MODULE_LICENSE("GPL");
260
261static void __exit pcm20_cleanup(void)
262{
263 struct pcm20 *dev = &pcm20_card;
264
265 video_unregister_device(&dev->vdev);
266 v4l2_device_unregister(&dev->v4l2_dev);
267}
268
269module_init(pcm20_init);
270module_exit(pcm20_cleanup);
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 570be139f9df..08f2d07bf56a 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -121,6 +121,12 @@ config TWL4030_POWER
121 and load scripts controling which resources are switched off/on 121 and load scripts controling which resources are switched off/on
122 or reset when a sleep, wakeup or warm reset event occurs. 122 or reset when a sleep, wakeup or warm reset event occurs.
123 123
124config TWL4030_CODEC
125 bool
126 depends on TWL4030_CORE
127 select MFD_CORE
128 default n
129
124config MFD_TMIO 130config MFD_TMIO
125 bool 131 bool
126 default n 132 default n
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index f3b277b90d40..af0fc903cec8 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_MENELAUS) += menelaus.o
26 26
27obj-$(CONFIG_TWL4030_CORE) += twl4030-core.o twl4030-irq.o 27obj-$(CONFIG_TWL4030_CORE) += twl4030-core.o twl4030-irq.o
28obj-$(CONFIG_TWL4030_POWER) += twl4030-power.o 28obj-$(CONFIG_TWL4030_POWER) += twl4030-power.o
29obj-$(CONFIG_TWL4030_CODEC) += twl4030-codec.o
29 30
30obj-$(CONFIG_MFD_MC13783) += mc13783-core.o 31obj-$(CONFIG_MFD_MC13783) += mc13783-core.o
31 32
diff --git a/drivers/mfd/twl4030-codec.c b/drivers/mfd/twl4030-codec.c
new file mode 100644
index 000000000000..77b914907d7c
--- /dev/null
+++ b/drivers/mfd/twl4030-codec.c
@@ -0,0 +1,276 @@
1/*
2 * MFD driver for twl4030 codec submodule
3 *
4 * Author: Peter Ujfalusi <peter.ujfalusi@nokia.com>
5 *
6 * Copyright: (C) 2009 Nokia Corporation
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#include <linux/module.h>
25#include <linux/types.h>
26#include <linux/kernel.h>
27#include <linux/fs.h>
28#include <linux/platform_device.h>
29#include <linux/i2c/twl4030.h>
30#include <linux/mfd/core.h>
31#include <linux/mfd/twl4030-codec.h>
32
33#define TWL4030_CODEC_CELLS 2
34
35static struct platform_device *twl4030_codec_dev;
36
37struct twl4030_codec_resource {
38 int request_count;
39 u8 reg;
40 u8 mask;
41};
42
43struct twl4030_codec {
44 unsigned int audio_mclk;
45 struct mutex mutex;
46 struct twl4030_codec_resource resource[TWL4030_CODEC_RES_MAX];
47 struct mfd_cell cells[TWL4030_CODEC_CELLS];
48};
49
50/*
51 * Modify the resource, the function returns the content of the register
52 * after the modification.
53 */
54static int twl4030_codec_set_resource(enum twl4030_codec_res id, int enable)
55{
56 struct twl4030_codec *codec = platform_get_drvdata(twl4030_codec_dev);
57 u8 val;
58
59 twl4030_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &val,
60 codec->resource[id].reg);
61
62 if (enable)
63 val |= codec->resource[id].mask;
64 else
65 val &= ~codec->resource[id].mask;
66
67 twl4030_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
68 val, codec->resource[id].reg);
69
70 return val;
71}
72
73static inline int twl4030_codec_get_resource(enum twl4030_codec_res id)
74{
75 struct twl4030_codec *codec = platform_get_drvdata(twl4030_codec_dev);
76 u8 val;
77
78 twl4030_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &val,
79 codec->resource[id].reg);
80
81 return val;
82}
83
84/*
85 * Enable the resource.
86 * The function returns with error or the content of the register
87 */
88int twl4030_codec_enable_resource(enum twl4030_codec_res id)
89{
90 struct twl4030_codec *codec = platform_get_drvdata(twl4030_codec_dev);
91 int val;
92
93 if (id >= TWL4030_CODEC_RES_MAX) {
94 dev_err(&twl4030_codec_dev->dev,
95 "Invalid resource ID (%u)\n", id);
96 return -EINVAL;
97 }
98
99 mutex_lock(&codec->mutex);
100 if (!codec->resource[id].request_count)
101 /* Resource was disabled, enable it */
102 val = twl4030_codec_set_resource(id, 1);
103 else
104 val = twl4030_codec_get_resource(id);
105
106 codec->resource[id].request_count++;
107 mutex_unlock(&codec->mutex);
108
109 return val;
110}
111EXPORT_SYMBOL_GPL(twl4030_codec_enable_resource);
112
113/*
114 * Disable the resource.
115 * The function returns with error or the content of the register
116 */
117int twl4030_codec_disable_resource(unsigned id)
118{
119 struct twl4030_codec *codec = platform_get_drvdata(twl4030_codec_dev);
120 int val;
121
122 if (id >= TWL4030_CODEC_RES_MAX) {
123 dev_err(&twl4030_codec_dev->dev,
124 "Invalid resource ID (%u)\n", id);
125 return -EINVAL;
126 }
127
128 mutex_lock(&codec->mutex);
129 if (!codec->resource[id].request_count) {
130 dev_err(&twl4030_codec_dev->dev,
131 "Resource has been disabled already (%u)\n", id);
132 mutex_unlock(&codec->mutex);
133 return -EPERM;
134 }
135 codec->resource[id].request_count--;
136
137 if (!codec->resource[id].request_count)
138 /* Resource can be disabled now */
139 val = twl4030_codec_set_resource(id, 0);
140 else
141 val = twl4030_codec_get_resource(id);
142
143 mutex_unlock(&codec->mutex);
144
145 return val;
146}
147EXPORT_SYMBOL_GPL(twl4030_codec_disable_resource);
148
149unsigned int twl4030_codec_get_mclk(void)
150{
151 struct twl4030_codec *codec = platform_get_drvdata(twl4030_codec_dev);
152
153 return codec->audio_mclk;
154}
155EXPORT_SYMBOL_GPL(twl4030_codec_get_mclk);
156
157static int __devinit twl4030_codec_probe(struct platform_device *pdev)
158{
159 struct twl4030_codec *codec;
160 struct twl4030_codec_data *pdata = pdev->dev.platform_data;
161 struct mfd_cell *cell = NULL;
162 int ret, childs = 0;
163 u8 val;
164
165 if (!pdata) {
166 dev_err(&pdev->dev, "Platform data is missing\n");
167 return -EINVAL;
168 }
169
170 /* Configure APLL_INFREQ and disable APLL if enabled */
171 val = 0;
172 switch (pdata->audio_mclk) {
173 case 19200000:
174 val |= TWL4030_APLL_INFREQ_19200KHZ;
175 break;
176 case 26000000:
177 val |= TWL4030_APLL_INFREQ_26000KHZ;
178 break;
179 case 38400000:
180 val |= TWL4030_APLL_INFREQ_38400KHZ;
181 break;
182 default:
183 dev_err(&pdev->dev, "Invalid audio_mclk\n");
184 return -EINVAL;
185 }
186 twl4030_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
187 val, TWL4030_REG_APLL_CTL);
188
189 codec = kzalloc(sizeof(struct twl4030_codec), GFP_KERNEL);
190 if (!codec)
191 return -ENOMEM;
192
193 platform_set_drvdata(pdev, codec);
194
195 twl4030_codec_dev = pdev;
196 mutex_init(&codec->mutex);
197 codec->audio_mclk = pdata->audio_mclk;
198
199 /* Codec power */
200 codec->resource[TWL4030_CODEC_RES_POWER].reg = TWL4030_REG_CODEC_MODE;
201 codec->resource[TWL4030_CODEC_RES_POWER].mask = TWL4030_CODECPDZ;
202
203 /* PLL */
204 codec->resource[TWL4030_CODEC_RES_APLL].reg = TWL4030_REG_APLL_CTL;
205 codec->resource[TWL4030_CODEC_RES_APLL].mask = TWL4030_APLL_EN;
206
207 if (pdata->audio) {
208 cell = &codec->cells[childs];
209 cell->name = "twl4030_codec_audio";
210 cell->platform_data = pdata->audio;
211 cell->data_size = sizeof(*pdata->audio);
212 childs++;
213 }
214 if (pdata->vibra) {
215 cell = &codec->cells[childs];
216 cell->name = "twl4030_codec_vibra";
217 cell->platform_data = pdata->vibra;
218 cell->data_size = sizeof(*pdata->vibra);
219 childs++;
220 }
221
222 if (childs)
223 ret = mfd_add_devices(&pdev->dev, pdev->id, codec->cells,
224 childs, NULL, 0);
225 else {
226 dev_err(&pdev->dev, "No platform data found for childs\n");
227 ret = -ENODEV;
228 }
229
230 if (!ret)
231 return 0;
232
233 platform_set_drvdata(pdev, NULL);
234 kfree(codec);
235 twl4030_codec_dev = NULL;
236 return ret;
237}
238
239static int __devexit twl4030_codec_remove(struct platform_device *pdev)
240{
241 struct twl4030_codec *codec = platform_get_drvdata(pdev);
242
243 mfd_remove_devices(&pdev->dev);
244 platform_set_drvdata(pdev, NULL);
245 kfree(codec);
246 twl4030_codec_dev = NULL;
247
248 return 0;
249}
250
251MODULE_ALIAS("platform:twl4030_codec");
252
253static struct platform_driver twl4030_codec_driver = {
254 .probe = twl4030_codec_probe,
255 .remove = __devexit_p(twl4030_codec_remove),
256 .driver = {
257 .owner = THIS_MODULE,
258 .name = "twl4030_codec",
259 },
260};
261
262static int __devinit twl4030_codec_init(void)
263{
264 return platform_driver_register(&twl4030_codec_driver);
265}
266module_init(twl4030_codec_init);
267
268static void __devexit twl4030_codec_exit(void)
269{
270 platform_driver_unregister(&twl4030_codec_driver);
271}
272module_exit(twl4030_codec_exit);
273
274MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@nokia.com>");
275MODULE_LICENSE("GPL");
276
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
index a1c47ee95c0e..98b984e191d5 100644
--- a/drivers/mfd/twl4030-core.c
+++ b/drivers/mfd/twl4030-core.c
@@ -114,6 +114,12 @@
114#define twl_has_watchdog() false 114#define twl_has_watchdog() false
115#endif 115#endif
116 116
117#if defined(CONFIG_TWL4030_CODEC) || defined(CONFIG_TWL4030_CODEC_MODULE)
118#define twl_has_codec() true
119#else
120#define twl_has_codec() false
121#endif
122
117/* Triton Core internal information (BEGIN) */ 123/* Triton Core internal information (BEGIN) */
118 124
119/* Last - for index max*/ 125/* Last - for index max*/
@@ -601,6 +607,14 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
601 return PTR_ERR(child); 607 return PTR_ERR(child);
602 } 608 }
603 609
610 if (twl_has_codec() && pdata->codec) {
611 child = add_child(1, "twl4030_codec",
612 pdata->codec, sizeof(*pdata->codec),
613 false, 0, 0);
614 if (IS_ERR(child))
615 return PTR_ERR(child);
616 }
617
604 if (twl_has_regulator()) { 618 if (twl_has_regulator()) {
605 /* 619 /*
606 child = add_regulator(TWL4030_REG_VPLL1, pdata->vpll1); 620 child = add_regulator(TWL4030_REG_VPLL1, pdata->vpll1);
@@ -763,7 +777,7 @@ static int twl4030_remove(struct i2c_client *client)
763} 777}
764 778
765/* NOTE: this driver only handles a single twl4030/tps659x0 chip */ 779/* NOTE: this driver only handles a single twl4030/tps659x0 chip */
766static int 780static int __init
767twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id) 781twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id)
768{ 782{
769 int status; 783 int status;