aboutsummaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2014-06-12 12:09:42 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-21 19:10:48 -0400
commit0c4348ada001181637b8f73482242166ba2fb56e (patch)
tree819c95c0cc6a31fea3730f3c9254d04cc1cb2c6a /include/media
parent5a573925159aeec1dd159627d849dc6c66000faf (diff)
[media] v4l: ctrls: Unlocked variants of v4l2_ctrl_s_ctrl{,_int64}()
Implement unlocked variants of v4l2_ctrl_s_ctrl() and v4l2_ctrl_s_ctrl_int64(). As drivers need to set controls as they access driver internal state elsewhere than in the control framework unlocked variants of these functions become handy. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> 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.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 5d1a30ca29af..8c4edd69fa4b 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -679,6 +679,8 @@ void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify, void
679 */ 679 */
680s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl); 680s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
681 681
682/** __v4l2_ctrl_s_ctrl() - Unlocked variant of v4l2_ctrl_s_ctrl(). */
683int __v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
682/** v4l2_ctrl_s_ctrl() - Helper function to set the control's value from within a driver. 684/** v4l2_ctrl_s_ctrl() - Helper function to set the control's value from within a driver.
683 * @ctrl: The control. 685 * @ctrl: The control.
684 * @val: The new value. 686 * @val: The new value.
@@ -689,7 +691,16 @@ s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
689 * 691 *
690 * This function is for integer type controls only. 692 * This function is for integer type controls only.
691 */ 693 */
692int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val); 694static inline int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val)
695{
696 int rval;
697
698 v4l2_ctrl_lock(ctrl);
699 rval = __v4l2_ctrl_s_ctrl(ctrl, val);
700 v4l2_ctrl_unlock(ctrl);
701
702 return rval;
703}
693 704
694/** v4l2_ctrl_g_ctrl_int64() - Helper function to get a 64-bit control's value from within a driver. 705/** v4l2_ctrl_g_ctrl_int64() - Helper function to get a 64-bit control's value from within a driver.
695 * @ctrl: The control. 706 * @ctrl: The control.
@@ -702,6 +713,9 @@ int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
702 */ 713 */
703s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl); 714s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl);
704 715
716/** __v4l2_ctrl_s_ctrl_int64() - Unlocked variant of v4l2_ctrl_s_ctrl_int64(). */
717int __v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val);
718
705/** v4l2_ctrl_s_ctrl_int64() - Helper function to set a 64-bit control's value from within a driver. 719/** v4l2_ctrl_s_ctrl_int64() - Helper function to set a 64-bit control's value from within a driver.
706 * @ctrl: The control. 720 * @ctrl: The control.
707 * @val: The new value. 721 * @val: The new value.
@@ -712,7 +726,16 @@ s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl);
712 * 726 *
713 * This function is for 64-bit integer type controls only. 727 * This function is for 64-bit integer type controls only.
714 */ 728 */
715int v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val); 729static inline int v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val)
730{
731 int rval;
732
733 v4l2_ctrl_lock(ctrl);
734 rval = __v4l2_ctrl_s_ctrl_int64(ctrl, val);
735 v4l2_ctrl_unlock(ctrl);
736
737 return rval;
738}
716 739
717/* Internal helper functions that deal with control events. */ 740/* Internal helper functions that deal with control events. */
718extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops; 741extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops;