media: staging/imx: rearrange group id to take in account IPU
Some imx system do not have IPU, so prepare the imx media drivers to support this kind of devices. Rename the group ids to include an _IPU_ prefix, add a new group id to support systems with only a CSI without IPU, and also rename the create internal links to make it clear that only systems with IPU have internal subdevices. Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
Родитель
174bcae1a4
Коммит
67673ed550
|
@ -41,13 +41,13 @@ static int imx_ic_probe(struct platform_device *pdev)
|
||||||
pdata = priv->dev->platform_data;
|
pdata = priv->dev->platform_data;
|
||||||
priv->ipu_id = pdata->ipu_id;
|
priv->ipu_id = pdata->ipu_id;
|
||||||
switch (pdata->grp_id) {
|
switch (pdata->grp_id) {
|
||||||
case IMX_MEDIA_GRP_ID_IC_PRP:
|
case IMX_MEDIA_GRP_ID_IPU_IC_PRP:
|
||||||
priv->task_id = IC_TASK_PRP;
|
priv->task_id = IC_TASK_PRP;
|
||||||
break;
|
break;
|
||||||
case IMX_MEDIA_GRP_ID_IC_PRPENC:
|
case IMX_MEDIA_GRP_ID_IPU_IC_PRPENC:
|
||||||
priv->task_id = IC_TASK_ENCODER;
|
priv->task_id = IC_TASK_ENCODER;
|
||||||
break;
|
break;
|
||||||
case IMX_MEDIA_GRP_ID_IC_PRPVF:
|
case IMX_MEDIA_GRP_ID_IPU_IC_PRPVF:
|
||||||
priv->task_id = IC_TASK_VIEWFINDER;
|
priv->task_id = IC_TASK_VIEWFINDER;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -77,7 +77,7 @@ static int prp_start(struct prp_priv *priv)
|
||||||
priv->ipu = priv->md->ipu[ic_priv->ipu_id];
|
priv->ipu = priv->md->ipu[ic_priv->ipu_id];
|
||||||
|
|
||||||
/* set IC to receive from CSI or VDI depending on source */
|
/* set IC to receive from CSI or VDI depending on source */
|
||||||
src_is_vdic = !!(priv->src_sd->grp_id & IMX_MEDIA_GRP_ID_VDIC);
|
src_is_vdic = !!(priv->src_sd->grp_id & IMX_MEDIA_GRP_ID_IPU_VDIC);
|
||||||
|
|
||||||
ipu_set_ic_src_mux(priv->ipu, priv->csi_id, src_is_vdic);
|
ipu_set_ic_src_mux(priv->ipu, priv->csi_id, src_is_vdic);
|
||||||
|
|
||||||
|
@ -237,8 +237,8 @@ static int prp_link_setup(struct media_entity *entity,
|
||||||
ret = -EBUSY;
|
ret = -EBUSY;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (priv->sink_sd_prpenc && (remote_sd->grp_id &
|
if (priv->sink_sd_prpenc &&
|
||||||
IMX_MEDIA_GRP_ID_VDIC)) {
|
(remote_sd->grp_id & IMX_MEDIA_GRP_ID_IPU_VDIC)) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ static int prp_link_setup(struct media_entity *entity,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (priv->src_sd && (priv->src_sd->grp_id &
|
if (priv->src_sd && (priv->src_sd->grp_id &
|
||||||
IMX_MEDIA_GRP_ID_VDIC)) {
|
IMX_MEDIA_GRP_ID_IPU_VDIC)) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -309,13 +309,13 @@ static int prp_link_validate(struct v4l2_subdev *sd,
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
csi = imx_media_find_upstream_subdev(priv->md, &ic_priv->sd.entity,
|
csi = imx_media_find_upstream_subdev(priv->md, &ic_priv->sd.entity,
|
||||||
IMX_MEDIA_GRP_ID_CSI);
|
IMX_MEDIA_GRP_ID_IPU_CSI);
|
||||||
if (IS_ERR(csi))
|
if (IS_ERR(csi))
|
||||||
csi = NULL;
|
csi = NULL;
|
||||||
|
|
||||||
mutex_lock(&priv->lock);
|
mutex_lock(&priv->lock);
|
||||||
|
|
||||||
if (priv->src_sd->grp_id & IMX_MEDIA_GRP_ID_VDIC) {
|
if (priv->src_sd->grp_id & IMX_MEDIA_GRP_ID_IPU_VDIC) {
|
||||||
/*
|
/*
|
||||||
* the ->PRPENC link cannot be enabled if the source
|
* the ->PRPENC link cannot be enabled if the source
|
||||||
* is the VDIC
|
* is the VDIC
|
||||||
|
@ -334,10 +334,10 @@ static int prp_link_validate(struct v4l2_subdev *sd,
|
||||||
|
|
||||||
if (csi) {
|
if (csi) {
|
||||||
switch (csi->grp_id) {
|
switch (csi->grp_id) {
|
||||||
case IMX_MEDIA_GRP_ID_CSI0:
|
case IMX_MEDIA_GRP_ID_IPU_CSI0:
|
||||||
priv->csi_id = 0;
|
priv->csi_id = 0;
|
||||||
break;
|
break;
|
||||||
case IMX_MEDIA_GRP_ID_CSI1:
|
case IMX_MEDIA_GRP_ID_IPU_CSI1:
|
||||||
priv->csi_id = 1;
|
priv->csi_id = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1074,10 +1074,10 @@ static int csi_link_setup(struct media_entity *entity,
|
||||||
|
|
||||||
remote_sd = media_entity_to_v4l2_subdev(remote->entity);
|
remote_sd = media_entity_to_v4l2_subdev(remote->entity);
|
||||||
switch (remote_sd->grp_id) {
|
switch (remote_sd->grp_id) {
|
||||||
case IMX_MEDIA_GRP_ID_VDIC:
|
case IMX_MEDIA_GRP_ID_IPU_VDIC:
|
||||||
priv->dest = IPU_CSI_DEST_VDIC;
|
priv->dest = IPU_CSI_DEST_VDIC;
|
||||||
break;
|
break;
|
||||||
case IMX_MEDIA_GRP_ID_IC_PRP:
|
case IMX_MEDIA_GRP_ID_IPU_IC_PRP:
|
||||||
priv->dest = IPU_CSI_DEST_IC;
|
priv->dest = IPU_CSI_DEST_IC;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1973,7 +1973,7 @@ static int imx_csi_probe(struct platform_device *pdev)
|
||||||
priv->sd.owner = THIS_MODULE;
|
priv->sd.owner = THIS_MODULE;
|
||||||
priv->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
|
priv->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
|
||||||
priv->sd.grp_id = priv->csi_id ?
|
priv->sd.grp_id = priv->csi_id ?
|
||||||
IMX_MEDIA_GRP_ID_CSI1 : IMX_MEDIA_GRP_ID_CSI0;
|
IMX_MEDIA_GRP_ID_IPU_CSI1 : IMX_MEDIA_GRP_ID_IPU_CSI0;
|
||||||
imx_media_grp_id_to_sd_name(priv->sd.name, sizeof(priv->sd.name),
|
imx_media_grp_id_to_sd_name(priv->sd.name, sizeof(priv->sd.name),
|
||||||
priv->sd.grp_id, ipu_get_num(priv->ipu));
|
priv->sd.grp_id, ipu_get_num(priv->ipu));
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ int imx_media_subdev_bound(struct v4l2_async_notifier *notifier,
|
||||||
|
|
||||||
mutex_lock(&imxmd->mutex);
|
mutex_lock(&imxmd->mutex);
|
||||||
|
|
||||||
if (sd->grp_id & IMX_MEDIA_GRP_ID_CSI) {
|
if (sd->grp_id & IMX_MEDIA_GRP_ID_IPU_CSI) {
|
||||||
ret = imx_media_get_ipu(imxmd, sd);
|
ret = imx_media_get_ipu(imxmd, sd);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -149,13 +149,13 @@ static int imx_media_create_links(struct v4l2_async_notifier *notifier)
|
||||||
|
|
||||||
list_for_each_entry(sd, &imxmd->v4l2_dev.subdevs, list) {
|
list_for_each_entry(sd, &imxmd->v4l2_dev.subdevs, list) {
|
||||||
switch (sd->grp_id) {
|
switch (sd->grp_id) {
|
||||||
case IMX_MEDIA_GRP_ID_VDIC:
|
case IMX_MEDIA_GRP_ID_IPU_VDIC:
|
||||||
case IMX_MEDIA_GRP_ID_IC_PRP:
|
case IMX_MEDIA_GRP_ID_IPU_IC_PRP:
|
||||||
case IMX_MEDIA_GRP_ID_IC_PRPENC:
|
case IMX_MEDIA_GRP_ID_IPU_IC_PRPENC:
|
||||||
case IMX_MEDIA_GRP_ID_IC_PRPVF:
|
case IMX_MEDIA_GRP_ID_IPU_IC_PRPVF:
|
||||||
case IMX_MEDIA_GRP_ID_CSI0:
|
case IMX_MEDIA_GRP_ID_IPU_CSI0:
|
||||||
case IMX_MEDIA_GRP_ID_CSI1:
|
case IMX_MEDIA_GRP_ID_IPU_CSI1:
|
||||||
ret = imx_media_create_internal_links(imxmd, sd);
|
ret = imx_media_create_ipu_internal_links(imxmd, sd);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
/*
|
/*
|
||||||
|
@ -163,9 +163,13 @@ static int imx_media_create_links(struct v4l2_async_notifier *notifier)
|
||||||
* internal entities, so create the external links
|
* internal entities, so create the external links
|
||||||
* to the CSI sink pads.
|
* to the CSI sink pads.
|
||||||
*/
|
*/
|
||||||
if (sd->grp_id & IMX_MEDIA_GRP_ID_CSI)
|
if (sd->grp_id & IMX_MEDIA_GRP_ID_IPU_CSI)
|
||||||
imx_media_create_csi_of_links(imxmd, sd);
|
imx_media_create_csi_of_links(imxmd, sd);
|
||||||
break;
|
break;
|
||||||
|
case IMX_MEDIA_GRP_ID_CSI:
|
||||||
|
imx_media_create_csi_of_links(imxmd, sd);
|
||||||
|
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
/*
|
/*
|
||||||
* if this subdev has fwnode links, create media
|
* if this subdev has fwnode links, create media
|
||||||
|
|
|
@ -30,32 +30,32 @@ static const struct internal_subdev_id {
|
||||||
} isd_id[num_isd] = {
|
} isd_id[num_isd] = {
|
||||||
[isd_csi0] = {
|
[isd_csi0] = {
|
||||||
.index = isd_csi0,
|
.index = isd_csi0,
|
||||||
.grp_id = IMX_MEDIA_GRP_ID_CSI0,
|
.grp_id = IMX_MEDIA_GRP_ID_IPU_CSI0,
|
||||||
.name = "imx-ipuv3-csi",
|
.name = "imx-ipuv3-csi",
|
||||||
},
|
},
|
||||||
[isd_csi1] = {
|
[isd_csi1] = {
|
||||||
.index = isd_csi1,
|
.index = isd_csi1,
|
||||||
.grp_id = IMX_MEDIA_GRP_ID_CSI1,
|
.grp_id = IMX_MEDIA_GRP_ID_IPU_CSI1,
|
||||||
.name = "imx-ipuv3-csi",
|
.name = "imx-ipuv3-csi",
|
||||||
},
|
},
|
||||||
[isd_vdic] = {
|
[isd_vdic] = {
|
||||||
.index = isd_vdic,
|
.index = isd_vdic,
|
||||||
.grp_id = IMX_MEDIA_GRP_ID_VDIC,
|
.grp_id = IMX_MEDIA_GRP_ID_IPU_VDIC,
|
||||||
.name = "imx-ipuv3-vdic",
|
.name = "imx-ipuv3-vdic",
|
||||||
},
|
},
|
||||||
[isd_ic_prp] = {
|
[isd_ic_prp] = {
|
||||||
.index = isd_ic_prp,
|
.index = isd_ic_prp,
|
||||||
.grp_id = IMX_MEDIA_GRP_ID_IC_PRP,
|
.grp_id = IMX_MEDIA_GRP_ID_IPU_IC_PRP,
|
||||||
.name = "imx-ipuv3-ic",
|
.name = "imx-ipuv3-ic",
|
||||||
},
|
},
|
||||||
[isd_ic_prpenc] = {
|
[isd_ic_prpenc] = {
|
||||||
.index = isd_ic_prpenc,
|
.index = isd_ic_prpenc,
|
||||||
.grp_id = IMX_MEDIA_GRP_ID_IC_PRPENC,
|
.grp_id = IMX_MEDIA_GRP_ID_IPU_IC_PRPENC,
|
||||||
.name = "imx-ipuv3-ic",
|
.name = "imx-ipuv3-ic",
|
||||||
},
|
},
|
||||||
[isd_ic_prpvf] = {
|
[isd_ic_prpvf] = {
|
||||||
.index = isd_ic_prpvf,
|
.index = isd_ic_prpvf,
|
||||||
.grp_id = IMX_MEDIA_GRP_ID_IC_PRPVF,
|
.grp_id = IMX_MEDIA_GRP_ID_IPU_IC_PRPVF,
|
||||||
.name = "imx-ipuv3-ic",
|
.name = "imx-ipuv3-ic",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -229,8 +229,8 @@ static int create_ipu_internal_link(struct imx_media_dev *imxmd,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int imx_media_create_internal_links(struct imx_media_dev *imxmd,
|
int imx_media_create_ipu_internal_links(struct imx_media_dev *imxmd,
|
||||||
struct v4l2_subdev *sd)
|
struct v4l2_subdev *sd)
|
||||||
{
|
{
|
||||||
const struct internal_subdev *intsd;
|
const struct internal_subdev *intsd;
|
||||||
const struct internal_pad *intpad;
|
const struct internal_pad *intpad;
|
||||||
|
@ -312,8 +312,8 @@ static int add_ipu_internal_subdevs(struct imx_media_dev *imxmd, int ipu_id)
|
||||||
* of_parse_subdev().
|
* of_parse_subdev().
|
||||||
*/
|
*/
|
||||||
switch (isd->id->grp_id) {
|
switch (isd->id->grp_id) {
|
||||||
case IMX_MEDIA_GRP_ID_CSI0:
|
case IMX_MEDIA_GRP_ID_IPU_CSI0:
|
||||||
case IMX_MEDIA_GRP_ID_CSI1:
|
case IMX_MEDIA_GRP_ID_IPU_CSI1:
|
||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -715,20 +715,20 @@ void imx_media_grp_id_to_sd_name(char *sd_name, int sz, u32 grp_id, int ipu_id)
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
switch (grp_id) {
|
switch (grp_id) {
|
||||||
case IMX_MEDIA_GRP_ID_CSI0...IMX_MEDIA_GRP_ID_CSI1:
|
case IMX_MEDIA_GRP_ID_IPU_CSI0...IMX_MEDIA_GRP_ID_IPU_CSI1:
|
||||||
id = (grp_id >> IMX_MEDIA_GRP_ID_CSI_BIT) - 1;
|
id = (grp_id >> IMX_MEDIA_GRP_ID_IPU_CSI_BIT) - 1;
|
||||||
snprintf(sd_name, sz, "ipu%d_csi%d", ipu_id + 1, id);
|
snprintf(sd_name, sz, "ipu%d_csi%d", ipu_id + 1, id);
|
||||||
break;
|
break;
|
||||||
case IMX_MEDIA_GRP_ID_VDIC:
|
case IMX_MEDIA_GRP_ID_IPU_VDIC:
|
||||||
snprintf(sd_name, sz, "ipu%d_vdic", ipu_id + 1);
|
snprintf(sd_name, sz, "ipu%d_vdic", ipu_id + 1);
|
||||||
break;
|
break;
|
||||||
case IMX_MEDIA_GRP_ID_IC_PRP:
|
case IMX_MEDIA_GRP_ID_IPU_IC_PRP:
|
||||||
snprintf(sd_name, sz, "ipu%d_ic_prp", ipu_id + 1);
|
snprintf(sd_name, sz, "ipu%d_ic_prp", ipu_id + 1);
|
||||||
break;
|
break;
|
||||||
case IMX_MEDIA_GRP_ID_IC_PRPENC:
|
case IMX_MEDIA_GRP_ID_IPU_IC_PRPENC:
|
||||||
snprintf(sd_name, sz, "ipu%d_ic_prpenc", ipu_id + 1);
|
snprintf(sd_name, sz, "ipu%d_ic_prpenc", ipu_id + 1);
|
||||||
break;
|
break;
|
||||||
case IMX_MEDIA_GRP_ID_IC_PRPVF:
|
case IMX_MEDIA_GRP_ID_IPU_IC_PRPVF:
|
||||||
snprintf(sd_name, sz, "ipu%d_ic_prpvf", ipu_id + 1);
|
snprintf(sd_name, sz, "ipu%d_ic_prpvf", ipu_id + 1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -253,8 +253,8 @@ void imx_media_fim_free(struct imx_media_fim *fim);
|
||||||
|
|
||||||
/* imx-media-internal-sd.c */
|
/* imx-media-internal-sd.c */
|
||||||
int imx_media_add_internal_subdevs(struct imx_media_dev *imxmd);
|
int imx_media_add_internal_subdevs(struct imx_media_dev *imxmd);
|
||||||
int imx_media_create_internal_links(struct imx_media_dev *imxmd,
|
int imx_media_create_ipu_internal_links(struct imx_media_dev *imxmd,
|
||||||
struct v4l2_subdev *sd);
|
struct v4l2_subdev *sd);
|
||||||
void imx_media_remove_internal_subdevs(struct imx_media_dev *imxmd);
|
void imx_media_remove_internal_subdevs(struct imx_media_dev *imxmd);
|
||||||
|
|
||||||
/* imx-media-of.c */
|
/* imx-media-of.c */
|
||||||
|
@ -281,14 +281,15 @@ void imx_media_capture_device_set_format(struct imx_media_video_dev *vdev,
|
||||||
void imx_media_capture_device_error(struct imx_media_video_dev *vdev);
|
void imx_media_capture_device_error(struct imx_media_video_dev *vdev);
|
||||||
|
|
||||||
/* subdev group ids */
|
/* subdev group ids */
|
||||||
#define IMX_MEDIA_GRP_ID_CSI2 BIT(8)
|
#define IMX_MEDIA_GRP_ID_CSI2 BIT(8)
|
||||||
#define IMX_MEDIA_GRP_ID_CSI_BIT 9
|
#define IMX_MEDIA_GRP_ID_CSI BIT(9)
|
||||||
#define IMX_MEDIA_GRP_ID_CSI (0x3 << IMX_MEDIA_GRP_ID_CSI_BIT)
|
#define IMX_MEDIA_GRP_ID_IPU_CSI_BIT 10
|
||||||
#define IMX_MEDIA_GRP_ID_CSI0 BIT(IMX_MEDIA_GRP_ID_CSI_BIT)
|
#define IMX_MEDIA_GRP_ID_IPU_CSI (0x3 << IMX_MEDIA_GRP_ID_IPU_CSI_BIT)
|
||||||
#define IMX_MEDIA_GRP_ID_CSI1 (2 << IMX_MEDIA_GRP_ID_CSI_BIT)
|
#define IMX_MEDIA_GRP_ID_IPU_CSI0 BIT(IMX_MEDIA_GRP_ID_IPU_CSI_BIT)
|
||||||
#define IMX_MEDIA_GRP_ID_VDIC BIT(11)
|
#define IMX_MEDIA_GRP_ID_IPU_CSI1 (2 << IMX_MEDIA_GRP_ID_IPU_CSI_BIT)
|
||||||
#define IMX_MEDIA_GRP_ID_IC_PRP BIT(12)
|
#define IMX_MEDIA_GRP_ID_IPU_VDIC BIT(12)
|
||||||
#define IMX_MEDIA_GRP_ID_IC_PRPENC BIT(13)
|
#define IMX_MEDIA_GRP_ID_IPU_IC_PRP BIT(13)
|
||||||
#define IMX_MEDIA_GRP_ID_IC_PRPVF BIT(14)
|
#define IMX_MEDIA_GRP_ID_IPU_IC_PRPENC BIT(14)
|
||||||
|
#define IMX_MEDIA_GRP_ID_IPU_IC_PRPVF BIT(15)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Загрузка…
Ссылка в новой задаче