[v2] ipa: rkisp1: Add RKISP1_V_IMX8MP version
diff mbox series

Message ID 20240216110952.3169023-1-paul.elder@ideasonboard.com
State New
Headers show
Series
  • [v2] ipa: rkisp1: Add RKISP1_V_IMX8MP version
Related show

Commit Message

Paul Elder Feb. 16, 2024, 11:09 a.m. UTC
Add the version number for RKISP1_V_IMX8MP, and initialize values for
it.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
This patch goes with the kernel series [1] which adds support for
i.MX8MP.

[1] https://lore.kernel.org/linux-media/20240216095458.2919694-1-paul.elder@ideasonboard.com/
---
 include/linux/rkisp1-config.h | 8 +++++---
 src/ipa/rkisp1/rkisp1.cpp     | 1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

Comments

Laurent Pinchart Feb. 16, 2024, 6:23 p.m. UTC | #1
Hi Paul,

Thank you for the patch.

On Fri, Feb 16, 2024 at 08:09:52PM +0900, Paul Elder wrote:
> Add the version number for RKISP1_V_IMX8MP, and initialize values for
> it.
> 
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> ---
> This patch goes with the kernel series [1] which adds support for
> i.MX8MP.
> 
> [1] https://lore.kernel.org/linux-media/20240216095458.2919694-1-paul.elder@ideasonboard.com/
> ---
>  include/linux/rkisp1-config.h | 8 +++++---
>  src/ipa/rkisp1/rkisp1.cpp     | 1 +
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/rkisp1-config.h b/include/linux/rkisp1-config.h
> index ec7cde8c..2d1c448a 100644
> --- a/include/linux/rkisp1-config.h
> +++ b/include/linux/rkisp1-config.h
> @@ -4,8 +4,8 @@
>   * Copyright (C) 2017 Rockchip Electronics Co., Ltd.
>   */
>  
> -#ifndef _RKISP1_CONFIG_H
> -#define _RKISP1_CONFIG_H
> +#ifndef _UAPI_RKISP1_CONFIG_H
> +#define _UAPI_RKISP1_CONFIG_H
>  
>  #include <linux/types.h>
>  
> @@ -179,12 +179,14 @@
>   * @RKISP1_V11: declared in the original vendor code, but not used
>   * @RKISP1_V12: used at least in rk3326 and px30
>   * @RKISP1_V13: used at least in rk1808
> + * @RKISP1_V_IMX8MP: used in at least imx8mp
>   */
>  enum rkisp1_cif_isp_version {
>  	RKISP1_V10 = 10,
>  	RKISP1_V11,
>  	RKISP1_V12,
>  	RKISP1_V13,
> +	RKISP1_V_IMX8MP,
>  };
>  
>  enum rkisp1_cif_isp_histogram_mode {
> @@ -992,4 +994,4 @@ struct rkisp1_stat_buffer {
>  	struct rkisp1_cif_isp_stat params;
>  };
>  
> -#endif /* _RKISP1_CONFIG_H */
> +#endif /* _UAPI_RKISP1_CONFIG_H */
> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> index 6544c925..11e31bf4 100644
> --- a/src/ipa/rkisp1/rkisp1.cpp
> +++ b/src/ipa/rkisp1/rkisp1.cpp
> @@ -128,6 +128,7 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,
>  	/* \todo Add support for other revisions */
>  	switch (hwRevision) {
>  	case RKISP1_V10:
> +	case RKISP1_V_IMX8MP:

There's a similar version check in agc.cpp that needs to be updated, as
the i.MX8MP has 16 histogram bins. And now that I'm looking at this, the
three variables below are never used. I'll post a v2 of this patch as a
series that includes cleanups.

>  		hwHistBinNMax_ = RKISP1_CIF_ISP_HIST_BIN_N_MAX_V10;
>  		hwGammaOutMaxSamples_ = RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10;
>  		hwHistogramWeightGridsSize_ = RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10;
Stefan Klug Feb. 20, 2024, 8:42 a.m. UTC | #2
Hi Paul,

Am 16.02.24 um 12:09 schrieb Paul Elder:
> Add the version number for RKISP1_V_IMX8MP, and initialize values for
> it.
> 
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> ---
> This patch goes with the kernel series [1] which adds support for
> i.MX8MP.
> 
> [1] https://lore.kernel.org/linux-media/20240216095458.2919694-1-paul.elder@ideasonboard.com/
> ---
>   include/linux/rkisp1-config.h | 8 +++++---
>   src/ipa/rkisp1/rkisp1.cpp     | 1 +
>   2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/rkisp1-config.h b/include/linux/rkisp1-config.h
> index ec7cde8c..2d1c448a 100644
> --- a/include/linux/rkisp1-config.h
> +++ b/include/linux/rkisp1-config.h
> @@ -4,8 +4,8 @@
>    * Copyright (C) 2017 Rockchip Electronics Co., Ltd.
>    */
>   
> -#ifndef _RKISP1_CONFIG_H
> -#define _RKISP1_CONFIG_H
> +#ifndef _UAPI_RKISP1_CONFIG_H
> +#define _UAPI_RKISP1_CONFIG_H
>   
>   #include <linux/types.h>
>   
> @@ -179,12 +179,14 @@
>    * @RKISP1_V11: declared in the original vendor code, but not used
>    * @RKISP1_V12: used at least in rk3326 and px30
>    * @RKISP1_V13: used at least in rk1808
> + * @RKISP1_V_IMX8MP: used in at least imx8mp
>    */
>   enum rkisp1_cif_isp_version {
>   	RKISP1_V10 = 10,
>   	RKISP1_V11,
>   	RKISP1_V12,
>   	RKISP1_V13,
> +	RKISP1_V_IMX8MP,
maybe it's a bit late in the process. But would it make sense to somehow 
reference the upstream names used by VSI? (This would then spill over to 
the kernel patches).
These files give a pretty good overview:
https://github.com/nxp-imx/isp-vvcam/blob/lf-5.15.y_2.0.0/vvcam/isp/isp_version.h
https://github.com/nxp-imx/isp-vvcam/blob/lf-5.15.y_2.0.0/vvcam/isp/mrv_all_regs.h

And according to 
https://github.com/nxp-imx/meta-imx/blob/mickledore-6.1.22-2.0.0/meta-bsp/recipes-bsp/isp-imx/isp-imx_4.2.2.22.0.bb

the isp of the imx8mp is officially named ISP8000NANO_V1802

>   };
>   
>   enum rkisp1_cif_isp_histogram_mode {
> @@ -992,4 +994,4 @@ struct rkisp1_stat_buffer {
>   	struct rkisp1_cif_isp_stat params;
>   };
>   
> -#endif /* _RKISP1_CONFIG_H */
> +#endif /* _UAPI_RKISP1_CONFIG_H */
> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> index 6544c925..11e31bf4 100644
> --- a/src/ipa/rkisp1/rkisp1.cpp
> +++ b/src/ipa/rkisp1/rkisp1.cpp
> @@ -128,6 +128,7 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,
>   	/* \todo Add support for other revisions */
>   	switch (hwRevision) {
>   	case RKISP1_V10:
> +	case RKISP1_V_IMX8MP:
>   		hwHistBinNMax_ = RKISP1_CIF_ISP_HIST_BIN_N_MAX_V10;
>   		hwGammaOutMaxSamples_ = RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10;
>   		hwHistogramWeightGridsSize_ = RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10;
Laurent Pinchart Feb. 23, 2024, 12:21 p.m. UTC | #3
Hi Stefan,

On Tue, Feb 20, 2024 at 09:42:59AM +0100, Stefan Klug wrote:
> Am 16.02.24 um 12:09 schrieb Paul Elder:
> > Add the version number for RKISP1_V_IMX8MP, and initialize values for
> > it.
> > 
> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> > ---
> > This patch goes with the kernel series [1] which adds support for
> > i.MX8MP.
> > 
> > [1] https://lore.kernel.org/linux-media/20240216095458.2919694-1-paul.elder@ideasonboard.com/
> > ---
> >   include/linux/rkisp1-config.h | 8 +++++---
> >   src/ipa/rkisp1/rkisp1.cpp     | 1 +
> >   2 files changed, 6 insertions(+), 3 deletions(-)
> > 
> > diff --git a/include/linux/rkisp1-config.h b/include/linux/rkisp1-config.h
> > index ec7cde8c..2d1c448a 100644
> > --- a/include/linux/rkisp1-config.h
> > +++ b/include/linux/rkisp1-config.h
> > @@ -4,8 +4,8 @@
> >    * Copyright (C) 2017 Rockchip Electronics Co., Ltd.
> >    */
> >   
> > -#ifndef _RKISP1_CONFIG_H
> > -#define _RKISP1_CONFIG_H
> > +#ifndef _UAPI_RKISP1_CONFIG_H
> > +#define _UAPI_RKISP1_CONFIG_H
> >   
> >   #include <linux/types.h>
> >   
> > @@ -179,12 +179,14 @@
> >    * @RKISP1_V11: declared in the original vendor code, but not used
> >    * @RKISP1_V12: used at least in rk3326 and px30
> >    * @RKISP1_V13: used at least in rk1808
> > + * @RKISP1_V_IMX8MP: used in at least imx8mp
> >    */
> >   enum rkisp1_cif_isp_version {
> >   	RKISP1_V10 = 10,
> >   	RKISP1_V11,
> >   	RKISP1_V12,
> >   	RKISP1_V13,
> > +	RKISP1_V_IMX8MP,
>
> maybe it's a bit late in the process. But would it make sense to somehow 
> reference the upstream names used by VSI? (This would then spill over to 
> the kernel patches).
> These files give a pretty good overview:
> https://github.com/nxp-imx/isp-vvcam/blob/lf-5.15.y_2.0.0/vvcam/isp/isp_version.h
> https://github.com/nxp-imx/isp-vvcam/blob/lf-5.15.y_2.0.0/vvcam/isp/mrv_all_regs.h
> 
> And according to 
> https://github.com/nxp-imx/meta-imx/blob/mickledore-6.1.22-2.0.0/meta-bsp/recipes-bsp/isp-imx/isp-imx_4.2.2.22.0.bb
> 
> the isp of the imx8mp is officially named ISP8000NANO_V1802

I'd like to, but I'm lacking information :-( We don't know if the
version in the i.MX8MP is unmodified compared to the V1802. In
particular, I suspect the 34-bit DMA addresses may be an extension
specific to the i.MX8MP, not necessarily present in other V1802. More
generally, I don't know if there are any other V1802, or where the other
versions of the ISP may have been integrated. As we're really blind
here, we decided to add a version specific to the i.MX8MP.

Ideally I would have liked to use the value reported by the hardware
version register instead of a custom enum, but we also lack information
there. In particular, we don't know if the version register may take the
same value for different ISP versions that need to be handled
differently by the driver, and we also don't know if there's a risk of a
version number clash between Rockchip and VSI.

> >   };
> >   
> >   enum rkisp1_cif_isp_histogram_mode {
> > @@ -992,4 +994,4 @@ struct rkisp1_stat_buffer {
> >   	struct rkisp1_cif_isp_stat params;
> >   };
> >   
> > -#endif /* _RKISP1_CONFIG_H */
> > +#endif /* _UAPI_RKISP1_CONFIG_H */
> > diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> > index 6544c925..11e31bf4 100644
> > --- a/src/ipa/rkisp1/rkisp1.cpp
> > +++ b/src/ipa/rkisp1/rkisp1.cpp
> > @@ -128,6 +128,7 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,
> >   	/* \todo Add support for other revisions */
> >   	switch (hwRevision) {
> >   	case RKISP1_V10:
> > +	case RKISP1_V_IMX8MP:
> >   		hwHistBinNMax_ = RKISP1_CIF_ISP_HIST_BIN_N_MAX_V10;
> >   		hwGammaOutMaxSamples_ = RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10;
> >   		hwHistogramWeightGridsSize_ = RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10;

Patch
diff mbox series

diff --git a/include/linux/rkisp1-config.h b/include/linux/rkisp1-config.h
index ec7cde8c..2d1c448a 100644
--- a/include/linux/rkisp1-config.h
+++ b/include/linux/rkisp1-config.h
@@ -4,8 +4,8 @@ 
  * Copyright (C) 2017 Rockchip Electronics Co., Ltd.
  */
 
-#ifndef _RKISP1_CONFIG_H
-#define _RKISP1_CONFIG_H
+#ifndef _UAPI_RKISP1_CONFIG_H
+#define _UAPI_RKISP1_CONFIG_H
 
 #include <linux/types.h>
 
@@ -179,12 +179,14 @@ 
  * @RKISP1_V11: declared in the original vendor code, but not used
  * @RKISP1_V12: used at least in rk3326 and px30
  * @RKISP1_V13: used at least in rk1808
+ * @RKISP1_V_IMX8MP: used in at least imx8mp
  */
 enum rkisp1_cif_isp_version {
 	RKISP1_V10 = 10,
 	RKISP1_V11,
 	RKISP1_V12,
 	RKISP1_V13,
+	RKISP1_V_IMX8MP,
 };
 
 enum rkisp1_cif_isp_histogram_mode {
@@ -992,4 +994,4 @@  struct rkisp1_stat_buffer {
 	struct rkisp1_cif_isp_stat params;
 };
 
-#endif /* _RKISP1_CONFIG_H */
+#endif /* _UAPI_RKISP1_CONFIG_H */
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 6544c925..11e31bf4 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -128,6 +128,7 @@  int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,
 	/* \todo Add support for other revisions */
 	switch (hwRevision) {
 	case RKISP1_V10:
+	case RKISP1_V_IMX8MP:
 		hwHistBinNMax_ = RKISP1_CIF_ISP_HIST_BIN_N_MAX_V10;
 		hwGammaOutMaxSamples_ = RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10;
 		hwHistogramWeightGridsSize_ = RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10;