#include <linux/moduleparam.h>
#include <linux/string.h>
#include <linux/vmalloc.h>
#include <linux/v4l2-mediabus.h>
#include <media/v4l2-rect.h>
#include <media/v4l2-subdev.h>
#include "vimc-common.h"
enum vimc_scaler_pad { … };
#define VIMC_SCALER_FMT_WIDTH_DEFAULT …
#define VIMC_SCALER_FMT_HEIGHT_DEFAULT …
struct vimc_scaler_device { … };
static const struct v4l2_mbus_framefmt fmt_default = …;
static const struct v4l2_rect crop_rect_default = …;
static const struct v4l2_rect crop_rect_min = …;
static struct v4l2_rect
vimc_scaler_get_crop_bound_sink(const struct v4l2_mbus_framefmt *sink_fmt)
{ … }
static int vimc_scaler_init_state(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state)
{ … }
static int vimc_scaler_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code)
{ … }
static int vimc_scaler_enum_frame_size(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_size_enum *fse)
{ … }
static int vimc_scaler_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *format)
{ … }
static int vimc_scaler_get_selection(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel)
{ … }
static void vimc_scaler_adjust_sink_crop(struct v4l2_rect *r,
const struct v4l2_mbus_framefmt *sink_fmt)
{ … }
static int vimc_scaler_set_selection(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel)
{ … }
static const struct v4l2_subdev_pad_ops vimc_scaler_pad_ops = …;
static int vimc_scaler_s_stream(struct v4l2_subdev *sd, int enable)
{ … }
static const struct v4l2_subdev_video_ops vimc_scaler_video_ops = …;
static const struct v4l2_subdev_ops vimc_scaler_ops = …;
static const struct v4l2_subdev_internal_ops vimc_scaler_internal_ops = …;
static void vimc_scaler_fill_src_frame(const struct vimc_scaler_device *const vscaler,
const u8 *const sink_frame)
{ … }
static void *vimc_scaler_process_frame(struct vimc_ent_device *ved,
const void *sink_frame)
{
struct vimc_scaler_device *vscaler = container_of(ved, struct vimc_scaler_device,
ved);
if (!vscaler->src_frame)
return ERR_PTR(-EINVAL);
vimc_scaler_fill_src_frame(vscaler, sink_frame);
return vscaler->src_frame;
};
static void vimc_scaler_release(struct vimc_ent_device *ved)
{ … }
static struct vimc_ent_device *vimc_scaler_add(struct vimc_device *vimc,
const char *vcfg_name)
{ … }
const struct vimc_ent_type vimc_scaler_type = …;