21 #ifndef _V4L2_SUBDEV_H
22 #define _V4L2_SUBDEV_H
24 #include <linux/types.h>
33 #define V4L2_SUBDEV_IR_RX_NOTIFY _IOW('v', 0, u32)
34 #define V4L2_SUBDEV_IR_RX_FIFO_SERVICE_REQ 0x00000001
35 #define V4L2_SUBDEV_IR_RX_END_OF_RX_DETECTED 0x00000002
36 #define V4L2_SUBDEV_IR_RX_HW_FIFO_OVERRUN 0x00000004
37 #define V4L2_SUBDEV_IR_RX_SW_FIFO_OVERRUN 0x00000008
39 #define V4L2_SUBDEV_IR_TX_NOTIFY _IOW('v', 1, u32)
40 #define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001
104 #define V4L2_SUBDEV_IO_PIN_DISABLE (1 << 0)
105 #define V4L2_SUBDEV_IO_PIN_OUTPUT (1 << 1)
106 #define V4L2_SUBDEV_IO_PIN_INPUT (1 << 2)
107 #define V4L2_SUBDEV_IO_PIN_SET_VALUE (1 << 3)
108 #define V4L2_SUBDEV_IO_PIN_ACTIVE_LOW (1 << 4)
166 #ifdef CONFIG_VIDEO_ADV_DEBUG
232 #define V4L2_MBUS_FRAME_DESC_FL_LEN_MAX (1U << 0)
234 #define V4L2_MBUS_FRAME_DESC_FL_BLOB (1U << 1)
249 #define V4L2_FRAME_DESC_ENTRY_MAX 4
329 struct v4l2_subdev_frame_interval *
interval);
331 struct v4l2_subdev_frame_interval *
interval);
357 struct v4l2_mbus_framefmt *
fmt);
359 struct v4l2_mbus_framefmt *
fmt);
361 struct v4l2_mbus_framefmt *
fmt);
504 struct v4l2_subdev_mbus_code_enum *
code);
507 struct v4l2_subdev_frame_size_enum *fse);
510 struct v4l2_subdev_frame_interval_enum *fie);
520 struct v4l2_subdev_selection *
sel);
522 struct v4l2_subdev_selection *
sel);
525 #ifdef CONFIG_MEDIA_CONTROLLER
568 #define V4L2_SUBDEV_NAME_SIZE 32
571 #define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
573 #define V4L2_SUBDEV_FL_IS_SPI (1U << 1)
575 #define V4L2_SUBDEV_FL_HAS_DEVNODE (1U << 2)
577 #define V4L2_SUBDEV_FL_HAS_EVENTS (1U << 3)
583 #if defined(CONFIG_MEDIA_CONTROLLER)
606 #define media_entity_to_v4l2_subdev(ent) \
607 container_of(ent, struct v4l2_subdev, entity)
608 #define vdev_to_v4l2_subdev(vdev) \
609 ((struct v4l2_subdev *)video_get_drvdata(vdev))
616 #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
618 struct v4l2_mbus_framefmt try_fmt;
625 #define to_v4l2_subdev_fh(fh) \
626 container_of(fh, struct v4l2_subdev_fh, vfh)
628 #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
629 #define __V4L2_SUBDEV_MK_GET_TRY(rtype, fun_name, field_name) \
630 static inline struct rtype * \
631 v4l2_subdev_get_try_##fun_name(struct v4l2_subdev_fh *fh, \
634 BUG_ON(unlikely(pad >= vdev_to_v4l2_subdev( \
635 fh->vfh.vdev)->entity.num_pads)); \
636 return &fh->pad[pad].field_name; \
639 __V4L2_SUBDEV_MK_GET_TRY(v4l2_mbus_framefmt,
format, try_fmt)
640 __V4L2_SUBDEV_MK_GET_TRY(
v4l2_rect, crop, try_compose)
641 __V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, compose, try_compose)
646 static inline void v4l2_set_subdevdata(
struct v4l2_subdev *
sd,
void *
p)
651 static inline void *v4l2_get_subdevdata(
const struct v4l2_subdev *
sd)
656 static inline void v4l2_set_subdev_hostdata(
struct v4l2_subdev *
sd,
void *
p)
661 static inline void *v4l2_get_subdev_hostdata(
const struct v4l2_subdev *
sd)
666 #ifdef CONFIG_MEDIA_CONTROLLER
667 int v4l2_subdev_link_validate_default(
struct v4l2_subdev *
sd,
681 #define v4l2_subdev_call(sd, o, f, args...) \
682 (!(sd) ? -ENODEV : (((sd)->ops->o && (sd)->ops->o->f) ? \
683 (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD))
686 #define v4l2_subdev_notify(sd, notification, arg) \
687 ((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \
688 (sd)->v4l2_dev->notify((sd), (notification), (arg)))