linux-omap 2.6.37: sync with OE .dev
[glsdk/meta-ti-glsdk.git] / recipes-bsp / linux / linux-omap / media / 0003-v4l-subdev-Merge-v4l2_i2c_new_subdev_cfg-and-v4l2_i2.patch
1 From 2c7009851d70caeb91ac806b133b7d77c5c2ca19 Mon Sep 17 00:00:00 2001
2 From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
3 Date: Thu, 8 Jul 2010 12:01:09 +0200
4 Subject: [PATCH 03/43] v4l: subdev: Merge v4l2_i2c_new_subdev_cfg and v4l2_i2c_new_subdev
6 v4l2_i2c_new_subdev is a thin wrapper around v4l2_i2c_new_subdev_cfg,
7 which is itself a wrapper around v4l2_i2c_new_subdev_board.
9 The intermediate v4l2_i2c_new_subdev_cfg function is called directly by
10 the ivtv and cafe-ccic drivers only. Merge it with v4l2_i2c_new_subdev
11 and use v4l2_i2c_new_subdev_board in the ivtv and cafe-ccic drivers.
13 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
14 ---
15  drivers/media/video/cafe_ccic.c     |   11 +++++++++--
16  drivers/media/video/ivtv/ivtv-i2c.c |   11 +++++++++--
17  drivers/media/video/v4l2-common.c   |    7 ++-----
18  include/media/v4l2-common.h         |   13 +------------
19  4 files changed, 21 insertions(+), 21 deletions(-)
21 diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
22 index 0dfff50..6e23add 100644
23 --- a/drivers/media/video/cafe_ccic.c
24 +++ b/drivers/media/video/cafe_ccic.c
25 @@ -1992,6 +1992,7 @@ static int cafe_pci_probe(struct pci_dev *pdev,
26  {
27         int ret;
28         struct cafe_camera *cam;
29 +       struct i2c_board_info info;
30         struct ov7670_config sensor_cfg = {
31                 /* This controller only does SMBUS */
32                 .use_smbus = true,
33 @@ -2065,8 +2066,14 @@ static int cafe_pci_probe(struct pci_dev *pdev,
34                 sensor_cfg.clock_speed = 45;
35  
36         cam->sensor_addr = 0x42;
37 -       cam->sensor = v4l2_i2c_new_subdev_cfg(&cam->v4l2_dev, &cam->i2c_adapter,
38 -                       "ov7670", 0, &sensor_cfg, cam->sensor_addr, NULL);
39 +
40 +       memset(&info, 0, sizeof(info));
41 +       strlcpy(info.type, "ov7670", sizeof(info.type));
42 +       info.addr = cam->sensor_addr;
43 +       info.platform_data = &sensor_cfg;
44 +
45 +       cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev,
46 +                       &cam->i2c_adapter, &info, NULL);
47         if (cam->sensor == NULL) {
48                 ret = -ENODEV;
49                 goto out_smbus;
50 diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c
51 index 665191c..6651a6c 100644
52 --- a/drivers/media/video/ivtv/ivtv-i2c.c
53 +++ b/drivers/media/video/ivtv/ivtv-i2c.c
54 @@ -267,10 +267,17 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx)
55                                 adap, type, 0, I2C_ADDRS(hw_addrs[idx]));
56         } else if (hw == IVTV_HW_CX25840) {
57                 struct cx25840_platform_data pdata;
58 +               struct i2c_board_info info;
59  
60                 pdata.pvr150_workaround = itv->pvr150_workaround;
61 -               sd = v4l2_i2c_new_subdev_cfg(&itv->v4l2_dev,
62 -                               adap, type, 0, &pdata, hw_addrs[idx], NULL);
63 +
64 +               memset(&info, 0, sizeof(info));
65 +               strlcpy(info.type, type, sizeof(info.type));
66 +               info.addr = hw_addrs[idx];
67 +               info.platform_data = &pdata;
68 +
69 +               sd = v4l2_i2c_new_subdev_board(&itv->v4l2_dev, adap, &info,
70 +                                              NULL);
71         } else {
72                 sd = v4l2_i2c_new_subdev(&itv->v4l2_dev,
73                                 adap, type, hw_addrs[idx], NULL);
74 diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
75 index b5eb1f3..e007e61 100644
76 --- a/drivers/media/video/v4l2-common.c
77 +++ b/drivers/media/video/v4l2-common.c
78 @@ -428,9 +428,8 @@ error:
79  }
80  EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_board);
81  
82 -struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev,
83 +struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
84                 struct i2c_adapter *adapter, const char *client_type,
85 -               int irq, void *platform_data,
86                 u8 addr, const unsigned short *probe_addrs)
87  {
88         struct i2c_board_info info;
89 @@ -440,12 +439,10 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev,
90         memset(&info, 0, sizeof(info));
91         strlcpy(info.type, client_type, sizeof(info.type));
92         info.addr = addr;
93 -       info.irq = irq;
94 -       info.platform_data = platform_data;
95  
96         return v4l2_i2c_new_subdev_board(v4l2_dev, adapter, &info, probe_addrs);
97  }
98 -EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_cfg);
99 +EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev);
100  
101  /* Return i2c client address of v4l2_subdev. */
102  unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd)
103 diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
104 index 239125a..565fb32 100644
105 --- a/include/media/v4l2-common.h
106 +++ b/include/media/v4l2-common.h
107 @@ -138,21 +138,10 @@ struct v4l2_subdev_ops;
108  
109  /* Load an i2c module and return an initialized v4l2_subdev struct.
110     The client_type argument is the name of the chip that's on the adapter. */
111 -struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev,
112 +struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
113                 struct i2c_adapter *adapter, const char *client_type,
114 -               int irq, void *platform_data,
115                 u8 addr, const unsigned short *probe_addrs);
116  
117 -/* Load an i2c module and return an initialized v4l2_subdev struct.
118 -   The client_type argument is the name of the chip that's on the adapter. */
119 -static inline struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
120 -               struct i2c_adapter *adapter, const char *client_type,
121 -               u8 addr, const unsigned short *probe_addrs)
122 -{
123 -       return v4l2_i2c_new_subdev_cfg(v4l2_dev, adapter, client_type, 0, NULL,
124 -                                      addr, probe_addrs);
125 -}
127  struct i2c_board_info;
128  
129  struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,
130 -- 
131 1.6.6.1