25 #include <linux/module.h>
26 #include <linux/types.h>
27 #include <linux/slab.h>
28 #include <linux/kernel.h>
37 #define TWL4030_AUDIO_CELLS 2
79 struct twl4030_audio *audio = platform_get_drvdata(twl4030_audio_dev);
94 struct twl4030_audio *audio = platform_get_drvdata(twl4030_audio_dev);
99 "Invalid resource ID (%u)\n",
id);
104 if (!audio->
resource[
id].request_count)
106 val = twl4030_audio_set_resource(
id, 1);
108 val = twl4030_audio_get_resource(
id);
123 struct twl4030_audio *audio = platform_get_drvdata(twl4030_audio_dev);
128 "Invalid resource ID (%u)\n",
id);
133 if (!audio->
resource[
id].request_count) {
135 "Resource has been disabled already (%u)\n",
id);
141 if (!audio->
resource[
id].request_count)
143 val = twl4030_audio_set_resource(
id, 0);
145 val = twl4030_audio_get_resource(
id);
155 struct twl4030_audio *audio = platform_get_drvdata(twl4030_audio_dev);
164 if (pdata && pdata->
codec)
178 if (pdata && pdata->
vibra)
181 if (!of_property_read_u32(node,
"ti,enable-vibra", &vibra) && vibra)
196 if (!pdata && !node) {
197 dev_err(&pdev->
dev,
"Platform data is missing\n");
234 if (twl4030_audio_has_codec(pdata, node)) {
235 cell = &audio->
cells[childs];
236 cell->
name =
"twl4030-codec";
243 if (twl4030_audio_has_vibra(pdata, node)) {
244 cell = &audio->
cells[childs];
245 cell->
name =
"twl4030-vibra";
253 platform_set_drvdata(pdev, audio);
254 twl4030_audio_dev = pdev;
260 dev_err(&pdev->
dev,
"No platform data found for childs\n");
265 platform_set_drvdata(pdev,
NULL);
266 twl4030_audio_dev =
NULL;
275 platform_set_drvdata(pdev,
NULL);
276 twl4030_audio_dev =
NULL;
281 static const struct of_device_id twl4030_audio_of_match[] = {
282 {.compatible =
"ti,twl4030-audio", },
290 .name =
"twl4030-audio",
291 .of_match_table = twl4030_audio_of_match,
293 .probe = twl4030_audio_probe,