aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx23885/cx23885-i2c.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-03-29 05:53:29 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:48 -0400
commit0d5a19f15837de69f864b2a43a93f119224d778c (patch)
tree952be3a127bdf863a7163f552e243020a44f64b1 /drivers/media/video/cx23885/cx23885-i2c.c
parentd35ed62704bc1d44dd4746a242e8c09f2a48fc40 (diff)
V4L/DVB (11297): cx23885: convert to v4l2_subdev.
Convert this driver to v4l2_subdev. Note that currently the only card with analog support in this driver is the HVR-1800. The analog tuner support in this driver is limited to what is needed for this board. When analog support is added for other cards, then the tuner load code will probably have to be expanded to take care of those boards. For example, there is currently no support for either radio tuners or tda9887 demods. I'd like to thank Steven Toth for testing this on his HVR-1800. Tested-by: Steven Toth <stoth@linuxtv.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx23885/cx23885-i2c.c')
-rw-r--r--drivers/media/video/cx23885/cx23885-i2c.c67
1 files changed, 4 insertions, 63 deletions
diff --git a/drivers/media/video/cx23885/cx23885-i2c.c b/drivers/media/video/cx23885/cx23885-i2c.c
index 969b7ebbc827..3421bd12056a 100644
--- a/drivers/media/video/cx23885/cx23885-i2c.c
+++ b/drivers/media/video/cx23885/cx23885-i2c.c
@@ -268,65 +268,6 @@ static int i2c_xfer(struct i2c_adapter *i2c_adap,
268 return retval; 268 return retval;
269} 269}
270 270
271static int attach_inform(struct i2c_client *client)
272{
273 struct v4l2_device *v4l2_dev = i2c_get_adapdata(client->adapter);
274 struct cx23885_dev *dev = to_cx23885(v4l2_dev);
275 struct tuner_setup tun_setup;
276
277 dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n",
278 client->driver->driver.name, client->addr, client->name);
279
280 if (!client->driver->command)
281 return 0;
282
283 if (dev->tuner_type != UNSET) {
284
285 dprintk(1, "%s (tuner) i2c attach [addr=0x%x,client=%s]\n",
286 client->driver->driver.name, client->addr,
287 client->name);
288
289 if ((dev->tuner_addr == ADDR_UNSET) ||
290 (dev->tuner_addr == client->addr)) {
291
292 dprintk(1, "%s (tuner || addr UNSET)\n",
293 client->driver->driver.name);
294
295 dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n",
296 client->driver->driver.name,
297 client->addr, client->name);
298
299 tun_setup.mode_mask = T_ANALOG_TV;
300 tun_setup.type = dev->tuner_type;
301 tun_setup.addr = dev->tuner_addr;
302
303 client->driver->command(client, TUNER_SET_TYPE_ADDR,
304 &tun_setup);
305 }
306 }
307
308 return 0;
309}
310
311static int detach_inform(struct i2c_client *client)
312{
313 struct v4l2_device *v4l2_dev = i2c_get_adapdata(client->adapter);
314 struct cx23885_dev *dev = to_cx23885(v4l2_dev);
315
316 dprintk(1, "i2c detach [client=%s]\n", client->name);
317
318 return 0;
319}
320
321void cx23885_call_i2c_clients(struct cx23885_i2c *bus,
322 unsigned int cmd, void *arg)
323{
324 if (bus->i2c_rc != 0)
325 return;
326
327 i2c_clients_command(&bus->i2c_adap, cmd, arg);
328}
329
330static u32 cx23885_functionality(struct i2c_adapter *adap) 271static u32 cx23885_functionality(struct i2c_adapter *adap)
331{ 272{
332 return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C; 273 return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C;
@@ -344,9 +285,6 @@ static struct i2c_adapter cx23885_i2c_adap_template = {
344 .owner = THIS_MODULE, 285 .owner = THIS_MODULE,
345 .id = I2C_HW_B_CX23885, 286 .id = I2C_HW_B_CX23885,
346 .algo = &cx23885_i2c_algo_template, 287 .algo = &cx23885_i2c_algo_template,
347 .class = I2C_CLASS_TV_ANALOG,
348 .client_register = attach_inform,
349 .client_unregister = detach_inform,
350}; 288};
351 289
352static struct i2c_client cx23885_i2c_client_template = { 290static struct i2c_client cx23885_i2c_client_template = {
@@ -410,8 +348,11 @@ int cx23885_i2c_register(struct cx23885_i2c *bus)
410 348
411 if (0 == bus->i2c_rc) { 349 if (0 == bus->i2c_rc) {
412 dprintk(1, "%s: i2c bus %d registered\n", dev->name, bus->nr); 350 dprintk(1, "%s: i2c bus %d registered\n", dev->name, bus->nr);
413 if (i2c_scan) 351 if (i2c_scan) {
352 printk(KERN_INFO "%s: scan bus %d:\n",
353 dev->name, bus->nr);
414 do_i2c_scan(dev->name, &bus->i2c_client); 354 do_i2c_scan(dev->name, &bus->i2c_client);
355 }
415 } else 356 } else
416 printk(KERN_WARNING "%s: i2c bus %d register FAILED\n", 357 printk(KERN_WARNING "%s: i2c bus %d register FAILED\n",
417 dev->name, bus->nr); 358 dev->name, bus->nr);