mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-09-02 16:44:59 +00:00
media: qcom: camss: Restructure camss_link_entities
Refactor the camss_link_entities function by breaking it down into three distinct functions. Each function will handle the linking of a specific entity separately. SC7280 and later targets mandates for 1:1 linking for csid -> vfe. i.e. csid0 can be mapped to vfe0 only. Signed-off-by: Suresh Vankadara <quic_svankada@quicinc.com> Signed-off-by: Trishansh Bhardwaj <quic_tbhardwa@quicinc.com> Signed-off-by: Vikram Sharma <quic_vikramsa@quicinc.com> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
parent
53b01a5fdb
commit
cc1ecabe67
@ -1994,7 +1994,6 @@ static int camss_init_subdevices(struct camss *camss)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* camss_link_entities - Register subdev nodes and create links
|
|
||||||
* camss_link_err - print error in case link creation fails
|
* camss_link_err - print error in case link creation fails
|
||||||
* @src_name: name for source of the link
|
* @src_name: name for source of the link
|
||||||
* @sink_name: name for sink of the link
|
* @sink_name: name for sink of the link
|
||||||
@ -2012,14 +2011,64 @@ inline void camss_link_err(struct camss *camss,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* camss_link_entities - Register subdev nodes and create links
|
* camss_link_entities_csid - Register subdev nodes and create links
|
||||||
* @camss: CAMSS device
|
* @camss: CAMSS device
|
||||||
*
|
*
|
||||||
* Return 0 on success or a negative error code on failure
|
* Return 0 on success or a negative error code on failure
|
||||||
*/
|
*/
|
||||||
static int camss_link_entities(struct camss *camss)
|
static int camss_link_entities_csid(struct camss *camss)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
struct media_entity *src_entity;
|
||||||
|
struct media_entity *sink_entity;
|
||||||
|
int ret, line_num;
|
||||||
|
u16 sink_pad;
|
||||||
|
u16 src_pad;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
for (i = 0; i < camss->res->csid_num; i++) {
|
||||||
|
if (camss->ispif)
|
||||||
|
line_num = camss->ispif->line_num;
|
||||||
|
else
|
||||||
|
line_num = camss->vfe[i].res->line_num;
|
||||||
|
|
||||||
|
src_entity = &camss->csid[i].subdev.entity;
|
||||||
|
for (j = 0; j < line_num; j++) {
|
||||||
|
if (camss->ispif) {
|
||||||
|
sink_entity = &camss->ispif->line[j].subdev.entity;
|
||||||
|
src_pad = MSM_CSID_PAD_SRC;
|
||||||
|
sink_pad = MSM_ISPIF_PAD_SINK;
|
||||||
|
} else {
|
||||||
|
sink_entity = &camss->vfe[i].line[j].subdev.entity;
|
||||||
|
src_pad = MSM_CSID_PAD_FIRST_SRC + j;
|
||||||
|
sink_pad = MSM_VFE_PAD_SINK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = media_create_pad_link(src_entity,
|
||||||
|
src_pad,
|
||||||
|
sink_entity,
|
||||||
|
sink_pad,
|
||||||
|
0);
|
||||||
|
if (ret < 0) {
|
||||||
|
camss_link_err(camss, src_entity->name,
|
||||||
|
sink_entity->name,
|
||||||
|
ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* camss_link_entities_csiphy - Register subdev nodes and create links
|
||||||
|
* @camss: CAMSS device
|
||||||
|
*
|
||||||
|
* Return 0 on success or a negative error code on failure
|
||||||
|
*/
|
||||||
|
static int camss_link_entities_csiphy(struct camss *camss)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
for (i = 0; i < camss->res->csiphy_num; i++) {
|
for (i = 0; i < camss->res->csiphy_num; i++) {
|
||||||
@ -2039,66 +2088,68 @@ static int camss_link_entities(struct camss *camss)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (camss->ispif) {
|
return 0;
|
||||||
for (i = 0; i < camss->res->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_link_entities_ispif - Register subdev nodes and create links
|
||||||
&camss->ispif->line[j].subdev.entity,
|
* @camss: CAMSS device
|
||||||
MSM_ISPIF_PAD_SINK,
|
*
|
||||||
|
* Return 0 on success or a negative error code on failure
|
||||||
|
*/
|
||||||
|
static int camss_link_entities_ispif(struct camss *camss)
|
||||||
|
{
|
||||||
|
int i, j, k;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
for (i = 0; i < camss->ispif->line_num; i++) {
|
||||||
|
for (k = 0; k < camss->res->vfe_num; k++) {
|
||||||
|
for (j = 0; j < camss->vfe[k].res->line_num; 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);
|
0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
camss_link_err(camss,
|
camss_link_err(camss, ispif->entity.name,
|
||||||
camss->csid[i].subdev.entity.name,
|
vfe->entity.name,
|
||||||
camss->ispif->line[j].subdev.entity.name,
|
|
||||||
ret);
|
ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < camss->ispif->line_num; i++)
|
|
||||||
for (k = 0; k < camss->res->vfe_num; k++)
|
|
||||||
for (j = 0; j < camss->vfe[k].res->line_num; 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) {
|
|
||||||
camss_link_err(camss, ispif->entity.name,
|
|
||||||
vfe->entity.name,
|
|
||||||
ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (i = 0; i < camss->res->csid_num; i++)
|
|
||||||
for (k = 0; k < camss->res->vfe_num; k++)
|
|
||||||
for (j = 0; j < camss->vfe[k].res->line_num; 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_FIRST_SRC + j,
|
|
||||||
&vfe->entity,
|
|
||||||
MSM_VFE_PAD_SINK,
|
|
||||||
0);
|
|
||||||
if (ret < 0) {
|
|
||||||
camss_link_err(camss, csid->entity.name,
|
|
||||||
vfe->entity.name,
|
|
||||||
ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* camss_link_entities - Register subdev nodes and create links
|
||||||
|
* @camss: CAMSS device
|
||||||
|
*
|
||||||
|
* Return 0 on success or a negative error code on failure
|
||||||
|
*/
|
||||||
|
static int camss_link_entities(struct camss *camss)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = camss_link_entities_csiphy(camss);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ret = camss_link_entities_csid(camss);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if (camss->ispif)
|
||||||
|
ret = camss_link_entities_ispif(camss);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* camss_register_entities - Register subdev nodes and create links
|
* camss_register_entities - Register subdev nodes and create links
|
||||||
* @camss: CAMSS device
|
* @camss: CAMSS device
|
||||||
|
Loading…
Reference in New Issue
Block a user