From 95099d4622f8cb224d94e314c7a8e0df60b13f87 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Sat, 09 Dec 2023 08:38:01 +0000
Subject: [PATCH] enable docker ppp
---
kernel/drivers/media/i2c/techpoint/techpoint_dev.c | 71 ++++++++++++++---------------------
1 files changed, 28 insertions(+), 43 deletions(-)
diff --git a/kernel/drivers/media/i2c/techpoint/techpoint_dev.c b/kernel/drivers/media/i2c/techpoint/techpoint_dev.c
index 1354c15..33115f0 100644
--- a/kernel/drivers/media/i2c/techpoint/techpoint_dev.c
+++ b/kernel/drivers/media/i2c/techpoint/techpoint_dev.c
@@ -2,7 +2,7 @@
/*
* techpoint dev driver
*
- * Copyright (C) 2022 Rockchip Electronics Co., Ltd.
+ * Copyright (C) 2023 Rockchip Electronics Co., Ltd.
*
* V0.0X01.0X00 first version.
*/
@@ -13,7 +13,7 @@
#include "techpoint_tp2855.h"
#include "techpoint_tp2815.h"
-static struct semaphore reg_sem;
+static DEFINE_MUTEX(reg_sem);
int techpoint_write_reg(struct i2c_client *client, u8 reg, u8 val)
{
@@ -126,10 +126,9 @@
techpoint->chip_id = CHIP_TP9950;
techpoint->input_type = TECHPOINT_MIPI;
return 0;
- } else {
- dev_info(&client->dev, "techpoint check chip id failed !\n");
}
+ dev_info(&client->dev, "techpoint check chip id failed !\n");
return -1;
}
@@ -138,15 +137,12 @@
if (check_chip_id(techpoint))
return -1;
- if (techpoint->chip_id == CHIP_TP9930) {
+ if (techpoint->chip_id == CHIP_TP9930)
tp9930_initialize(techpoint);
- } else if (techpoint->chip_id == CHIP_TP2855) {
+ else if (techpoint->chip_id == CHIP_TP2855)
tp2855_initialize(techpoint);
- } else if (techpoint->chip_id == CHIP_TP9950) {
+ else if (techpoint->chip_id == CHIP_TP9950)
tp9950_initialize(techpoint);
- }
-
- sema_init(®_sem, 1);
return 0;
}
@@ -159,7 +155,7 @@
int need_reset_wait = -1;
if (techpoint->power_on) {
- down(®_sem);
+ mutex_lock(®_sem);
if (techpoint->chip_id == CHIP_TP9930) {
tp9930_get_all_input_status(techpoint,
techpoint->detect_status);
@@ -173,12 +169,12 @@
tp2855_set_decoder_mode(client, i,
techpoint->detect_status[i]);
}
- up(®_sem);
+ mutex_unlock(®_sem);
techpoint->do_reset = 0;
}
while (!kthread_should_stop()) {
- down(®_sem);
+ mutex_lock(®_sem);
if (techpoint->power_on) {
for (i = 0; i < PAD_MAX; i++) {
if (techpoint->chip_id == CHIP_TP9930)
@@ -220,7 +216,7 @@
"trigger reset time up\n");
}
}
- up(®_sem);
+ mutex_unlock(®_sem);
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(msecs_to_jiffies(200));
}
@@ -260,7 +256,7 @@
enum techpoint_support_reso reso = 0xff;
struct i2c_client *client = techpoint->client;
- down(®_sem);
+ mutex_lock(®_sem);
for (ch = 0; ch < PAD_MAX; ch++) {
if (techpoint->chip_id == CHIP_TP9930) {
@@ -277,7 +273,7 @@
tp9950_set_channel_reso(client, 0, reso);
}
- up(®_sem);
+ mutex_unlock(®_sem);
return 0;
}
@@ -290,7 +286,7 @@
enum techpoint_support_reso reso = 0xff;
struct i2c_client *client = techpoint->client;
- down(®_sem);
+ mutex_lock(®_sem);
for (ch = 0; ch < PAD_MAX; ch++) {
if (techpoint->chip_id == CHIP_TP9930) {
@@ -341,27 +337,25 @@
}
}
- up(®_sem);
+ mutex_unlock(®_sem);
}
void techpoint_get_vc_fmt_inf(struct techpoint *techpoint,
struct rkmodule_vc_fmt_info *inf)
{
- down(®_sem);
+ mutex_lock(®_sem);
- if (techpoint->chip_id == CHIP_TP9930) {
+ if (techpoint->chip_id == CHIP_TP9930)
tp9930_pll_reset(techpoint->client);
- }
techpoint_write_array(techpoint->client,
techpoint->cur_video_mode->common_reg_list,
techpoint->cur_video_mode->common_reg_size);
- if (techpoint->chip_id == CHIP_TP9930) {
+ if (techpoint->chip_id == CHIP_TP9930)
tp9930_do_reset_pll(techpoint->client);
- }
- up(®_sem);
+ mutex_unlock(®_sem);
__techpoint_get_vc_fmt_inf(techpoint, inf);
}
@@ -374,7 +368,7 @@
memset(inf, 0, sizeof(*inf));
- down(®_sem);
+ mutex_lock(®_sem);
for (ch = 0; ch < 4; ch++) {
if (techpoint->chip_id == CHIP_TP9930)
@@ -387,14 +381,13 @@
inf->detect_status |= detect_status << ch;
}
- up(®_sem);
+ mutex_unlock(®_sem);
}
void techpoint_set_quick_stream(struct techpoint *techpoint, u32 stream)
{
- if (techpoint->chip_id == CHIP_TP2855) {
+ if (techpoint->chip_id == CHIP_TP2855)
tp2855_set_quick_stream(techpoint, stream);
- }
}
int techpoint_start_video_stream(struct techpoint *techpoint)
@@ -402,11 +395,10 @@
int ret = 0;
struct i2c_client *client = techpoint->client;
- down(®_sem);
- if (techpoint->chip_id == CHIP_TP9930) {
+ mutex_lock(®_sem);
+ if (techpoint->chip_id == CHIP_TP9930)
tp9930_pll_reset(techpoint->client);
- }
- up(®_sem);
+ mutex_unlock(®_sem);
auto_detect_channel_fmt(techpoint);
ret = techpoint_write_array(techpoint->client,
@@ -414,15 +406,14 @@
techpoint->cur_video_mode->common_reg_size);
if (ret) {
dev_err(&client->dev,
- "techpoint_start_video_stream common_reg_list failed");
+ "%s common_reg_list failed", __func__);
return ret;
}
- down(®_sem);
- if (techpoint->chip_id == CHIP_TP9930) {
+ mutex_lock(®_sem);
+ if (techpoint->chip_id == CHIP_TP9930)
tp9930_do_reset_pll(techpoint->client);
- }
- up(®_sem);
+ mutex_unlock(®_sem);
usleep_range(500 * 1000, 1000 * 1000);
@@ -434,11 +425,5 @@
int techpoint_stop_video_stream(struct techpoint *techpoint)
{
detect_thread_stop(techpoint);
-
- if (techpoint->chip_id == CHIP_TP9930) {
-
- } else if (techpoint->chip_id == CHIP_TP2855) {
-
- }
return 0;
}
--
Gitblit v1.6.2