aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/au0828
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@linuxtv.org>2009-03-11 02:01:04 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:27 -0400
commitb14667f32ad0f85f986847ef65f9f3d12a44b71a (patch)
treebb5e0a2867f9d16e37d2a27f9a5d3b7efe122f5f /drivers/media/video/au0828
parent2eaf396020555973cad7aa5b517c2418eccbca50 (diff)
V4L/DVB (11080): au0828: Convert to use v4l2_device/subdev framework
Convert over to using the new subdev framework for the au0828 bridge. This includes using the new i2c probing mechanism. Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/au0828')
-rw-r--r--drivers/media/video/au0828/au0828-cards.c13
-rw-r--r--drivers/media/video/au0828/au0828-core.c15
-rw-r--r--drivers/media/video/au0828/au0828-i2c.c5
-rw-r--r--drivers/media/video/au0828/au0828-video.c2
-rw-r--r--drivers/media/video/au0828/au0828.h4
5 files changed, 31 insertions, 8 deletions
diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c
index 0516c060810e..a12c92c03746 100644
--- a/drivers/media/video/au0828/au0828-cards.c
+++ b/drivers/media/video/au0828/au0828-cards.c
@@ -173,6 +173,7 @@ void au0828_card_setup(struct au0828_dev *dev)
173{ 173{
174 static u8 eeprom[256]; 174 static u8 eeprom[256];
175 struct tuner_setup tun_setup; 175 struct tuner_setup tun_setup;
176 struct v4l2_subdev *sd;
176 unsigned int mode_mask = T_ANALOG_TV | 177 unsigned int mode_mask = T_ANALOG_TV |
177 T_DIGITAL_TV; 178 T_DIGITAL_TV;
178 179
@@ -199,13 +200,21 @@ void au0828_card_setup(struct au0828_dev *dev)
199 /* Load the analog demodulator driver (note this would need to 200 /* Load the analog demodulator driver (note this would need to
200 be abstracted out if we ever need to support a different 201 be abstracted out if we ever need to support a different
201 demod) */ 202 demod) */
202 request_module("au8522"); 203 sd = v4l2_i2c_new_subdev(&dev->i2c_adap, "au8522", "au8522",
204 0x8e >> 1);
205 if (sd == NULL) {
206 printk("analog subdev registration failure\n");
207 }
203 } 208 }
204 209
205 /* Setup tuners */ 210 /* Setup tuners */
206 if (dev->board.tuner_type != TUNER_ABSENT) { 211 if (dev->board.tuner_type != TUNER_ABSENT) {
207 /* Load the tuner module, which does the attach */ 212 /* Load the tuner module, which does the attach */
208 request_module("tuner"); 213 sd = v4l2_i2c_new_subdev(&dev->i2c_adap, "tuner", "tuner",
214 dev->board.tuner_addr);
215 if (sd == NULL) {
216 printk("analog tuner subdev registration failure\n");
217 }
209 218
210 tun_setup.mode_mask = mode_mask; 219 tun_setup.mode_mask = mode_mask;
211 tun_setup.type = dev->board.tuner_type; 220 tun_setup.type = dev->board.tuner_type;
diff --git a/drivers/media/video/au0828/au0828-core.c b/drivers/media/video/au0828/au0828-core.c
index 5199c8aa5888..3281a17fa2cd 100644
--- a/drivers/media/video/au0828/au0828-core.c
+++ b/drivers/media/video/au0828/au0828-core.c
@@ -152,6 +152,8 @@ static void au0828_usb_disconnect(struct usb_interface *interface)
152 /* I2C */ 152 /* I2C */
153 au0828_i2c_unregister(dev); 153 au0828_i2c_unregister(dev);
154 154
155 v4l2_device_unregister(&dev->v4l2_dev);
156
155 usb_set_intfdata(interface, NULL); 157 usb_set_intfdata(interface, NULL);
156 158
157 mutex_lock(&dev->mutex); 159 mutex_lock(&dev->mutex);
@@ -165,7 +167,7 @@ static void au0828_usb_disconnect(struct usb_interface *interface)
165static int au0828_usb_probe(struct usb_interface *interface, 167static int au0828_usb_probe(struct usb_interface *interface,
166 const struct usb_device_id *id) 168 const struct usb_device_id *id)
167{ 169{
168 int ifnum; 170 int ifnum, retval;
169 struct au0828_dev *dev; 171 struct au0828_dev *dev;
170 struct usb_device *usbdev = interface_to_usbdev(interface); 172 struct usb_device *usbdev = interface_to_usbdev(interface);
171 173
@@ -192,6 +194,17 @@ static int au0828_usb_probe(struct usb_interface *interface,
192 194
193 usb_set_intfdata(interface, dev); 195 usb_set_intfdata(interface, dev);
194 196
197 /* Create the v4l2_device */
198 snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), "%s-%03d",
199 "au0828", 0);
200 retval = v4l2_device_register(&dev->usbdev->dev, &dev->v4l2_dev);
201 if (retval) {
202 printk(KERN_ERR "%s() v4l2_device_register failed\n",
203 __func__);
204 kfree(dev);
205 return -EIO;
206 }
207
195 /* Power Up the bridge */ 208 /* Power Up the bridge */
196 au0828_write(dev, REG_600, 1 << 4); 209 au0828_write(dev, REG_600, 1 << 4);
197 210
diff --git a/drivers/media/video/au0828/au0828-i2c.c b/drivers/media/video/au0828/au0828-i2c.c
index d57a38f5c738..e841ba5a6424 100644
--- a/drivers/media/video/au0828/au0828-i2c.c
+++ b/drivers/media/video/au0828/au0828-i2c.c
@@ -345,7 +345,6 @@ static struct i2c_adapter au0828_i2c_adap_template = {
345 .owner = THIS_MODULE, 345 .owner = THIS_MODULE,
346 .id = I2C_HW_B_AU0828, 346 .id = I2C_HW_B_AU0828,
347 .algo = &au0828_i2c_algo_template, 347 .algo = &au0828_i2c_algo_template,
348 .class = I2C_CLASS_TV_ANALOG,
349 .client_register = attach_inform, 348 .client_register = attach_inform,
350 .client_unregister = detach_inform, 349 .client_unregister = detach_inform,
351}; 350};
@@ -392,9 +391,9 @@ int au0828_i2c_register(struct au0828_dev *dev)
392 strlcpy(dev->i2c_adap.name, DRIVER_NAME, 391 strlcpy(dev->i2c_adap.name, DRIVER_NAME,
393 sizeof(dev->i2c_adap.name)); 392 sizeof(dev->i2c_adap.name));
394 393
395 dev->i2c_algo.data = dev; 394 dev->i2c_adap.algo = &dev->i2c_algo;
396 dev->i2c_adap.algo_data = dev; 395 dev->i2c_adap.algo_data = dev;
397 i2c_set_adapdata(&dev->i2c_adap, dev); 396 i2c_set_adapdata(&dev->i2c_adap, &dev->v4l2_dev);
398 i2c_add_adapter(&dev->i2c_adap); 397 i2c_add_adapter(&dev->i2c_adap);
399 398
400 dev->i2c_client.adapter = &dev->i2c_adap; 399 dev->i2c_client.adapter = &dev->i2c_adap;
diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c
index 6abdd8bf4494..f6e8cb17445b 100644
--- a/drivers/media/video/au0828/au0828-video.c
+++ b/drivers/media/video/au0828/au0828-video.c
@@ -1021,7 +1021,7 @@ static int vidioc_querycap(struct file *file, void *priv,
1021 memset(cap, 0, sizeof(*cap)); 1021 memset(cap, 0, sizeof(*cap));
1022 strlcpy(cap->driver, "au0828", sizeof(cap->driver)); 1022 strlcpy(cap->driver, "au0828", sizeof(cap->driver));
1023 strlcpy(cap->card, dev->board.name, sizeof(cap->card)); 1023 strlcpy(cap->card, dev->board.name, sizeof(cap->card));
1024 strlcpy(cap->bus_info, dev->usbdev->dev.bus_id, sizeof(cap->bus_info)); 1024 strlcpy(cap->bus_info, dev->v4l2_dev.name, sizeof(cap->bus_info));
1025 1025
1026 cap->version = AU0828_VERSION_CODE; 1026 cap->version = AU0828_VERSION_CODE;
1027 1027
diff --git a/drivers/media/video/au0828/au0828.h b/drivers/media/video/au0828/au0828.h
index 590d15e461dc..876b18cfbf55 100644
--- a/drivers/media/video/au0828/au0828.h
+++ b/drivers/media/video/au0828/au0828.h
@@ -27,6 +27,7 @@
27/* Analog */ 27/* Analog */
28#include <linux/videodev2.h> 28#include <linux/videodev2.h>
29#include <media/videobuf-vmalloc.h> 29#include <media/videobuf-vmalloc.h>
30#include <media/v4l2-device.h>
30 31
31/* DVB */ 32/* DVB */
32#include "demux.h" 33#include "demux.h"
@@ -188,7 +189,7 @@ struct au0828_dev {
188 189
189 /* I2C */ 190 /* I2C */
190 struct i2c_adapter i2c_adap; 191 struct i2c_adapter i2c_adap;
191 struct i2c_algo_bit_data i2c_algo; 192 struct i2c_algorithm i2c_algo;
192 struct i2c_client i2c_client; 193 struct i2c_client i2c_client;
193 u32 i2c_rc; 194 u32 i2c_rc;
194 195
@@ -197,6 +198,7 @@ struct au0828_dev {
197 198
198 /* Analog */ 199 /* Analog */
199 struct list_head au0828list; 200 struct list_head au0828list;
201 struct v4l2_device v4l2_dev;
200 int users; 202 int users;
201 unsigned int stream_on:1; /* Locks streams */ 203 unsigned int stream_on:1; /* Locks streams */
202 struct video_device *vdev; 204 struct video_device *vdev;