aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2010-09-24 08:58:51 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-22 19:55:21 -0400
commit84d0d4f0674c55d0625bd1b6eb91dba4ef3948f9 (patch)
treee5c3356158bf30269ecd7b60e837789a3b461f30
parentdfffec67951494a02244b43b0b2cdc9cded841b2 (diff)
[media] ivtv: Don't use module names to load I2C modules
With the v4l2_i2c_new_subdev* functions now supporting loading modules based on modaliases, replace the hardcoded module name passed to those functions by NULL. The sub-devices without a listed module name don't result in and I2C sub-device being created, as they either are IR devices or don't have an I2C address listed. It's thus safe to rely on modaliases only. All corresponding I2C modules have been checked, and all of them include a module aliases table with names corresponding to what the ivtv driver uses. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/ivtv/ivtv-i2c.c42
1 files changed, 8 insertions, 34 deletions
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c
index a74fa099c565..9e8039ac909e 100644
--- a/drivers/media/video/ivtv/ivtv-i2c.c
+++ b/drivers/media/video/ivtv/ivtv-i2c.c
@@ -121,31 +121,6 @@ static const u8 hw_addrs[] = {
121}; 121};
122 122
123/* This array should match the IVTV_HW_ defines */ 123/* This array should match the IVTV_HW_ defines */
124static const char *hw_modules[] = {
125 "cx25840",
126 "saa7115",
127 "saa7127",
128 "msp3400",
129 "tuner",
130 "wm8775",
131 "cs53l32a",
132 NULL,
133 "saa7115",
134 "upd64031a",
135 "upd64083",
136 "saa717x",
137 "wm8739",
138 "vp27smpx",
139 "m52790",
140 NULL,
141 NULL, /* IVTV_HW_I2C_IR_RX_AVER */
142 NULL, /* IVTV_HW_I2C_IR_RX_HAUP_EXT */
143 NULL, /* IVTV_HW_I2C_IR_RX_HAUP_INT */
144 NULL, /* IVTV_HW_Z8F0811_IR_TX_HAUP */
145 NULL, /* IVTV_HW_Z8F0811_IR_RX_HAUP */
146};
147
148/* This array should match the IVTV_HW_ defines */
149static const char * const hw_devicenames[] = { 124static const char * const hw_devicenames[] = {
150 "cx25840", 125 "cx25840",
151 "saa7115", 126 "saa7115",
@@ -257,7 +232,6 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx)
257{ 232{
258 struct v4l2_subdev *sd; 233 struct v4l2_subdev *sd;
259 struct i2c_adapter *adap = &itv->i2c_adap; 234 struct i2c_adapter *adap = &itv->i2c_adap;
260 const char *mod = hw_modules[idx];
261 const char *type = hw_devicenames[idx]; 235 const char *type = hw_devicenames[idx];
262 u32 hw = 1 << idx; 236 u32 hw = 1 << idx;
263 237
@@ -266,17 +240,17 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx)
266 if (hw == IVTV_HW_TUNER) { 240 if (hw == IVTV_HW_TUNER) {
267 /* special tuner handling */ 241 /* special tuner handling */
268 sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, 242 sd = v4l2_i2c_new_subdev(&itv->v4l2_dev,
269 adap, mod, type, 243 adap, NULL, type,
270 0, itv->card_i2c->radio); 244 0, itv->card_i2c->radio);
271 if (sd) 245 if (sd)
272 sd->grp_id = 1 << idx; 246 sd->grp_id = 1 << idx;
273 sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, 247 sd = v4l2_i2c_new_subdev(&itv->v4l2_dev,
274 adap, mod, type, 248 adap, NULL, type,
275 0, itv->card_i2c->demod); 249 0, itv->card_i2c->demod);
276 if (sd) 250 if (sd)
277 sd->grp_id = 1 << idx; 251 sd->grp_id = 1 << idx;
278 sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, 252 sd = v4l2_i2c_new_subdev(&itv->v4l2_dev,
279 adap, mod, type, 253 adap, NULL, type,
280 0, itv->card_i2c->tv); 254 0, itv->card_i2c->tv);
281 if (sd) 255 if (sd)
282 sd->grp_id = 1 << idx; 256 sd->grp_id = 1 << idx;
@@ -293,16 +267,17 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx)
293 /* It's an I2C device other than an analog tuner or IR chip */ 267 /* It's an I2C device other than an analog tuner or IR chip */
294 if (hw == IVTV_HW_UPD64031A || hw == IVTV_HW_UPD6408X) { 268 if (hw == IVTV_HW_UPD64031A || hw == IVTV_HW_UPD6408X) {
295 sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, 269 sd = v4l2_i2c_new_subdev(&itv->v4l2_dev,
296 adap, mod, type, 0, I2C_ADDRS(hw_addrs[idx])); 270 adap, NULL, type, 0, I2C_ADDRS(hw_addrs[idx]));
297 } else if (hw == IVTV_HW_CX25840) { 271 } else if (hw == IVTV_HW_CX25840) {
298 struct cx25840_platform_data pdata; 272 struct cx25840_platform_data pdata;
299 273
300 pdata.pvr150_workaround = itv->pvr150_workaround; 274 pdata.pvr150_workaround = itv->pvr150_workaround;
301 sd = v4l2_i2c_new_subdev_cfg(&itv->v4l2_dev, 275 sd = v4l2_i2c_new_subdev_cfg(&itv->v4l2_dev,
302 adap, mod, type, 0, &pdata, hw_addrs[idx], NULL); 276 adap, NULL, type, 0, &pdata, hw_addrs[idx],
277 NULL);
303 } else { 278 } else {
304 sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, 279 sd = v4l2_i2c_new_subdev(&itv->v4l2_dev,
305 adap, mod, type, hw_addrs[idx], NULL); 280 adap, NULL, type, hw_addrs[idx], NULL);
306 } 281 }
307 if (sd) 282 if (sd)
308 sd->grp_id = 1 << idx; 283 sd->grp_id = 1 << idx;
@@ -706,8 +681,7 @@ int init_ivtv_i2c(struct ivtv *itv)
706 /* Sanity checks for the I2C hardware arrays. They must be the 681 /* Sanity checks for the I2C hardware arrays. They must be the
707 * same size. 682 * same size.
708 */ 683 */
709 if (ARRAY_SIZE(hw_devicenames) != ARRAY_SIZE(hw_addrs) || 684 if (ARRAY_SIZE(hw_devicenames) != ARRAY_SIZE(hw_addrs)) {
710 ARRAY_SIZE(hw_devicenames) != ARRAY_SIZE(hw_modules)) {
711 IVTV_ERR("Mismatched I2C hardware arrays\n"); 685 IVTV_ERR("Mismatched I2C hardware arrays\n");
712 return -ENODEV; 686 return -ENODEV;
713 } 687 }