2018-04-23 05:33:20 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2013-06-04 22:22:30 +08:00
|
|
|
/*
|
|
|
|
* vsp1_uds.c -- R-Car VSP1 Up and Down Scaler
|
|
|
|
*
|
2014-02-07 01:42:31 +08:00
|
|
|
* Copyright (C) 2013-2014 Renesas Electronics Corporation
|
2013-06-04 22:22:30 +08:00
|
|
|
*
|
|
|
|
* Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/gfp.h>
|
|
|
|
|
|
|
|
#include <media/v4l2-subdev.h>
|
|
|
|
|
|
|
|
#include "vsp1.h"
|
2015-11-23 06:29:25 +08:00
|
|
|
#include "vsp1_dl.h"
|
2016-09-12 10:26:35 +08:00
|
|
|
#include "vsp1_pipe.h"
|
2013-06-04 22:22:30 +08:00
|
|
|
#include "vsp1_uds.h"
|
|
|
|
|
|
|
|
#define UDS_MIN_SIZE 4U
|
|
|
|
#define UDS_MAX_SIZE 8190U
|
|
|
|
|
|
|
|
#define UDS_MIN_FACTOR 0x0100
|
|
|
|
#define UDS_MAX_FACTOR 0xffff
|
|
|
|
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
* Device Access
|
|
|
|
*/
|
|
|
|
|
2018-05-19 04:42:02 +08:00
|
|
|
static inline void vsp1_uds_write(struct vsp1_uds *uds,
|
|
|
|
struct vsp1_dl_body *dlb, u32 reg, u32 data)
|
2013-06-04 22:22:30 +08:00
|
|
|
{
|
2018-05-19 04:42:02 +08:00
|
|
|
vsp1_dl_body_write(dlb, reg + uds->entity.index * VI6_UDS_OFFSET, data);
|
2013-06-04 22:22:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
* Scaling Computation
|
|
|
|
*/
|
|
|
|
|
2018-05-19 04:42:02 +08:00
|
|
|
void vsp1_uds_set_alpha(struct vsp1_entity *entity, struct vsp1_dl_body *dlb,
|
2015-11-23 06:29:25 +08:00
|
|
|
unsigned int alpha)
|
2014-05-31 08:45:48 +08:00
|
|
|
{
|
2016-06-20 10:19:43 +08:00
|
|
|
struct vsp1_uds *uds = to_uds(&entity->subdev);
|
|
|
|
|
2018-05-19 04:42:02 +08:00
|
|
|
vsp1_uds_write(uds, dlb, VI6_UDS_ALPVAL,
|
2015-11-23 06:29:25 +08:00
|
|
|
alpha << VI6_UDS_ALPVAL_VAL0_SHIFT);
|
2014-05-31 08:45:48 +08:00
|
|
|
}
|
|
|
|
|
2013-06-04 22:22:30 +08:00
|
|
|
/*
|
|
|
|
* uds_output_size - Return the output size for an input size and scaling ratio
|
|
|
|
* @input: input size in pixels
|
|
|
|
* @ratio: scaling ratio in U4.12 fixed-point format
|
|
|
|
*/
|
|
|
|
static unsigned int uds_output_size(unsigned int input, unsigned int ratio)
|
|
|
|
{
|
|
|
|
if (ratio > 4096) {
|
|
|
|
/* Down-scaling */
|
|
|
|
unsigned int mp;
|
|
|
|
|
|
|
|
mp = ratio / 4096;
|
|
|
|
mp = mp < 4 ? 1 : (mp < 8 ? 2 : 4);
|
|
|
|
|
|
|
|
return (input - 1) / mp * mp * 4096 / ratio + 1;
|
|
|
|
} else {
|
|
|
|
/* Up-scaling */
|
|
|
|
return (input - 1) * 4096 / ratio + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* uds_output_limits - Return the min and max output sizes for an input size
|
|
|
|
* @input: input size in pixels
|
|
|
|
* @minimum: minimum output size (returned)
|
|
|
|
* @maximum: maximum output size (returned)
|
|
|
|
*/
|
|
|
|
static void uds_output_limits(unsigned int input,
|
|
|
|
unsigned int *minimum, unsigned int *maximum)
|
|
|
|
{
|
|
|
|
*minimum = max(uds_output_size(input, UDS_MAX_FACTOR), UDS_MIN_SIZE);
|
|
|
|
*maximum = min(uds_output_size(input, UDS_MIN_FACTOR), UDS_MAX_SIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* uds_passband_width - Return the passband filter width for a scaling ratio
|
|
|
|
* @ratio: scaling ratio in U4.12 fixed-point format
|
|
|
|
*/
|
|
|
|
static unsigned int uds_passband_width(unsigned int ratio)
|
|
|
|
{
|
|
|
|
if (ratio >= 4096) {
|
|
|
|
/* Down-scaling */
|
|
|
|
unsigned int mp;
|
|
|
|
|
|
|
|
mp = ratio / 4096;
|
|
|
|
mp = mp < 4 ? 1 : (mp < 8 ? 2 : 4);
|
|
|
|
|
|
|
|
return 64 * 4096 * mp / ratio;
|
|
|
|
} else {
|
|
|
|
/* Up-scaling */
|
|
|
|
return 64;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned int uds_compute_ratio(unsigned int input, unsigned int output)
|
|
|
|
{
|
|
|
|
/* TODO: This is an approximation that will need to be refined. */
|
|
|
|
return (input - 1) * 4096 / (output - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
* V4L2 Subdevice Pad Operations
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int uds_enum_mbus_code(struct v4l2_subdev *subdev,
|
2015-03-04 17:47:54 +08:00
|
|
|
struct v4l2_subdev_pad_config *cfg,
|
2013-06-04 22:22:30 +08:00
|
|
|
struct v4l2_subdev_mbus_code_enum *code)
|
|
|
|
{
|
|
|
|
static const unsigned int codes[] = {
|
2014-11-11 01:28:31 +08:00
|
|
|
MEDIA_BUS_FMT_ARGB8888_1X32,
|
|
|
|
MEDIA_BUS_FMT_AYUV8_1X32,
|
2013-06-04 22:22:30 +08:00
|
|
|
};
|
|
|
|
|
2016-02-25 07:25:42 +08:00
|
|
|
return vsp1_subdev_enum_mbus_code(subdev, cfg, code, codes,
|
|
|
|
ARRAY_SIZE(codes));
|
2013-06-04 22:22:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int uds_enum_frame_size(struct v4l2_subdev *subdev,
|
2015-03-04 17:47:54 +08:00
|
|
|
struct v4l2_subdev_pad_config *cfg,
|
2013-06-04 22:22:30 +08:00
|
|
|
struct v4l2_subdev_frame_size_enum *fse)
|
|
|
|
{
|
2015-03-04 17:47:58 +08:00
|
|
|
struct vsp1_uds *uds = to_uds(subdev);
|
2015-11-16 05:14:22 +08:00
|
|
|
struct v4l2_subdev_pad_config *config;
|
2013-06-04 22:22:30 +08:00
|
|
|
struct v4l2_mbus_framefmt *format;
|
2016-06-26 19:09:31 +08:00
|
|
|
int ret = 0;
|
2013-06-04 22:22:30 +08:00
|
|
|
|
2015-11-16 05:14:22 +08:00
|
|
|
config = vsp1_entity_get_pad_config(&uds->entity, cfg, fse->which);
|
|
|
|
if (!config)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
format = vsp1_entity_get_pad_format(&uds->entity, config,
|
|
|
|
UDS_PAD_SINK);
|
2013-06-04 22:22:30 +08:00
|
|
|
|
2016-06-26 19:09:31 +08:00
|
|
|
mutex_lock(&uds->entity.lock);
|
|
|
|
|
|
|
|
if (fse->index || fse->code != format->code) {
|
|
|
|
ret = -EINVAL;
|
|
|
|
goto done;
|
|
|
|
}
|
2013-06-04 22:22:30 +08:00
|
|
|
|
|
|
|
if (fse->pad == UDS_PAD_SINK) {
|
|
|
|
fse->min_width = UDS_MIN_SIZE;
|
|
|
|
fse->max_width = UDS_MAX_SIZE;
|
|
|
|
fse->min_height = UDS_MIN_SIZE;
|
|
|
|
fse->max_height = UDS_MAX_SIZE;
|
|
|
|
} else {
|
|
|
|
uds_output_limits(format->width, &fse->min_width,
|
|
|
|
&fse->max_width);
|
|
|
|
uds_output_limits(format->height, &fse->min_height,
|
|
|
|
&fse->max_height);
|
|
|
|
}
|
|
|
|
|
2016-06-26 19:09:31 +08:00
|
|
|
done:
|
|
|
|
mutex_unlock(&uds->entity.lock);
|
|
|
|
return ret;
|
2013-06-04 22:22:30 +08:00
|
|
|
}
|
|
|
|
|
2015-11-02 01:18:32 +08:00
|
|
|
static void uds_try_format(struct vsp1_uds *uds,
|
2015-11-16 05:14:22 +08:00
|
|
|
struct v4l2_subdev_pad_config *config,
|
|
|
|
unsigned int pad, struct v4l2_mbus_framefmt *fmt)
|
2013-06-04 22:22:30 +08:00
|
|
|
{
|
|
|
|
struct v4l2_mbus_framefmt *format;
|
|
|
|
unsigned int minimum;
|
|
|
|
unsigned int maximum;
|
|
|
|
|
|
|
|
switch (pad) {
|
|
|
|
case UDS_PAD_SINK:
|
|
|
|
/* Default to YUV if the requested format is not supported. */
|
2014-11-11 01:28:31 +08:00
|
|
|
if (fmt->code != MEDIA_BUS_FMT_ARGB8888_1X32 &&
|
|
|
|
fmt->code != MEDIA_BUS_FMT_AYUV8_1X32)
|
|
|
|
fmt->code = MEDIA_BUS_FMT_AYUV8_1X32;
|
2013-06-04 22:22:30 +08:00
|
|
|
|
|
|
|
fmt->width = clamp(fmt->width, UDS_MIN_SIZE, UDS_MAX_SIZE);
|
|
|
|
fmt->height = clamp(fmt->height, UDS_MIN_SIZE, UDS_MAX_SIZE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case UDS_PAD_SOURCE:
|
|
|
|
/* The UDS scales but can't perform format conversion. */
|
2015-11-16 05:14:22 +08:00
|
|
|
format = vsp1_entity_get_pad_format(&uds->entity, config,
|
|
|
|
UDS_PAD_SINK);
|
2013-06-04 22:22:30 +08:00
|
|
|
fmt->code = format->code;
|
|
|
|
|
|
|
|
uds_output_limits(format->width, &minimum, &maximum);
|
|
|
|
fmt->width = clamp(fmt->width, minimum, maximum);
|
|
|
|
uds_output_limits(format->height, &minimum, &maximum);
|
|
|
|
fmt->height = clamp(fmt->height, minimum, maximum);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt->field = V4L2_FIELD_NONE;
|
|
|
|
fmt->colorspace = V4L2_COLORSPACE_SRGB;
|
|
|
|
}
|
|
|
|
|
2015-11-02 01:18:32 +08:00
|
|
|
static int uds_set_format(struct v4l2_subdev *subdev,
|
|
|
|
struct v4l2_subdev_pad_config *cfg,
|
2013-06-04 22:22:30 +08:00
|
|
|
struct v4l2_subdev_format *fmt)
|
|
|
|
{
|
|
|
|
struct vsp1_uds *uds = to_uds(subdev);
|
2015-11-16 05:14:22 +08:00
|
|
|
struct v4l2_subdev_pad_config *config;
|
2013-06-04 22:22:30 +08:00
|
|
|
struct v4l2_mbus_framefmt *format;
|
2016-06-26 19:09:31 +08:00
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
mutex_lock(&uds->entity.lock);
|
2013-06-04 22:22:30 +08:00
|
|
|
|
2015-11-16 05:14:22 +08:00
|
|
|
config = vsp1_entity_get_pad_config(&uds->entity, cfg, fmt->which);
|
2016-06-26 19:09:31 +08:00
|
|
|
if (!config) {
|
|
|
|
ret = -EINVAL;
|
|
|
|
goto done;
|
|
|
|
}
|
2015-11-16 05:14:22 +08:00
|
|
|
|
|
|
|
uds_try_format(uds, config, fmt->pad, &fmt->format);
|
2013-06-04 22:22:30 +08:00
|
|
|
|
2015-11-16 05:14:22 +08:00
|
|
|
format = vsp1_entity_get_pad_format(&uds->entity, config, fmt->pad);
|
2013-06-04 22:22:30 +08:00
|
|
|
*format = fmt->format;
|
|
|
|
|
|
|
|
if (fmt->pad == UDS_PAD_SINK) {
|
|
|
|
/* Propagate the format to the source pad. */
|
2015-11-16 05:14:22 +08:00
|
|
|
format = vsp1_entity_get_pad_format(&uds->entity, config,
|
|
|
|
UDS_PAD_SOURCE);
|
2013-06-04 22:22:30 +08:00
|
|
|
*format = fmt->format;
|
|
|
|
|
2015-11-16 05:14:22 +08:00
|
|
|
uds_try_format(uds, config, UDS_PAD_SOURCE, format);
|
2013-06-04 22:22:30 +08:00
|
|
|
}
|
|
|
|
|
2016-06-26 19:09:31 +08:00
|
|
|
done:
|
|
|
|
mutex_unlock(&uds->entity.lock);
|
|
|
|
return ret;
|
2013-06-04 22:22:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
* V4L2 Subdevice Operations
|
|
|
|
*/
|
|
|
|
|
2016-06-18 08:11:26 +08:00
|
|
|
static const struct v4l2_subdev_pad_ops uds_pad_ops = {
|
2015-11-16 06:09:08 +08:00
|
|
|
.init_cfg = vsp1_entity_init_cfg,
|
2013-06-04 22:22:30 +08:00
|
|
|
.enum_mbus_code = uds_enum_mbus_code,
|
|
|
|
.enum_frame_size = uds_enum_frame_size,
|
2016-02-25 08:10:13 +08:00
|
|
|
.get_fmt = vsp1_subdev_get_pad_format,
|
2013-06-04 22:22:30 +08:00
|
|
|
.set_fmt = uds_set_format,
|
|
|
|
};
|
|
|
|
|
2016-06-18 08:11:26 +08:00
|
|
|
static const struct v4l2_subdev_ops uds_ops = {
|
2013-06-04 22:22:30 +08:00
|
|
|
.pad = &uds_pad_ops,
|
|
|
|
};
|
|
|
|
|
2015-11-17 23:10:26 +08:00
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
* VSP1 Entity Operations
|
|
|
|
*/
|
|
|
|
|
2018-05-19 04:42:01 +08:00
|
|
|
static void uds_configure_stream(struct vsp1_entity *entity,
|
|
|
|
struct vsp1_pipeline *pipe,
|
2019-03-12 02:13:43 +08:00
|
|
|
struct vsp1_dl_list *dl,
|
2018-05-19 04:42:02 +08:00
|
|
|
struct vsp1_dl_body *dlb)
|
2015-11-17 23:10:26 +08:00
|
|
|
{
|
|
|
|
struct vsp1_uds *uds = to_uds(&entity->subdev);
|
|
|
|
const struct v4l2_mbus_framefmt *output;
|
|
|
|
const struct v4l2_mbus_framefmt *input;
|
|
|
|
unsigned int hscale;
|
|
|
|
unsigned int vscale;
|
|
|
|
bool multitap;
|
|
|
|
|
2017-08-05 00:32:42 +08:00
|
|
|
input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config,
|
|
|
|
UDS_PAD_SINK);
|
|
|
|
output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config,
|
|
|
|
UDS_PAD_SOURCE);
|
|
|
|
|
2015-11-17 23:10:26 +08:00
|
|
|
hscale = uds_compute_ratio(input->width, output->width);
|
|
|
|
vscale = uds_compute_ratio(input->height, output->height);
|
|
|
|
|
|
|
|
dev_dbg(uds->entity.vsp1->dev, "hscale %u vscale %u\n", hscale, vscale);
|
|
|
|
|
2017-02-26 21:29:50 +08:00
|
|
|
/*
|
|
|
|
* Multi-tap scaling can't be enabled along with alpha scaling when
|
2015-11-17 23:10:26 +08:00
|
|
|
* scaling down with a factor lower than or equal to 1/2 in either
|
|
|
|
* direction.
|
|
|
|
*/
|
|
|
|
if (uds->scale_alpha && (hscale >= 8192 || vscale >= 8192))
|
|
|
|
multitap = false;
|
|
|
|
else
|
|
|
|
multitap = true;
|
|
|
|
|
2018-05-19 04:42:02 +08:00
|
|
|
vsp1_uds_write(uds, dlb, VI6_UDS_CTRL,
|
2015-11-17 23:10:26 +08:00
|
|
|
(uds->scale_alpha ? VI6_UDS_CTRL_AON : 0) |
|
|
|
|
(multitap ? VI6_UDS_CTRL_BC : 0));
|
|
|
|
|
2018-05-19 04:42:02 +08:00
|
|
|
vsp1_uds_write(uds, dlb, VI6_UDS_PASS_BWIDTH,
|
2015-11-17 23:10:26 +08:00
|
|
|
(uds_passband_width(hscale)
|
|
|
|
<< VI6_UDS_PASS_BWIDTH_H_SHIFT) |
|
|
|
|
(uds_passband_width(vscale)
|
|
|
|
<< VI6_UDS_PASS_BWIDTH_V_SHIFT));
|
|
|
|
|
2016-09-12 10:26:35 +08:00
|
|
|
/* Set the scaling ratios. */
|
2018-05-19 04:42:02 +08:00
|
|
|
vsp1_uds_write(uds, dlb, VI6_UDS_SCALE,
|
2015-11-17 23:10:26 +08:00
|
|
|
(hscale << VI6_UDS_SCALE_HFRAC_SHIFT) |
|
|
|
|
(vscale << VI6_UDS_SCALE_VFRAC_SHIFT));
|
|
|
|
}
|
|
|
|
|
2018-05-19 04:42:01 +08:00
|
|
|
static void uds_configure_partition(struct vsp1_entity *entity,
|
|
|
|
struct vsp1_pipeline *pipe,
|
2018-05-19 04:42:02 +08:00
|
|
|
struct vsp1_dl_list *dl,
|
|
|
|
struct vsp1_dl_body *dlb)
|
2018-05-19 04:42:01 +08:00
|
|
|
{
|
|
|
|
struct vsp1_uds *uds = to_uds(&entity->subdev);
|
|
|
|
struct vsp1_partition *partition = pipe->partition;
|
|
|
|
const struct v4l2_mbus_framefmt *output;
|
|
|
|
|
|
|
|
output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config,
|
|
|
|
UDS_PAD_SOURCE);
|
|
|
|
|
2018-08-31 22:40:44 +08:00
|
|
|
/* Input size clipping. */
|
2018-05-19 04:42:02 +08:00
|
|
|
vsp1_uds_write(uds, dlb, VI6_UDS_HSZCLIP, VI6_UDS_HSZCLIP_HCEN |
|
2018-05-19 04:42:01 +08:00
|
|
|
(0 << VI6_UDS_HSZCLIP_HCL_OFST_SHIFT) |
|
|
|
|
(partition->uds_sink.width
|
|
|
|
<< VI6_UDS_HSZCLIP_HCL_SIZE_SHIFT));
|
|
|
|
|
2018-08-31 22:40:44 +08:00
|
|
|
/* Output size clipping. */
|
2018-05-19 04:42:02 +08:00
|
|
|
vsp1_uds_write(uds, dlb, VI6_UDS_CLIP_SIZE,
|
2018-05-19 04:42:01 +08:00
|
|
|
(partition->uds_source.width
|
|
|
|
<< VI6_UDS_CLIP_SIZE_HSIZE_SHIFT) |
|
|
|
|
(output->height
|
|
|
|
<< VI6_UDS_CLIP_SIZE_VSIZE_SHIFT));
|
|
|
|
}
|
|
|
|
|
2016-07-12 21:06:34 +08:00
|
|
|
static unsigned int uds_max_width(struct vsp1_entity *entity,
|
|
|
|
struct vsp1_pipeline *pipe)
|
|
|
|
{
|
|
|
|
struct vsp1_uds *uds = to_uds(&entity->subdev);
|
|
|
|
const struct v4l2_mbus_framefmt *output;
|
|
|
|
const struct v4l2_mbus_framefmt *input;
|
|
|
|
unsigned int hscale;
|
|
|
|
|
|
|
|
input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config,
|
|
|
|
UDS_PAD_SINK);
|
|
|
|
output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config,
|
|
|
|
UDS_PAD_SOURCE);
|
|
|
|
hscale = output->width / input->width;
|
|
|
|
|
2018-09-14 22:26:52 +08:00
|
|
|
/*
|
|
|
|
* The maximum width of the UDS is 304 pixels. These are input pixels
|
|
|
|
* in the event of up-scaling, and output pixels in the event of
|
|
|
|
* downscaling.
|
|
|
|
*
|
|
|
|
* To support overlapping partition windows we clamp at units of 256 and
|
|
|
|
* the remaining pixels are reserved.
|
|
|
|
*/
|
2016-07-12 21:06:34 +08:00
|
|
|
if (hscale <= 2)
|
|
|
|
return 256;
|
|
|
|
else if (hscale <= 4)
|
|
|
|
return 512;
|
|
|
|
else if (hscale <= 8)
|
|
|
|
return 1024;
|
|
|
|
else
|
|
|
|
return 2048;
|
|
|
|
}
|
|
|
|
|
2017-08-05 00:32:44 +08:00
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
* Partition Algorithm Support
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void uds_partition(struct vsp1_entity *entity,
|
|
|
|
struct vsp1_pipeline *pipe,
|
|
|
|
struct vsp1_partition *partition,
|
|
|
|
unsigned int partition_idx,
|
|
|
|
struct vsp1_partition_window *window)
|
|
|
|
{
|
|
|
|
struct vsp1_uds *uds = to_uds(&entity->subdev);
|
|
|
|
const struct v4l2_mbus_framefmt *output;
|
|
|
|
const struct v4l2_mbus_framefmt *input;
|
|
|
|
|
2018-08-31 22:40:44 +08:00
|
|
|
/* Initialise the partition state. */
|
2017-08-05 00:32:44 +08:00
|
|
|
partition->uds_sink = *window;
|
|
|
|
partition->uds_source = *window;
|
|
|
|
|
|
|
|
input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config,
|
|
|
|
UDS_PAD_SINK);
|
|
|
|
output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config,
|
|
|
|
UDS_PAD_SOURCE);
|
|
|
|
|
|
|
|
partition->uds_sink.width = window->width * input->width
|
|
|
|
/ output->width;
|
|
|
|
partition->uds_sink.left = window->left * input->width
|
|
|
|
/ output->width;
|
|
|
|
|
|
|
|
*window = partition->uds_sink;
|
|
|
|
}
|
|
|
|
|
2015-11-17 23:10:26 +08:00
|
|
|
static const struct vsp1_entity_operations uds_entity_ops = {
|
2018-05-19 04:42:01 +08:00
|
|
|
.configure_stream = uds_configure_stream,
|
|
|
|
.configure_partition = uds_configure_partition,
|
2016-07-12 21:06:34 +08:00
|
|
|
.max_width = uds_max_width,
|
2017-08-05 00:32:44 +08:00
|
|
|
.partition = uds_partition,
|
2015-11-17 23:10:26 +08:00
|
|
|
};
|
|
|
|
|
2013-06-04 22:22:30 +08:00
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
* Initialization and Cleanup
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct vsp1_uds *vsp1_uds_create(struct vsp1_device *vsp1, unsigned int index)
|
|
|
|
{
|
|
|
|
struct vsp1_uds *uds;
|
2015-11-16 05:42:01 +08:00
|
|
|
char name[6];
|
2013-06-04 22:22:30 +08:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
uds = devm_kzalloc(vsp1->dev, sizeof(*uds), GFP_KERNEL);
|
|
|
|
if (uds == NULL)
|
|
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
|
2015-11-17 23:10:26 +08:00
|
|
|
uds->entity.ops = &uds_entity_ops;
|
2013-06-04 22:22:30 +08:00
|
|
|
uds->entity.type = VSP1_ENTITY_UDS;
|
|
|
|
uds->entity.index = index;
|
|
|
|
|
2015-11-16 05:42:01 +08:00
|
|
|
sprintf(name, "uds.%u", index);
|
2016-02-16 08:10:26 +08:00
|
|
|
ret = vsp1_entity_init(vsp1, &uds->entity, name, 2, &uds_ops,
|
|
|
|
MEDIA_ENT_F_PROC_VIDEO_SCALER);
|
2013-06-04 22:22:30 +08:00
|
|
|
if (ret < 0)
|
|
|
|
return ERR_PTR(ret);
|
|
|
|
|
|
|
|
return uds;
|
|
|
|
}
|