* [PATCH 0/2] Fix the rkisp1 userspace API for later IP versions
@ 2021-01-11 23:40 Heiko Stuebner
2021-01-11 23:40 ` [PATCH 1/2] media: rockchip: rkisp1: carry ip version information Heiko Stuebner
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Heiko Stuebner @ 2021-01-11 23:40 UTC (permalink / raw)
To: dafna.hirschfeld, helen.koike, linux-media, mchehab,
Laurent.pinchart, hverkuil
Cc: linux-rockchip, ezequiel, heiko, christoph.muellner
This NEEDs to go into 5.11 while we can still adapt the uapi
during its RC-cycle.
When looking into supporting the rkisp1 of the px30 I noticed that
some fields got bigger in the uapi, caused by bigger number of samples
for example for histograms or gamma values.
The rkisp1 was destaged with 5.11-rc1 so we have still time during
the 5.11 cycle to fix that without big hassles.
This was discussed previously in a mail [0] and a rfc series [1]
and this two-part series now splits out the important parts that
really should become part of a 5.11-rc and thus the final 5.11.
[0] http://lore.kernel.org/r/3342088.iIbC2pHGDl@diego
[1] https://lore.kernel.org/r/20210108193311.3423236-2-heiko@sntech.de
Heiko Stuebner (2):
media: rockchip: rkisp1: carry ip version information
media: rockchip: rkisp1: extend uapi array sizes
.../platform/rockchip/rkisp1/rkisp1-common.h | 1 +
.../platform/rockchip/rkisp1/rkisp1-dev.c | 22 +++++++++-------
include/uapi/linux/rkisp1-config.h | 25 ++++++++++++++++---
3 files changed, 35 insertions(+), 13 deletions(-)
--
2.29.2
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/2] media: rockchip: rkisp1: carry ip version information
2021-01-11 23:40 [PATCH 0/2] Fix the rkisp1 userspace API for later IP versions Heiko Stuebner
@ 2021-01-11 23:40 ` Heiko Stuebner
2021-01-12 8:32 ` Hans Verkuil
2022-02-11 14:04 ` Laurent Pinchart
2021-01-11 23:40 ` [PATCH 2/2] media: rockchip: rkisp1: extend uapi array sizes Heiko Stuebner
2022-03-04 17:21 ` [PATCH 0/2] Fix the rkisp1 userspace API for later IP versions Laurent Pinchart
2 siblings, 2 replies; 10+ messages in thread
From: Heiko Stuebner @ 2021-01-11 23:40 UTC (permalink / raw)
To: dafna.hirschfeld, helen.koike, linux-media, mchehab,
Laurent.pinchart, hverkuil
Cc: Heiko Stuebner, linux-rockchip, ezequiel, heiko,
christoph.muellner
From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
The IP block evolved from its rk3288/rk3399 base and the vendor
designates them with a numerical version. rk3399 for example
is designated V10 probably meaning V1.0.
There doesn't seem to be an actual version register we could read that
information from, so allow the match_data to carry that information
for future differentiation.
Also carry that information in the hw_revision field of the media-
controller API, so that userspace also has access to that.
The added versions are:
- V10: at least rk3288 + rk3399
- V11: seemingly unused as of now, but probably appeared in some soc
- V12: at least rk3326 + px30
- V13: at least rk1808
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
---
changes since rfc:
- move rkisp1_version enum into uapo
- show version in media-api hw_revision
.../platform/rockchip/rkisp1/rkisp1-common.h | 1 +
.../platform/rockchip/rkisp1/rkisp1-dev.c | 22 +++++++++++--------
include/uapi/linux/rkisp1-config.h | 7 ++++++
3 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
index 038c303a8aed..bad1bd468f2f 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
@@ -354,6 +354,7 @@ struct rkisp1_device {
void __iomem *base_addr;
int irq;
struct device *dev;
+ enum rkisp1_cif_isp_version isp_ver;
unsigned int clk_size;
struct clk_bulk_data clks[RKISP1_MAX_BUS_CLK];
struct v4l2_device v4l2_dev;
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
index 68da1eed753d..f594d7cd03d0 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
@@ -104,6 +104,7 @@
struct rkisp1_match_data {
const char * const *clks;
unsigned int size;
+ enum rkisp1_cif_isp_version isp_ver;
};
/* ----------------------------------------------------------------------------
@@ -411,15 +412,16 @@ static const char * const rk3399_isp_clks[] = {
"hclk",
};
-static const struct rkisp1_match_data rk3399_isp_clk_data = {
+static const struct rkisp1_match_data rk3399_isp_match_data = {
.clks = rk3399_isp_clks,
.size = ARRAY_SIZE(rk3399_isp_clks),
+ .isp_ver = RKISP1_V10,
};
static const struct of_device_id rkisp1_of_match[] = {
{
.compatible = "rockchip,rk3399-cif-isp",
- .data = &rk3399_isp_clk_data,
+ .data = &rk3399_isp_match_data,
},
{},
};
@@ -457,15 +459,15 @@ static void rkisp1_debug_init(struct rkisp1_device *rkisp1)
static int rkisp1_probe(struct platform_device *pdev)
{
- const struct rkisp1_match_data *clk_data;
+ const struct rkisp1_match_data *match_data;
struct device *dev = &pdev->dev;
struct rkisp1_device *rkisp1;
struct v4l2_device *v4l2_dev;
unsigned int i;
int ret, irq;
- clk_data = of_device_get_match_data(&pdev->dev);
- if (!clk_data)
+ match_data = of_device_get_match_data(&pdev->dev);
+ if (!match_data)
return -ENODEV;
rkisp1 = devm_kzalloc(dev, sizeof(*rkisp1), GFP_KERNEL);
@@ -494,15 +496,17 @@ static int rkisp1_probe(struct platform_device *pdev)
rkisp1->irq = irq;
- for (i = 0; i < clk_data->size; i++)
- rkisp1->clks[i].id = clk_data->clks[i];
- ret = devm_clk_bulk_get(dev, clk_data->size, rkisp1->clks);
+ for (i = 0; i < match_data->size; i++)
+ rkisp1->clks[i].id = match_data->clks[i];
+ ret = devm_clk_bulk_get(dev, match_data->size, rkisp1->clks);
if (ret)
return ret;
- rkisp1->clk_size = clk_data->size;
+ rkisp1->clk_size = match_data->size;
+ rkisp1->isp_ver = match_data->isp_ver;
pm_runtime_enable(&pdev->dev);
+ rkisp1->media_dev.hw_revision = rkisp1->isp_ver;
strscpy(rkisp1->media_dev.model, RKISP1_DRIVER_NAME,
sizeof(rkisp1->media_dev.model));
rkisp1->media_dev.dev = &pdev->dev;
diff --git a/include/uapi/linux/rkisp1-config.h b/include/uapi/linux/rkisp1-config.h
index 6e449e784260..bad46aadf838 100644
--- a/include/uapi/linux/rkisp1-config.h
+++ b/include/uapi/linux/rkisp1-config.h
@@ -124,6 +124,13 @@
#define RKISP1_CIF_ISP_STAT_AFM (1U << 2)
#define RKISP1_CIF_ISP_STAT_HIST (1U << 3)
+enum rkisp1_cif_isp_version {
+ RKISP1_V10 = 0,
+ RKISP1_V11,
+ RKISP1_V12,
+ RKISP1_V13,
+};
+
enum rkisp1_cif_isp_histogram_mode {
RKISP1_CIF_ISP_HISTOGRAM_MODE_DISABLE,
RKISP1_CIF_ISP_HISTOGRAM_MODE_RGB_COMBINED,
--
2.29.2
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/2] media: rockchip: rkisp1: extend uapi array sizes
2021-01-11 23:40 [PATCH 0/2] Fix the rkisp1 userspace API for later IP versions Heiko Stuebner
2021-01-11 23:40 ` [PATCH 1/2] media: rockchip: rkisp1: carry ip version information Heiko Stuebner
@ 2021-01-11 23:40 ` Heiko Stuebner
2021-01-12 8:39 ` Hans Verkuil
2022-03-04 17:21 ` [PATCH 0/2] Fix the rkisp1 userspace API for later IP versions Laurent Pinchart
2 siblings, 1 reply; 10+ messages in thread
From: Heiko Stuebner @ 2021-01-11 23:40 UTC (permalink / raw)
To: dafna.hirschfeld, helen.koike, linux-media, mchehab,
Laurent.pinchart, hverkuil
Cc: Heiko Stuebner, linux-rockchip, ezequiel, heiko,
christoph.muellner
From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Later variants of the rkisp1 block use more entries in some arrays:
RKISP1_CIF_ISP_AE_MEAN_MAX 25 -> 81
RKISP1_CIF_ISP_HIST_BIN_N_MAX 16 -> 32
RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES 17 -> 34
RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE 28 -> 81
and we can still extend the uapi during the 5.11-rc cycle, so do that
now to be on the safe side.
V10 and V11 only need the smaller sizes, while V12 and V13 needed
the larger sizes.
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
---
changes since rfc:
- introduce constants for versions and make max use the biggest
include/uapi/linux/rkisp1-config.h | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/include/uapi/linux/rkisp1-config.h b/include/uapi/linux/rkisp1-config.h
index bad46aadf838..20d24656a8b7 100644
--- a/include/uapi/linux/rkisp1-config.h
+++ b/include/uapi/linux/rkisp1-config.h
@@ -49,8 +49,14 @@
#define RKISP1_CIF_ISP_CTK_COEFF_MAX 0x100
#define RKISP1_CIF_ISP_CTK_OFFSET_MAX 0x800
-#define RKISP1_CIF_ISP_AE_MEAN_MAX 25
-#define RKISP1_CIF_ISP_HIST_BIN_N_MAX 16
+#define RKISP1_CIF_ISP_AE_MEAN_MAX_V10 25
+#define RKISP1_CIF_ISP_AE_MEAN_MAX_V12 81
+#define RKISP1_CIF_ISP_AE_MEAN_MAX RKISP1_CIF_ISP_AE_MEAN_MAX_V12
+
+#define RKISP1_CIF_ISP_HIST_BIN_N_MAX_V10 16
+#define RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12 32
+#define RKISP1_CIF_ISP_HIST_BIN_N_MAX RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12
+
#define RKISP1_CIF_ISP_AFM_MAX_WINDOWS 3
#define RKISP1_CIF_ISP_DEGAMMA_CURVE_SIZE 17
@@ -86,7 +92,9 @@
* Gamma out
*/
/* Maximum number of color samples supported */
-#define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES 17
+#define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10 17
+#define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12 34
+#define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12
/*
* Lens shade correction
@@ -103,7 +111,9 @@
* Histogram calculation
*/
/* Last 3 values unused. */
-#define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE 28
+#define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10 28
+#define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12 81
+#define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12
/*
* Defect Pixel Cluster Correction
--
2.29.2
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] media: rockchip: rkisp1: carry ip version information
2021-01-11 23:40 ` [PATCH 1/2] media: rockchip: rkisp1: carry ip version information Heiko Stuebner
@ 2021-01-12 8:32 ` Hans Verkuil
2021-01-12 10:47 ` Dafna Hirschfeld
2022-02-11 14:04 ` Laurent Pinchart
1 sibling, 1 reply; 10+ messages in thread
From: Hans Verkuil @ 2021-01-12 8:32 UTC (permalink / raw)
To: Heiko Stuebner, dafna.hirschfeld, helen.koike, linux-media,
mchehab, Laurent.pinchart
Cc: Heiko Stuebner, linux-rockchip, ezequiel, christoph.muellner
On 12/01/2021 00:40, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
>
> The IP block evolved from its rk3288/rk3399 base and the vendor
> designates them with a numerical version. rk3399 for example
> is designated V10 probably meaning V1.0.
>
> There doesn't seem to be an actual version register we could read that
> information from, so allow the match_data to carry that information
> for future differentiation.
>
> Also carry that information in the hw_revision field of the media-
> controller API, so that userspace also has access to that.
>
> The added versions are:
> - V10: at least rk3288 + rk3399
> - V11: seemingly unused as of now, but probably appeared in some soc
> - V12: at least rk3326 + px30
> - V13: at least rk1808
>
> Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
> ---
> changes since rfc:
> - move rkisp1_version enum into uapo
> - show version in media-api hw_revision
>
> .../platform/rockchip/rkisp1/rkisp1-common.h | 1 +
> .../platform/rockchip/rkisp1/rkisp1-dev.c | 22 +++++++++++--------
> include/uapi/linux/rkisp1-config.h | 7 ++++++
> 3 files changed, 21 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> index 038c303a8aed..bad1bd468f2f 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> @@ -354,6 +354,7 @@ struct rkisp1_device {
> void __iomem *base_addr;
> int irq;
> struct device *dev;
> + enum rkisp1_cif_isp_version isp_ver;
> unsigned int clk_size;
> struct clk_bulk_data clks[RKISP1_MAX_BUS_CLK];
> struct v4l2_device v4l2_dev;
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> index 68da1eed753d..f594d7cd03d0 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> @@ -104,6 +104,7 @@
> struct rkisp1_match_data {
> const char * const *clks;
> unsigned int size;
> + enum rkisp1_cif_isp_version isp_ver;
> };
>
> /* ----------------------------------------------------------------------------
> @@ -411,15 +412,16 @@ static const char * const rk3399_isp_clks[] = {
> "hclk",
> };
>
> -static const struct rkisp1_match_data rk3399_isp_clk_data = {
> +static const struct rkisp1_match_data rk3399_isp_match_data = {
> .clks = rk3399_isp_clks,
> .size = ARRAY_SIZE(rk3399_isp_clks),
> + .isp_ver = RKISP1_V10,
> };
>
> static const struct of_device_id rkisp1_of_match[] = {
> {
> .compatible = "rockchip,rk3399-cif-isp",
> - .data = &rk3399_isp_clk_data,
> + .data = &rk3399_isp_match_data,
> },
> {},
> };
> @@ -457,15 +459,15 @@ static void rkisp1_debug_init(struct rkisp1_device *rkisp1)
>
> static int rkisp1_probe(struct platform_device *pdev)
> {
> - const struct rkisp1_match_data *clk_data;
> + const struct rkisp1_match_data *match_data;
> struct device *dev = &pdev->dev;
> struct rkisp1_device *rkisp1;
> struct v4l2_device *v4l2_dev;
> unsigned int i;
> int ret, irq;
>
> - clk_data = of_device_get_match_data(&pdev->dev);
> - if (!clk_data)
> + match_data = of_device_get_match_data(&pdev->dev);
> + if (!match_data)
> return -ENODEV;
>
> rkisp1 = devm_kzalloc(dev, sizeof(*rkisp1), GFP_KERNEL);
> @@ -494,15 +496,17 @@ static int rkisp1_probe(struct platform_device *pdev)
>
> rkisp1->irq = irq;
>
> - for (i = 0; i < clk_data->size; i++)
> - rkisp1->clks[i].id = clk_data->clks[i];
> - ret = devm_clk_bulk_get(dev, clk_data->size, rkisp1->clks);
> + for (i = 0; i < match_data->size; i++)
> + rkisp1->clks[i].id = match_data->clks[i];
> + ret = devm_clk_bulk_get(dev, match_data->size, rkisp1->clks);
> if (ret)
> return ret;
> - rkisp1->clk_size = clk_data->size;
> + rkisp1->clk_size = match_data->size;
> + rkisp1->isp_ver = match_data->isp_ver;
>
> pm_runtime_enable(&pdev->dev);
>
> + rkisp1->media_dev.hw_revision = rkisp1->isp_ver;
This must be documented in Documentation/media/admin-guide/rkisp1.rst.
Document that this field is used by this driver and the mapping of the
version number to SoCs.
> strscpy(rkisp1->media_dev.model, RKISP1_DRIVER_NAME,
> sizeof(rkisp1->media_dev.model));
> rkisp1->media_dev.dev = &pdev->dev;
> diff --git a/include/uapi/linux/rkisp1-config.h b/include/uapi/linux/rkisp1-config.h
> index 6e449e784260..bad46aadf838 100644
> --- a/include/uapi/linux/rkisp1-config.h
> +++ b/include/uapi/linux/rkisp1-config.h
> @@ -124,6 +124,13 @@
> #define RKISP1_CIF_ISP_STAT_AFM (1U << 2)
> #define RKISP1_CIF_ISP_STAT_HIST (1U << 3)
>
> +enum rkisp1_cif_isp_version {
> + RKISP1_V10 = 0,
> + RKISP1_V11,
> + RKISP1_V12,
> + RKISP1_V13,
> +};
> +
> enum rkisp1_cif_isp_histogram_mode {
> RKISP1_CIF_ISP_HISTOGRAM_MODE_DISABLE,
> RKISP1_CIF_ISP_HISTOGRAM_MODE_RGB_COMBINED,
>
Regards,
Hans
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] media: rockchip: rkisp1: extend uapi array sizes
2021-01-11 23:40 ` [PATCH 2/2] media: rockchip: rkisp1: extend uapi array sizes Heiko Stuebner
@ 2021-01-12 8:39 ` Hans Verkuil
0 siblings, 0 replies; 10+ messages in thread
From: Hans Verkuil @ 2021-01-12 8:39 UTC (permalink / raw)
To: Heiko Stuebner, dafna.hirschfeld, helen.koike, linux-media,
mchehab, Laurent.pinchart
Cc: Heiko Stuebner, linux-rockchip, ezequiel, christoph.muellner
On 12/01/2021 00:40, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
>
> Later variants of the rkisp1 block use more entries in some arrays:
>
> RKISP1_CIF_ISP_AE_MEAN_MAX 25 -> 81
> RKISP1_CIF_ISP_HIST_BIN_N_MAX 16 -> 32
> RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES 17 -> 34
> RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE 28 -> 81
>
> and we can still extend the uapi during the 5.11-rc cycle, so do that
> now to be on the safe side.
>
> V10 and V11 only need the smaller sizes, while V12 and V13 needed
> the larger sizes.
>
> Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
> ---
> changes since rfc:
> - introduce constants for versions and make max use the biggest
>
> include/uapi/linux/rkisp1-config.h | 18 ++++++++++++++----
> 1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/include/uapi/linux/rkisp1-config.h b/include/uapi/linux/rkisp1-config.h
> index bad46aadf838..20d24656a8b7 100644
> --- a/include/uapi/linux/rkisp1-config.h
> +++ b/include/uapi/linux/rkisp1-config.h
> @@ -49,8 +49,14 @@
> #define RKISP1_CIF_ISP_CTK_COEFF_MAX 0x100
> #define RKISP1_CIF_ISP_CTK_OFFSET_MAX 0x800
>
> -#define RKISP1_CIF_ISP_AE_MEAN_MAX 25
> -#define RKISP1_CIF_ISP_HIST_BIN_N_MAX 16
> +#define RKISP1_CIF_ISP_AE_MEAN_MAX_V10 25
> +#define RKISP1_CIF_ISP_AE_MEAN_MAX_V12 81
> +#define RKISP1_CIF_ISP_AE_MEAN_MAX RKISP1_CIF_ISP_AE_MEAN_MAX_V12
> +
> +#define RKISP1_CIF_ISP_HIST_BIN_N_MAX_V10 16
> +#define RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12 32
> +#define RKISP1_CIF_ISP_HIST_BIN_N_MAX RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12
> +
> #define RKISP1_CIF_ISP_AFM_MAX_WINDOWS 3
> #define RKISP1_CIF_ISP_DEGAMMA_CURVE_SIZE 17
>
> @@ -86,7 +92,9 @@
> * Gamma out
> */
> /* Maximum number of color samples supported */
> -#define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES 17
> +#define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10 17
> +#define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12 34
> +#define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12
>
> /*
> * Lens shade correction
> @@ -103,7 +111,9 @@
> * Histogram calculation
> */
> /* Last 3 values unused. */
> -#define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE 28
> +#define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10 28
> +#define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12 81
> +#define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12
>
> /*
> * Defect Pixel Cluster Correction
>
You must update the documentation in this header for the relevant
structs as well, including a mention that this depends on hw_revision.
What happens to the unused parts of these arrays on a V10/V11 SoC?
Are they zeroed? Please check that no kernel memory contents is leaked
in the unused parts.
Regards,
Hans
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] media: rockchip: rkisp1: carry ip version information
2021-01-12 8:32 ` Hans Verkuil
@ 2021-01-12 10:47 ` Dafna Hirschfeld
2021-01-14 22:50 ` Heiko Stübner
0 siblings, 1 reply; 10+ messages in thread
From: Dafna Hirschfeld @ 2021-01-12 10:47 UTC (permalink / raw)
To: Hans Verkuil, Heiko Stuebner, helen.koike, linux-media, mchehab,
Laurent.pinchart
Cc: Heiko Stuebner, linux-rockchip, Tomasz Figa, ezequiel,
christoph.muellner
Am 12.01.21 um 09:32 schrieb Hans Verkuil:
> On 12/01/2021 00:40, Heiko Stuebner wrote:
>> From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
>>
>> The IP block evolved from its rk3288/rk3399 base and the vendor
>> designates them with a numerical version. rk3399 for example
>> is designated V10 probably meaning V1.0.
>>
>> There doesn't seem to be an actual version register we could read that
>> information from, so allow the match_data to carry that information
>> for future differentiation.
There is a register RKISP1_CIF_VI_ID.
The datasheet I have says: "MARVIN revision ID"
The datasheet says that the reset value is 1085'3017H
which is also the value for the rk3399 and is described "M14_v2 id (Rel. 1.1)"
I don't how this register corresponds to the versions from
the downstream code if at all.
The register is read and kprinted in function rkisp1_config_cif
Could you report the value printed in the px30?
>>
>> Also carry that information in the hw_revision field of the media-
>> controller API, so that userspace also has access to that.
>>
>> The added versions are:
>> - V10: at least rk3288 + rk3399
>> - V11: seemingly unused as of now, but probably appeared in some soc
>> - V12: at least rk3326 + px30
>> - V13: at least rk1808
>>
>> Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
>> ---
>> changes since rfc:
>> - move rkisp1_version enum into uapo
>> - show version in media-api hw_revision
>>
>> .../platform/rockchip/rkisp1/rkisp1-common.h | 1 +
>> .../platform/rockchip/rkisp1/rkisp1-dev.c | 22 +++++++++++--------
>> include/uapi/linux/rkisp1-config.h | 7 ++++++
>> 3 files changed, 21 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
>> index 038c303a8aed..bad1bd468f2f 100644
>> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
>> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
>> @@ -354,6 +354,7 @@ struct rkisp1_device {
>> void __iomem *base_addr;
>> int irq;
>> struct device *dev;
>> + enum rkisp1_cif_isp_version isp_ver;
I don't think we need to add this field,
seems to be enough to set the media_dev.hw_revision
Thanks,
Dafna
>> unsigned int clk_size;
>> struct clk_bulk_data clks[RKISP1_MAX_BUS_CLK];
>> struct v4l2_device v4l2_dev;
>> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
>> index 68da1eed753d..f594d7cd03d0 100644
>> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
>> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
>> @@ -104,6 +104,7 @@
>> struct rkisp1_match_data {
>> const char * const *clks;
>> unsigned int size;
>> + enum rkisp1_cif_isp_version isp_ver;
>> };
>>
>> /* ----------------------------------------------------------------------------
>> @@ -411,15 +412,16 @@ static const char * const rk3399_isp_clks[] = {
>> "hclk",
>> };
>>
>> -static const struct rkisp1_match_data rk3399_isp_clk_data = {
>> +static const struct rkisp1_match_data rk3399_isp_match_data = {
>> .clks = rk3399_isp_clks,
>> .size = ARRAY_SIZE(rk3399_isp_clks),
>> + .isp_ver = RKISP1_V10,
>> };
>>
>> static const struct of_device_id rkisp1_of_match[] = {
>> {
>> .compatible = "rockchip,rk3399-cif-isp",
>> - .data = &rk3399_isp_clk_data,
>> + .data = &rk3399_isp_match_data,
>> },
>> {},
>> };
>> @@ -457,15 +459,15 @@ static void rkisp1_debug_init(struct rkisp1_device *rkisp1)
>>
>> static int rkisp1_probe(struct platform_device *pdev)
>> {
>> - const struct rkisp1_match_data *clk_data;
>> + const struct rkisp1_match_data *match_data;
>> struct device *dev = &pdev->dev;
>> struct rkisp1_device *rkisp1;
>> struct v4l2_device *v4l2_dev;
>> unsigned int i;
>> int ret, irq;
>>
>> - clk_data = of_device_get_match_data(&pdev->dev);
>> - if (!clk_data)
>> + match_data = of_device_get_match_data(&pdev->dev);
>> + if (!match_data)
>> return -ENODEV;
>>
>> rkisp1 = devm_kzalloc(dev, sizeof(*rkisp1), GFP_KERNEL);
>> @@ -494,15 +496,17 @@ static int rkisp1_probe(struct platform_device *pdev)
>>
>> rkisp1->irq = irq;
>>
>> - for (i = 0; i < clk_data->size; i++)
>> - rkisp1->clks[i].id = clk_data->clks[i];
>> - ret = devm_clk_bulk_get(dev, clk_data->size, rkisp1->clks);
>> + for (i = 0; i < match_data->size; i++)
>> + rkisp1->clks[i].id = match_data->clks[i];
>> + ret = devm_clk_bulk_get(dev, match_data->size, rkisp1->clks);
>> if (ret)
>> return ret;
>> - rkisp1->clk_size = clk_data->size;
>> + rkisp1->clk_size = match_data->size;
>> + rkisp1->isp_ver = match_data->isp_ver;
>>
>> pm_runtime_enable(&pdev->dev);
>>
>> + rkisp1->media_dev.hw_revision = rkisp1->isp_ver;
>
> This must be documented in Documentation/media/admin-guide/rkisp1.rst.
> Document that this field is used by this driver and the mapping of the
> version number to SoCs.
>
>> strscpy(rkisp1->media_dev.model, RKISP1_DRIVER_NAME,
>> sizeof(rkisp1->media_dev.model));
>> rkisp1->media_dev.dev = &pdev->dev;
>> diff --git a/include/uapi/linux/rkisp1-config.h b/include/uapi/linux/rkisp1-config.h
>> index 6e449e784260..bad46aadf838 100644
>> --- a/include/uapi/linux/rkisp1-config.h
>> +++ b/include/uapi/linux/rkisp1-config.h
>> @@ -124,6 +124,13 @@
>> #define RKISP1_CIF_ISP_STAT_AFM (1U << 2)
>> #define RKISP1_CIF_ISP_STAT_HIST (1U << 3)
>>
>> +enum rkisp1_cif_isp_version {
>> + RKISP1_V10 = 0,
>> + RKISP1_V11,
>> + RKISP1_V12,
>> + RKISP1_V13,
>> +};
>> +
>> enum rkisp1_cif_isp_histogram_mode {
>> RKISP1_CIF_ISP_HISTOGRAM_MODE_DISABLE,
>> RKISP1_CIF_ISP_HISTOGRAM_MODE_RGB_COMBINED,
>>
>
> Regards,
>
> Hans
>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] media: rockchip: rkisp1: carry ip version information
2021-01-12 10:47 ` Dafna Hirschfeld
@ 2021-01-14 22:50 ` Heiko Stübner
0 siblings, 0 replies; 10+ messages in thread
From: Heiko Stübner @ 2021-01-14 22:50 UTC (permalink / raw)
To: Hans Verkuil, helen.koike, linux-media, mchehab, Laurent.pinchart,
Dafna Hirschfeld
Cc: linux-rockchip, Tomasz Figa, ezequiel, christoph.muellner
Am Dienstag, 12. Januar 2021, 11:47:57 CET schrieb Dafna Hirschfeld:
>
> Am 12.01.21 um 09:32 schrieb Hans Verkuil:
> > On 12/01/2021 00:40, Heiko Stuebner wrote:
> >> From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
> >>
> >> The IP block evolved from its rk3288/rk3399 base and the vendor
> >> designates them with a numerical version. rk3399 for example
> >> is designated V10 probably meaning V1.0.
> >>
> >> There doesn't seem to be an actual version register we could read that
> >> information from, so allow the match_data to carry that information
> >> for future differentiation.
>
> There is a register RKISP1_CIF_VI_ID.
> The datasheet I have says: "MARVIN revision ID"
> The datasheet says that the reset value is 1085'3017H
printing CIF_VI_ID on the px30 shows:
rkisp1 ff4a0000.isp: CIF_ID 0x09305366
though I also can't guess what that should mean.
> which is also the value for the rk3399 and is described "M14_v2 id (Rel. 1.1)"
>
> I don't how this register corresponds to the versions from
> the downstream code if at all.
>
> The register is read and kprinted in function rkisp1_config_cif
> Could you report the value printed in the px30?
>
> >>
> >> Also carry that information in the hw_revision field of the media-
> >> controller API, so that userspace also has access to that.
> >>
> >> The added versions are:
> >> - V10: at least rk3288 + rk3399
> >> - V11: seemingly unused as of now, but probably appeared in some soc
> >> - V12: at least rk3326 + px30
> >> - V13: at least rk1808
> >>
> >> Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
> >> ---
> >> changes since rfc:
> >> - move rkisp1_version enum into uapo
> >> - show version in media-api hw_revision
> >>
> >> .../platform/rockchip/rkisp1/rkisp1-common.h | 1 +
> >> .../platform/rockchip/rkisp1/rkisp1-dev.c | 22 +++++++++++--------
> >> include/uapi/linux/rkisp1-config.h | 7 ++++++
> >> 3 files changed, 21 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> >> index 038c303a8aed..bad1bd468f2f 100644
> >> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> >> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> >> @@ -354,6 +354,7 @@ struct rkisp1_device {
> >> void __iomem *base_addr;
> >> int irq;
> >> struct device *dev;
> >> + enum rkisp1_cif_isp_version isp_ver;
>
> I don't think we need to add this field,
> seems to be enough to set the media_dev.hw_revision
you're right, one instance in media_dev.hw_revision should be enough
Will change that in v2.
Heiko
> >> unsigned int clk_size;
> >> struct clk_bulk_data clks[RKISP1_MAX_BUS_CLK];
> >> struct v4l2_device v4l2_dev;
> >> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> >> index 68da1eed753d..f594d7cd03d0 100644
> >> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> >> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> >> @@ -104,6 +104,7 @@
> >> struct rkisp1_match_data {
> >> const char * const *clks;
> >> unsigned int size;
> >> + enum rkisp1_cif_isp_version isp_ver;
> >> };
> >>
> >> /* ----------------------------------------------------------------------------
> >> @@ -411,15 +412,16 @@ static const char * const rk3399_isp_clks[] = {
> >> "hclk",
> >> };
> >>
> >> -static const struct rkisp1_match_data rk3399_isp_clk_data = {
> >> +static const struct rkisp1_match_data rk3399_isp_match_data = {
> >> .clks = rk3399_isp_clks,
> >> .size = ARRAY_SIZE(rk3399_isp_clks),
> >> + .isp_ver = RKISP1_V10,
> >> };
> >>
> >> static const struct of_device_id rkisp1_of_match[] = {
> >> {
> >> .compatible = "rockchip,rk3399-cif-isp",
> >> - .data = &rk3399_isp_clk_data,
> >> + .data = &rk3399_isp_match_data,
> >> },
> >> {},
> >> };
> >> @@ -457,15 +459,15 @@ static void rkisp1_debug_init(struct rkisp1_device *rkisp1)
> >>
> >> static int rkisp1_probe(struct platform_device *pdev)
> >> {
> >> - const struct rkisp1_match_data *clk_data;
> >> + const struct rkisp1_match_data *match_data;
> >> struct device *dev = &pdev->dev;
> >> struct rkisp1_device *rkisp1;
> >> struct v4l2_device *v4l2_dev;
> >> unsigned int i;
> >> int ret, irq;
> >>
> >> - clk_data = of_device_get_match_data(&pdev->dev);
> >> - if (!clk_data)
> >> + match_data = of_device_get_match_data(&pdev->dev);
> >> + if (!match_data)
> >> return -ENODEV;
> >>
> >> rkisp1 = devm_kzalloc(dev, sizeof(*rkisp1), GFP_KERNEL);
> >> @@ -494,15 +496,17 @@ static int rkisp1_probe(struct platform_device *pdev)
> >>
> >> rkisp1->irq = irq;
> >>
> >> - for (i = 0; i < clk_data->size; i++)
> >> - rkisp1->clks[i].id = clk_data->clks[i];
> >> - ret = devm_clk_bulk_get(dev, clk_data->size, rkisp1->clks);
> >> + for (i = 0; i < match_data->size; i++)
> >> + rkisp1->clks[i].id = match_data->clks[i];
> >> + ret = devm_clk_bulk_get(dev, match_data->size, rkisp1->clks);
> >> if (ret)
> >> return ret;
> >> - rkisp1->clk_size = clk_data->size;
> >> + rkisp1->clk_size = match_data->size;
> >> + rkisp1->isp_ver = match_data->isp_ver;
> >>
> >> pm_runtime_enable(&pdev->dev);
> >>
> >> + rkisp1->media_dev.hw_revision = rkisp1->isp_ver;
> >
> > This must be documented in Documentation/media/admin-guide/rkisp1.rst.
> > Document that this field is used by this driver and the mapping of the
> > version number to SoCs.
> >
> >> strscpy(rkisp1->media_dev.model, RKISP1_DRIVER_NAME,
> >> sizeof(rkisp1->media_dev.model));
> >> rkisp1->media_dev.dev = &pdev->dev;
> >> diff --git a/include/uapi/linux/rkisp1-config.h b/include/uapi/linux/rkisp1-config.h
> >> index 6e449e784260..bad46aadf838 100644
> >> --- a/include/uapi/linux/rkisp1-config.h
> >> +++ b/include/uapi/linux/rkisp1-config.h
> >> @@ -124,6 +124,13 @@
> >> #define RKISP1_CIF_ISP_STAT_AFM (1U << 2)
> >> #define RKISP1_CIF_ISP_STAT_HIST (1U << 3)
> >>
> >> +enum rkisp1_cif_isp_version {
> >> + RKISP1_V10 = 0,
> >> + RKISP1_V11,
> >> + RKISP1_V12,
> >> + RKISP1_V13,
> >> +};
> >> +
> >> enum rkisp1_cif_isp_histogram_mode {
> >> RKISP1_CIF_ISP_HISTOGRAM_MODE_DISABLE,
> >> RKISP1_CIF_ISP_HISTOGRAM_MODE_RGB_COMBINED,
> >>
> >
> > Regards,
> >
> > Hans
> >
>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/2] media: rockchip: rkisp1: carry ip version information
2021-01-14 23:33 [PATCH v2 " Heiko Stuebner
@ 2021-01-14 23:33 ` Heiko Stuebner
0 siblings, 0 replies; 10+ messages in thread
From: Heiko Stuebner @ 2021-01-14 23:33 UTC (permalink / raw)
To: dafna.hirschfeld, helen.koike, linux-media, mchehab,
Laurent.pinchart, hverkuil
Cc: heiko, Heiko Stuebner, tfiga, linux-rockchip, ezequiel,
christoph.muellner
From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
The IP block evolved from its rk3288/rk3399 base and the vendor
designates them with a numerical version. rk3399 for example
is designated V10 probably meaning V1.0.
There doesn't seem to be an actual version register we could read that
information from, so allow the match_data to carry that information
for future differentiation.
Also carry that information in the hw_revision field of the media-
controller API, so that userspace also has access to that.
The added versions are:
- V10: at least rk3288 + rk3399
- V11: seemingly unused as of now, but probably appeared in some soc
- V12: at least rk3326 + px30
- V13: at least rk1808
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
---
changes since rfc:
- move rkisp1_version enum into uapo
- show version in media-api hw_revision
.../platform/rockchip/rkisp1/rkisp1-common.h | 1 +
.../platform/rockchip/rkisp1/rkisp1-dev.c | 22 +++++++++++--------
include/uapi/linux/rkisp1-config.h | 7 ++++++
3 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
index 038c303a8aed..bad1bd468f2f 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
@@ -354,6 +354,7 @@ struct rkisp1_device {
void __iomem *base_addr;
int irq;
struct device *dev;
+ enum rkisp1_cif_isp_version isp_ver;
unsigned int clk_size;
struct clk_bulk_data clks[RKISP1_MAX_BUS_CLK];
struct v4l2_device v4l2_dev;
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
index 68da1eed753d..f594d7cd03d0 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
@@ -104,6 +104,7 @@
struct rkisp1_match_data {
const char * const *clks;
unsigned int size;
+ enum rkisp1_cif_isp_version isp_ver;
};
/* ----------------------------------------------------------------------------
@@ -411,15 +412,16 @@ static const char * const rk3399_isp_clks[] = {
"hclk",
};
-static const struct rkisp1_match_data rk3399_isp_clk_data = {
+static const struct rkisp1_match_data rk3399_isp_match_data = {
.clks = rk3399_isp_clks,
.size = ARRAY_SIZE(rk3399_isp_clks),
+ .isp_ver = RKISP1_V10,
};
static const struct of_device_id rkisp1_of_match[] = {
{
.compatible = "rockchip,rk3399-cif-isp",
- .data = &rk3399_isp_clk_data,
+ .data = &rk3399_isp_match_data,
},
{},
};
@@ -457,15 +459,15 @@ static void rkisp1_debug_init(struct rkisp1_device *rkisp1)
static int rkisp1_probe(struct platform_device *pdev)
{
- const struct rkisp1_match_data *clk_data;
+ const struct rkisp1_match_data *match_data;
struct device *dev = &pdev->dev;
struct rkisp1_device *rkisp1;
struct v4l2_device *v4l2_dev;
unsigned int i;
int ret, irq;
- clk_data = of_device_get_match_data(&pdev->dev);
- if (!clk_data)
+ match_data = of_device_get_match_data(&pdev->dev);
+ if (!match_data)
return -ENODEV;
rkisp1 = devm_kzalloc(dev, sizeof(*rkisp1), GFP_KERNEL);
@@ -494,15 +496,17 @@ static int rkisp1_probe(struct platform_device *pdev)
rkisp1->irq = irq;
- for (i = 0; i < clk_data->size; i++)
- rkisp1->clks[i].id = clk_data->clks[i];
- ret = devm_clk_bulk_get(dev, clk_data->size, rkisp1->clks);
+ for (i = 0; i < match_data->size; i++)
+ rkisp1->clks[i].id = match_data->clks[i];
+ ret = devm_clk_bulk_get(dev, match_data->size, rkisp1->clks);
if (ret)
return ret;
- rkisp1->clk_size = clk_data->size;
+ rkisp1->clk_size = match_data->size;
+ rkisp1->isp_ver = match_data->isp_ver;
pm_runtime_enable(&pdev->dev);
+ rkisp1->media_dev.hw_revision = rkisp1->isp_ver;
strscpy(rkisp1->media_dev.model, RKISP1_DRIVER_NAME,
sizeof(rkisp1->media_dev.model));
rkisp1->media_dev.dev = &pdev->dev;
diff --git a/include/uapi/linux/rkisp1-config.h b/include/uapi/linux/rkisp1-config.h
index 6e449e784260..bad46aadf838 100644
--- a/include/uapi/linux/rkisp1-config.h
+++ b/include/uapi/linux/rkisp1-config.h
@@ -124,6 +124,13 @@
#define RKISP1_CIF_ISP_STAT_AFM (1U << 2)
#define RKISP1_CIF_ISP_STAT_HIST (1U << 3)
+enum rkisp1_cif_isp_version {
+ RKISP1_V10 = 0,
+ RKISP1_V11,
+ RKISP1_V12,
+ RKISP1_V13,
+};
+
enum rkisp1_cif_isp_histogram_mode {
RKISP1_CIF_ISP_HISTOGRAM_MODE_DISABLE,
RKISP1_CIF_ISP_HISTOGRAM_MODE_RGB_COMBINED,
--
2.29.2
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] media: rockchip: rkisp1: carry ip version information
2021-01-11 23:40 ` [PATCH 1/2] media: rockchip: rkisp1: carry ip version information Heiko Stuebner
2021-01-12 8:32 ` Hans Verkuil
@ 2022-02-11 14:04 ` Laurent Pinchart
1 sibling, 0 replies; 10+ messages in thread
From: Laurent Pinchart @ 2022-02-11 14:04 UTC (permalink / raw)
To: Heiko Stuebner
Cc: dafna.hirschfeld, helen.koike, linux-media, mchehab, hverkuil,
linux-rockchip, ezequiel, christoph.muellner, Heiko Stuebner
Hi Heiko,
Reviving a bit of an older thread.
On Tue, Jan 12, 2021 at 12:40:10AM +0100, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
>
> The IP block evolved from its rk3288/rk3399 base and the vendor
> designates them with a numerical version. rk3399 for example
> is designated V10 probably meaning V1.0.
>
> There doesn't seem to be an actual version register we could read that
> information from, so allow the match_data to carry that information
> for future differentiation.
>
> Also carry that information in the hw_revision field of the media-
> controller API, so that userspace also has access to that.
>
> The added versions are:
> - V10: at least rk3288 + rk3399
> - V11: seemingly unused as of now, but probably appeared in some soc
> - V12: at least rk3326 + px30
> - V13: at least rk1808
>
> Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
The ISP has a version register, which is read at streamon time and
printed in a dev_dbg() message. On RK3399 it reads as 0x30153017, and I
was wondering what values are returned for other SoCs. Would you be able
to test on the other platforms you have access to ?
> ---
> changes since rfc:
> - move rkisp1_version enum into uapo
> - show version in media-api hw_revision
>
> .../platform/rockchip/rkisp1/rkisp1-common.h | 1 +
> .../platform/rockchip/rkisp1/rkisp1-dev.c | 22 +++++++++++--------
> include/uapi/linux/rkisp1-config.h | 7 ++++++
> 3 files changed, 21 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> index 038c303a8aed..bad1bd468f2f 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> @@ -354,6 +354,7 @@ struct rkisp1_device {
> void __iomem *base_addr;
> int irq;
> struct device *dev;
> + enum rkisp1_cif_isp_version isp_ver;
> unsigned int clk_size;
> struct clk_bulk_data clks[RKISP1_MAX_BUS_CLK];
> struct v4l2_device v4l2_dev;
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> index 68da1eed753d..f594d7cd03d0 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> @@ -104,6 +104,7 @@
> struct rkisp1_match_data {
> const char * const *clks;
> unsigned int size;
> + enum rkisp1_cif_isp_version isp_ver;
> };
>
> /* ----------------------------------------------------------------------------
> @@ -411,15 +412,16 @@ static const char * const rk3399_isp_clks[] = {
> "hclk",
> };
>
> -static const struct rkisp1_match_data rk3399_isp_clk_data = {
> +static const struct rkisp1_match_data rk3399_isp_match_data = {
> .clks = rk3399_isp_clks,
> .size = ARRAY_SIZE(rk3399_isp_clks),
> + .isp_ver = RKISP1_V10,
> };
>
> static const struct of_device_id rkisp1_of_match[] = {
> {
> .compatible = "rockchip,rk3399-cif-isp",
> - .data = &rk3399_isp_clk_data,
> + .data = &rk3399_isp_match_data,
> },
> {},
> };
> @@ -457,15 +459,15 @@ static void rkisp1_debug_init(struct rkisp1_device *rkisp1)
>
> static int rkisp1_probe(struct platform_device *pdev)
> {
> - const struct rkisp1_match_data *clk_data;
> + const struct rkisp1_match_data *match_data;
> struct device *dev = &pdev->dev;
> struct rkisp1_device *rkisp1;
> struct v4l2_device *v4l2_dev;
> unsigned int i;
> int ret, irq;
>
> - clk_data = of_device_get_match_data(&pdev->dev);
> - if (!clk_data)
> + match_data = of_device_get_match_data(&pdev->dev);
> + if (!match_data)
> return -ENODEV;
>
> rkisp1 = devm_kzalloc(dev, sizeof(*rkisp1), GFP_KERNEL);
> @@ -494,15 +496,17 @@ static int rkisp1_probe(struct platform_device *pdev)
>
> rkisp1->irq = irq;
>
> - for (i = 0; i < clk_data->size; i++)
> - rkisp1->clks[i].id = clk_data->clks[i];
> - ret = devm_clk_bulk_get(dev, clk_data->size, rkisp1->clks);
> + for (i = 0; i < match_data->size; i++)
> + rkisp1->clks[i].id = match_data->clks[i];
> + ret = devm_clk_bulk_get(dev, match_data->size, rkisp1->clks);
> if (ret)
> return ret;
> - rkisp1->clk_size = clk_data->size;
> + rkisp1->clk_size = match_data->size;
> + rkisp1->isp_ver = match_data->isp_ver;
>
> pm_runtime_enable(&pdev->dev);
>
> + rkisp1->media_dev.hw_revision = rkisp1->isp_ver;
> strscpy(rkisp1->media_dev.model, RKISP1_DRIVER_NAME,
> sizeof(rkisp1->media_dev.model));
> rkisp1->media_dev.dev = &pdev->dev;
> diff --git a/include/uapi/linux/rkisp1-config.h b/include/uapi/linux/rkisp1-config.h
> index 6e449e784260..bad46aadf838 100644
> --- a/include/uapi/linux/rkisp1-config.h
> +++ b/include/uapi/linux/rkisp1-config.h
> @@ -124,6 +124,13 @@
> #define RKISP1_CIF_ISP_STAT_AFM (1U << 2)
> #define RKISP1_CIF_ISP_STAT_HIST (1U << 3)
>
> +enum rkisp1_cif_isp_version {
> + RKISP1_V10 = 0,
> + RKISP1_V11,
> + RKISP1_V12,
> + RKISP1_V13,
> +};
> +
> enum rkisp1_cif_isp_histogram_mode {
> RKISP1_CIF_ISP_HISTOGRAM_MODE_DISABLE,
> RKISP1_CIF_ISP_HISTOGRAM_MODE_RGB_COMBINED,
--
Regards,
Laurent Pinchart
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/2] Fix the rkisp1 userspace API for later IP versions
2021-01-11 23:40 [PATCH 0/2] Fix the rkisp1 userspace API for later IP versions Heiko Stuebner
2021-01-11 23:40 ` [PATCH 1/2] media: rockchip: rkisp1: carry ip version information Heiko Stuebner
2021-01-11 23:40 ` [PATCH 2/2] media: rockchip: rkisp1: extend uapi array sizes Heiko Stuebner
@ 2022-03-04 17:21 ` Laurent Pinchart
2 siblings, 0 replies; 10+ messages in thread
From: Laurent Pinchart @ 2022-03-04 17:21 UTC (permalink / raw)
To: Heiko Stuebner
Cc: dafna.hirschfeld, helen.koike, linux-media, mchehab, hverkuil,
linux-rockchip, ezequiel, christoph.muellner
Hi Heiko,
On Tue, Jan 12, 2021 at 12:40:09AM +0100, Heiko Stuebner wrote:
> This NEEDs to go into 5.11 while we can still adapt the uapi
> during its RC-cycle.
>
>
> When looking into supporting the rkisp1 of the px30 I noticed that
> some fields got bigger in the uapi, caused by bigger number of samples
> for example for histograms or gamma values.
As I don't have access to a PX30 platform, I was wondering if you could
read the RKISP1_CIF_VI_ID register and report its value.
> The rkisp1 was destaged with 5.11-rc1 so we have still time during
> the 5.11 cycle to fix that without big hassles.
>
> This was discussed previously in a mail [0] and a rfc series [1]
> and this two-part series now splits out the important parts that
> really should become part of a 5.11-rc and thus the final 5.11.
>
>
> [0] http://lore.kernel.org/r/3342088.iIbC2pHGDl@diego
> [1] https://lore.kernel.org/r/20210108193311.3423236-2-heiko@sntech.de
>
> Heiko Stuebner (2):
> media: rockchip: rkisp1: carry ip version information
> media: rockchip: rkisp1: extend uapi array sizes
>
> .../platform/rockchip/rkisp1/rkisp1-common.h | 1 +
> .../platform/rockchip/rkisp1/rkisp1-dev.c | 22 +++++++++-------
> include/uapi/linux/rkisp1-config.h | 25 ++++++++++++++++---
> 3 files changed, 35 insertions(+), 13 deletions(-)
--
Regards,
Laurent Pinchart
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-03-04 17:28 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-11 23:40 [PATCH 0/2] Fix the rkisp1 userspace API for later IP versions Heiko Stuebner
2021-01-11 23:40 ` [PATCH 1/2] media: rockchip: rkisp1: carry ip version information Heiko Stuebner
2021-01-12 8:32 ` Hans Verkuil
2021-01-12 10:47 ` Dafna Hirschfeld
2021-01-14 22:50 ` Heiko Stübner
2022-02-11 14:04 ` Laurent Pinchart
2021-01-11 23:40 ` [PATCH 2/2] media: rockchip: rkisp1: extend uapi array sizes Heiko Stuebner
2021-01-12 8:39 ` Hans Verkuil
2022-03-04 17:21 ` [PATCH 0/2] Fix the rkisp1 userspace API for later IP versions Laurent Pinchart
-- strict thread matches above, loose matches on Subject: below --
2021-01-14 23:33 [PATCH v2 " Heiko Stuebner
2021-01-14 23:33 ` [PATCH 1/2] media: rockchip: rkisp1: carry ip version information Heiko Stuebner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox