Commit 8c71fff4 authored by Kieran Bingham's avatar Kieran Bingham Committed by Mauro Carvalho Chehab

[media] v4l: vsp1: Adapt vsp1_du_setup_lif() interface to use a structure

The interface to configure the LIF in the VSP1 requires adapting the
function prototype for any changes. This makes extending the interface
difficult.

Change the function prototype to pass a structure which can be easily
extended.

This changes the means of disabling the pipeline, by now passing a NULL
configuration rather than passing either a 0 width or height.

[Fixed kerneldoc, made vsp1_du_setup_lif() cfg argument const]
Signed-off-by: default avatarKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: default avatarDave Airlie <airlied@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 606142af
...@@ -32,6 +32,10 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) ...@@ -32,6 +32,10 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc)
{ {
const struct drm_display_mode *mode = &crtc->crtc.state->adjusted_mode; const struct drm_display_mode *mode = &crtc->crtc.state->adjusted_mode;
struct rcar_du_device *rcdu = crtc->group->dev; struct rcar_du_device *rcdu = crtc->group->dev;
struct vsp1_du_lif_config cfg = {
.width = mode->hdisplay,
.height = mode->vdisplay,
};
struct rcar_du_plane_state state = { struct rcar_du_plane_state state = {
.state = { .state = {
.crtc = &crtc->crtc, .crtc = &crtc->crtc,
...@@ -66,12 +70,12 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) ...@@ -66,12 +70,12 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc)
*/ */
crtc->group->need_restart = true; crtc->group->need_restart = true;
vsp1_du_setup_lif(crtc->vsp->vsp, mode->hdisplay, mode->vdisplay); vsp1_du_setup_lif(crtc->vsp->vsp, &cfg);
} }
void rcar_du_vsp_disable(struct rcar_du_crtc *crtc) void rcar_du_vsp_disable(struct rcar_du_crtc *crtc)
{ {
vsp1_du_setup_lif(crtc->vsp->vsp, 0, 0); vsp1_du_setup_lif(crtc->vsp->vsp, NULL);
} }
void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc) void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc)
......
...@@ -54,12 +54,11 @@ EXPORT_SYMBOL_GPL(vsp1_du_init); ...@@ -54,12 +54,11 @@ EXPORT_SYMBOL_GPL(vsp1_du_init);
/** /**
* vsp1_du_setup_lif - Setup the output part of the VSP pipeline * vsp1_du_setup_lif - Setup the output part of the VSP pipeline
* @dev: the VSP device * @dev: the VSP device
* @width: output frame width in pixels * @cfg: the LIF configuration
* @height: output frame height in pixels
* *
* Configure the output part of VSP DRM pipeline for the given frame @width and * Configure the output part of VSP DRM pipeline for the given frame @cfg.width
* @height. This sets up formats on the BRU source pad, the WPF0 sink and source * and @cfg.height. This sets up formats on the BRU source pad, the WPF0 sink
* pads, and the LIF sink pad. * and source pads, and the LIF sink pad.
* *
* As the media bus code on the BRU source pad is conditioned by the * As the media bus code on the BRU source pad is conditioned by the
* configuration of the BRU sink 0 pad, we also set up the formats on all BRU * configuration of the BRU sink 0 pad, we also set up the formats on all BRU
...@@ -69,8 +68,7 @@ EXPORT_SYMBOL_GPL(vsp1_du_init); ...@@ -69,8 +68,7 @@ EXPORT_SYMBOL_GPL(vsp1_du_init);
* *
* Return 0 on success or a negative error code on failure. * Return 0 on success or a negative error code on failure.
*/ */
int vsp1_du_setup_lif(struct device *dev, unsigned int width, int vsp1_du_setup_lif(struct device *dev, const struct vsp1_du_lif_config *cfg)
unsigned int height)
{ {
struct vsp1_device *vsp1 = dev_get_drvdata(dev); struct vsp1_device *vsp1 = dev_get_drvdata(dev);
struct vsp1_pipeline *pipe = &vsp1->drm->pipe; struct vsp1_pipeline *pipe = &vsp1->drm->pipe;
...@@ -79,11 +77,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width, ...@@ -79,11 +77,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width,
unsigned int i; unsigned int i;
int ret; int ret;
dev_dbg(vsp1->dev, "%s: configuring LIF with format %ux%u\n", if (!cfg) {
__func__, width, height); /* NULL configuration means the CRTC is being disabled, stop
if (width == 0 || height == 0) {
/* Zero width or height means the CRTC is being disabled, stop
* the pipeline and turn the light off. * the pipeline and turn the light off.
*/ */
ret = vsp1_pipeline_stop(pipe); ret = vsp1_pipeline_stop(pipe);
...@@ -108,6 +103,9 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width, ...@@ -108,6 +103,9 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width,
return 0; return 0;
} }
dev_dbg(vsp1->dev, "%s: configuring LIF with format %ux%u\n",
__func__, cfg->width, cfg->height);
/* Configure the format at the BRU sinks and propagate it through the /* Configure the format at the BRU sinks and propagate it through the
* pipeline. * pipeline.
*/ */
...@@ -117,8 +115,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width, ...@@ -117,8 +115,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width,
for (i = 0; i < bru->entity.source_pad; ++i) { for (i = 0; i < bru->entity.source_pad; ++i) {
format.pad = i; format.pad = i;
format.format.width = width; format.format.width = cfg->width;
format.format.height = height; format.format.height = cfg->height;
format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32; format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32;
format.format.field = V4L2_FIELD_NONE; format.format.field = V4L2_FIELD_NONE;
...@@ -133,8 +131,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width, ...@@ -133,8 +131,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width,
} }
format.pad = bru->entity.source_pad; format.pad = bru->entity.source_pad;
format.format.width = width; format.format.width = cfg->width;
format.format.height = height; format.format.height = cfg->height;
format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32; format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32;
format.format.field = V4L2_FIELD_NONE; format.format.field = V4L2_FIELD_NONE;
...@@ -180,7 +178,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width, ...@@ -180,7 +178,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width,
/* Verify that the format at the output of the pipeline matches the /* Verify that the format at the output of the pipeline matches the
* requested frame size and media bus code. * requested frame size and media bus code.
*/ */
if (format.format.width != width || format.format.height != height || if (format.format.width != cfg->width ||
format.format.height != cfg->height ||
format.format.code != MEDIA_BUS_FMT_ARGB8888_1X32) { format.format.code != MEDIA_BUS_FMT_ARGB8888_1X32) {
dev_dbg(vsp1->dev, "%s: format mismatch\n", __func__); dev_dbg(vsp1->dev, "%s: format mismatch\n", __func__);
return -EPIPE; return -EPIPE;
......
...@@ -20,8 +20,17 @@ struct device; ...@@ -20,8 +20,17 @@ struct device;
int vsp1_du_init(struct device *dev); int vsp1_du_init(struct device *dev);
int vsp1_du_setup_lif(struct device *dev, unsigned int width, /**
unsigned int height); * struct vsp1_du_lif_config - VSP LIF configuration
* @width: output frame width
* @height: output frame height
*/
struct vsp1_du_lif_config {
unsigned int width;
unsigned int height;
};
int vsp1_du_setup_lif(struct device *dev, const struct vsp1_du_lif_config *cfg);
struct vsp1_du_atomic_config { struct vsp1_du_atomic_config {
u32 pixelformat; u32 pixelformat;
......
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