Commit 5aa2eb3c authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[media] v4l: vsp1: Configure device based on IP version

The IP version number carries enough information to identify the exact
device instance features. Drop the related DT properties and use the IP
version instead.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 1517b039
...@@ -14,21 +14,6 @@ Required properties: ...@@ -14,21 +14,6 @@ Required properties:
- interrupts: VSP interrupt specifier. - interrupts: VSP interrupt specifier.
- clocks: A phandle + clock-specifier pair for the VSP functional clock. - clocks: A phandle + clock-specifier pair for the VSP functional clock.
- renesas,#rpf: Number of Read Pixel Formatter (RPF) modules in the VSP.
- renesas,#wpf: Number of Write Pixel Formatter (WPF) modules in the VSP.
Optional properties:
- renesas,#uds: Number of Up Down Scaler (UDS) modules in the VSP. Defaults
to 0 if not present.
- renesas,has-lif: Boolean, indicates that the LCD Interface (LIF) module is
available.
- renesas,has-lut: Boolean, indicates that the Look Up Table (LUT) module is
available.
- renesas,has-sru: Boolean, indicates that the Super Resolution Unit (SRU)
module is available.
Example: R8A7790 (R-Car H2) VSP1-S node Example: R8A7790 (R-Car H2) VSP1-S node
...@@ -37,10 +22,4 @@ Example: R8A7790 (R-Car H2) VSP1-S node ...@@ -37,10 +22,4 @@ Example: R8A7790 (R-Car H2) VSP1-S node
reg = <0 0xfe928000 0 0x8000>; reg = <0 0xfe928000 0 0x8000>;
interrupts = <0 267 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 267 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp1_clks R8A7790_CLK_VSP1_S>; clocks = <&mstp1_clks R8A7790_CLK_VSP1_S>;
renesas,has-lut;
renesas,has-sru;
renesas,#rpf = <5>;
renesas,#uds = <3>;
renesas,#wpf = <4>;
}; };
...@@ -47,7 +47,8 @@ struct vsp1_uds; ...@@ -47,7 +47,8 @@ struct vsp1_uds;
#define VSP1_HAS_SRU (1 << 2) #define VSP1_HAS_SRU (1 << 2)
#define VSP1_HAS_BRU (1 << 3) #define VSP1_HAS_BRU (1 << 3)
struct vsp1_platform_data { struct vsp1_device_info {
u32 version;
unsigned int features; unsigned int features;
unsigned int rpf_count; unsigned int rpf_count;
unsigned int uds_count; unsigned int uds_count;
...@@ -58,7 +59,7 @@ struct vsp1_platform_data { ...@@ -58,7 +59,7 @@ struct vsp1_platform_data {
struct vsp1_device { struct vsp1_device {
struct device *dev; struct device *dev;
struct vsp1_platform_data pdata; const struct vsp1_device_info *info;
void __iomem *mmio; void __iomem *mmio;
struct clk *clock; struct clk *clock;
......
...@@ -416,7 +416,7 @@ struct vsp1_bru *vsp1_bru_create(struct vsp1_device *vsp1) ...@@ -416,7 +416,7 @@ struct vsp1_bru *vsp1_bru_create(struct vsp1_device *vsp1)
bru->entity.type = VSP1_ENTITY_BRU; bru->entity.type = VSP1_ENTITY_BRU;
ret = vsp1_entity_init(vsp1, &bru->entity, ret = vsp1_entity_init(vsp1, &bru->entity,
vsp1->pdata.num_bru_inputs + 1); vsp1->info->num_bru_inputs + 1);
if (ret < 0) if (ret < 0)
return ERR_PTR(ret); return ERR_PTR(ret);
......
...@@ -285,7 +285,7 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index, ...@@ -285,7 +285,7 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
unsigned long flags; unsigned long flags;
int ret; int ret;
if (rpf_index >= vsp1->pdata.rpf_count) if (rpf_index >= vsp1->info->rpf_count)
return -EINVAL; return -EINVAL;
rpf = vsp1->rpf[rpf_index]; rpf = vsp1->rpf[rpf_index];
...@@ -519,7 +519,7 @@ int vsp1_drm_create_links(struct vsp1_device *vsp1) ...@@ -519,7 +519,7 @@ int vsp1_drm_create_links(struct vsp1_device *vsp1)
if (!vsp1->bru || !vsp1->lif) if (!vsp1->bru || !vsp1->lif)
return -ENXIO; return -ENXIO;
for (i = 0; i < vsp1->pdata.rpf_count; ++i) { for (i = 0; i < vsp1->info->rpf_count; ++i) {
struct vsp1_rwpf *rpf = vsp1->rpf[i]; struct vsp1_rwpf *rpf = vsp1->rpf[i];
ret = media_create_pad_link(&rpf->entity.subdev.entity, ret = media_create_pad_link(&rpf->entity.subdev.entity,
...@@ -572,7 +572,7 @@ int vsp1_drm_init(struct vsp1_device *vsp1) ...@@ -572,7 +572,7 @@ int vsp1_drm_init(struct vsp1_device *vsp1)
pipe->frame_end = vsp1_drm_pipeline_frame_end; pipe->frame_end = vsp1_drm_pipeline_frame_end;
/* The DRM pipeline is static, add entities manually. */ /* The DRM pipeline is static, add entities manually. */
for (i = 0; i < vsp1->pdata.rpf_count; ++i) { for (i = 0; i < vsp1->info->rpf_count; ++i) {
struct vsp1_rwpf *input = vsp1->rpf[i]; struct vsp1_rwpf *input = vsp1->rpf[i];
list_add_tail(&input->entity.list_pipe, &pipe->entities); list_add_tail(&input->entity.list_pipe, &pipe->entities);
......
This diff is collapsed.
...@@ -45,7 +45,7 @@ int vsp1_entity_set_streaming(struct vsp1_entity *entity, bool streaming) ...@@ -45,7 +45,7 @@ int vsp1_entity_set_streaming(struct vsp1_entity *entity, bool streaming)
if (!streaming) if (!streaming)
return 0; return 0;
if (!entity->vsp1->pdata.uapi || !entity->subdev.ctrl_handler) if (!entity->vsp1->info->uapi || !entity->subdev.ctrl_handler)
return 0; return 0;
ret = v4l2_ctrl_handler_setup(entity->subdev.ctrl_handler); ret = v4l2_ctrl_handler_setup(entity->subdev.ctrl_handler);
......
...@@ -368,7 +368,7 @@ void vsp1_pipelines_suspend(struct vsp1_device *vsp1) ...@@ -368,7 +368,7 @@ void vsp1_pipelines_suspend(struct vsp1_device *vsp1)
* pipelines twice, first to set them all to the stopping state, and * pipelines twice, first to set them all to the stopping state, and
* then to wait for the stop to complete. * then to wait for the stop to complete.
*/ */
for (i = 0; i < vsp1->pdata.wpf_count; ++i) { for (i = 0; i < vsp1->info->wpf_count; ++i) {
struct vsp1_rwpf *wpf = vsp1->wpf[i]; struct vsp1_rwpf *wpf = vsp1->wpf[i];
struct vsp1_pipeline *pipe; struct vsp1_pipeline *pipe;
...@@ -385,7 +385,7 @@ void vsp1_pipelines_suspend(struct vsp1_device *vsp1) ...@@ -385,7 +385,7 @@ void vsp1_pipelines_suspend(struct vsp1_device *vsp1)
spin_unlock_irqrestore(&pipe->irqlock, flags); spin_unlock_irqrestore(&pipe->irqlock, flags);
} }
for (i = 0; i < vsp1->pdata.wpf_count; ++i) { for (i = 0; i < vsp1->info->wpf_count; ++i) {
struct vsp1_rwpf *wpf = vsp1->wpf[i]; struct vsp1_rwpf *wpf = vsp1->wpf[i];
struct vsp1_pipeline *pipe; struct vsp1_pipeline *pipe;
...@@ -409,7 +409,7 @@ void vsp1_pipelines_resume(struct vsp1_device *vsp1) ...@@ -409,7 +409,7 @@ void vsp1_pipelines_resume(struct vsp1_device *vsp1)
unsigned int i; unsigned int i;
/* Resume pipeline all running pipelines. */ /* Resume pipeline all running pipelines. */
for (i = 0; i < vsp1->pdata.wpf_count; ++i) { for (i = 0; i < vsp1->info->wpf_count; ++i) {
struct vsp1_rwpf *wpf = vsp1->wpf[i]; struct vsp1_rwpf *wpf = vsp1->wpf[i];
struct vsp1_pipeline *pipe; struct vsp1_pipeline *pipe;
......
...@@ -151,12 +151,12 @@ static int rpf_s_stream(struct v4l2_subdev *subdev, int enable) ...@@ -151,12 +151,12 @@ static int rpf_s_stream(struct v4l2_subdev *subdev, int enable)
(fmtinfo->alpha ? VI6_RPF_ALPH_SEL_ASEL_PACKED (fmtinfo->alpha ? VI6_RPF_ALPH_SEL_ASEL_PACKED
: VI6_RPF_ALPH_SEL_ASEL_FIXED)); : VI6_RPF_ALPH_SEL_ASEL_FIXED));
if (vsp1->pdata.uapi) if (vsp1->info->uapi)
mutex_lock(rpf->ctrls.lock); mutex_lock(rpf->ctrls.lock);
vsp1_rpf_write(rpf, VI6_RPF_VRTCOL_SET, vsp1_rpf_write(rpf, VI6_RPF_VRTCOL_SET,
rpf->alpha->cur.val << VI6_RPF_VRTCOL_SET_LAYA_SHIFT); rpf->alpha->cur.val << VI6_RPF_VRTCOL_SET_LAYA_SHIFT);
vsp1_pipeline_propagate_alpha(pipe, &rpf->entity, rpf->alpha->cur.val); vsp1_pipeline_propagate_alpha(pipe, &rpf->entity, rpf->alpha->cur.val);
if (vsp1->pdata.uapi) if (vsp1->info->uapi)
mutex_unlock(rpf->ctrls.lock); mutex_unlock(rpf->ctrls.lock);
vsp1_rpf_write(rpf, VI6_RPF_MSK_CTRL, 0); vsp1_rpf_write(rpf, VI6_RPF_MSK_CTRL, 0);
......
...@@ -151,12 +151,12 @@ static int sru_s_stream(struct v4l2_subdev *subdev, int enable) ...@@ -151,12 +151,12 @@ static int sru_s_stream(struct v4l2_subdev *subdev, int enable)
/* Take the control handler lock to ensure that the CTRL0 value won't be /* Take the control handler lock to ensure that the CTRL0 value won't be
* changed behind our back by a set control operation. * changed behind our back by a set control operation.
*/ */
if (sru->entity.vsp1->pdata.uapi) if (sru->entity.vsp1->info->uapi)
mutex_lock(sru->ctrls.lock); mutex_lock(sru->ctrls.lock);
ctrl0 |= vsp1_sru_read(sru, VI6_SRU_CTRL0) ctrl0 |= vsp1_sru_read(sru, VI6_SRU_CTRL0)
& (VI6_SRU_CTRL0_PARAM0_MASK | VI6_SRU_CTRL0_PARAM1_MASK); & (VI6_SRU_CTRL0_PARAM0_MASK | VI6_SRU_CTRL0_PARAM1_MASK);
vsp1_sru_write(sru, VI6_SRU_CTRL0, ctrl0); vsp1_sru_write(sru, VI6_SRU_CTRL0, ctrl0);
if (sru->entity.vsp1->pdata.uapi) if (sru->entity.vsp1->info->uapi)
mutex_unlock(sru->ctrls.lock); mutex_unlock(sru->ctrls.lock);
vsp1_sru_write(sru, VI6_SRU_CTRL1, VI6_SRU_CTRL1_PARAM5); vsp1_sru_write(sru, VI6_SRU_CTRL1, VI6_SRU_CTRL1_PARAM5);
......
...@@ -324,7 +324,7 @@ static int vsp1_video_pipeline_validate(struct vsp1_pipeline *pipe, ...@@ -324,7 +324,7 @@ static int vsp1_video_pipeline_validate(struct vsp1_pipeline *pipe,
/* Follow links downstream for each input and make sure the graph /* Follow links downstream for each input and make sure the graph
* contains no loop and that all branches end at the output WPF. * contains no loop and that all branches end at the output WPF.
*/ */
for (i = 0; i < video->vsp1->pdata.rpf_count; ++i) { for (i = 0; i < video->vsp1->info->rpf_count; ++i) {
if (!pipe->inputs[i]) if (!pipe->inputs[i])
continue; continue;
...@@ -456,7 +456,7 @@ static void vsp1_video_pipeline_frame_end(struct vsp1_pipeline *pipe) ...@@ -456,7 +456,7 @@ static void vsp1_video_pipeline_frame_end(struct vsp1_pipeline *pipe)
unsigned int i; unsigned int i;
/* Complete buffers on all video nodes. */ /* Complete buffers on all video nodes. */
for (i = 0; i < vsp1->pdata.rpf_count; ++i) { for (i = 0; i < vsp1->info->rpf_count; ++i) {
if (!pipe->inputs[i]) if (!pipe->inputs[i])
continue; continue;
......
...@@ -98,7 +98,7 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable) ...@@ -98,7 +98,7 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable)
* inputs as sub-layers and select the virtual RPF as the master * inputs as sub-layers and select the virtual RPF as the master
* layer. * layer.
*/ */
for (i = 0; i < vsp1->pdata.rpf_count; ++i) { for (i = 0; i < vsp1->info->rpf_count; ++i) {
struct vsp1_rwpf *input = pipe->inputs[i]; struct vsp1_rwpf *input = pipe->inputs[i];
if (!input) if (!input)
...@@ -155,11 +155,11 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable) ...@@ -155,11 +155,11 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable)
/* Take the control handler lock to ensure that the PDV value won't be /* Take the control handler lock to ensure that the PDV value won't be
* changed behind our back by a set control operation. * changed behind our back by a set control operation.
*/ */
if (vsp1->pdata.uapi) if (vsp1->info->uapi)
mutex_lock(wpf->ctrls.lock); mutex_lock(wpf->ctrls.lock);
outfmt |= wpf->alpha->cur.val << VI6_WPF_OUTFMT_PDV_SHIFT; outfmt |= wpf->alpha->cur.val << VI6_WPF_OUTFMT_PDV_SHIFT;
vsp1_wpf_write(wpf, VI6_WPF_OUTFMT, outfmt); vsp1_wpf_write(wpf, VI6_WPF_OUTFMT, outfmt);
if (vsp1->pdata.uapi) if (vsp1->info->uapi)
mutex_unlock(wpf->ctrls.lock); mutex_unlock(wpf->ctrls.lock);
vsp1_mod_write(&wpf->entity, VI6_DPR_WPF_FPORCH(wpf->entity.index), vsp1_mod_write(&wpf->entity, VI6_DPR_WPF_FPORCH(wpf->entity.index),
......
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