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) {
....@@ -138,27 +135,6 @@
138135 }
139136 }
140137
141
-
142
- //usb_en_oc_gpio
143
- ret = of_get_named_gpio_flags(node, "usb_en_oc_gpio", 0, &flags);
144
- if (ret < 0) {
145
- printk("%s() Can not read property usb_en_oc_gpio\n", __FUNCTION__);
146
- goto err;
147
- } else {
148
- pdata->usb_en_oc_gpio = ret;
149
- gpio_free(ret);
150
- ret = devm_gpio_request(&pdev->dev, pdata->usb_en_oc_gpio, "usb_en_oc_gpio");
151
- if (ret < 0){
152
- printk("%s() devm_gpio_request usb_en_oc_gpio request ERROR\n", __FUNCTION__);
153
- goto err;
154
- }
155
-
156
- ret = gpio_direction_output(pdata->usb_en_oc_gpio,1);
157
- if(ret < 0){
158
- printk("%s() gpio_direction_input usb_en_oc_gpio set ERROR\n", __FUNCTION__);
159
- goto err;
160
- }
161
- }
162138
163139 //hub_host2_5V_rest_gpio
164140 ret = of_get_named_gpio_flags(node, "hub_host2_5V_rest_gpio", 0, &flags);
....@@ -262,13 +238,13 @@
262238 if(ret < 0){
263239 printk("%s() devm_gpio_request reset_4g_gpio request ERROR\n", __FUNCTION__);
264240 }
265
- ret = gpio_direction_output(pdata->reset_4g_gpio,0);
241
+ ret = gpio_direction_output(pdata->reset_4g_gpio,1);
266242 if(ret < 0){
267243 printk("%s() gpio_direction_input reset_4g_gpio set ERROR\n", __FUNCTION__);
268244 goto err;
269245 }
270246 msleep(800);
271
- ret = gpio_direction_output(pdata->reset_4g_gpio,1);
247
+ ret = gpio_direction_output(pdata->reset_4g_gpio,0);
272248 if(ret < 0){
273249 printk("%s() gpio_direction_input reset_4g_gpio set ERROR\n", __FUNCTION__);
274250
....@@ -292,7 +268,75 @@
292268 }
293269 }
294270
271
+ //hp_en_gpio
272
+ ret = of_get_named_gpio_flags(node, "hp_en_gpio", 0, &flags);
273
+ if (ret < 0) {
274
+ printk("%s() Can not read property hp_en_gpio\n", __FUNCTION__);
275
+ } else {
276
+ pdata->hp_en_gpio = ret;
295277
278
+ ret = devm_gpio_request(&pdev->dev, pdata->hp_en_gpio, "hp_en_gpio");
279
+ if(ret < 0){
280
+ printk("%s() devm_gpio_request hp_en_gpio request ERROR\n", __FUNCTION__);
281
+ }
282
+ ret = gpio_direction_output(pdata->hp_en_gpio,1);
283
+ if(ret < 0){
284
+ printk("%s() gpio_direction_output hp_en_gpio set ERROR\n", __FUNCTION__);
285
+ }
286
+ }
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
305
+ //wifi_power_en_gpio
306
+ ret = of_get_named_gpio_flags(node, "wifi_power_en_gpio", 0, &flags);
307
+ if (ret < 0) {
308
+ printk("%s() Can not read property wifi_power_en_gpio\n", __FUNCTION__);
309
+ } else {
310
+ pdata->wifi_power_en_gpio = ret;
311
+
312
+ ret = devm_gpio_request(&pdev->dev, pdata->wifi_power_en_gpio, "wifi_power_en_gpio");
313
+ if(ret < 0){
314
+ printk("%s() devm_gpio_request wifi_power_en_gpio request ERROR\n", __FUNCTION__);
315
+ }
316
+ ret = gpio_direction_output(pdata->wifi_power_en_gpio,1);
317
+ if(ret < 0){
318
+ printk("%s() gpio_direction_output wifi_power_en_gpio set ERROR\n", __FUNCTION__);
319
+ }
320
+ }
321
+
322
+/*
323
+ //spk_out_gpio
324
+ ret = of_get_named_gpio_flags(node, "spk_out_gpio", 0, &flags);
325
+ if (ret < 0) {
326
+ printk("%s() Can not read property spk_out_gpio\n", __FUNCTION__);
327
+ } else {
328
+ pdata->spk_out_gpio = ret;
329
+
330
+ ret = devm_gpio_request(&pdev->dev, pdata->spk_out_gpio, "spk_out_gpio");
331
+ if(ret < 0){
332
+ printk("%s() devm_gpio_request spk_out_gpio request ERROR\n", __FUNCTION__);
333
+ }
334
+ ret = gpio_direction_output(pdata->spk_out_gpio,0);
335
+ if(ret < 0){
336
+ printk("%s() gpio_direction_output spk_out_gpio set ERROR\n", __FUNCTION__);
337
+ }
338
+ }
339
+*/
296340 //air_mode_4g_gpio
297341 ret = of_get_named_gpio_flags(node, "air_mode_4g_gpio", 0, &flags);
298342 if (ret < 0) {
....@@ -348,24 +392,42 @@
348392 }
349393 }
350394
351
- //ch342_enable-gpio;
352
- 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);
353397 if (ret < 0) {
354
- printk("%s() Can not read property ch342_gpio\n", __FUNCTION__);
398
+ printk("%s() Can not read property lcd_bk_en_gpio\n", __FUNCTION__);
355399 } else {
356
- pdata->ch342_power = ret;
400
+ pdata->lcd_bk_en_gpio = ret;
357401
358
- 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");
359403 if(ret < 0){
360
- 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__);
361405 }
362406
363
- ret = gpio_direction_output(pdata->ch342_power,1);
407
+ ret = gpio_direction_output(pdata->lcd_bk_en_gpio,1);
364408 if(ret < 0){
365
- 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__);
366410 }
367411 }
368
-*/
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
+
369431
370432 //edp_set_pixel-s
371433 ret = of_get_named_gpio_flags(node, "edp_reset", 0, &flags);
....@@ -469,6 +531,12 @@
469531 gpio_direction_output(gpio2, lvds_gpio[2]);
470532 gpio_direction_output(gpio3, lvds_gpio[3]);
471533
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
+*/
472540 printk(" #######nk_io_control_probe end####### \n");
473541 return 0;
474542
....@@ -513,38 +581,6 @@
513581
514582 static int nk_io_control_resume(struct platform_device *pdev)
515583 {
516
- int ret,reset_pin;
517
- printk("nk_io resume !!!!\n");
518
- ret = gpio_get_value(120);
519
-
520
-#if 0
521
- gpio_set_value(8,1);
522
- ret = gpio_get_value(8);
523
- printk("vcc12v gpio value : %d\n",ret);
524
-#endif
525
-#if 0
526
- gpio_set_value(15,1);
527
- ret = gpio_get_value(15);
528
- printk("edp_en gpio value : %d\n",ret);
529
- gpio_set_value(21,1);
530
- ret = gpio_get_value(21);
531
- printk("hub_host3_5v_gpio value : %d\n",ret);
532
-#endif
533
-#if 0
534
- usleep_range(80000, 100000);
535
- gpio_set_value(120,0);
536
-// gpio_direction_output(120, 0);
537
- usleep_range(80000, 100000);
538
- ret = gpio_get_value(120);
539
- printk("edp_reset gpio value : %d\n",ret);
540
-// gpio_direction_output(120, 1);
541
- gpio_set_value(120,1);
542
- usleep_range(80000, 100000);
543
- ret = gpio_get_value(120);
544
- printk("edp_reset gpio value : %d\n",ret);
545
-#endif
546
- //enable = 1;
547
- //LED_SET(11);
548584 return 0;
549585 }
550586