From 557c24d082b6ecb9bfe5407b77ae43fa7650a5dc Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Fri, 17 Feb 2023 11:02:20 +0000
Subject: [PATCH] add eDP LVDS PCIE WIFI6
---
kernel/drivers/misc/nkio/nk_io_core.c | 229 ++++++++++++++++++++++++++++-----------------------------
1 files changed, 113 insertions(+), 116 deletions(-)
diff --git a/kernel/drivers/misc/nkio/nk_io_core.c b/kernel/drivers/misc/nkio/nk_io_core.c
index 4f770bb..b9db2bd 100755
--- a/kernel/drivers/misc/nkio/nk_io_core.c
+++ b/kernel/drivers/misc/nkio/nk_io_core.c
@@ -42,29 +42,6 @@
//static struct class *nk_class;
-void MODULE_SET(int i)
-{
- if(i==11){
- gpio_direction_output(NKpdata_info->en_4g_gpio, 1);
- }else{
- gpio_direction_output(NKpdata_info->en_4g_gpio, 0);
- }
-}
-
-EXPORT_SYMBOL_GPL(MODULE_SET);
-
-
-void LED_SET(int i)
-{
- if(i==11){
- gpio_direction_output(NKpdata_info->led_gpio, 1);
- }else{
- gpio_direction_output(NKpdata_info->led_gpio, 0);
- }
-}
-
-EXPORT_SYMBOL_GPL(LED_SET);
-
void Audio_SET(int i);
@@ -84,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;
@@ -120,11 +94,11 @@
goto err;
}
}
-
+#if 0
//vcc3_io_en_gpio
ret = of_get_named_gpio_flags(node, "vcc3_io_en_gpio", 0, &flags);
if (ret < 0) {
- printk("%s() Can not read property tp_enable\n", __FUNCTION__);
+ printk("%s() Can not read property vcc3_io_en_gpio\n", __FUNCTION__);
goto err;
} else {
pdata->vcc3_io_en_gpio = ret;
@@ -140,7 +114,7 @@
goto err;
}
}
-
+#endif
//vcc_12v_io
ret = of_get_named_gpio_flags(node, "vcc_12v_io", 0, &flags);
if (ret < 0) {
@@ -161,49 +135,6 @@
}
}
-
-
- //hub_host2_5v_gpio
- ret = of_get_named_gpio_flags(node, "hub_host2_5v_gpio", 0, &flags);
- if (ret < 0) {
- printk("%s() Can not read property hub_host2_5v_gpio\n", __FUNCTION__);
- goto err;
- } else {
- pdata->hub_host2_5v_gpio = ret;
- gpio_free(ret);
- ret = devm_gpio_request(&pdev->dev, pdata->hub_host2_5v_gpio, "hub_host2_5v_gpio");
- if (ret < 0){
- printk("%s() devm_gpio_request hub_host2_5v_gpio request ERROR\n", __FUNCTION__);
- goto err;
- }
-
- ret = gpio_direction_output(pdata->hub_host2_5v_gpio,1);
- if(ret < 0){
- printk("%s() gpio_direction_input hub_host2_5v_gpio set ERROR\n", __FUNCTION__);
- goto err;
- }
- }
-
- //usb_en_oc_gpio
- ret = of_get_named_gpio_flags(node, "usb_en_oc_gpio", 0, &flags);
- if (ret < 0) {
- printk("%s() Can not read property usb_en_oc_gpio\n", __FUNCTION__);
- goto err;
- } else {
- pdata->usb_en_oc_gpio = ret;
- gpio_free(ret);
- ret = devm_gpio_request(&pdev->dev, pdata->usb_en_oc_gpio, "usb_en_oc_gpio");
- if (ret < 0){
- printk("%s() devm_gpio_request usb_en_oc_gpio request ERROR\n", __FUNCTION__);
- goto err;
- }
-
- ret = gpio_direction_output(pdata->usb_en_oc_gpio,1);
- if(ret < 0){
- printk("%s() gpio_direction_input usb_en_oc_gpio set ERROR\n", __FUNCTION__);
- goto err;
- }
- }
//hub_host2_5V_rest_gpio
ret = of_get_named_gpio_flags(node, "hub_host2_5V_rest_gpio", 0, &flags);
@@ -307,10 +238,17 @@
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,0);
+ if(ret < 0){
+ printk("%s() gpio_direction_input reset_4g_gpio set ERROR\n", __FUNCTION__);
+
+ }
}
//en_4g_gpio
@@ -326,11 +264,78 @@
}
ret = gpio_direction_output(pdata->en_4g_gpio,1);
if(ret < 0){
- printk("%s() gpio_direction_input en_4g_gpio set ERROR\n", __FUNCTION__);
+ printk("%s() gpio_direction_output en_4g_gpio set ERROR\n", __FUNCTION__);
+ }
+ }
+
+ //hp_en_gpio
+ ret = of_get_named_gpio_flags(node, "hp_en_gpio", 0, &flags);
+ if (ret < 0) {
+ printk("%s() Can not read property hp_en_gpio\n", __FUNCTION__);
+ } else {
+ pdata->hp_en_gpio = ret;
+
+ ret = devm_gpio_request(&pdev->dev, pdata->hp_en_gpio, "hp_en_gpio");
+ if(ret < 0){
+ printk("%s() devm_gpio_request hp_en_gpio request ERROR\n", __FUNCTION__);
+ }
+ ret = gpio_direction_output(pdata->hp_en_gpio,1);
+ if(ret < 0){
+ 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) {
+ printk("%s() Can not read property wifi_power_en_gpio\n", __FUNCTION__);
+ } else {
+ pdata->wifi_power_en_gpio = ret;
+
+ ret = devm_gpio_request(&pdev->dev, pdata->wifi_power_en_gpio, "wifi_power_en_gpio");
+ if(ret < 0){
+ printk("%s() devm_gpio_request wifi_power_en_gpio request ERROR\n", __FUNCTION__);
+ }
+ ret = gpio_direction_output(pdata->wifi_power_en_gpio,1);
+ if(ret < 0){
+ printk("%s() gpio_direction_output wifi_power_en_gpio set ERROR\n", __FUNCTION__);
}
}
+ //spk_out_gpio
+ ret = of_get_named_gpio_flags(node, "spk_out_gpio", 0, &flags);
+ if (ret < 0) {
+ printk("%s() Can not read property spk_out_gpio\n", __FUNCTION__);
+ } else {
+ pdata->spk_out_gpio = ret;
+
+ ret = devm_gpio_request(&pdev->dev, pdata->spk_out_gpio, "spk_out_gpio");
+ if(ret < 0){
+ printk("%s() devm_gpio_request spk_out_gpio request ERROR\n", __FUNCTION__);
+ }
+ ret = gpio_direction_output(pdata->spk_out_gpio,0);
+ if(ret < 0){
+ 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) {
@@ -386,24 +391,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);
@@ -507,6 +530,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;
@@ -551,38 +580,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