Commit 3a9e69f1 authored by Shuah Khan's avatar Shuah Khan Committed by Mauro Carvalho Chehab

media: vimc: move duplicated IS_SRC and IS_SINK to common header

Move duplicated IS_SRC and IS_SINK dfines to common header. Rename
them to VIMC_IS_SRC and VIM_IS_SINK.
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
Acked-by: default avatarHelen Koike <helen.koike@collabora.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent d7fb5c36
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
#define VIMC_FRAME_INDEX(lin, col, width, bpp) ((lin * width + col) * bpp) #define VIMC_FRAME_INDEX(lin, col, width, bpp) ((lin * width + col) * bpp)
/* Source and sink pad checks */
#define VIMC_IS_SRC(pad) (pad)
#define VIMC_IS_SINK(pad) (!(pad))
/** /**
* struct vimc_colorimetry_clamp - Adjust colorimetry parameters * struct vimc_colorimetry_clamp - Adjust colorimetry parameters
* *
......
...@@ -20,9 +20,6 @@ MODULE_PARM_DESC(deb_mean_win_size, " the window size to calculate the mean.\n" ...@@ -20,9 +20,6 @@ MODULE_PARM_DESC(deb_mean_win_size, " the window size to calculate the mean.\n"
"stays in the center of the window, otherwise the next odd number " "stays in the center of the window, otherwise the next odd number "
"is considered"); "is considered");
#define IS_SINK(pad) (!pad)
#define IS_SRC(pad) (pad)
enum vimc_deb_rgb_colors { enum vimc_deb_rgb_colors {
VIMC_DEB_RED = 0, VIMC_DEB_RED = 0,
VIMC_DEB_GREEN = 1, VIMC_DEB_GREEN = 1,
...@@ -155,7 +152,7 @@ static int vimc_deb_enum_mbus_code(struct v4l2_subdev *sd, ...@@ -155,7 +152,7 @@ static int vimc_deb_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_mbus_code_enum *code) struct v4l2_subdev_mbus_code_enum *code)
{ {
/* We only support one format for source pads */ /* We only support one format for source pads */
if (IS_SRC(code->pad)) { if (VIMC_IS_SRC(code->pad)) {
struct vimc_deb_device *vdeb = v4l2_get_subdevdata(sd); struct vimc_deb_device *vdeb = v4l2_get_subdevdata(sd);
if (code->index) if (code->index)
...@@ -181,7 +178,7 @@ static int vimc_deb_enum_frame_size(struct v4l2_subdev *sd, ...@@ -181,7 +178,7 @@ static int vimc_deb_enum_frame_size(struct v4l2_subdev *sd,
if (fse->index) if (fse->index)
return -EINVAL; return -EINVAL;
if (IS_SINK(fse->pad)) { if (VIMC_IS_SINK(fse->pad)) {
const struct vimc_deb_pix_map *vpix = const struct vimc_deb_pix_map *vpix =
vimc_deb_pix_map_by_code(fse->code); vimc_deb_pix_map_by_code(fse->code);
...@@ -211,7 +208,7 @@ static int vimc_deb_get_fmt(struct v4l2_subdev *sd, ...@@ -211,7 +208,7 @@ static int vimc_deb_get_fmt(struct v4l2_subdev *sd,
vdeb->sink_fmt; vdeb->sink_fmt;
/* Set the right code for the source pad */ /* Set the right code for the source pad */
if (IS_SRC(fmt->pad)) if (VIMC_IS_SRC(fmt->pad))
fmt->format.code = vdeb->src_code; fmt->format.code = vdeb->src_code;
return 0; return 0;
...@@ -258,7 +255,7 @@ static int vimc_deb_set_fmt(struct v4l2_subdev *sd, ...@@ -258,7 +255,7 @@ static int vimc_deb_set_fmt(struct v4l2_subdev *sd,
* Do not change the format of the source pad, * Do not change the format of the source pad,
* it is propagated from the sink * it is propagated from the sink
*/ */
if (IS_SRC(fmt->pad)) { if (VIMC_IS_SRC(fmt->pad)) {
fmt->format = *sink_fmt; fmt->format = *sink_fmt;
/* TODO: Add support for other formats */ /* TODO: Add support for other formats */
fmt->format.code = vdeb->src_code; fmt->format.code = vdeb->src_code;
......
...@@ -16,8 +16,6 @@ static unsigned int sca_mult = 3; ...@@ -16,8 +16,6 @@ static unsigned int sca_mult = 3;
module_param(sca_mult, uint, 0000); module_param(sca_mult, uint, 0000);
MODULE_PARM_DESC(sca_mult, " the image size multiplier"); MODULE_PARM_DESC(sca_mult, " the image size multiplier");
#define IS_SINK(pad) (!pad)
#define IS_SRC(pad) (pad)
#define MAX_ZOOM 8 #define MAX_ZOOM 8
struct vimc_sca_device { struct vimc_sca_device {
...@@ -93,7 +91,7 @@ static int vimc_sca_enum_frame_size(struct v4l2_subdev *sd, ...@@ -93,7 +91,7 @@ static int vimc_sca_enum_frame_size(struct v4l2_subdev *sd,
fse->min_width = VIMC_FRAME_MIN_WIDTH; fse->min_width = VIMC_FRAME_MIN_WIDTH;
fse->min_height = VIMC_FRAME_MIN_HEIGHT; fse->min_height = VIMC_FRAME_MIN_HEIGHT;
if (IS_SINK(fse->pad)) { if (VIMC_IS_SINK(fse->pad)) {
fse->max_width = VIMC_FRAME_MAX_WIDTH; fse->max_width = VIMC_FRAME_MAX_WIDTH;
fse->max_height = VIMC_FRAME_MAX_HEIGHT; fse->max_height = VIMC_FRAME_MAX_HEIGHT;
} else { } else {
...@@ -116,7 +114,7 @@ static int vimc_sca_get_fmt(struct v4l2_subdev *sd, ...@@ -116,7 +114,7 @@ static int vimc_sca_get_fmt(struct v4l2_subdev *sd,
vsca->sink_fmt; vsca->sink_fmt;
/* Scale the frame size for the source pad */ /* Scale the frame size for the source pad */
if (IS_SRC(format->pad)) { if (VIMC_IS_SRC(format->pad)) {
format->format.width = vsca->sink_fmt.width * sca_mult; format->format.width = vsca->sink_fmt.width * sca_mult;
format->format.height = vsca->sink_fmt.height * sca_mult; format->format.height = vsca->sink_fmt.height * sca_mult;
} }
...@@ -165,7 +163,7 @@ static int vimc_sca_set_fmt(struct v4l2_subdev *sd, ...@@ -165,7 +163,7 @@ static int vimc_sca_set_fmt(struct v4l2_subdev *sd,
* Do not change the format of the source pad, * Do not change the format of the source pad,
* it is propagated from the sink * it is propagated from the sink
*/ */
if (IS_SRC(fmt->pad)) { if (VIMC_IS_SRC(fmt->pad)) {
fmt->format = *sink_fmt; fmt->format = *sink_fmt;
fmt->format.width = sink_fmt->width * sca_mult; fmt->format.width = sink_fmt->width * sca_mult;
fmt->format.height = sink_fmt->height * sca_mult; fmt->format.height = sink_fmt->height * sca_mult;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment