diff options
Diffstat (limited to 'drivers/media/video/dpc7146.c')
| -rw-r--r-- | drivers/media/video/dpc7146.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/media/video/dpc7146.c b/drivers/media/video/dpc7146.c index 2831bdd12057..0fcc935828f8 100644 --- a/drivers/media/video/dpc7146.c +++ b/drivers/media/video/dpc7146.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | dpc7146.c - v4l2 driver for the dpc7146 demonstration board | 2 | dpc7146.c - v4l2 driver for the dpc7146 demonstration board |
| 3 | 3 | ||
| 4 | Copyright (C) 2000-2003 Michael Hunold <michael@mihu.de> | 4 | Copyright (C) 2000-2003 Michael Hunold <michael@mihu.de> |
| 5 | 5 | ||
| 6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| @@ -52,7 +52,7 @@ | |||
| 52 | #define SAA711X_DECODED_BYTES_OF_TS_2 0x1C | 52 | #define SAA711X_DECODED_BYTES_OF_TS_2 0x1C |
| 53 | #define SAA711X_STATUS_BYTE 0x1F | 53 | #define SAA711X_STATUS_BYTE 0x1F |
| 54 | 54 | ||
| 55 | #define DPC_BOARD_CAN_DO_VBI(dev) (dev->revision != 0) | 55 | #define DPC_BOARD_CAN_DO_VBI(dev) (dev->revision != 0) |
| 56 | 56 | ||
| 57 | static int debug = 0; | 57 | static int debug = 0; |
| 58 | module_param(debug, int, 0); | 58 | module_param(debug, int, 0); |
| @@ -81,16 +81,16 @@ struct dpc | |||
| 81 | struct video_device *video_dev; | 81 | struct video_device *video_dev; |
| 82 | struct video_device *vbi_dev; | 82 | struct video_device *vbi_dev; |
| 83 | 83 | ||
| 84 | struct i2c_adapter i2c_adapter; | 84 | struct i2c_adapter i2c_adapter; |
| 85 | struct i2c_client *saa7111a; | 85 | struct i2c_client *saa7111a; |
| 86 | 86 | ||
| 87 | int cur_input; /* current input */ | 87 | int cur_input; /* current input */ |
| 88 | }; | 88 | }; |
| 89 | 89 | ||
| 90 | /* fixme: add vbi stuff here */ | 90 | /* fixme: add vbi stuff here */ |
| 91 | static int dpc_probe(struct saa7146_dev* dev) | 91 | static int dpc_probe(struct saa7146_dev* dev) |
| 92 | { | 92 | { |
| 93 | struct dpc* dpc = NULL; | 93 | struct dpc* dpc = NULL; |
| 94 | struct i2c_client *client; | 94 | struct i2c_client *client; |
| 95 | struct list_head *item; | 95 | struct list_head *item; |
| 96 | 96 | ||
| @@ -118,20 +118,20 @@ static int dpc_probe(struct saa7146_dev* dev) | |||
| 118 | /* loop through all i2c-devices on the bus and look who is there */ | 118 | /* loop through all i2c-devices on the bus and look who is there */ |
| 119 | list_for_each(item,&dpc->i2c_adapter.clients) { | 119 | list_for_each(item,&dpc->i2c_adapter.clients) { |
| 120 | client = list_entry(item, struct i2c_client, list); | 120 | client = list_entry(item, struct i2c_client, list); |
| 121 | if( I2C_SAA7111A == client->addr ) | 121 | if( I2C_SAA7111A == client->addr ) |
| 122 | dpc->saa7111a = client; | 122 | dpc->saa7111a = client; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | /* check if all devices are present */ | 125 | /* check if all devices are present */ |
| 126 | if( 0 == dpc->saa7111a ) { | 126 | if( 0 == dpc->saa7111a ) { |
| 127 | DEB_D(("dpc_v4l2.o: dpc_attach failed for this device.\n")); | 127 | DEB_D(("dpc_v4l2.o: dpc_attach failed for this device.\n")); |
| 128 | i2c_del_adapter(&dpc->i2c_adapter); | 128 | i2c_del_adapter(&dpc->i2c_adapter); |
| 129 | kfree(dpc); | 129 | kfree(dpc); |
| 130 | return -ENODEV; | 130 | return -ENODEV; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | /* all devices are present, probe was successful */ | 133 | /* all devices are present, probe was successful */ |
| 134 | DEB_D(("dpc_v4l2.o: dpc_probe succeeded for this device.\n")); | 134 | DEB_D(("dpc_v4l2.o: dpc_probe succeeded for this device.\n")); |
| 135 | 135 | ||
| 136 | /* we store the pointer in our private data field */ | 136 | /* we store the pointer in our private data field */ |
| 137 | dev->ext_priv = dpc; | 137 | dev->ext_priv = dpc; |
| @@ -182,7 +182,7 @@ static struct saa7146_ext_vv vv_data; | |||
| 182 | static int dpc_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data *info) | 182 | static int dpc_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data *info) |
| 183 | { | 183 | { |
| 184 | struct dpc* dpc = (struct dpc*)dev->ext_priv; | 184 | struct dpc* dpc = (struct dpc*)dev->ext_priv; |
| 185 | 185 | ||
| 186 | DEB_D(("dpc_v4l2.o: dpc_attach called.\n")); | 186 | DEB_D(("dpc_v4l2.o: dpc_attach called.\n")); |
| 187 | 187 | ||
| 188 | /* checking for i2c-devices can be omitted here, because we | 188 | /* checking for i2c-devices can be omitted here, because we |
| @@ -193,7 +193,7 @@ static int dpc_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data | |||
| 193 | ERR(("cannot register capture v4l2 device. skipping.\n")); | 193 | ERR(("cannot register capture v4l2 device. skipping.\n")); |
| 194 | return -1; | 194 | return -1; |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | /* initialization stuff (vbi) (only for revision > 0 and for extensions which want it)*/ | 197 | /* initialization stuff (vbi) (only for revision > 0 and for extensions which want it)*/ |
| 198 | if( 0 != DPC_BOARD_CAN_DO_VBI(dev)) { | 198 | if( 0 != DPC_BOARD_CAN_DO_VBI(dev)) { |
| 199 | if( 0 != saa7146_register_device(&dpc->vbi_dev, dev, "dpc", VFL_TYPE_VBI)) { | 199 | if( 0 != saa7146_register_device(&dpc->vbi_dev, dev, "dpc", VFL_TYPE_VBI)) { |
| @@ -205,18 +205,18 @@ static int dpc_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data | |||
| 205 | 205 | ||
| 206 | printk("dpc: found 'dpc7146 demonstration board'-%d.\n",dpc_num); | 206 | printk("dpc: found 'dpc7146 demonstration board'-%d.\n",dpc_num); |
| 207 | dpc_num++; | 207 | dpc_num++; |
| 208 | 208 | ||
| 209 | /* the rest */ | 209 | /* the rest */ |
| 210 | dpc->cur_input = 0; | 210 | dpc->cur_input = 0; |
| 211 | dpc_init_done(dev); | 211 | dpc_init_done(dev); |
| 212 | 212 | ||
| 213 | return 0; | 213 | return 0; |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | static int dpc_detach(struct saa7146_dev* dev) | 216 | static int dpc_detach(struct saa7146_dev* dev) |
| 217 | { | 217 | { |
| 218 | struct dpc* dpc = (struct dpc*)dev->ext_priv; | 218 | struct dpc* dpc = (struct dpc*)dev->ext_priv; |
| 219 | 219 | ||
| 220 | DEB_EE(("dev:%p\n",dev)); | 220 | DEB_EE(("dev:%p\n",dev)); |
| 221 | 221 | ||
| 222 | i2c_release_client(dpc->saa7111a); | 222 | i2c_release_client(dpc->saa7111a); |
| @@ -238,25 +238,25 @@ static int dpc_detach(struct saa7146_dev* dev) | |||
| 238 | int dpc_vbi_bypass(struct saa7146_dev* dev) | 238 | int dpc_vbi_bypass(struct saa7146_dev* dev) |
| 239 | { | 239 | { |
| 240 | struct dpc* dpc = (struct dpc*)dev->ext_priv; | 240 | struct dpc* dpc = (struct dpc*)dev->ext_priv; |
| 241 | 241 | ||
| 242 | int i = 1; | 242 | int i = 1; |
| 243 | 243 | ||
| 244 | /* switch bypass in saa7111a */ | 244 | /* switch bypass in saa7111a */ |
| 245 | if ( 0 != dpc->saa7111a->driver->command(dpc->saa7111a,SAA711X_VBI_BYPASS, &i)) { | 245 | if ( 0 != dpc->saa7111a->driver->command(dpc->saa7111a,SAA711X_VBI_BYPASS, &i)) { |
| 246 | printk("dpc_v4l2.o: VBI_BYPASS: could not address saa7111a.\n"); | 246 | printk("dpc_v4l2.o: VBI_BYPASS: could not address saa7111a.\n"); |
| 247 | return -1; | 247 | return -1; |
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | return 0; | 250 | return 0; |
| 251 | } | 251 | } |
| 252 | #endif | 252 | #endif |
| 253 | 253 | ||
| 254 | static int dpc_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) | 254 | static int dpc_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) |
| 255 | { | 255 | { |
| 256 | struct saa7146_dev *dev = fh->dev; | 256 | struct saa7146_dev *dev = fh->dev; |
| 257 | struct dpc* dpc = (struct dpc*)dev->ext_priv; | 257 | struct dpc* dpc = (struct dpc*)dev->ext_priv; |
| 258 | /* | 258 | /* |
| 259 | struct saa7146_vv *vv = dev->vv_data; | 259 | struct saa7146_vv *vv = dev->vv_data; |
| 260 | */ | 260 | */ |
| 261 | switch(cmd) | 261 | switch(cmd) |
| 262 | { | 262 | { |
| @@ -264,11 +264,11 @@ static int dpc_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) | |||
| 264 | { | 264 | { |
| 265 | struct v4l2_input *i = arg; | 265 | struct v4l2_input *i = arg; |
| 266 | DEB_EE(("VIDIOC_ENUMINPUT %d.\n",i->index)); | 266 | DEB_EE(("VIDIOC_ENUMINPUT %d.\n",i->index)); |
| 267 | 267 | ||
| 268 | if( i->index < 0 || i->index >= DPC_INPUTS) { | 268 | if( i->index < 0 || i->index >= DPC_INPUTS) { |
| 269 | return -EINVAL; | 269 | return -EINVAL; |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | memcpy(i, &dpc_inputs[i->index], sizeof(struct v4l2_input)); | 272 | memcpy(i, &dpc_inputs[i->index], sizeof(struct v4l2_input)); |
| 273 | 273 | ||
| 274 | DEB_D(("dpc_v4l2.o: v4l2_ioctl: VIDIOC_ENUMINPUT %d.\n",i->index)); | 274 | DEB_D(("dpc_v4l2.o: v4l2_ioctl: VIDIOC_ENUMINPUT %d.\n",i->index)); |
| @@ -289,13 +289,13 @@ static int dpc_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) | |||
| 289 | if (input < 0 || input >= DPC_INPUTS) { | 289 | if (input < 0 || input >= DPC_INPUTS) { |
| 290 | return -EINVAL; | 290 | return -EINVAL; |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | dpc->cur_input = input; | 293 | dpc->cur_input = input; |
| 294 | 294 | ||
| 295 | /* fixme: switch input here, switch audio, too! */ | 295 | /* fixme: switch input here, switch audio, too! */ |
| 296 | // saa7146_set_hps_source_and_sync(dev, input_port_selection[input].hps_source, input_port_selection[input].hps_sync); | 296 | // saa7146_set_hps_source_and_sync(dev, input_port_selection[input].hps_source, input_port_selection[input].hps_sync); |
| 297 | printk("dpc_v4l2.o: VIDIOC_S_INPUT: fixme switch input.\n"); | 297 | printk("dpc_v4l2.o: VIDIOC_S_INPUT: fixme switch input.\n"); |
| 298 | 298 | ||
| 299 | return 0; | 299 | return 0; |
| 300 | } | 300 | } |
| 301 | default: | 301 | default: |
| @@ -334,8 +334,8 @@ static struct saa7146_standard standard[] = { | |||
| 334 | static struct saa7146_extension extension; | 334 | static struct saa7146_extension extension; |
| 335 | 335 | ||
| 336 | static struct saa7146_pci_extension_data dpc = { | 336 | static struct saa7146_pci_extension_data dpc = { |
| 337 | .ext_priv = "Multimedia eXtension Board", | 337 | .ext_priv = "Multimedia eXtension Board", |
| 338 | .ext = &extension, | 338 | .ext = &extension, |
| 339 | }; | 339 | }; |
| 340 | 340 | ||
| 341 | static struct pci_device_id pci_tbl[] = { | 341 | static struct pci_device_id pci_tbl[] = { |
| @@ -357,7 +357,7 @@ static struct saa7146_ext_vv vv_data = { | |||
| 357 | .capabilities = V4L2_CAP_VBI_CAPTURE, | 357 | .capabilities = V4L2_CAP_VBI_CAPTURE, |
| 358 | .stds = &standard[0], | 358 | .stds = &standard[0], |
| 359 | .num_stds = sizeof(standard)/sizeof(struct saa7146_standard), | 359 | .num_stds = sizeof(standard)/sizeof(struct saa7146_standard), |
| 360 | .std_callback = &std_callback, | 360 | .std_callback = &std_callback, |
| 361 | .ioctls = &ioctls[0], | 361 | .ioctls = &ioctls[0], |
| 362 | .ioctl = dpc_ioctl, | 362 | .ioctl = dpc_ioctl, |
| 363 | }; | 363 | }; |
| @@ -365,7 +365,7 @@ static struct saa7146_ext_vv vv_data = { | |||
| 365 | static struct saa7146_extension extension = { | 365 | static struct saa7146_extension extension = { |
| 366 | .name = "dpc7146 demonstration board", | 366 | .name = "dpc7146 demonstration board", |
| 367 | .flags = SAA7146_USE_I2C_IRQ, | 367 | .flags = SAA7146_USE_I2C_IRQ, |
| 368 | 368 | ||
| 369 | .pci_tbl = &pci_tbl[0], | 369 | .pci_tbl = &pci_tbl[0], |
| 370 | .module = THIS_MODULE, | 370 | .module = THIS_MODULE, |
| 371 | 371 | ||
| @@ -375,7 +375,7 @@ static struct saa7146_extension extension = { | |||
| 375 | 375 | ||
| 376 | .irq_mask = 0, | 376 | .irq_mask = 0, |
| 377 | .irq_func = NULL, | 377 | .irq_func = NULL, |
| 378 | }; | 378 | }; |
| 379 | 379 | ||
| 380 | static int __init dpc_init_module(void) | 380 | static int __init dpc_init_module(void) |
| 381 | { | 381 | { |
| @@ -383,7 +383,7 @@ static int __init dpc_init_module(void) | |||
| 383 | DEB_S(("failed to register extension.\n")); | 383 | DEB_S(("failed to register extension.\n")); |
| 384 | return -ENODEV; | 384 | return -ENODEV; |
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | return 0; | 387 | return 0; |
| 388 | } | 388 | } |
| 389 | 389 | ||
