Skip to content

Arducam 64mp add pdaf support #5523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 143 additions & 8 deletions drivers/media/i2c/arducam_64mp.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
#define ARDUCAM_64MP_TEST_PATTERN_GB_DEFAULT 0

/* Embedded metadata stream structure */
#define ARDUCAM_64MP_EMBEDDED_LINE_WIDTH 16384
#define ARDUCAM_64MP_EMBEDDED_LINE_WIDTH (11560 * 3)
#define ARDUCAM_64MP_NUM_EMBEDDED_LINES 1

enum pad_types {
Expand Down Expand Up @@ -144,6 +144,7 @@ struct arducam_64mp_mode {
};

static const struct arducam_64mp_reg mode_common_regs[] = {
{0x0100, 0x00},
{0x0136, 0x18},
{0x0137, 0x00},
{0x33F0, 0x01},
Expand Down Expand Up @@ -788,6 +789,7 @@ static const struct arducam_64mp_reg mode_common_regs[] = {
{0x3092, 0x01},
{0x3093, 0x00},
{0x0350, 0x00},
{0x3419, 0x00},
};

/* 64 mpix 2.7fps */
Expand Down Expand Up @@ -847,6 +849,81 @@ static const struct arducam_64mp_reg mode_9152x6944_regs[] = {
{0x0205, 0x00},
{0x020e, 0x01},
{0x020f, 0x00},
{0x341a, 0x00},
{0x341b, 0x00},
{0x341c, 0x00},
{0x341d, 0x00},
{0x341e, 0x02},
{0x341f, 0x3c},
{0x3420, 0x02},
{0x3421, 0x42},
};

/* 48 mpix 3.0fps */
static const struct arducam_64mp_reg mode_8000x6000_regs[] = {
{0x0342, 0xb6},
{0x0343, 0xb2},
{0x0340, 0x19},
{0x0341, 0x0e},
{0x0344, 0x02},
{0x0345, 0x70},
{0x0346, 0x01},
{0x0347, 0xd8},
{0x0348, 0x21},
{0x0349, 0xaf},
{0x034a, 0x19},
{0x034b, 0x47},
{0x0900, 0x00},
{0x0901, 0x11},
{0x0902, 0x0a},
{0x30d8, 0x00},
{0x3200, 0x01},
{0x3201, 0x01},
{0x0408, 0x00},
{0x0409, 0x00},
{0x040a, 0x00},
{0x040b, 0x00},
{0x040c, 0x1f},
{0x040d, 0x40},
{0x040e, 0x17},
{0x040f, 0x70},
{0x034c, 0x1f},
{0x034d, 0x40},
{0x034e, 0x17},
{0x034f, 0x70},
{0x30d9, 0x01},
{0x32d5, 0x01},
{0x32d6, 0x00},
{0x401e, 0x00},
{0x40b8, 0x04},
{0x40b9, 0x20},
{0x40bc, 0x02},
{0x40bd, 0x58},
{0x40be, 0x02},
{0x40bf, 0x58},
{0x41a4, 0x00},
{0x5a09, 0x01},
{0x5a17, 0x01},
{0x5a25, 0x01},
{0x5a33, 0x01},
{0x98d7, 0x14},
{0x98d8, 0x14},
{0x98d9, 0x00},
{0x99c4, 0x00},
{0x0202, 0x03},
{0x0203, 0xe8},
{0x0204, 0x00},
{0x0205, 0x00},
{0x020e, 0x01},
{0x020f, 0x00},
{0x341a, 0x00},
{0x341b, 0x00},
{0x341c, 0x00},
{0x341d, 0x00},
{0x341e, 0x01},
{0x341f, 0xf4},
{0x3420, 0x01},
{0x3421, 0xf4},
};

/* 16 mpix 10fps */
Expand Down Expand Up @@ -900,6 +977,14 @@ static const struct arducam_64mp_reg mode_4624x3472_regs[] = {
{0x98d8, 0x8c},
{0x98d9, 0x0a},
{0x99c4, 0x16},
{0x341a, 0x00},
{0x341b, 0x00},
{0x341c, 0x00},
{0x341d, 0x00},
{0x341e, 0x01},
{0x341f, 0x21},
{0x3420, 0x01},
{0x3421, 0x21},
};

/* 4k 20fps mode */
Expand Down Expand Up @@ -953,6 +1038,14 @@ static const struct arducam_64mp_reg mode_3840x2160_regs[] = {
{0x98d8, 0x8c},
{0x98d9, 0x0a},
{0x99c4, 0x16},
{0x341a, 0x00},
{0x341b, 0x00},
{0x341c, 0x00},
{0x341d, 0x00},
{0x341e, 0x00},
{0x341f, 0xf0},
{0x3420, 0x00},
{0x3421, 0xb4},
};

/* 4x4 binned 30fps mode */
Expand All @@ -972,7 +1065,7 @@ static const struct arducam_64mp_reg mode_2312x1736_regs[] = {
{0x0900, 0x01},
{0x0901, 0x44},
{0x0902, 0x08},
{0x30d8, 0x00},
{0x30d8, 0x04},
{0x3200, 0x43},
{0x3201, 0x43},
{0x0408, 0x00},
Expand All @@ -987,7 +1080,7 @@ static const struct arducam_64mp_reg mode_2312x1736_regs[] = {
{0x034d, 0x08},
{0x034e, 0x06},
{0x034f, 0xc8},
{0x30d9, 0x01},
{0x30d9, 0x00},
{0x32d5, 0x00},
{0x32d6, 0x00},
{0x401e, 0x00},
Expand All @@ -1006,6 +1099,14 @@ static const struct arducam_64mp_reg mode_2312x1736_regs[] = {
{0x98d8, 0x8c},
{0x98d9, 0x0a},
{0x99c4, 0x16},
{0x341a, 0x00},
{0x341b, 0x00},
{0x341c, 0x00},
{0x341d, 0x00},
{0x341e, 0x00},
{0x341f, 0x90},
{0x3420, 0x00},
{0x3421, 0x90},
};

/* 1080p 60fps mode */
Expand Down Expand Up @@ -1059,14 +1160,22 @@ static const struct arducam_64mp_reg mode_1920x1080_regs[] = {
{0x98d8, 0x8c},
{0x98d9, 0x0a},
{0x99c4, 0x16},
{0x341a, 0x00},
{0x341b, 0x00},
{0x341c, 0x00},
{0x341d, 0x00},
{0x341e, 0x00},
{0x341f, 0x78},
{0x3420, 0x00},
{0x3421, 0x5a},
};

/* 720p 120fps mode */
static const struct arducam_64mp_reg mode_1280x720_regs[] = {
{0x0342, 0x1d},
{0x0343, 0xc4},
{0x0340, 0x03},
{0x0341, 0xd8},
{0x0342, 0x1b},
{0x0343, 0x08},
{0x0340, 0x04},
{0x0341, 0x3b},
{0x0344, 0x08},
{0x0345, 0x10},
{0x0346, 0x07},
Expand Down Expand Up @@ -1112,6 +1221,14 @@ static const struct arducam_64mp_reg mode_1280x720_regs[] = {
{0x98d8, 0x8c},
{0x98d9, 0x0a},
{0x99c4, 0x16},
{0x341a, 0x00},
{0x341b, 0x00},
{0x341c, 0x00},
{0x341d, 0x00},
{0x341e, 0x00},
{0x341f, 0x50},
{0x3420, 0x00},
{0x3421, 0x3c},
};

/* Mode configs */
Expand All @@ -1134,6 +1251,24 @@ static const struct arducam_64mp_mode supported_modes[] = {
.num_of_regs = ARRAY_SIZE(mode_9152x6944_regs),
.regs = mode_9152x6944_regs,
}
}, {
.width = 8000,
.height = 6000,
.line_length_pix = 0xb6b2,
.crop = {
.left = ARDUCAM_64MP_PIXEL_ARRAY_LEFT + 624,
.top = ARDUCAM_64MP_PIXEL_ARRAY_TOP + 472,
.width = 9248,
.height = 6944,
},
.timeperframe_default = {
.numerator = 100,
.denominator = 300
},
.reg_list = {
.num_of_regs = ARRAY_SIZE(mode_8000x6000_regs),
.regs = mode_8000x6000_regs,
}
}, {
.width = 4624,
.height = 3472,
Expand Down Expand Up @@ -1209,7 +1344,7 @@ static const struct arducam_64mp_mode supported_modes[] = {
}, {
.width = 1280,
.height = 720,
.line_length_pix = 0x1dc4,
.line_length_pix = 0x1b08,
.crop = {
.left = ARDUCAM_64MP_PIXEL_ARRAY_LEFT + 2064,
.top = ARDUCAM_64MP_PIXEL_ARRAY_TOP + 2032,
Expand Down