diff options
Diffstat (limited to 'Documentation/video4linux/v4l2-framework.txt')
-rw-r--r-- | Documentation/video4linux/v4l2-framework.txt | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index a31177390e55..854808b67fae 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt | |||
@@ -90,7 +90,7 @@ up before calling v4l2_device_register then it will be untouched. If dev is | |||
90 | NULL, then you *must* setup v4l2_dev->name before calling v4l2_device_register. | 90 | NULL, then you *must* setup v4l2_dev->name before calling v4l2_device_register. |
91 | 91 | ||
92 | The first 'dev' argument is normally the struct device pointer of a pci_dev, | 92 | The first 'dev' argument is normally the struct device pointer of a pci_dev, |
93 | usb_device or platform_device. It is rare for dev to be NULL, but it happens | 93 | usb_interface or platform_device. It is rare for dev to be NULL, but it happens |
94 | with ISA devices or when one device creates multiple PCI devices, thus making | 94 | with ISA devices or when one device creates multiple PCI devices, thus making |
95 | it impossible to associate v4l2_dev with a particular parent. | 95 | it impossible to associate v4l2_dev with a particular parent. |
96 | 96 | ||
@@ -351,17 +351,6 @@ And this to go from an i2c_client to a v4l2_subdev struct: | |||
351 | 351 | ||
352 | struct v4l2_subdev *sd = i2c_get_clientdata(client); | 352 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
353 | 353 | ||
354 | Finally you need to make a command function to make driver->command() | ||
355 | call the right subdev_ops functions: | ||
356 | |||
357 | static int subdev_command(struct i2c_client *client, unsigned cmd, void *arg) | ||
358 | { | ||
359 | return v4l2_subdev_command(i2c_get_clientdata(client), cmd, arg); | ||
360 | } | ||
361 | |||
362 | If driver->command is never used then you can leave this out. Eventually the | ||
363 | driver->command usage should be removed from v4l. | ||
364 | |||
365 | Make sure to call v4l2_device_unregister_subdev(sd) when the remove() callback | 354 | Make sure to call v4l2_device_unregister_subdev(sd) when the remove() callback |
366 | is called. This will unregister the sub-device from the bridge driver. It is | 355 | is called. This will unregister the sub-device from the bridge driver. It is |
367 | safe to call this even if the sub-device was never registered. | 356 | safe to call this even if the sub-device was never registered. |
@@ -375,14 +364,12 @@ from the remove() callback ensures that this is always done correctly. | |||
375 | 364 | ||
376 | The bridge driver also has some helper functions it can use: | 365 | The bridge driver also has some helper functions it can use: |
377 | 366 | ||
378 | struct v4l2_subdev *sd = v4l2_i2c_new_subdev(adapter, "module_foo", "chipid", 0x36); | 367 | struct v4l2_subdev *sd = v4l2_i2c_new_subdev(v4l2_dev, adapter, |
368 | "module_foo", "chipid", 0x36); | ||
379 | 369 | ||
380 | This loads the given module (can be NULL if no module needs to be loaded) and | 370 | This loads the given module (can be NULL if no module needs to be loaded) and |
381 | calls i2c_new_device() with the given i2c_adapter and chip/address arguments. | 371 | calls i2c_new_device() with the given i2c_adapter and chip/address arguments. |
382 | If all goes well, then it registers the subdev with the v4l2_device. It gets | 372 | If all goes well, then it registers the subdev with the v4l2_device. |
383 | the v4l2_device by calling i2c_get_adapdata(adapter), so you should make sure | ||
384 | to call i2c_set_adapdata(adapter, v4l2_device) when you setup the i2c_adapter | ||
385 | in your driver. | ||
386 | 373 | ||
387 | You can also use v4l2_i2c_new_probed_subdev() which is very similar to | 374 | You can also use v4l2_i2c_new_probed_subdev() which is very similar to |
388 | v4l2_i2c_new_subdev(), except that it has an array of possible I2C addresses | 375 | v4l2_i2c_new_subdev(), except that it has an array of possible I2C addresses |