Commit 9d95baf9 authored by Robert Foss's avatar Robert Foss Committed by Mauro Carvalho Chehab

media: camss: Make ISPIF subdevice optional

This driver supports multiple architecture versions of the Qualcomm ISP.
The CAMSS architecure which this driver is name after, and with the
introduction of this series, the Titan architecture.

The ISPIF is an IP-block that is only present in the CAMSS generation of
the architecture. In order to support the Titan generation, make the
ISPIF an optional subdevice.
Signed-off-by: default avatarRobert Foss <robert.foss@linaro.org>
Reviewed-by: default avatarAndrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 96387cff
......@@ -63,11 +63,12 @@ struct ispif_device {
struct mutex config_lock;
unsigned int line_num;
struct ispif_line *line;
struct camss *camss;
};
struct resources_ispif;
int msm_ispif_subdev_init(struct ispif_device *ispif,
int msm_ispif_subdev_init(struct camss *camss,
const struct resources_ispif *res);
int msm_ispif_register_entities(struct ispif_device *ispif,
......
......@@ -768,10 +768,10 @@ static int camss_init_subdevices(struct camss *camss)
}
}
ret = msm_ispif_subdev_init(&camss->ispif, ispif_res);
ret = msm_ispif_subdev_init(camss, ispif_res);
if (ret < 0) {
dev_err(camss->dev, "Failed to init ispif sub-device: %d\n",
ret);
ret);
return ret;
}
......@@ -821,10 +821,11 @@ static int camss_register_entities(struct camss *camss)
}
}
ret = msm_ispif_register_entities(&camss->ispif, &camss->v4l2_dev);
ret = msm_ispif_register_entities(camss->ispif,
&camss->v4l2_dev);
if (ret < 0) {
dev_err(camss->dev, "Failed to register ispif entities: %d\n",
ret);
ret);
goto err_reg_ispif;
}
......@@ -858,43 +859,68 @@ static int camss_register_entities(struct camss *camss)
}
}
for (i = 0; i < camss->csid_num; i++) {
for (j = 0; j < camss->ispif.line_num; j++) {
ret = media_create_pad_link(
&camss->csid[i].subdev.entity,
MSM_CSID_PAD_SRC,
&camss->ispif.line[j].subdev.entity,
MSM_ISPIF_PAD_SINK,
0);
if (ret < 0) {
dev_err(camss->dev,
"Failed to link %s->%s entities: %d\n",
camss->csid[i].subdev.entity.name,
camss->ispif.line[j].subdev.entity.name,
ret);
goto err_link;
}
}
}
for (i = 0; i < camss->ispif.line_num; i++)
for (k = 0; k < camss->vfe_num; k++)
for (j = 0; j < ARRAY_SIZE(camss->vfe[k].line); j++) {
if (camss->ispif) {
for (i = 0; i < camss->csid_num; i++) {
for (j = 0; j < camss->ispif->line_num; j++) {
ret = media_create_pad_link(
&camss->ispif.line[i].subdev.entity,
MSM_ISPIF_PAD_SRC,
&camss->vfe[k].line[j].subdev.entity,
MSM_VFE_PAD_SINK,
&camss->csid[i].subdev.entity,
MSM_CSID_PAD_SRC,
&camss->ispif->line[j].subdev.entity,
MSM_ISPIF_PAD_SINK,
0);
if (ret < 0) {
dev_err(camss->dev,
"Failed to link %s->%s entities: %d\n",
camss->ispif.line[i].subdev.entity.name,
camss->vfe[k].line[j].subdev.entity.name,
camss->csid[i].subdev.entity.name,
camss->ispif->line[j].subdev.entity.name,
ret);
goto err_link;
}
}
}
for (i = 0; i < camss->ispif->line_num; i++)
for (k = 0; k < camss->vfe_num; k++)
for (j = 0; j < ARRAY_SIZE(camss->vfe[k].line); j++) {
struct v4l2_subdev *ispif = &camss->ispif->line[i].subdev;
struct v4l2_subdev *vfe = &camss->vfe[k].line[j].subdev;
ret = media_create_pad_link(&ispif->entity,
MSM_ISPIF_PAD_SRC,
&vfe->entity,
MSM_VFE_PAD_SINK,
0);
if (ret < 0) {
dev_err(camss->dev,
"Failed to link %s->%s entities: %d\n",
ispif->entity.name,
vfe->entity.name,
ret);
goto err_link;
}
}
} else {
for (i = 0; i < camss->csid_num; i++)
for (k = 0; k < camss->vfe_num; k++)
for (j = 0; j < ARRAY_SIZE(camss->vfe[k].line); j++) {
struct v4l2_subdev *csid = &camss->csid[i].subdev;
struct v4l2_subdev *vfe = &camss->vfe[k].line[j].subdev;
ret = media_create_pad_link(&csid->entity,
MSM_CSID_PAD_SRC,
&vfe->entity,
MSM_VFE_PAD_SINK,
0);
if (ret < 0) {
dev_err(camss->dev,
"Failed to link %s->%s entities: %d\n",
csid->entity.name,
vfe->entity.name,
ret);
goto err_link;
}
}
}
return 0;
......@@ -904,8 +930,8 @@ static int camss_register_entities(struct camss *camss)
for (i--; i >= 0; i--)
msm_vfe_unregister_entities(&camss->vfe[i]);
msm_ispif_unregister_entities(&camss->ispif);
err_reg_ispif:
msm_ispif_unregister_entities(camss->ispif);
i = camss->csid_num;
err_reg_csid:
......@@ -936,7 +962,7 @@ static void camss_unregister_entities(struct camss *camss)
for (i = 0; i < camss->csid_num; i++)
msm_csid_unregister_entity(&camss->csid[i]);
msm_ispif_unregister_entities(&camss->ispif);
msm_ispif_unregister_entities(camss->ispif);
for (i = 0; i < camss->vfe_num; i++)
msm_vfe_unregister_entities(&camss->vfe[i]);
......@@ -1067,6 +1093,15 @@ static int camss_probe(struct platform_device *pdev)
goto err_free;
}
if (camss->version == CAMSS_8x16 ||
camss->version == CAMSS_8x96) {
camss->ispif = devm_kcalloc(dev, 1, sizeof(*camss->ispif), GFP_KERNEL);
if (!camss->ispif) {
ret = -ENOMEM;
goto err_free;
}
}
camss->vfe = devm_kcalloc(dev, camss->vfe_num, sizeof(*camss->vfe),
GFP_KERNEL);
if (!camss->vfe) {
......
......@@ -79,7 +79,7 @@ struct camss {
struct csiphy_device *csiphy;
int csid_num;
struct csid_device *csid;
struct ispif_device ispif;
struct ispif_device *ispif;
int vfe_num;
struct vfe_device *vfe;
atomic_t ref_count;
......
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