Skip to content

Commit 00e6b62

Browse files
hz2jdevers
authored andcommitted
media: rockchip: rkcif: add support for RK3576 VICAP
The RK3576 Video Capture (VICAP) unit features five MIPI CSI-2 capture interfaces (compared to six on RK3588). The register layout is identical to the RK3588 variant. Add the compatible string and match data with mipi_num set to 5. Signed-off-by: Jason Devers <dev.json2@gmail.com>
1 parent 700e8ba commit 00e6b62

3 files changed

Lines changed: 100 additions & 0 deletions

File tree

drivers/media/platform/rockchip/rkcif/rkcif-capture-mipi.c

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,87 @@ rkcif_rk3588_mipi_ctrl0(struct rkcif_stream *stream,
531531
return ctrl0;
532532
}
533533

534+
const struct rkcif_mipi_match_data rkcif_rk3576_vicap_mipi_match_data = {
535+
.mipi_num = 5,
536+
.mipi_ctrl0 = rkcif_rk3588_mipi_ctrl0,
537+
.regs = {
538+
[RKCIF_MIPI_CTRL] = 0x20,
539+
[RKCIF_MIPI_INTEN] = 0x74,
540+
[RKCIF_MIPI_INTSTAT] = 0x78,
541+
},
542+
.regs_id = {
543+
[RKCIF_ID0] = {
544+
[RKCIF_MIPI_CTRL0] = 0x00,
545+
[RKCIF_MIPI_CTRL1] = 0x04,
546+
[RKCIF_MIPI_FRAME0_ADDR_Y] = 0x24,
547+
[RKCIF_MIPI_FRAME0_ADDR_UV] = 0x2c,
548+
[RKCIF_MIPI_FRAME0_VLW_Y] = 0x34,
549+
[RKCIF_MIPI_FRAME0_VLW_UV] = RKCIF_REGISTER_NOTSUPPORTED,
550+
[RKCIF_MIPI_FRAME1_ADDR_Y] = 0x28,
551+
[RKCIF_MIPI_FRAME1_ADDR_UV] = 0x30,
552+
[RKCIF_MIPI_FRAME1_VLW_Y] = RKCIF_REGISTER_NOTSUPPORTED,
553+
[RKCIF_MIPI_FRAME1_VLW_UV] = RKCIF_REGISTER_NOTSUPPORTED,
554+
[RKCIF_MIPI_CROP_START] = 0x8c,
555+
},
556+
[RKCIF_ID1] = {
557+
[RKCIF_MIPI_CTRL0] = 0x08,
558+
[RKCIF_MIPI_CTRL1] = 0x0c,
559+
[RKCIF_MIPI_FRAME0_ADDR_Y] = 0x38,
560+
[RKCIF_MIPI_FRAME0_ADDR_UV] = 0x40,
561+
[RKCIF_MIPI_FRAME0_VLW_Y] = 0x48,
562+
[RKCIF_MIPI_FRAME0_VLW_UV] = RKCIF_REGISTER_NOTSUPPORTED,
563+
[RKCIF_MIPI_FRAME1_ADDR_Y] = 0x3c,
564+
[RKCIF_MIPI_FRAME1_ADDR_UV] = 0x44,
565+
[RKCIF_MIPI_FRAME1_VLW_Y] = RKCIF_REGISTER_NOTSUPPORTED,
566+
[RKCIF_MIPI_FRAME1_VLW_UV] = RKCIF_REGISTER_NOTSUPPORTED,
567+
[RKCIF_MIPI_CROP_START] = 0x90,
568+
},
569+
[RKCIF_ID2] = {
570+
[RKCIF_MIPI_CTRL0] = 0x10,
571+
[RKCIF_MIPI_CTRL1] = 0x14,
572+
[RKCIF_MIPI_FRAME0_ADDR_Y] = 0x4c,
573+
[RKCIF_MIPI_FRAME0_ADDR_UV] = 0x54,
574+
[RKCIF_MIPI_FRAME0_VLW_Y] = 0x5c,
575+
[RKCIF_MIPI_FRAME0_VLW_UV] = RKCIF_REGISTER_NOTSUPPORTED,
576+
[RKCIF_MIPI_FRAME1_ADDR_Y] = 0x50,
577+
[RKCIF_MIPI_FRAME1_ADDR_UV] = 0x58,
578+
[RKCIF_MIPI_FRAME1_VLW_Y] = RKCIF_REGISTER_NOTSUPPORTED,
579+
[RKCIF_MIPI_FRAME1_VLW_UV] = RKCIF_REGISTER_NOTSUPPORTED,
580+
[RKCIF_MIPI_CROP_START] = 0x94,
581+
},
582+
[RKCIF_ID3] = {
583+
[RKCIF_MIPI_CTRL0] = 0x18,
584+
[RKCIF_MIPI_CTRL1] = 0x1c,
585+
[RKCIF_MIPI_FRAME0_ADDR_Y] = 0x60,
586+
[RKCIF_MIPI_FRAME0_ADDR_UV] = 0x68,
587+
[RKCIF_MIPI_FRAME0_VLW_Y] = 0x70,
588+
[RKCIF_MIPI_FRAME0_VLW_UV] = RKCIF_REGISTER_NOTSUPPORTED,
589+
[RKCIF_MIPI_FRAME1_ADDR_Y] = 0x64,
590+
[RKCIF_MIPI_FRAME1_ADDR_UV] = 0x6c,
591+
[RKCIF_MIPI_FRAME1_VLW_Y] = RKCIF_REGISTER_NOTSUPPORTED,
592+
[RKCIF_MIPI_FRAME1_VLW_UV] = RKCIF_REGISTER_NOTSUPPORTED,
593+
[RKCIF_MIPI_CROP_START] = 0x98,
594+
},
595+
},
596+
.blocks = {
597+
{
598+
.offset = 0x100,
599+
},
600+
{
601+
.offset = 0x200,
602+
},
603+
{
604+
.offset = 0x300,
605+
},
606+
{
607+
.offset = 0x400,
608+
},
609+
{
610+
.offset = 0x500,
611+
},
612+
},
613+
};
614+
534615
const struct rkcif_mipi_match_data rkcif_rk3588_vicap_mipi_match_data = {
535616
.mipi_num = 6,
536617
.mipi_ctrl0 = rkcif_rk3588_mipi_ctrl0,

drivers/media/platform/rockchip/rkcif/rkcif-capture-mipi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "rkcif-common.h"
1414

1515
extern const struct rkcif_mipi_match_data rkcif_rk3568_vicap_mipi_match_data;
16+
extern const struct rkcif_mipi_match_data rkcif_rk3576_vicap_mipi_match_data;
1617
extern const struct rkcif_mipi_match_data rkcif_rk3588_vicap_mipi_match_data;
1718

1819
int rkcif_mipi_register(struct rkcif_device *rkcif);

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,20 @@ static const struct rkcif_match_data rk3568_vicap_match_data = {
5353
.mipi = &rkcif_rk3568_vicap_mipi_match_data,
5454
};
5555

56+
static const char *const rk3576_vicap_clks[] = {
57+
"aclk",
58+
"hclk",
59+
"dclk",
60+
"iclk_host0",
61+
"iclk_host1",
62+
};
63+
64+
static const struct rkcif_match_data rk3576_vicap_match_data = {
65+
.clks = rk3576_vicap_clks,
66+
.clks_num = ARRAY_SIZE(rk3576_vicap_clks),
67+
.mipi = &rkcif_rk3576_vicap_mipi_match_data,
68+
};
69+
5670
static const char *const rk3588_vicap_clks[] = {
5771
"aclk",
5872
"hclk",
@@ -76,6 +90,10 @@ static const struct of_device_id rkcif_plat_of_match[] = {
7690
.compatible = "rockchip,rk3568-vicap",
7791
.data = &rk3568_vicap_match_data,
7892
},
93+
{
94+
.compatible = "rockchip,rk3576-vicap",
95+
.data = &rk3576_vicap_match_data,
96+
},
7997
{
8098
.compatible = "rockchip,rk3588-vicap",
8199
.data = &rk3588_vicap_match_data,

0 commit comments

Comments
 (0)