Skip to content

Commit fc672d8

Browse files
mmindmchehab
authored andcommitted
media: rockchip: rkisp1: carry ip version information
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 [fix checkpatch warning don't use multiple blank lines] Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com> Acked-by: Helen Koike <helen.koike@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1 parent 66d81de commit fc672d8

3 files changed

Lines changed: 43 additions & 9 deletions

File tree

Documentation/admin-guide/media/rkisp1.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,22 @@ This file documents the driver for the Rockchip ISP1 that is part of RK3288
1313
and RK3399 SoCs. The driver is located under drivers/staging/media/rkisp1
1414
and uses the Media-Controller API.
1515

16+
Revisions
17+
=========
18+
19+
There exist multiple smaller revisions to this ISP that got introduced in
20+
later SoCs. Revisions can be found in the enum :c:type:`rkisp1_cif_isp_version`
21+
in the UAPI and the revision of the ISP inside the running SoC can be read
22+
in the field hw_revision of struct media_device_info as returned by
23+
ioctl MEDIA_IOC_DEVICE_INFO.
24+
25+
Versions in use are:
26+
27+
- RKISP1_V10: used at least in rk3288 and rk3399
28+
- RKISP1_V11: declared in the original vendor code, but not used
29+
- RKISP1_V12: used at least in rk3326 and px30
30+
- RKISP1_V13: used at least in rk1808
31+
1632
Topology
1733
========
1834
.. _rkisp1_topology_graph:

drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
struct rkisp1_match_data {
105105
const char * const *clks;
106106
unsigned int size;
107+
enum rkisp1_cif_isp_version isp_ver;
107108
};
108109

109110
/* ----------------------------------------------------------------------------
@@ -411,15 +412,16 @@ static const char * const rk3399_isp_clks[] = {
411412
"hclk",
412413
};
413414

414-
static const struct rkisp1_match_data rk3399_isp_clk_data = {
415+
static const struct rkisp1_match_data rk3399_isp_match_data = {
415416
.clks = rk3399_isp_clks,
416417
.size = ARRAY_SIZE(rk3399_isp_clks),
418+
.isp_ver = RKISP1_V10,
417419
};
418420

419421
static const struct of_device_id rkisp1_of_match[] = {
420422
{
421423
.compatible = "rockchip,rk3399-cif-isp",
422-
.data = &rk3399_isp_clk_data,
424+
.data = &rk3399_isp_match_data,
423425
},
424426
{},
425427
};
@@ -457,15 +459,15 @@ static void rkisp1_debug_init(struct rkisp1_device *rkisp1)
457459

458460
static int rkisp1_probe(struct platform_device *pdev)
459461
{
460-
const struct rkisp1_match_data *clk_data;
462+
const struct rkisp1_match_data *match_data;
461463
struct device *dev = &pdev->dev;
462464
struct rkisp1_device *rkisp1;
463465
struct v4l2_device *v4l2_dev;
464466
unsigned int i;
465467
int ret, irq;
466468

467-
clk_data = of_device_get_match_data(&pdev->dev);
468-
if (!clk_data)
469+
match_data = of_device_get_match_data(&pdev->dev);
470+
if (!match_data)
469471
return -ENODEV;
470472

471473
rkisp1 = devm_kzalloc(dev, sizeof(*rkisp1), GFP_KERNEL);
@@ -494,15 +496,16 @@ static int rkisp1_probe(struct platform_device *pdev)
494496

495497
rkisp1->irq = irq;
496498

497-
for (i = 0; i < clk_data->size; i++)
498-
rkisp1->clks[i].id = clk_data->clks[i];
499-
ret = devm_clk_bulk_get(dev, clk_data->size, rkisp1->clks);
499+
for (i = 0; i < match_data->size; i++)
500+
rkisp1->clks[i].id = match_data->clks[i];
501+
ret = devm_clk_bulk_get(dev, match_data->size, rkisp1->clks);
500502
if (ret)
501503
return ret;
502-
rkisp1->clk_size = clk_data->size;
504+
rkisp1->clk_size = match_data->size;
503505

504506
pm_runtime_enable(&pdev->dev);
505507

508+
rkisp1->media_dev.hw_revision = match_data->isp_ver;
506509
strscpy(rkisp1->media_dev.model, RKISP1_DRIVER_NAME,
507510
sizeof(rkisp1->media_dev.model));
508511
rkisp1->media_dev.dev = &pdev->dev;

include/uapi/linux/rkisp1-config.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,21 @@
123123
#define RKISP1_CIF_ISP_STAT_AFM (1U << 2)
124124
#define RKISP1_CIF_ISP_STAT_HIST (1U << 3)
125125

126+
/**
127+
* enum rkisp1_cif_isp_version - ISP variants
128+
*
129+
* @RKISP1_V10: used at least in rk3288 and rk3399
130+
* @RKISP1_V11: declared in the original vendor code, but not used
131+
* @RKISP1_V12: used at least in rk3326 and px30
132+
* @RKISP1_V13: used at least in rk1808
133+
*/
134+
enum rkisp1_cif_isp_version {
135+
RKISP1_V10 = 10,
136+
RKISP1_V11,
137+
RKISP1_V12,
138+
RKISP1_V13,
139+
};
140+
126141
enum rkisp1_cif_isp_histogram_mode {
127142
RKISP1_CIF_ISP_HISTOGRAM_MODE_DISABLE,
128143
RKISP1_CIF_ISP_HISTOGRAM_MODE_RGB_COMBINED,

0 commit comments

Comments
 (0)