cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

v4l2-ctrls-priv.h (3276B)


      1/* SPDX-License-Identifier: GPL-2.0-or-later */
      2/*
      3 * V4L2 controls framework private header.
      4 *
      5 * Copyright (C) 2010-2021  Hans Verkuil <hverkuil-cisco@xs4all.nl>
      6 */
      7
      8#ifndef _V4L2_CTRLS_PRIV_H_
      9#define _V4L2_CTRLS_PRIV_H_
     10
     11#define dprintk(vdev, fmt, arg...) do {					\
     12	if (!WARN_ON(!(vdev)) && ((vdev)->dev_debug & V4L2_DEV_DEBUG_CTRL)) \
     13		printk(KERN_DEBUG pr_fmt("%s: %s: " fmt),		\
     14		       __func__, video_device_node_name(vdev), ##arg);	\
     15} while (0)
     16
     17#define has_op(master, op) \
     18	((master)->ops && (master)->ops->op)
     19#define call_op(master, op) \
     20	(has_op(master, op) ? (master)->ops->op(master) : 0)
     21
     22static inline u32 node2id(struct list_head *node)
     23{
     24	return list_entry(node, struct v4l2_ctrl_ref, node)->ctrl->id;
     25}
     26
     27/*
     28 * Small helper function to determine if the autocluster is set to manual
     29 * mode.
     30 */
     31static inline bool is_cur_manual(const struct v4l2_ctrl *master)
     32{
     33	return master->is_auto && master->cur.val == master->manual_mode_value;
     34}
     35
     36/*
     37 * Small helper function to determine if the autocluster will be set to manual
     38 * mode.
     39 */
     40static inline bool is_new_manual(const struct v4l2_ctrl *master)
     41{
     42	return master->is_auto && master->val == master->manual_mode_value;
     43}
     44
     45static inline u32 user_flags(const struct v4l2_ctrl *ctrl)
     46{
     47	u32 flags = ctrl->flags;
     48
     49	if (ctrl->is_ptr)
     50		flags |= V4L2_CTRL_FLAG_HAS_PAYLOAD;
     51
     52	return flags;
     53}
     54
     55/* v4l2-ctrls-core.c */
     56void cur_to_new(struct v4l2_ctrl *ctrl);
     57void cur_to_req(struct v4l2_ctrl_ref *ref);
     58void new_to_cur(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl, u32 ch_flags);
     59void new_to_req(struct v4l2_ctrl_ref *ref);
     60void req_to_new(struct v4l2_ctrl_ref *ref);
     61void send_initial_event(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl);
     62void send_event(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl, u32 changes);
     63int validate_new(const struct v4l2_ctrl *ctrl, union v4l2_ctrl_ptr p_new);
     64int handler_new_ref(struct v4l2_ctrl_handler *hdl,
     65		    struct v4l2_ctrl *ctrl,
     66		    struct v4l2_ctrl_ref **ctrl_ref,
     67		    bool from_other_dev, bool allocate_req);
     68struct v4l2_ctrl_ref *find_ref(struct v4l2_ctrl_handler *hdl, u32 id);
     69struct v4l2_ctrl_ref *find_ref_lock(struct v4l2_ctrl_handler *hdl, u32 id);
     70int check_range(enum v4l2_ctrl_type type,
     71		s64 min, s64 max, u64 step, s64 def);
     72void update_from_auto_cluster(struct v4l2_ctrl *master);
     73int try_or_set_cluster(struct v4l2_fh *fh, struct v4l2_ctrl *master,
     74		       bool set, u32 ch_flags);
     75
     76/* v4l2-ctrls-api.c */
     77int v4l2_g_ext_ctrls_common(struct v4l2_ctrl_handler *hdl,
     78			    struct v4l2_ext_controls *cs,
     79			    struct video_device *vdev);
     80int try_set_ext_ctrls_common(struct v4l2_fh *fh,
     81			     struct v4l2_ctrl_handler *hdl,
     82			     struct v4l2_ext_controls *cs,
     83			     struct video_device *vdev, bool set);
     84
     85/* v4l2-ctrls-request.c */
     86void v4l2_ctrl_handler_init_request(struct v4l2_ctrl_handler *hdl);
     87void v4l2_ctrl_handler_free_request(struct v4l2_ctrl_handler *hdl);
     88int v4l2_g_ext_ctrls_request(struct v4l2_ctrl_handler *hdl, struct video_device *vdev,
     89			     struct media_device *mdev, struct v4l2_ext_controls *cs);
     90int try_set_ext_ctrls_request(struct v4l2_fh *fh,
     91			      struct v4l2_ctrl_handler *hdl,
     92			      struct video_device *vdev,
     93			      struct media_device *mdev,
     94			      struct v4l2_ext_controls *cs, bool set);
     95
     96#endif