aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/au0828
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@linuxtv.org>2009-03-15 19:01:53 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:28 -0400
commit2689d3dcc6c75c0b4a05b66330db85df2c036d3e (patch)
treef97c0181d6fd325dc039ea907e517994de48c63e /drivers/media/video/au0828
parentdd27ade7a9195cb3b1f56df4d0ec39763830390b (diff)
V4L/DVB (11088): au0828: finish videodev/subdev conversion
Per Hans Verkuil <hverkuil@xs4all.nl> instruction, remove the deprecated attach_inform/detach_inform routines, and convert over the i2c calls to subdev calls. Thanks to Hans Verkuil <hverkuil@xs4all.nl> for providing feedback on the au0828 analog support. 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.c3
-rw-r--r--drivers/media/video/au0828/au0828-i2c.c29
-rw-r--r--drivers/media/video/au0828/au0828-video.c32
-rw-r--r--drivers/media/video/au0828/au0828.h2
4 files changed, 16 insertions, 50 deletions
diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c
index 1b48eb58a161..1aabaa7e55bb 100644
--- a/drivers/media/video/au0828/au0828-cards.c
+++ b/drivers/media/video/au0828/au0828-cards.c
@@ -218,7 +218,8 @@ void au0828_card_setup(struct au0828_dev *dev)
218 tun_setup.type = dev->board.tuner_type; 218 tun_setup.type = dev->board.tuner_type;
219 tun_setup.addr = dev->board.tuner_addr; 219 tun_setup.addr = dev->board.tuner_addr;
220 tun_setup.tuner_callback = au0828_tuner_callback; 220 tun_setup.tuner_callback = au0828_tuner_callback;
221 au0828_call_i2c_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup); 221 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr,
222 &tun_setup);
222 } 223 }
223} 224}
224 225
diff --git a/drivers/media/video/au0828/au0828-i2c.c b/drivers/media/video/au0828/au0828-i2c.c
index 1b110f37b895..f9a958d0aef1 100644
--- a/drivers/media/video/au0828/au0828-i2c.c
+++ b/drivers/media/video/au0828/au0828-i2c.c
@@ -299,33 +299,6 @@ err:
299 return retval; 299 return retval;
300} 300}
301 301
302static int attach_inform(struct i2c_client *client)
303{
304 dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n",
305 client->driver->driver.name, client->addr, client->name);
306
307 if (!client->driver->command)
308 return 0;
309
310 return 0;
311}
312
313static int detach_inform(struct i2c_client *client)
314{
315 dprintk(1, "i2c detach [client=%s]\n", client->name);
316
317 return 0;
318}
319
320void au0828_call_i2c_clients(struct au0828_dev *dev,
321 unsigned int cmd, void *arg)
322{
323 if (dev->i2c_rc != 0)
324 return;
325
326 i2c_clients_command(&dev->i2c_adap, cmd, arg);
327}
328
329static u32 au0828_functionality(struct i2c_adapter *adap) 302static u32 au0828_functionality(struct i2c_adapter *adap)
330{ 303{
331 return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C; 304 return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C;
@@ -343,8 +316,6 @@ static struct i2c_adapter au0828_i2c_adap_template = {
343 .owner = THIS_MODULE, 316 .owner = THIS_MODULE,
344 .id = I2C_HW_B_AU0828, 317 .id = I2C_HW_B_AU0828,
345 .algo = &au0828_i2c_algo_template, 318 .algo = &au0828_i2c_algo_template,
346 .client_register = attach_inform,
347 .client_unregister = detach_inform,
348}; 319};
349 320
350static struct i2c_client au0828_i2c_client_template = { 321static struct i2c_client au0828_i2c_client_template = {
diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c
index e1940467b472..5de968e128f6 100644
--- a/drivers/media/video/au0828/au0828-video.c
+++ b/drivers/media/video/au0828/au0828-video.c
@@ -996,7 +996,7 @@ static int vidioc_queryctrl(struct file *file, void *priv,
996{ 996{
997 struct au0828_fh *fh = priv; 997 struct au0828_fh *fh = priv;
998 struct au0828_dev *dev = fh->dev; 998 struct au0828_dev *dev = fh->dev;
999 au0828_call_i2c_clients(dev, VIDIOC_QUERYCTRL, qc); 999 v4l2_device_call_all(&dev->v4l2_dev, 0, core, queryctrl, qc);
1000 if (qc->type) 1000 if (qc->type)
1001 return 0; 1001 return 0;
1002 else 1002 else
@@ -1100,7 +1100,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id * norm)
1100 have to make the au0828 bridge adjust the size of its capture 1100 have to make the au0828 bridge adjust the size of its capture
1101 buffer, which is currently hardcoded at 720x480 */ 1101 buffer, which is currently hardcoded at 720x480 */
1102 1102
1103 au0828_call_i2c_clients(dev, VIDIOC_S_STD, norm); 1103 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_std, *norm);
1104 return 0; 1104 return 0;
1105} 1105}
1106 1106
@@ -1182,7 +1182,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index)
1182 1182
1183 route.input = AUVI_INPUT(index).vmux; 1183 route.input = AUVI_INPUT(index).vmux;
1184 route.output = 0; 1184 route.output = 0;
1185 au0828_call_i2c_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route); 1185 v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, &route);
1186 1186
1187 for (i = 0; i < AU0828_MAX_INPUT; i++) { 1187 for (i = 0; i < AU0828_MAX_INPUT; i++) {
1188 int enable = 0; 1188 int enable = 0;
@@ -1206,8 +1206,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index)
1206 } 1206 }
1207 1207
1208 route.input = AUVI_INPUT(index).amux; 1208 route.input = AUVI_INPUT(index).amux;
1209 au0828_call_i2c_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, 1209 v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, &route);
1210 &route);
1211 return 0; 1210 return 0;
1212} 1211}
1213 1212
@@ -1246,7 +1245,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
1246 struct au0828_fh *fh = priv; 1245 struct au0828_fh *fh = priv;
1247 struct au0828_dev *dev = fh->dev; 1246 struct au0828_dev *dev = fh->dev;
1248 1247
1249 au0828_call_i2c_clients(dev, VIDIOC_G_CTRL, ctrl); 1248 v4l2_device_call_all(&dev->v4l2_dev, 0, core, g_ctrl, ctrl);
1250 return 0; 1249 return 0;
1251 1250
1252} 1251}
@@ -1256,7 +1255,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
1256{ 1255{
1257 struct au0828_fh *fh = priv; 1256 struct au0828_fh *fh = priv;
1258 struct au0828_dev *dev = fh->dev; 1257 struct au0828_dev *dev = fh->dev;
1259 au0828_call_i2c_clients(dev, VIDIOC_S_CTRL, ctrl); 1258 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_ctrl, ctrl);
1260 return 0; 1259 return 0;
1261} 1260}
1262 1261
@@ -1269,8 +1268,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
1269 return -EINVAL; 1268 return -EINVAL;
1270 1269
1271 strcpy(t->name, "Auvitek tuner"); 1270 strcpy(t->name, "Auvitek tuner");
1272 1271 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t);
1273 au0828_call_i2c_clients(dev, VIDIOC_G_TUNER, t);
1274 return 0; 1272 return 0;
1275} 1273}
1276 1274
@@ -1284,7 +1282,7 @@ static int vidioc_s_tuner(struct file *file, void *priv,
1284 return -EINVAL; 1282 return -EINVAL;
1285 1283
1286 t->type = V4L2_TUNER_ANALOG_TV; 1284 t->type = V4L2_TUNER_ANALOG_TV;
1287 au0828_call_i2c_clients(dev, VIDIOC_S_TUNER, t); 1285 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_tuner, t);
1288 dprintk(1, "VIDIOC_S_TUNER: signal = %x, afc = %x\n", t->signal, 1286 dprintk(1, "VIDIOC_S_TUNER: signal = %x, afc = %x\n", t->signal,
1289 t->afc); 1287 t->afc);
1290 return 0; 1288 return 0;
@@ -1315,7 +1313,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
1315 1313
1316 dev->ctrl_freq = freq->frequency; 1314 dev->ctrl_freq = freq->frequency;
1317 1315
1318 au0828_call_i2c_clients(dev, VIDIOC_S_FREQUENCY, freq); 1316 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, freq);
1319 1317
1320 au0828_analog_stream_reset(dev); 1318 au0828_analog_stream_reset(dev);
1321 1319
@@ -1335,7 +1333,7 @@ static int vidioc_g_chip_ident(struct file *file, void *priv,
1335 return 0; 1333 return 0;
1336 } 1334 }
1337 1335
1338 au0828_call_i2c_clients(dev, VIDIOC_DBG_G_CHIP_IDENT, chip); 1336 v4l2_device_call_all(&dev->v4l2_dev, 0, core, g_chip_ident, chip);
1339 if (chip->ident == V4L2_IDENT_NONE) 1337 if (chip->ident == V4L2_IDENT_NONE)
1340 return -EINVAL; 1338 return -EINVAL;
1341 1339
@@ -1369,7 +1367,6 @@ static int vidioc_streamon(struct file *file, void *priv,
1369{ 1367{
1370 struct au0828_fh *fh = priv; 1368 struct au0828_fh *fh = priv;
1371 struct au0828_dev *dev = fh->dev; 1369 struct au0828_dev *dev = fh->dev;
1372 int b = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1373 int rc; 1370 int rc;
1374 1371
1375 rc = check_dev(dev); 1372 rc = check_dev(dev);
@@ -1378,7 +1375,7 @@ static int vidioc_streamon(struct file *file, void *priv,
1378 1375
1379 if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { 1376 if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
1380 au0828_analog_stream_enable(dev); 1377 au0828_analog_stream_enable(dev);
1381 au0828_call_i2c_clients(dev, VIDIOC_STREAMON, &b); 1378 v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 1);
1382 } 1379 }
1383 1380
1384 mutex_lock(&dev->lock); 1381 mutex_lock(&dev->lock);
@@ -1396,7 +1393,6 @@ static int vidioc_streamoff(struct file *file, void *priv,
1396{ 1393{
1397 struct au0828_fh *fh = priv; 1394 struct au0828_fh *fh = priv;
1398 struct au0828_dev *dev = fh->dev; 1395 struct au0828_dev *dev = fh->dev;
1399 int b = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1400 int i; 1396 int i;
1401 int ret; 1397 int ret;
1402 int rc; 1398 int rc;
@@ -1411,7 +1407,7 @@ static int vidioc_streamoff(struct file *file, void *priv,
1411 return -EINVAL; 1407 return -EINVAL;
1412 1408
1413 if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { 1409 if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
1414 au0828_call_i2c_clients(dev, VIDIOC_STREAMOFF, &b); 1410 v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0);
1415 ret = au0828_stream_interrupt(dev); 1411 ret = au0828_stream_interrupt(dev);
1416 if (ret != 0) 1412 if (ret != 0)
1417 return ret; 1413 return ret;
@@ -1439,7 +1435,7 @@ static int vidioc_g_register(struct file *file, void *priv,
1439 1435
1440 switch (reg->match.type) { 1436 switch (reg->match.type) {
1441 case V4L2_CHIP_MATCH_I2C_DRIVER: 1437 case V4L2_CHIP_MATCH_I2C_DRIVER:
1442 au0828_call_i2c_clients(dev, VIDIOC_DBG_G_REGISTER, reg); 1438 v4l2_device_call_all(&dev->v4l2_dev, 0, core, g_register, reg);
1443 return 0; 1439 return 0;
1444 default: 1440 default:
1445 return -EINVAL; 1441 return -EINVAL;
@@ -1454,7 +1450,7 @@ static int vidioc_s_register(struct file *file, void *priv,
1454 1450
1455 switch (reg->match.type) { 1451 switch (reg->match.type) {
1456 case V4L2_CHIP_MATCH_I2C_DRIVER: 1452 case V4L2_CHIP_MATCH_I2C_DRIVER:
1457 au0828_call_i2c_clients(dev, VIDIOC_DBG_S_REGISTER, reg); 1453 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_register, reg);
1458 return 0; 1454 return 0;
1459 default: 1455 default:
1460 return -EINVAL; 1456 return -EINVAL;
diff --git a/drivers/media/video/au0828/au0828.h b/drivers/media/video/au0828/au0828.h
index 6d9bd454ea53..6ed1a6129731 100644
--- a/drivers/media/video/au0828/au0828.h
+++ b/drivers/media/video/au0828/au0828.h
@@ -265,8 +265,6 @@ extern void au0828_card_setup(struct au0828_dev *dev);
265/* au0828-i2c.c */ 265/* au0828-i2c.c */
266extern int au0828_i2c_register(struct au0828_dev *dev); 266extern int au0828_i2c_register(struct au0828_dev *dev);
267extern int au0828_i2c_unregister(struct au0828_dev *dev); 267extern int au0828_i2c_unregister(struct au0828_dev *dev);
268extern void au0828_call_i2c_clients(struct au0828_dev *dev,
269 unsigned int cmd, void *arg);
270 268
271/* ----------------------------------------------------------- */ 269/* ----------------------------------------------------------- */
272/* au0828-video.c */ 270/* au0828-video.c */