On 26/11/2024 10:01, Vikram Sharma wrote:
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@xxxxxxxxxxx>
Signed-off-by: Trishansh Bhardwaj <quic_tbhardwa@xxxxxxxxxxx>
Signed-off-by: Vikram Sharma <quic_vikramsa@xxxxxxxxxxx>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
---
drivers/media/platform/qcom/camss/camss.c | 155 ++++++++++++++--------
1 file changed, 103 insertions(+), 52 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
index 6824ffbdf4a8..67fb11cbe865 100644
--- a/drivers/media/platform/qcom/camss/camss.c
+++ b/drivers/media/platform/qcom/camss/camss.c
@@ -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
* @src_name: name for source 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
*
* 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;
This statement is incorrect, you are indexing vfe[] with a control
derived from csid_num.
Below is the statement you are removing.
- 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++) {
As soon as csid_num > ARRAY_SIZE(vfe) your code breaks.
I noticed this as I added csid_lite to the x1e series where the
aggregate count of CSID is grater than the aggregate count of VFE.
Please fix.
---
bod