diff options
-rw-r--r-- | Documentation/video4linux/v4l2-framework.txt | 5 | ||||
-rw-r--r-- | include/media/v4l2-subdev.h | 20 |
2 files changed, 21 insertions, 4 deletions
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index e831aaca66f8..f5fdb395287f 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt | |||
@@ -192,6 +192,11 @@ You also need a way to go from the low-level struct to v4l2_subdev. For the | |||
192 | common i2c_client struct the i2c_set_clientdata() call is used to store a | 192 | common i2c_client struct the i2c_set_clientdata() call is used to store a |
193 | v4l2_subdev pointer, for other busses you may have to use other methods. | 193 | v4l2_subdev pointer, for other busses you may have to use other methods. |
194 | 194 | ||
195 | Bridges might also need to store per-subdev private data, such as a pointer to | ||
196 | bridge-specific per-subdev private data. The v4l2_subdev structure provides | ||
197 | host private data for that purpose that can be accessed with | ||
198 | v4l2_get_subdev_hostdata() and v4l2_set_subdev_hostdata(). | ||
199 | |||
195 | From the bridge driver perspective you load the sub-device module and somehow | 200 | From the bridge driver perspective you load the sub-device module and somehow |
196 | obtain the v4l2_subdev pointer. For i2c devices this is easy: you call | 201 | obtain the v4l2_subdev pointer. For i2c devices this is easy: you call |
197 | i2c_get_clientdata(). For other busses something similar needs to be done. | 202 | i2c_get_clientdata(). For other busses something similar needs to be done. |
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 905879d7742f..b0316a7cf08d 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h | |||
@@ -438,17 +438,28 @@ struct v4l2_subdev { | |||
438 | /* can be used to group similar subdevs, value is driver-specific */ | 438 | /* can be used to group similar subdevs, value is driver-specific */ |
439 | u32 grp_id; | 439 | u32 grp_id; |
440 | /* pointer to private data */ | 440 | /* pointer to private data */ |
441 | void *priv; | 441 | void *dev_priv; |
442 | void *host_priv; | ||
442 | }; | 443 | }; |
443 | 444 | ||
444 | static inline void v4l2_set_subdevdata(struct v4l2_subdev *sd, void *p) | 445 | static inline void v4l2_set_subdevdata(struct v4l2_subdev *sd, void *p) |
445 | { | 446 | { |
446 | sd->priv = p; | 447 | sd->dev_priv = p; |
447 | } | 448 | } |
448 | 449 | ||
449 | static inline void *v4l2_get_subdevdata(const struct v4l2_subdev *sd) | 450 | static inline void *v4l2_get_subdevdata(const struct v4l2_subdev *sd) |
450 | { | 451 | { |
451 | return sd->priv; | 452 | return sd->dev_priv; |
453 | } | ||
454 | |||
455 | static inline void v4l2_set_subdev_hostdata(struct v4l2_subdev *sd, void *p) | ||
456 | { | ||
457 | sd->host_priv = p; | ||
458 | } | ||
459 | |||
460 | static inline void *v4l2_get_subdev_hostdata(const struct v4l2_subdev *sd) | ||
461 | { | ||
462 | return sd->host_priv; | ||
452 | } | 463 | } |
453 | 464 | ||
454 | static inline void v4l2_subdev_init(struct v4l2_subdev *sd, | 465 | static inline void v4l2_subdev_init(struct v4l2_subdev *sd, |
@@ -462,7 +473,8 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd, | |||
462 | sd->flags = 0; | 473 | sd->flags = 0; |
463 | sd->name[0] = '\0'; | 474 | sd->name[0] = '\0'; |
464 | sd->grp_id = 0; | 475 | sd->grp_id = 0; |
465 | sd->priv = NULL; | 476 | sd->dev_priv = NULL; |
477 | sd->host_priv = NULL; | ||
466 | } | 478 | } |
467 | 479 | ||
468 | /* Call an ops of a v4l2_subdev, doing the right checks against | 480 | /* Call an ops of a v4l2_subdev, doing the right checks against |