static int hsit_get_format(struct v4l2_subdev *subdev, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) { struct vsp1_hsit *hsit = to_hsit(subdev); fmt->format = *vsp1_entity_get_pad_format(&hsit->entity, cfg, fmt->pad, fmt->which); return 0; }
static void hsit_configure(struct vsp1_entity *entity, struct vsp1_pipeline *pipe, struct vsp1_dl_list *dl, bool full) { struct vsp1_hsit *hsit = to_hsit(&entity->subdev); if (!full) return; if (hsit->inverse) vsp1_hsit_write(hsit, dl, VI6_HSI_CTRL, VI6_HSI_CTRL_EN); else vsp1_hsit_write(hsit, dl, VI6_HST_CTRL, VI6_HST_CTRL_EN); }
static int hsit_s_stream(struct v4l2_subdev *subdev, int enable) { struct vsp1_hsit *hsit = to_hsit(subdev); if (!enable) return 0; if (hsit->inverse) vsp1_hsit_write(hsit, VI6_HSI_CTRL, VI6_HSI_CTRL_EN); else vsp1_hsit_write(hsit, VI6_HST_CTRL, VI6_HST_CTRL_EN); return 0; }
static int hsit_enum_mbus_code(struct v4l2_subdev *subdev, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_mbus_code_enum *code) { struct vsp1_hsit *hsit = to_hsit(subdev); if (code->index > 0) return -EINVAL; if ((code->pad == HSIT_PAD_SINK && !hsit->inverse) | (code->pad == HSIT_PAD_SOURCE && hsit->inverse)) code->code = MEDIA_BUS_FMT_ARGB8888_1X32; else code->code = MEDIA_BUS_FMT_AHSV8888_1X32; return 0; }
static int hsit_set_format(struct v4l2_subdev *subdev, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) { struct vsp1_hsit *hsit = to_hsit(subdev); struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; config = vsp1_entity_get_pad_config(&hsit->entity, cfg, fmt->which); if (!config) return -EINVAL; format = vsp1_entity_get_pad_format(&hsit->entity, config, fmt->pad); if (fmt->pad == HSIT_PAD_SOURCE) { /* The HST and HSI output format code and resolution can't be * modified. */ fmt->format = *format; return 0; } format->code = hsit->inverse ? MEDIA_BUS_FMT_AHSV8888_1X32 : MEDIA_BUS_FMT_ARGB8888_1X32; format->width = clamp_t(unsigned int, fmt->format.width, HSIT_MIN_SIZE, HSIT_MAX_SIZE); format->height = clamp_t(unsigned int, fmt->format.height, HSIT_MIN_SIZE, HSIT_MAX_SIZE); format->field = V4L2_FIELD_NONE; format->colorspace = V4L2_COLORSPACE_SRGB; fmt->format = *format; /* Propagate the format to the source pad. */ format = vsp1_entity_get_pad_format(&hsit->entity, config, HSIT_PAD_SOURCE); *format = fmt->format; format->code = hsit->inverse ? MEDIA_BUS_FMT_ARGB8888_1X32 : MEDIA_BUS_FMT_AHSV8888_1X32; return 0; }