diff options
| author | Hans Verkuil <hans.verkuil@cisco.com> | 2014-07-21 09:45:42 -0400 |
|---|---|---|
| committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-25 18:18:51 -0400 |
| commit | 5d0360a4f027576e5419d4a7c711c9ca0f1be8ca (patch) | |
| tree | b8ebb9afdd68b7bef28da38986d1bbb4a2fcc3e6 /include/media | |
| parent | 592d1349f719db7c071ba9f4ade272be114b4196 (diff) | |
[media] v4l2-ctrls: add support for setting string controls
Rather than always having to use a v4l2_ext_control struct to set
a control value from within a driver, switch to just setting the
new value. This is faster and it makes it possible to set more
complex types such as a string control as is added by this
patch.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'include/media')
| -rw-r--r-- | include/media/v4l2-ctrls.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 8c4edd69fa4b..d6540d201764 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h | |||
| @@ -737,6 +737,30 @@ static inline int v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val) | |||
| 737 | return rval; | 737 | return rval; |
| 738 | } | 738 | } |
| 739 | 739 | ||
| 740 | /** __v4l2_ctrl_s_ctrl_string() - Unlocked variant of v4l2_ctrl_s_ctrl_string(). */ | ||
| 741 | int __v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s); | ||
| 742 | |||
| 743 | /** v4l2_ctrl_s_ctrl_string() - Helper function to set a control's string value from within a driver. | ||
| 744 | * @ctrl: The control. | ||
| 745 | * @s: The new string. | ||
| 746 | * | ||
| 747 | * This set the control's new string safely by going through the control | ||
| 748 | * framework. This function will lock the control's handler, so it cannot be | ||
| 749 | * used from within the &v4l2_ctrl_ops functions. | ||
| 750 | * | ||
| 751 | * This function is for string type controls only. | ||
| 752 | */ | ||
| 753 | static inline int v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s) | ||
| 754 | { | ||
| 755 | int rval; | ||
| 756 | |||
| 757 | v4l2_ctrl_lock(ctrl); | ||
| 758 | rval = __v4l2_ctrl_s_ctrl_string(ctrl, s); | ||
| 759 | v4l2_ctrl_unlock(ctrl); | ||
| 760 | |||
| 761 | return rval; | ||
| 762 | } | ||
| 763 | |||
| 740 | /* Internal helper functions that deal with control events. */ | 764 | /* Internal helper functions that deal with control events. */ |
| 741 | extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops; | 765 | extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops; |
| 742 | void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new); | 766 | void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new); |
