| .. | .. |
|---|
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
|---|
| 2 | 2 | /* |
|---|
| 3 | | - * techpoint techpoint lib |
|---|
| 3 | + * techpoint lib |
|---|
| 4 | 4 | * |
|---|
| 5 | | - * Copyright (C) 2021 Rockchip Electronics Co., Ltd. |
|---|
| 5 | + * Copyright (C) 2023 Rockchip Electronics Co., Ltd. |
|---|
| 6 | 6 | */ |
|---|
| 7 | 7 | |
|---|
| 8 | 8 | #include "techpoint_tp2855.h" |
|---|
| .. | .. |
|---|
| 46 | 46 | { 0x14, 0x33 }, |
|---|
| 47 | 47 | { 0x14, 0xb3 }, |
|---|
| 48 | 48 | { 0x14, 0x33 }, |
|---|
| 49 | + |
|---|
| 49 | 50 | // {0x23, 0x02}, //vi test ok |
|---|
| 50 | 51 | // {0x23, 0x00}, |
|---|
| 51 | 52 | }; |
|---|
| 52 | 53 | |
|---|
| 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 | + |
|---|
| 53 | 98 | 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 |
|---|
| 55 | 133 | .bus_fmt = MEDIA_BUS_FMT_UYVY8_2X8, |
|---|
| 56 | 134 | .width = 1920, |
|---|
| 57 | 135 | .height = 1080, |
|---|
| .. | .. |
|---|
| 69 | 147 | .vc[PAD2] = V4L2_MBUS_CSI2_CHANNEL_2, |
|---|
| 70 | 148 | .vc[PAD3] = V4L2_MBUS_CSI2_CHANNEL_3, |
|---|
| 71 | 149 | }, |
|---|
| 72 | | - { |
|---|
| 150 | + {//4 chn 4 lane 720p |
|---|
| 73 | 151 | .bus_fmt = MEDIA_BUS_FMT_UYVY8_2X8, |
|---|
| 74 | 152 | .width = 1280, |
|---|
| 75 | 153 | .height = 720, |
|---|
| .. | .. |
|---|
| 87 | 165 | .vc[PAD2] = V4L2_MBUS_CSI2_CHANNEL_2, |
|---|
| 88 | 166 | .vc[PAD3] = V4L2_MBUS_CSI2_CHANNEL_3, |
|---|
| 89 | 167 | }, |
|---|
| 90 | | - { |
|---|
| 168 | + {//4 chn 4 lane 576p |
|---|
| 91 | 169 | .bus_fmt = MEDIA_BUS_FMT_UYVY8_2X8, |
|---|
| 92 | 170 | .width = 720, |
|---|
| 93 | 171 | .height = 576, |
|---|
| .. | .. |
|---|
| 395 | 473 | break; |
|---|
| 396 | 474 | default: |
|---|
| 397 | 475 | 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); |
|---|
| 399 | 477 | techpoint_read_reg(client, 0xf5, &tmp); |
|---|
| 400 | 478 | tmp &= ~SYS_MODE[ch]; |
|---|
| 401 | 479 | techpoint_write_reg(client, 0xf5, tmp); |
|---|
| .. | .. |
|---|
| 466 | 544 | case TP2855_CVSTD_1080P_30: |
|---|
| 467 | 545 | dev_err(&client->dev, "detect channel %d 1080P_30\n", ch); |
|---|
| 468 | 546 | return TECHPOINT_S_RESO_1080P_30; |
|---|
| 469 | | - break; |
|---|
| 470 | 547 | case TP2855_CVSTD_1080P_25: |
|---|
| 471 | 548 | dev_err(&client->dev, "detect channel %d 1080P_25\n", ch); |
|---|
| 472 | 549 | return TECHPOINT_S_RESO_1080P_25; |
|---|
| 473 | | - break; |
|---|
| 474 | 550 | case TP2855_CVSTD_720P_30: |
|---|
| 475 | 551 | dev_err(&client->dev, "detect channel %d 720P_30\n", ch); |
|---|
| 476 | 552 | return TECHPOINT_S_RESO_720P_30; |
|---|
| 477 | | - break; |
|---|
| 478 | 553 | case TP2855_CVSTD_720P_25: |
|---|
| 479 | 554 | dev_err(&client->dev, "detect channel %d 720P_25\n", ch); |
|---|
| 480 | 555 | return TECHPOINT_S_RESO_720P_25; |
|---|
| 481 | | - break; |
|---|
| 482 | 556 | case TP2855_CVSTD_SD: |
|---|
| 483 | 557 | dev_err(&client->dev, "detect channel %d SD\n", ch); |
|---|
| 484 | 558 | return TECHPOINT_S_RESO_SD; |
|---|
| 485 | 559 | default: |
|---|
| 486 | 560 | 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); |
|---|
| 488 | 562 | return TECHPOINT_S_RESO_1080P_25; |
|---|
| 489 | | - break; |
|---|
| 490 | 563 | } |
|---|
| 491 | 564 | |
|---|
| 492 | 565 | return reso; |
|---|