hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/media/i2c/techpoint/techpoint_tp2855.c
....@@ -1,8 +1,8 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /*
3
- * techpoint techpoint lib
3
+ * techpoint lib
44 *
5
- * Copyright (C) 2021 Rockchip Electronics Co., Ltd.
5
+ * Copyright (C) 2023 Rockchip Electronics Co., Ltd.
66 */
77
88 #include "techpoint_tp2855.h"
....@@ -46,12 +46,90 @@
4646 { 0x14, 0x33 },
4747 { 0x14, 0xb3 },
4848 { 0x14, 0x33 },
49
+
4950 // {0x23, 0x02}, //vi test ok
5051 // {0x23, 0x00},
5152 };
5253
54
+static __maybe_unused const struct regval common_setting_594M_720p_1chn_2lane_regs[] = {
55
+ {0x40, 0x08},
56
+ {0x01, 0xf0},
57
+ {0x02, 0x01},
58
+ {0x08, 0x0f},
59
+ {0x20, 0x12},
60
+ {0x34, 0x10}, //output vin1&vin2
61
+ {0x15, 0x0c},
62
+ {0x25, 0x08},
63
+ {0x26, 0x06},
64
+ {0x27, 0x11},
65
+ {0x29, 0x0a},
66
+ {0x33, 0x07},
67
+ {0x33, 0x00},
68
+ {0x14, 0x43},
69
+ {0x14, 0xc3},
70
+ {0x14, 0x43},
71
+
72
+ {0x23, 0x02}, //vi test ok
73
+ {0x23, 0x00},
74
+};
75
+
76
+static __maybe_unused const struct regval common_setting_594M_4ch_2lane_720p_25fps_regs[] = {
77
+ { 0x40, 0x08 },
78
+ { 0x01, 0xf0 },
79
+ { 0x02, 0x01 },
80
+ { 0x08, 0x0f },
81
+ {0x20, 0x42},
82
+ {0x34, 0xe4}, //output vin1&vin2
83
+ {0x15, 0x0c},
84
+ {0x25, 0x08},
85
+ {0x26, 0x06},
86
+ {0x27, 0x11},
87
+ {0x29, 0x0a},
88
+ {0x33, 0x07},
89
+ {0x33, 0x00},
90
+ {0x14, 0x43},
91
+ {0x14, 0xc3},
92
+ {0x14, 0x43},
93
+
94
+ {0x23, 0x02},
95
+ {0x23, 0x00},
96
+};
97
+
5398 static struct techpoint_video_modes supported_modes[] = {
54
- {
99
+ {// 4CH 2lane 720p
100
+ .bus_fmt = MEDIA_BUS_FMT_UYVY8_2X8,
101
+ .width = 1280,
102
+ .height = 720,
103
+ .max_fps = {
104
+ .numerator = 10000,
105
+ .denominator = 250000,
106
+ },
107
+ .link_freq_value = TP2855_LINK_FREQ_594M,
108
+ .common_reg_list = common_setting_594M_4ch_2lane_720p_25fps_regs,
109
+ .common_reg_size = ARRAY_SIZE(common_setting_594M_4ch_2lane_720p_25fps_regs),
110
+ .bpp = 8,
111
+ .lane = 2,
112
+ .vc[PAD0] = V4L2_MBUS_CSI2_CHANNEL_0,
113
+ .vc[PAD1] = V4L2_MBUS_CSI2_CHANNEL_1,
114
+ .vc[PAD2] = V4L2_MBUS_CSI2_CHANNEL_2,
115
+ .vc[PAD3] = V4L2_MBUS_CSI2_CHANNEL_3,
116
+ },
117
+ {//1 chn 2 lane 720p
118
+ .bus_fmt = MEDIA_BUS_FMT_UYVY8_2X8,
119
+ .width = 1280,
120
+ .height = 720,
121
+ .max_fps = {
122
+ .numerator = 10000,
123
+ .denominator = 300000,
124
+ },
125
+ .link_freq_value = TP2855_LINK_FREQ_594M,
126
+ .common_reg_list = common_setting_594M_720p_1chn_2lane_regs,
127
+ .common_reg_size = ARRAY_SIZE(common_setting_594M_720p_1chn_2lane_regs),
128
+ .bpp = 8,
129
+ .lane = 2,
130
+ .vc[PAD0] = V4L2_MBUS_CSI2_CHANNEL_0,
131
+ },
132
+ {//4 chn 4 lane 1080p
55133 .bus_fmt = MEDIA_BUS_FMT_UYVY8_2X8,
56134 .width = 1920,
57135 .height = 1080,
....@@ -69,7 +147,7 @@
69147 .vc[PAD2] = V4L2_MBUS_CSI2_CHANNEL_2,
70148 .vc[PAD3] = V4L2_MBUS_CSI2_CHANNEL_3,
71149 },
72
- {
150
+ {//4 chn 4 lane 720p
73151 .bus_fmt = MEDIA_BUS_FMT_UYVY8_2X8,
74152 .width = 1280,
75153 .height = 720,
....@@ -87,7 +165,7 @@
87165 .vc[PAD2] = V4L2_MBUS_CSI2_CHANNEL_2,
88166 .vc[PAD3] = V4L2_MBUS_CSI2_CHANNEL_3,
89167 },
90
- {
168
+ {//4 chn 4 lane 576p
91169 .bus_fmt = MEDIA_BUS_FMT_UYVY8_2X8,
92170 .width = 720,
93171 .height = 576,
....@@ -395,7 +473,7 @@
395473 break;
396474 default:
397475 dev_info(&client->dev,
398
- "set channel %d UNSUPPORT, default 1080P_25\n", ch);
476
+ "set channel %d is not supported, default 1080P_25\n", ch);
399477 techpoint_read_reg(client, 0xf5, &tmp);
400478 tmp &= ~SYS_MODE[ch];
401479 techpoint_write_reg(client, 0xf5, tmp);
....@@ -466,27 +544,22 @@
466544 case TP2855_CVSTD_1080P_30:
467545 dev_err(&client->dev, "detect channel %d 1080P_30\n", ch);
468546 return TECHPOINT_S_RESO_1080P_30;
469
- break;
470547 case TP2855_CVSTD_1080P_25:
471548 dev_err(&client->dev, "detect channel %d 1080P_25\n", ch);
472549 return TECHPOINT_S_RESO_1080P_25;
473
- break;
474550 case TP2855_CVSTD_720P_30:
475551 dev_err(&client->dev, "detect channel %d 720P_30\n", ch);
476552 return TECHPOINT_S_RESO_720P_30;
477
- break;
478553 case TP2855_CVSTD_720P_25:
479554 dev_err(&client->dev, "detect channel %d 720P_25\n", ch);
480555 return TECHPOINT_S_RESO_720P_25;
481
- break;
482556 case TP2855_CVSTD_SD:
483557 dev_err(&client->dev, "detect channel %d SD\n", ch);
484558 return TECHPOINT_S_RESO_SD;
485559 default:
486560 dev_err(&client->dev,
487
- "detect channel %d UNSUPPORT, default 1080P_25\n", ch);
561
+ "detect channel %d is not supported, default 1080P_25\n", ch);
488562 return TECHPOINT_S_RESO_1080P_25;
489
- break;
490563 }
491564
492565 return reso;