aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-06 21:32:12 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-06 21:32:12 -0500
commit9e9bc9736756f25d6c47b4eba0ebf25b20a6f153 (patch)
tree647240f479c5f23910c3e6194d1c35b6ba54d75e /drivers/mfd
parent3c0cb7c31c206aaedb967e44b98442bbeb17a6c4 (diff)
parente3c92215198cb6aa00ad38db2780faa6b72e0a3f (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (255 commits) [media] radio-aimslab.c: Fix gcc 4.5+ bug [media] cx25821: Fix compilation breakage due to BKL dependency [media] v4l2-compat-ioctl32: fix compile warning [media] zoran: fix compiler warning [media] tda18218: fix compile warning [media] ngene: fix compile warning [media] DVB: IR support for TechnoTrend CT-3650 [media] cx23885, cimax2.c: Fix case of two CAM insertion irq [media] ir-nec-decoder: fix repeat key issue [media] staging: se401 depends on USB [media] staging: usbvideo/vicam depends on USB [media] soc_camera: Add the ability to bind regulators to soc_camedra devices [media] V4L2: Add a v4l2-subdev (soc-camera) driver for OmniVision OV2640 sensor [media] v4l: soc-camera: switch to .unlocked_ioctl [media] v4l: ov772x: simplify pointer dereference [media] ov9640: fix OmniVision OV9640 sensor driver's priv data retrieving [media] ov9640: use macro to request OmniVision OV9640 sensor private data [media] ivtv-i2c: Fix two warnings [media] staging/lirc: Update lirc TODO files [media] cx88: Remove the obsolete i2c_adapter.id field ...
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/Kconfig10
-rw-r--r--drivers/mfd/Makefile1
-rw-r--r--drivers/mfd/timberdale.c61
-rw-r--r--drivers/mfd/timberdale.h2
-rw-r--r--drivers/mfd/wl1273-core.c148
5 files changed, 218 insertions, 4 deletions
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index e8e704f52746..da9d2971102e 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -606,6 +606,16 @@ config MFD_VX855
606 VIA VX855/VX875 south bridge. You will need to enable the vx855_spi 606 VIA VX855/VX875 south bridge. You will need to enable the vx855_spi
607 and/or vx855_gpio drivers for this to do anything useful. 607 and/or vx855_gpio drivers for this to do anything useful.
608 608
609config MFD_WL1273_CORE
610 tristate
611 depends on I2C
612 select MFD_CORE
613 default n
614 help
615 This is the core driver for the TI WL1273 FM radio. This MFD
616 driver connects the radio-wl1273 V4L2 module and the wl1273
617 audio codec.
618
609endif # MFD_SUPPORT 619endif # MFD_SUPPORT
610 620
611menu "Multimedia Capabilities Port drivers" 621menu "Multimedia Capabilities Port drivers"
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index e590d1e44cf0..848e7eac75aa 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -81,3 +81,4 @@ obj-$(CONFIG_MFD_JANZ_CMODIO) += janz-cmodio.o
81obj-$(CONFIG_MFD_JZ4740_ADC) += jz4740-adc.o 81obj-$(CONFIG_MFD_JZ4740_ADC) += jz4740-adc.o
82obj-$(CONFIG_MFD_TPS6586X) += tps6586x.o 82obj-$(CONFIG_MFD_TPS6586X) += tps6586x.o
83obj-$(CONFIG_MFD_VX855) += vx855.o 83obj-$(CONFIG_MFD_VX855) += vx855.o
84obj-$(CONFIG_MFD_WL1273_CORE) += wl1273-core.o
diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c
index 727f62c15a60..6ad8a7f8d390 100644
--- a/drivers/mfd/timberdale.c
+++ b/drivers/mfd/timberdale.c
@@ -40,6 +40,7 @@
40#include <linux/spi/mc33880.h> 40#include <linux/spi/mc33880.h>
41 41
42#include <media/timb_radio.h> 42#include <media/timb_radio.h>
43#include <media/timb_video.h>
43 44
44#include <linux/timb_dma.h> 45#include <linux/timb_dma.h>
45 46
@@ -246,7 +247,23 @@ static const __devinitconst struct resource timberdale_uartlite_resources[] = {
246 }, 247 },
247}; 248};
248 249
249static const __devinitconst struct resource timberdale_radio_resources[] = { 250static __devinitdata struct i2c_board_info timberdale_adv7180_i2c_board_info = {
251 /* Requires jumper JP9 to be off */
252 I2C_BOARD_INFO("adv7180", 0x42 >> 1),
253 .irq = IRQ_TIMBERDALE_ADV7180
254};
255
256static __devinitdata struct timb_video_platform_data
257 timberdale_video_platform_data = {
258 .dma_channel = DMA_VIDEO_RX,
259 .i2c_adapter = 0,
260 .encoder = {
261 .info = &timberdale_adv7180_i2c_board_info
262 }
263};
264
265static const __devinitconst struct resource
266timberdale_radio_resources[] = {
250 { 267 {
251 .start = RDSOFFSET, 268 .start = RDSOFFSET,
252 .end = RDSEND, 269 .end = RDSEND,
@@ -271,15 +288,25 @@ static __devinitdata struct timb_radio_platform_data
271 timberdale_radio_platform_data = { 288 timberdale_radio_platform_data = {
272 .i2c_adapter = 0, 289 .i2c_adapter = 0,
273 .tuner = { 290 .tuner = {
274 .module_name = "tef6862",
275 .info = &timberdale_tef6868_i2c_board_info 291 .info = &timberdale_tef6868_i2c_board_info
276 }, 292 },
277 .dsp = { 293 .dsp = {
278 .module_name = "saa7706h",
279 .info = &timberdale_saa7706_i2c_board_info 294 .info = &timberdale_saa7706_i2c_board_info
280 } 295 }
281}; 296};
282 297
298static const __devinitconst struct resource timberdale_video_resources[] = {
299 {
300 .start = LOGIWOFFSET,
301 .end = LOGIWEND,
302 .flags = IORESOURCE_MEM,
303 },
304 /*
305 note that the "frame buffer" is located in DMA area
306 starting at 0x1200000
307 */
308};
309
283static __devinitdata struct timb_dma_platform_data timb_dma_platform_data = { 310static __devinitdata struct timb_dma_platform_data timb_dma_platform_data = {
284 .nr_channels = 10, 311 .nr_channels = 10,
285 .channels = { 312 .channels = {
@@ -380,6 +407,13 @@ static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg0[] = {
380 .data_size = sizeof(timberdale_gpio_platform_data), 407 .data_size = sizeof(timberdale_gpio_platform_data),
381 }, 408 },
382 { 409 {
410 .name = "timb-video",
411 .num_resources = ARRAY_SIZE(timberdale_video_resources),
412 .resources = timberdale_video_resources,
413 .platform_data = &timberdale_video_platform_data,
414 .data_size = sizeof(timberdale_video_platform_data),
415 },
416 {
383 .name = "timb-radio", 417 .name = "timb-radio",
384 .num_resources = ARRAY_SIZE(timberdale_radio_resources), 418 .num_resources = ARRAY_SIZE(timberdale_radio_resources),
385 .resources = timberdale_radio_resources, 419 .resources = timberdale_radio_resources,
@@ -440,6 +474,13 @@ static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg1[] = {
440 .resources = timberdale_mlogicore_resources, 474 .resources = timberdale_mlogicore_resources,
441 }, 475 },
442 { 476 {
477 .name = "timb-video",
478 .num_resources = ARRAY_SIZE(timberdale_video_resources),
479 .resources = timberdale_video_resources,
480 .platform_data = &timberdale_video_platform_data,
481 .data_size = sizeof(timberdale_video_platform_data),
482 },
483 {
443 .name = "timb-radio", 484 .name = "timb-radio",
444 .num_resources = ARRAY_SIZE(timberdale_radio_resources), 485 .num_resources = ARRAY_SIZE(timberdale_radio_resources),
445 .resources = timberdale_radio_resources, 486 .resources = timberdale_radio_resources,
@@ -490,6 +531,13 @@ static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg2[] = {
490 .data_size = sizeof(timberdale_gpio_platform_data), 531 .data_size = sizeof(timberdale_gpio_platform_data),
491 }, 532 },
492 { 533 {
534 .name = "timb-video",
535 .num_resources = ARRAY_SIZE(timberdale_video_resources),
536 .resources = timberdale_video_resources,
537 .platform_data = &timberdale_video_platform_data,
538 .data_size = sizeof(timberdale_video_platform_data),
539 },
540 {
493 .name = "timb-radio", 541 .name = "timb-radio",
494 .num_resources = ARRAY_SIZE(timberdale_radio_resources), 542 .num_resources = ARRAY_SIZE(timberdale_radio_resources),
495 .resources = timberdale_radio_resources, 543 .resources = timberdale_radio_resources,
@@ -533,6 +581,13 @@ static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg3[] = {
533 .data_size = sizeof(timberdale_gpio_platform_data), 581 .data_size = sizeof(timberdale_gpio_platform_data),
534 }, 582 },
535 { 583 {
584 .name = "timb-video",
585 .num_resources = ARRAY_SIZE(timberdale_video_resources),
586 .resources = timberdale_video_resources,
587 .platform_data = &timberdale_video_platform_data,
588 .data_size = sizeof(timberdale_video_platform_data),
589 },
590 {
536 .name = "timb-radio", 591 .name = "timb-radio",
537 .num_resources = ARRAY_SIZE(timberdale_radio_resources), 592 .num_resources = ARRAY_SIZE(timberdale_radio_resources),
538 .resources = timberdale_radio_resources, 593 .resources = timberdale_radio_resources,
diff --git a/drivers/mfd/timberdale.h b/drivers/mfd/timberdale.h
index c11bf6ebfe00..4412acd826fa 100644
--- a/drivers/mfd/timberdale.h
+++ b/drivers/mfd/timberdale.h
@@ -23,7 +23,7 @@
23#ifndef MFD_TIMBERDALE_H 23#ifndef MFD_TIMBERDALE_H
24#define MFD_TIMBERDALE_H 24#define MFD_TIMBERDALE_H
25 25
26#define DRV_VERSION "0.2" 26#define DRV_VERSION "0.3"
27 27
28/* This driver only support versions >= 3.8 and < 4.0 */ 28/* This driver only support versions >= 3.8 and < 4.0 */
29#define TIMB_SUPPORTED_MAJOR 3 29#define TIMB_SUPPORTED_MAJOR 3
diff --git a/drivers/mfd/wl1273-core.c b/drivers/mfd/wl1273-core.c
new file mode 100644
index 000000000000..d2ecc2435736
--- /dev/null
+++ b/drivers/mfd/wl1273-core.c
@@ -0,0 +1,148 @@
1/*
2 * MFD driver for wl1273 FM radio and audio codec submodules.
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 * Author: Matti Aaltonen <matti.j.aaltonen@nokia.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 *
21 */
22
23#include <linux/mfd/wl1273-core.h>
24#include <linux/slab.h>
25
26#define DRIVER_DESC "WL1273 FM Radio Core"
27
28static struct i2c_device_id wl1273_driver_id_table[] = {
29 { WL1273_FM_DRIVER_NAME, 0 },
30 { }
31};
32MODULE_DEVICE_TABLE(i2c, wl1273_driver_id_table);
33
34static int wl1273_core_remove(struct i2c_client *client)
35{
36 struct wl1273_core *core = i2c_get_clientdata(client);
37
38 dev_dbg(&client->dev, "%s\n", __func__);
39
40 mfd_remove_devices(&client->dev);
41 i2c_set_clientdata(client, NULL);
42 kfree(core);
43
44 return 0;
45}
46
47static int __devinit wl1273_core_probe(struct i2c_client *client,
48 const struct i2c_device_id *id)
49{
50 struct wl1273_fm_platform_data *pdata = client->dev.platform_data;
51 struct wl1273_core *core;
52 struct mfd_cell *cell;
53 int children = 0;
54 int r = 0;
55
56 dev_dbg(&client->dev, "%s\n", __func__);
57
58 if (!pdata) {
59 dev_err(&client->dev, "No platform data.\n");
60 return -EINVAL;
61 }
62
63 if (!(pdata->children & WL1273_RADIO_CHILD)) {
64 dev_err(&client->dev, "Cannot function without radio child.\n");
65 return -EINVAL;
66 }
67
68 core = kzalloc(sizeof(*core), GFP_KERNEL);
69 if (!core)
70 return -ENOMEM;
71
72 core->pdata = pdata;
73 core->client = client;
74 mutex_init(&core->lock);
75
76 i2c_set_clientdata(client, core);
77
78 dev_dbg(&client->dev, "%s: Have V4L2.\n", __func__);
79
80 cell = &core->cells[children];
81 cell->name = "wl1273_fm_radio";
82 cell->platform_data = &core;
83 cell->data_size = sizeof(core);
84 children++;
85
86 if (pdata->children & WL1273_CODEC_CHILD) {
87 cell = &core->cells[children];
88
89 dev_dbg(&client->dev, "%s: Have codec.\n", __func__);
90 cell->name = "wl1273-codec";
91 cell->platform_data = &core;
92 cell->data_size = sizeof(core);
93 children++;
94 }
95
96 dev_dbg(&client->dev, "%s: number of children: %d.\n",
97 __func__, children);
98
99 r = mfd_add_devices(&client->dev, -1, core->cells,
100 children, NULL, 0);
101 if (r)
102 goto err;
103
104 return 0;
105
106err:
107 i2c_set_clientdata(client, NULL);
108 pdata->free_resources();
109 kfree(core);
110
111 dev_dbg(&client->dev, "%s\n", __func__);
112
113 return r;
114}
115
116static struct i2c_driver wl1273_core_driver = {
117 .driver = {
118 .name = WL1273_FM_DRIVER_NAME,
119 },
120 .probe = wl1273_core_probe,
121 .id_table = wl1273_driver_id_table,
122 .remove = __devexit_p(wl1273_core_remove),
123};
124
125static int __init wl1273_core_init(void)
126{
127 int r;
128
129 r = i2c_add_driver(&wl1273_core_driver);
130 if (r) {
131 pr_err(WL1273_FM_DRIVER_NAME
132 ": driver registration failed\n");
133 return r;
134 }
135
136 return r;
137}
138
139static void __exit wl1273_core_exit(void)
140{
141 i2c_del_driver(&wl1273_core_driver);
142}
143late_initcall(wl1273_core_init);
144module_exit(wl1273_core_exit);
145
146MODULE_AUTHOR("Matti Aaltonen <matti.j.aaltonen@nokia.com>");
147MODULE_DESCRIPTION(DRIVER_DESC);
148MODULE_LICENSE("GPL");