[PATCH v2 05/12] media: imx-mipi-csis: Move clk to mipi_csis_info structure

Inbaraj E posted 12 patches 1 month, 3 weeks ago
[PATCH v2 05/12] media: imx-mipi-csis: Move clk to mipi_csis_info structure
Posted by Inbaraj E 1 month, 3 weeks ago
clock names in NXP SoC's is different from the FSD SoC. Inorder to
extend this driver to use for FSD SoC. Move the clock names to
mipi_csis_info structure.

Signed-off-by: Inbaraj E <inbaraj.e@samsung.com>
---
 drivers/media/platform/nxp/imx-mipi-csis.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
index 2beb5f43c2c0..4afa75734f05 100644
--- a/drivers/media/platform/nxp/imx-mipi-csis.c
+++ b/drivers/media/platform/nxp/imx-mipi-csis.c
@@ -267,6 +267,8 @@ static const struct mipi_csis_event mipi_csis_events[] = {
 
 #define MIPI_CSIS_NUM_EVENTS ARRAY_SIZE(mipi_csis_events)
 
+#define MIPI_CSIS_MAX_CLOCKS	4
+
 enum mipi_csis_clk {
 	MIPI_CSIS_CLK_PCLK,
 	MIPI_CSIS_CLK_WRAP,
@@ -274,13 +276,6 @@ enum mipi_csis_clk {
 	MIPI_CSIS_CLK_AXI,
 };
 
-static const char * const mipi_csis_clk_id[] = {
-	"pclk",
-	"wrap",
-	"phy",
-	"axi",
-};
-
 enum mipi_csis_version {
 	MIPI_CSIS_V3_3,
 	MIPI_CSIS_V3_6_3,
@@ -289,6 +284,7 @@ enum mipi_csis_version {
 struct mipi_csis_info {
 	enum mipi_csis_version version;
 	unsigned int num_clocks;
+	const char *clk_names[MIPI_CSIS_MAX_CLOCKS];
 };
 
 struct mipi_csis_device {
@@ -697,7 +693,7 @@ static int mipi_csis_clk_get(struct mipi_csis_device *csis)
 		return -ENOMEM;
 
 	for (i = 0; i < csis->info->num_clocks; i++)
-		csis->clks[i].id = mipi_csis_clk_id[i];
+		csis->clks[i].id = csis->info->clk_names[i];
 
 	ret = devm_clk_bulk_get(csis->dev, csis->info->num_clocks,
 				csis->clks);
@@ -1539,12 +1535,14 @@ static const struct of_device_id mipi_csis_of_match[] = {
 		.data = &(const struct mipi_csis_info){
 			.version = MIPI_CSIS_V3_3,
 			.num_clocks = 3,
+			.clk_names = {"pclk", "wrap", "phy"},
 		},
 	}, {
 		.compatible = "fsl,imx8mm-mipi-csi2",
 		.data = &(const struct mipi_csis_info){
 			.version = MIPI_CSIS_V3_6_3,
 			.num_clocks = 4,
+			.clk_names = {"pclk", "wrap", "phy", "axi"},
 		},
 	},
 	{ /* sentinel */ },
-- 
2.49.0
Re: [PATCH v2 05/12] media: imx-mipi-csis: Move clk to mipi_csis_info structure
Posted by Laurent Pinchart 1 month, 2 weeks ago
Hi Inbaraj,

On Thu, Aug 14, 2025 at 07:39:36PM +0530, Inbaraj E wrote:
> clock names in NXP SoC's is different from the FSD SoC. Inorder to

s/clock/Clock/
s/Inorder/In order/

Is the difference really a matter of SoCs, or is it because the FSD SoC
uses a different version of the IP ?

I also suspect that the "phy" clock was added by mistake, and isn't
needed in NXP SoCs. Could you please check and confirm if the v3.3 and
v3.6.3 versions of the IP have an input PHY clock ?

> extend this driver to use for FSD SoC. Move the clock names to
> mipi_csis_info structure.
> 
> Signed-off-by: Inbaraj E <inbaraj.e@samsung.com>
> ---
>  drivers/media/platform/nxp/imx-mipi-csis.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
> index 2beb5f43c2c0..4afa75734f05 100644
> --- a/drivers/media/platform/nxp/imx-mipi-csis.c
> +++ b/drivers/media/platform/nxp/imx-mipi-csis.c
> @@ -267,6 +267,8 @@ static const struct mipi_csis_event mipi_csis_events[] = {
>  
>  #define MIPI_CSIS_NUM_EVENTS ARRAY_SIZE(mipi_csis_events)
>  
> +#define MIPI_CSIS_MAX_CLOCKS	4
> +
>  enum mipi_csis_clk {
>  	MIPI_CSIS_CLK_PCLK,
>  	MIPI_CSIS_CLK_WRAP,
> @@ -274,13 +276,6 @@ enum mipi_csis_clk {
>  	MIPI_CSIS_CLK_AXI,
>  };
>  
> -static const char * const mipi_csis_clk_id[] = {
> -	"pclk",
> -	"wrap",
> -	"phy",
> -	"axi",
> -};
> -
>  enum mipi_csis_version {
>  	MIPI_CSIS_V3_3,
>  	MIPI_CSIS_V3_6_3,
> @@ -289,6 +284,7 @@ enum mipi_csis_version {
>  struct mipi_csis_info {
>  	enum mipi_csis_version version;
>  	unsigned int num_clocks;
> +	const char *clk_names[MIPI_CSIS_MAX_CLOCKS];
>  };
>  
>  struct mipi_csis_device {
> @@ -697,7 +693,7 @@ static int mipi_csis_clk_get(struct mipi_csis_device *csis)
>  		return -ENOMEM;
>  
>  	for (i = 0; i < csis->info->num_clocks; i++)
> -		csis->clks[i].id = mipi_csis_clk_id[i];
> +		csis->clks[i].id = csis->info->clk_names[i];
>  
>  	ret = devm_clk_bulk_get(csis->dev, csis->info->num_clocks,
>  				csis->clks);
> @@ -1539,12 +1535,14 @@ static const struct of_device_id mipi_csis_of_match[] = {
>  		.data = &(const struct mipi_csis_info){
>  			.version = MIPI_CSIS_V3_3,
>  			.num_clocks = 3,
> +			.clk_names = {"pclk", "wrap", "phy"},
>  		},
>  	}, {
>  		.compatible = "fsl,imx8mm-mipi-csi2",
>  		.data = &(const struct mipi_csis_info){
>  			.version = MIPI_CSIS_V3_6_3,
>  			.num_clocks = 4,
> +			.clk_names = {"pclk", "wrap", "phy", "axi"},
>  		},
>  	},
>  	{ /* sentinel */ },

-- 
Regards,

Laurent Pinchart
RE: [PATCH v2 05/12] media: imx-mipi-csis: Move clk to mipi_csis_info structure
Posted by Inbaraj E 1 month, 1 week ago
Hi Laurent,

Thanks for the review.

> 
> On Thu, Aug 14, 2025 at 07:39:36PM +0530, Inbaraj E wrote:
> > clock names in NXP SoC's is different from the FSD SoC. Inorder to
> 
> s/clock/Clock/
> s/Inorder/In order/
> 
I'll change in next patchset.

> Is the difference really a matter of SoCs, or is it because the FSD SoC uses a
> different version of the IP ?
> 

Yes, it is dependent on the version of the IP.  Thanks for pointing it out. I'll update commit
description accordingly.

> I also suspect that the "phy" clock was added by mistake, and isn't needed in
> NXP SoCs. Could you please check and confirm if the v3.3 and
> v3.6.3 versions of the IP have an input PHY clock ?

I don't have manuals for v3.3 and v3.6.3, So I cannot confirm  this. 

> 
> > extend this driver to use for FSD SoC. Move the clock names to
> > mipi_csis_info structure.
> >

Regards,
Inbaraj E