From f8c23d1415aad662de5acfa33671b5d14d2c1300 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Wed, 15 Mar 2023 09:58:59 +0000
Subject: [PATCH] 修复hp / spk自动切换
---
kernel/drivers/misc/nkio/nk_io_core.c | 109 +++++++++++++++++++++++++++++-------------------------
1 files changed, 58 insertions(+), 51 deletions(-)
diff --git a/kernel/drivers/misc/nkio/nk_io_core.c b/kernel/drivers/misc/nkio/nk_io_core.c
index 4193df9..7df3022 100755
--- a/kernel/drivers/misc/nkio/nk_io_core.c
+++ b/kernel/drivers/misc/nkio/nk_io_core.c
@@ -61,11 +61,8 @@
{
struct device_node *node = pdev->dev.of_node;
struct nk_io_pdata *pdata;
- int gpio0, gpio1, gpio2, gpio3, reset_pin, ch342_reset;
int ret;
- int lvds_index;
- int i=0;
- static int lvds_gpio[4] ;
+
enum of_gpio_flags flags;
@@ -97,7 +94,7 @@
goto err;
}
}
-
+#if 0
//vcc3_io_en_gpio
ret = of_get_named_gpio_flags(node, "vcc3_io_en_gpio", 0, &flags);
if (ret < 0) {
@@ -117,7 +114,7 @@
goto err;
}
}
-
+#endif
//vcc_12v_io
ret = of_get_named_gpio_flags(node, "vcc_12v_io", 0, &flags);
if (ret < 0) {
@@ -241,13 +238,13 @@
if(ret < 0){
printk("%s() devm_gpio_request reset_4g_gpio request ERROR\n", __FUNCTION__);
}
- ret = gpio_direction_output(pdata->reset_4g_gpio,0);
+ ret = gpio_direction_output(pdata->reset_4g_gpio,1);
if(ret < 0){
printk("%s() gpio_direction_input reset_4g_gpio set ERROR\n", __FUNCTION__);
goto err;
}
msleep(800);
- ret = gpio_direction_output(pdata->reset_4g_gpio,1);
+ ret = gpio_direction_output(pdata->reset_4g_gpio,0);
if(ret < 0){
printk("%s() gpio_direction_input reset_4g_gpio set ERROR\n", __FUNCTION__);
@@ -287,7 +284,24 @@
printk("%s() gpio_direction_output hp_en_gpio set ERROR\n", __FUNCTION__);
}
}
-
+#if 0
+ //pcie_power_en_gpio
+ ret = of_get_named_gpio_flags(node, "pcie_power_en_gpio", 0, &flags);
+ if (ret < 0) {
+ printk("%s() Can not read property pcie_power_en_gpio\n", __FUNCTION__);
+ } else {
+ pdata->pcie_power_en_gpio = ret;
+
+ ret = devm_gpio_request(&pdev->dev, pdata->pcie_power_en_gpio, "pcie_power_en_gpio");
+ if(ret < 0){
+ printk("%s() devm_gpio_request pcie_power_en_gpio request ERROR\n", __FUNCTION__);
+ }
+ ret = gpio_direction_output(pdata->pcie_power_en_gpio,1);
+ if(ret < 0){
+ printk("%s() gpio_direction_output pcie_power_en_gpio set ERROR\n", __FUNCTION__);
+ }
+ }
+#endif
//wifi_power_en_gpio
ret = of_get_named_gpio_flags(node, "wifi_power_en_gpio", 0, &flags);
if (ret < 0) {
@@ -305,7 +319,7 @@
}
}
-
+/*
//spk_out_gpio
ret = of_get_named_gpio_flags(node, "spk_out_gpio", 0, &flags);
if (ret < 0) {
@@ -322,6 +336,7 @@
printk("%s() gpio_direction_output spk_out_gpio set ERROR\n", __FUNCTION__);
}
}
+*/
//air_mode_4g_gpio
ret = of_get_named_gpio_flags(node, "air_mode_4g_gpio", 0, &flags);
if (ret < 0) {
@@ -377,24 +392,42 @@
}
}
- //ch342_enable-gpio;
- ret = of_get_named_gpio_flags(node, "ch342_power", 0, &flags);
+ //lcd_bk_en_gpio;
+ ret = of_get_named_gpio_flags(node, "lcd_bk_en_gpio", 0, &flags);
if (ret < 0) {
- printk("%s() Can not read property ch342_gpio\n", __FUNCTION__);
+ printk("%s() Can not read property lcd_bk_en_gpio\n", __FUNCTION__);
} else {
- pdata->ch342_power = ret;
+ pdata->lcd_bk_en_gpio = ret;
- ret = devm_gpio_request(&pdev->dev, pdata->ch342_power, "ch342_power");
+ ret = devm_gpio_request(&pdev->dev, pdata->lcd_bk_en_gpio, "lcd_bk_en_gpio");
if(ret < 0){
- printk("%s() devm_gpio_request ch342_power request ERROR\n", __FUNCTION__);
+ printk("%s() devm_gpio_request lcd_bk_en_gpio request ERROR\n", __FUNCTION__);
}
- ret = gpio_direction_output(pdata->ch342_power,1);
+ ret = gpio_direction_output(pdata->lcd_bk_en_gpio,1);
if(ret < 0){
- printk("%s() gpio_direction_input ch342_power set ERROR\n", __FUNCTION__);
+ printk("%s() gpio_direction_output lcd_bk_en_gpio set ERROR\n", __FUNCTION__);
}
}
-*/
+
+ //lcd_pwblk_gpio;
+ ret = of_get_named_gpio_flags(node, "lcd_pwblk_gpio", 0, &flags);
+ if (ret < 0) {
+ printk("%s() Can not read property lcd_pwblk_gpio\n", __FUNCTION__);
+ } else {
+ pdata->lcd_pwblk_gpio = ret;
+
+ ret = devm_gpio_request(&pdev->dev, pdata->lcd_pwblk_gpio, "lcd_pwblk_gpio");
+ if(ret < 0){
+ printk("%s() devm_gpio_request lcd_pwblk_gpio request ERROR\n", __FUNCTION__);
+ }
+
+ ret = gpio_direction_output(pdata->lcd_pwblk_gpio,1);
+ if(ret < 0){
+ printk("%s() gpio_direction_output lcd_pwblk_gpio set ERROR\n", __FUNCTION__);
+ }
+ }
+
//edp_set_pixel-s
ret = of_get_named_gpio_flags(node, "edp_reset", 0, &flags);
@@ -498,6 +531,12 @@
gpio_direction_output(gpio2, lvds_gpio[2]);
gpio_direction_output(gpio3, lvds_gpio[3]);
+
+ gpio_direction_output(reset_pin, 0);
+ usleep_range(80000, 100000);
+ gpio_direction_output(reset_pin, 1);
+ usleep_range(80000, 100000);
+*/
printk(" #######nk_io_control_probe end####### \n");
return 0;
@@ -542,38 +581,6 @@
static int nk_io_control_resume(struct platform_device *pdev)
{
- int ret,reset_pin;
- printk("nk_io resume !!!!\n");
- ret = gpio_get_value(120);
-
-#if 0
- gpio_set_value(8,1);
- ret = gpio_get_value(8);
- printk("vcc12v gpio value : %d\n",ret);
-#endif
-#if 0
- gpio_set_value(15,1);
- ret = gpio_get_value(15);
- printk("edp_en gpio value : %d\n",ret);
- gpio_set_value(21,1);
- ret = gpio_get_value(21);
- printk("hub_host3_5v_gpio value : %d\n",ret);
-#endif
-#if 0
- usleep_range(80000, 100000);
- gpio_set_value(120,0);
-// gpio_direction_output(120, 0);
- usleep_range(80000, 100000);
- ret = gpio_get_value(120);
- printk("edp_reset gpio value : %d\n",ret);
-// gpio_direction_output(120, 1);
- gpio_set_value(120,1);
- usleep_range(80000, 100000);
- ret = gpio_get_value(120);
- printk("edp_reset gpio value : %d\n",ret);
-#endif
- //enable = 1;
- //LED_SET(11);
return 0;
}
--
Gitblit v1.6.2