hc
2023-03-15 f8c23d1415aad662de5acfa33671b5d14d2c1300
kernel/drivers/misc/nkio/nk_io_core.c
....@@ -61,11 +61,8 @@
6161 {
6262 struct device_node *node = pdev->dev.of_node;
6363 struct nk_io_pdata *pdata;
64
- int gpio0, gpio1, gpio2, gpio3, reset_pin, ch342_reset;
6564 int ret;
66
- int lvds_index;
67
- int i=0;
68
- static int lvds_gpio[4] ;
65
+
6966
7067 enum of_gpio_flags flags;
7168
....@@ -97,7 +94,7 @@
9794 goto err;
9895 }
9996 }
100
-
97
+#if 0
10198 //vcc3_io_en_gpio
10299 ret = of_get_named_gpio_flags(node, "vcc3_io_en_gpio", 0, &flags);
103100 if (ret < 0) {
....@@ -117,7 +114,7 @@
117114 goto err;
118115 }
119116 }
120
-
117
+#endif
121118 //vcc_12v_io
122119 ret = of_get_named_gpio_flags(node, "vcc_12v_io", 0, &flags);
123120 if (ret < 0) {
....@@ -241,13 +238,13 @@
241238 if(ret < 0){
242239 printk("%s() devm_gpio_request reset_4g_gpio request ERROR\n", __FUNCTION__);
243240 }
244
- ret = gpio_direction_output(pdata->reset_4g_gpio,0);
241
+ ret = gpio_direction_output(pdata->reset_4g_gpio,1);
245242 if(ret < 0){
246243 printk("%s() gpio_direction_input reset_4g_gpio set ERROR\n", __FUNCTION__);
247244 goto err;
248245 }
249246 msleep(800);
250
- ret = gpio_direction_output(pdata->reset_4g_gpio,1);
247
+ ret = gpio_direction_output(pdata->reset_4g_gpio,0);
251248 if(ret < 0){
252249 printk("%s() gpio_direction_input reset_4g_gpio set ERROR\n", __FUNCTION__);
253250
....@@ -287,7 +284,24 @@
287284 printk("%s() gpio_direction_output hp_en_gpio set ERROR\n", __FUNCTION__);
288285 }
289286 }
290
-
287
+#if 0
288
+ //pcie_power_en_gpio
289
+ ret = of_get_named_gpio_flags(node, "pcie_power_en_gpio", 0, &flags);
290
+ if (ret < 0) {
291
+ printk("%s() Can not read property pcie_power_en_gpio\n", __FUNCTION__);
292
+ } else {
293
+ pdata->pcie_power_en_gpio = ret;
294
+
295
+ ret = devm_gpio_request(&pdev->dev, pdata->pcie_power_en_gpio, "pcie_power_en_gpio");
296
+ if(ret < 0){
297
+ printk("%s() devm_gpio_request pcie_power_en_gpio request ERROR\n", __FUNCTION__);
298
+ }
299
+ ret = gpio_direction_output(pdata->pcie_power_en_gpio,1);
300
+ if(ret < 0){
301
+ printk("%s() gpio_direction_output pcie_power_en_gpio set ERROR\n", __FUNCTION__);
302
+ }
303
+ }
304
+#endif
291305 //wifi_power_en_gpio
292306 ret = of_get_named_gpio_flags(node, "wifi_power_en_gpio", 0, &flags);
293307 if (ret < 0) {
....@@ -305,7 +319,7 @@
305319 }
306320 }
307321
308
-
322
+/*
309323 //spk_out_gpio
310324 ret = of_get_named_gpio_flags(node, "spk_out_gpio", 0, &flags);
311325 if (ret < 0) {
....@@ -322,6 +336,7 @@
322336 printk("%s() gpio_direction_output spk_out_gpio set ERROR\n", __FUNCTION__);
323337 }
324338 }
339
+*/
325340 //air_mode_4g_gpio
326341 ret = of_get_named_gpio_flags(node, "air_mode_4g_gpio", 0, &flags);
327342 if (ret < 0) {
....@@ -377,24 +392,42 @@
377392 }
378393 }
379394
380
- //ch342_enable-gpio;
381
- ret = of_get_named_gpio_flags(node, "ch342_power", 0, &flags);
395
+ //lcd_bk_en_gpio;
396
+ ret = of_get_named_gpio_flags(node, "lcd_bk_en_gpio", 0, &flags);
382397 if (ret < 0) {
383
- printk("%s() Can not read property ch342_gpio\n", __FUNCTION__);
398
+ printk("%s() Can not read property lcd_bk_en_gpio\n", __FUNCTION__);
384399 } else {
385
- pdata->ch342_power = ret;
400
+ pdata->lcd_bk_en_gpio = ret;
386401
387
- ret = devm_gpio_request(&pdev->dev, pdata->ch342_power, "ch342_power");
402
+ ret = devm_gpio_request(&pdev->dev, pdata->lcd_bk_en_gpio, "lcd_bk_en_gpio");
388403 if(ret < 0){
389
- printk("%s() devm_gpio_request ch342_power request ERROR\n", __FUNCTION__);
404
+ printk("%s() devm_gpio_request lcd_bk_en_gpio request ERROR\n", __FUNCTION__);
390405 }
391406
392
- ret = gpio_direction_output(pdata->ch342_power,1);
407
+ ret = gpio_direction_output(pdata->lcd_bk_en_gpio,1);
393408 if(ret < 0){
394
- printk("%s() gpio_direction_input ch342_power set ERROR\n", __FUNCTION__);
409
+ printk("%s() gpio_direction_output lcd_bk_en_gpio set ERROR\n", __FUNCTION__);
395410 }
396411 }
397
-*/
412
+
413
+ //lcd_pwblk_gpio;
414
+ ret = of_get_named_gpio_flags(node, "lcd_pwblk_gpio", 0, &flags);
415
+ if (ret < 0) {
416
+ printk("%s() Can not read property lcd_pwblk_gpio\n", __FUNCTION__);
417
+ } else {
418
+ pdata->lcd_pwblk_gpio = ret;
419
+
420
+ ret = devm_gpio_request(&pdev->dev, pdata->lcd_pwblk_gpio, "lcd_pwblk_gpio");
421
+ if(ret < 0){
422
+ printk("%s() devm_gpio_request lcd_pwblk_gpio request ERROR\n", __FUNCTION__);
423
+ }
424
+
425
+ ret = gpio_direction_output(pdata->lcd_pwblk_gpio,1);
426
+ if(ret < 0){
427
+ printk("%s() gpio_direction_output lcd_pwblk_gpio set ERROR\n", __FUNCTION__);
428
+ }
429
+ }
430
+
398431
399432 //edp_set_pixel-s
400433 ret = of_get_named_gpio_flags(node, "edp_reset", 0, &flags);
....@@ -498,6 +531,12 @@
498531 gpio_direction_output(gpio2, lvds_gpio[2]);
499532 gpio_direction_output(gpio3, lvds_gpio[3]);
500533
534
+
535
+ gpio_direction_output(reset_pin, 0);
536
+ usleep_range(80000, 100000);
537
+ gpio_direction_output(reset_pin, 1);
538
+ usleep_range(80000, 100000);
539
+*/
501540 printk(" #######nk_io_control_probe end####### \n");
502541 return 0;
503542
....@@ -542,38 +581,6 @@
542581
543582 static int nk_io_control_resume(struct platform_device *pdev)
544583 {
545
- int ret,reset_pin;
546
- printk("nk_io resume !!!!\n");
547
- ret = gpio_get_value(120);
548
-
549
-#if 0
550
- gpio_set_value(8,1);
551
- ret = gpio_get_value(8);
552
- printk("vcc12v gpio value : %d\n",ret);
553
-#endif
554
-#if 0
555
- gpio_set_value(15,1);
556
- ret = gpio_get_value(15);
557
- printk("edp_en gpio value : %d\n",ret);
558
- gpio_set_value(21,1);
559
- ret = gpio_get_value(21);
560
- printk("hub_host3_5v_gpio value : %d\n",ret);
561
-#endif
562
-#if 0
563
- usleep_range(80000, 100000);
564
- gpio_set_value(120,0);
565
-// gpio_direction_output(120, 0);
566
- usleep_range(80000, 100000);
567
- ret = gpio_get_value(120);
568
- printk("edp_reset gpio value : %d\n",ret);
569
-// gpio_direction_output(120, 1);
570
- gpio_set_value(120,1);
571
- usleep_range(80000, 100000);
572
- ret = gpio_get_value(120);
573
- printk("edp_reset gpio value : %d\n",ret);
574
-#endif
575
- //enable = 1;
576
- //LED_SET(11);
577584 return 0;
578585 }
579586