| .. | .. |
|---|
| 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_tp9930.h" |
|---|
| .. | .. |
|---|
| 355 | 355 | .link_freq_value = TP9930_LINK_FREQ_297M, |
|---|
| 356 | 356 | .common_reg_list = common_setting_148M_1080p_25fps_regs, |
|---|
| 357 | 357 | .common_reg_size = ARRAY_SIZE(common_setting_148M_1080p_25fps_regs), |
|---|
| 358 | | - }, |
|---|
| 358 | + }, |
|---|
| 359 | 359 | { |
|---|
| 360 | 360 | .bus_fmt = MEDIA_BUS_FMT_UYVY8_2X8, |
|---|
| 361 | 361 | .width = 1920, |
|---|
| .. | .. |
|---|
| 367 | 367 | .link_freq_value = TP9930_LINK_FREQ_297M, |
|---|
| 368 | 368 | .common_reg_list = common_setting_148M_1080p_30fps_regs, |
|---|
| 369 | 369 | .common_reg_size = ARRAY_SIZE(common_setting_148M_1080p_30fps_regs), |
|---|
| 370 | | - }, |
|---|
| 370 | + }, |
|---|
| 371 | 371 | #endif |
|---|
| 372 | 372 | { |
|---|
| 373 | 373 | .bus_fmt = MEDIA_BUS_FMT_UYVY8_2X8, |
|---|
| .. | .. |
|---|
| 380 | 380 | .link_freq_value = TP9930_LINK_FREQ_148M5, |
|---|
| 381 | 381 | .common_reg_list = common_setting_148M_720p_25fps_regs, |
|---|
| 382 | 382 | .common_reg_size = ARRAY_SIZE(common_setting_148M_720p_25fps_regs), |
|---|
| 383 | | - }, |
|---|
| 383 | + }, |
|---|
| 384 | 384 | { |
|---|
| 385 | 385 | .bus_fmt = MEDIA_BUS_FMT_UYVY8_2X8, |
|---|
| 386 | 386 | .width = 1280, |
|---|
| .. | .. |
|---|
| 392 | 392 | .link_freq_value = TP9930_LINK_FREQ_148M5, |
|---|
| 393 | 393 | .common_reg_list = common_setting_148M_720p_30fps_regs, |
|---|
| 394 | 394 | .common_reg_size = ARRAY_SIZE(common_setting_148M_720p_30fps_regs), |
|---|
| 395 | | - } |
|---|
| 395 | + } |
|---|
| 396 | 396 | }; |
|---|
| 397 | 397 | |
|---|
| 398 | 398 | int tp9930_initialize(struct techpoint *techpoint) |
|---|
| .. | .. |
|---|
| 423 | 423 | |
|---|
| 424 | 424 | techpoint_read_reg(client, 0xf4, &val_0xf4); |
|---|
| 425 | 425 | techpoint_write_reg(client, 0xf4, val_0xf4 | 0x80); |
|---|
| 426 | | - msleep(10); |
|---|
| 426 | + usleep_range(10000, 12000); |
|---|
| 427 | 427 | |
|---|
| 428 | 428 | techpoint_write_reg(client, 0x43, val_0x43); |
|---|
| 429 | 429 | techpoint_write_reg(client, 0x44, val_0x44); |
|---|
| .. | .. |
|---|
| 453 | 453 | techpoint_write_reg(client, 0x40, 0x00); |
|---|
| 454 | 454 | |
|---|
| 455 | 455 | #if DEF_1080P |
|---|
| 456 | | -#if 1 // 25FPS |
|---|
| 456 | +// 25FPS |
|---|
| 457 | 457 | techpoint_write_reg(client, 0x44, 0x07); |
|---|
| 458 | 458 | techpoint_write_reg(client, 0x43, 0x17); |
|---|
| 459 | 459 | techpoint_write_reg(client, 0x45, 0x09); |
|---|
| 460 | 460 | techpoint_write_reg(client, 0xf4, 0xa0); |
|---|
| 461 | | -#else |
|---|
| 462 | | - techpoint_write_reg(client, 0x44, 0x17); |
|---|
| 463 | | - techpoint_write_reg(client, 0x43, 0x12); |
|---|
| 464 | | - techpoint_write_reg(client, 0x45, 0x09); |
|---|
| 465 | | -#endif |
|---|
| 466 | 461 | #else |
|---|
| 467 | 462 | techpoint_write_reg(client, 0x44, 0x17); |
|---|
| 468 | 463 | techpoint_write_reg(client, 0x43, 0x17); |
|---|
| .. | .. |
|---|
| 498 | 493 | mutex_unlock(&techpoint->mutex); |
|---|
| 499 | 494 | dev_dbg(&client->dev, "input_status ch %d : %x\n", ch, val); |
|---|
| 500 | 495 | |
|---|
| 501 | | -#if 0 // inaccuracy |
|---|
| 502 | | - return (val & INPUT_STATUS_MASK) ? 0 : 1; |
|---|
| 503 | | -#else |
|---|
| 496 | +// inaccuracy |
|---|
| 504 | 497 | return (val == INPUT_STATUS_MATCH) ? 1 : 0; |
|---|
| 505 | | -#endif |
|---|
| 506 | 498 | } |
|---|
| 507 | 499 | |
|---|
| 508 | 500 | int tp9930_get_all_input_status(struct techpoint *techpoint, u8 *detect_status) |
|---|
| .. | .. |
|---|
| 540 | 532 | default: |
|---|
| 541 | 533 | #if DEF_1080P |
|---|
| 542 | 534 | dev_err(&client->dev, |
|---|
| 543 | | - "set channel %d UNSUPPORT, default 1080P_25, TBD", ch); |
|---|
| 535 | + "set channel %d is not supported, default 1080P_25, TBD", ch); |
|---|
| 544 | 536 | #else |
|---|
| 545 | 537 | dev_err(&client->dev, |
|---|
| 546 | | - "set channel %d UNSUPPORT, default 720P_25, TBD", ch); |
|---|
| 538 | + "set channel %d is not supported, default 720P_25, TBD", ch); |
|---|
| 547 | 539 | #endif |
|---|
| 548 | 540 | break; |
|---|
| 549 | 541 | } |
|---|
| .. | .. |
|---|
| 564 | 556 | case TP9930_CVSTD_1080P_30: |
|---|
| 565 | 557 | dev_err(&client->dev, "detect channel %d 1080P_30", ch); |
|---|
| 566 | 558 | return TECHPOINT_S_RESO_1080P_30; |
|---|
| 567 | | - break; |
|---|
| 568 | 559 | case TP9930_CVSTD_1080P_25: |
|---|
| 569 | 560 | dev_err(&client->dev, "detect channel %d 1080P_25", ch); |
|---|
| 570 | 561 | return TECHPOINT_S_RESO_1080P_25; |
|---|
| 571 | | - break; |
|---|
| 572 | 562 | case TP9930_CVSTD_720P_30: |
|---|
| 573 | 563 | dev_err(&client->dev, "detect channel %d 720P_30", ch); |
|---|
| 574 | 564 | return TECHPOINT_S_RESO_720P_30; |
|---|
| 575 | | - break; |
|---|
| 576 | 565 | case TP9930_CVSTD_720P_25: |
|---|
| 577 | 566 | dev_err(&client->dev, "detect channel %d 720P_25", ch); |
|---|
| 578 | 567 | return TECHPOINT_S_RESO_720P_25; |
|---|
| 579 | | - break; |
|---|
| 580 | 568 | case TP9930_CVSTD_720P_60: |
|---|
| 581 | 569 | case TP9930_CVSTD_720P_50: |
|---|
| 582 | 570 | default: |
|---|
| 583 | 571 | #if DEF_1080P |
|---|
| 584 | 572 | dev_err(&client->dev, |
|---|
| 585 | | - "detect channel %d UNSUPPORT, default 1080P_25", ch); |
|---|
| 573 | + "detect channel %d is not supported, default 1080P_25", ch); |
|---|
| 586 | 574 | return TECHPOINT_S_RESO_1080P_25; |
|---|
| 587 | 575 | #else |
|---|
| 588 | 576 | dev_err(&client->dev, |
|---|
| 589 | | - "detect channel %d UNSUPPORT, default 720P_25", ch); |
|---|
| 577 | + "detect channel %d is not supported, default 720P_25", ch); |
|---|
| 590 | 578 | return TECHPOINT_S_RESO_720P_25; |
|---|
| 591 | 579 | #endif |
|---|
| 592 | | - break; |
|---|
| 593 | 580 | } |
|---|
| 594 | 581 | |
|---|
| 595 | 582 | return reso; |
|---|