hc
2023-02-15 812ded0d8d6800728c4c11abed7546d735449123
kernel/drivers/misc/nkio/nk_io_core.c
....@@ -42,29 +42,6 @@
4242 //static struct class *nk_class;
4343
4444
45
-void MODULE_SET(int i)
46
-{
47
- if(i==11){
48
- gpio_direction_output(NKpdata_info->en_4g_gpio, 1);
49
- }else{
50
- gpio_direction_output(NKpdata_info->en_4g_gpio, 0);
51
- }
52
-}
53
-
54
-EXPORT_SYMBOL_GPL(MODULE_SET);
55
-
56
-
57
-void LED_SET(int i)
58
-{
59
- if(i==11){
60
- gpio_direction_output(NKpdata_info->led_gpio, 1);
61
- }else{
62
- gpio_direction_output(NKpdata_info->led_gpio, 0);
63
- }
64
-}
65
-
66
-EXPORT_SYMBOL_GPL(LED_SET);
67
-
6845
6946 void Audio_SET(int i);
7047
....@@ -124,7 +101,7 @@
124101 //vcc3_io_en_gpio
125102 ret = of_get_named_gpio_flags(node, "vcc3_io_en_gpio", 0, &flags);
126103 if (ret < 0) {
127
- printk("%s() Can not read property tp_enable\n", __FUNCTION__);
104
+ printk("%s() Can not read property vcc3_io_en_gpio\n", __FUNCTION__);
128105 goto err;
129106 } else {
130107 pdata->vcc3_io_en_gpio = ret;
....@@ -161,49 +138,6 @@
161138 }
162139 }
163140
164
-
165
-
166
- //hub_host2_5v_gpio
167
- ret = of_get_named_gpio_flags(node, "hub_host2_5v_gpio", 0, &flags);
168
- if (ret < 0) {
169
- printk("%s() Can not read property hub_host2_5v_gpio\n", __FUNCTION__);
170
- goto err;
171
- } else {
172
- pdata->hub_host2_5v_gpio = ret;
173
- gpio_free(ret);
174
- ret = devm_gpio_request(&pdev->dev, pdata->hub_host2_5v_gpio, "hub_host2_5v_gpio");
175
- if (ret < 0){
176
- printk("%s() devm_gpio_request hub_host2_5v_gpio request ERROR\n", __FUNCTION__);
177
- goto err;
178
- }
179
-
180
- ret = gpio_direction_output(pdata->hub_host2_5v_gpio,1);
181
- if(ret < 0){
182
- printk("%s() gpio_direction_input hub_host2_5v_gpio set ERROR\n", __FUNCTION__);
183
- goto err;
184
- }
185
- }
186
-
187
- //usb_en_oc_gpio
188
- ret = of_get_named_gpio_flags(node, "usb_en_oc_gpio", 0, &flags);
189
- if (ret < 0) {
190
- printk("%s() Can not read property usb_en_oc_gpio\n", __FUNCTION__);
191
- goto err;
192
- } else {
193
- pdata->usb_en_oc_gpio = ret;
194
- gpio_free(ret);
195
- ret = devm_gpio_request(&pdev->dev, pdata->usb_en_oc_gpio, "usb_en_oc_gpio");
196
- if (ret < 0){
197
- printk("%s() devm_gpio_request usb_en_oc_gpio request ERROR\n", __FUNCTION__);
198
- goto err;
199
- }
200
-
201
- ret = gpio_direction_output(pdata->usb_en_oc_gpio,1);
202
- if(ret < 0){
203
- printk("%s() gpio_direction_input usb_en_oc_gpio set ERROR\n", __FUNCTION__);
204
- goto err;
205
- }
206
- }
207141
208142 //hub_host2_5V_rest_gpio
209143 ret = of_get_named_gpio_flags(node, "hub_host2_5V_rest_gpio", 0, &flags);
....@@ -310,7 +244,14 @@
310244 ret = gpio_direction_output(pdata->reset_4g_gpio,0);
311245 if(ret < 0){
312246 printk("%s() gpio_direction_input reset_4g_gpio set ERROR\n", __FUNCTION__);
247
+ goto err;
313248 }
249
+ msleep(800);
250
+ ret = gpio_direction_output(pdata->reset_4g_gpio,1);
251
+ if(ret < 0){
252
+ printk("%s() gpio_direction_input reset_4g_gpio set ERROR\n", __FUNCTION__);
253
+
254
+ }
314255 }
315256
316257 //en_4g_gpio
....@@ -326,11 +267,61 @@
326267 }
327268 ret = gpio_direction_output(pdata->en_4g_gpio,1);
328269 if(ret < 0){
329
- printk("%s() gpio_direction_input en_4g_gpio set ERROR\n", __FUNCTION__);
270
+ printk("%s() gpio_direction_output en_4g_gpio set ERROR\n", __FUNCTION__);
271
+ }
272
+ }
273
+
274
+ //hp_en_gpio
275
+ ret = of_get_named_gpio_flags(node, "hp_en_gpio", 0, &flags);
276
+ if (ret < 0) {
277
+ printk("%s() Can not read property hp_en_gpio\n", __FUNCTION__);
278
+ } else {
279
+ pdata->hp_en_gpio = ret;
280
+
281
+ ret = devm_gpio_request(&pdev->dev, pdata->hp_en_gpio, "hp_en_gpio");
282
+ if(ret < 0){
283
+ printk("%s() devm_gpio_request hp_en_gpio request ERROR\n", __FUNCTION__);
284
+ }
285
+ ret = gpio_direction_output(pdata->hp_en_gpio,1);
286
+ if(ret < 0){
287
+ printk("%s() gpio_direction_output hp_en_gpio set ERROR\n", __FUNCTION__);
288
+ }
289
+ }
290
+
291
+ //wifi_power_en_gpio
292
+ ret = of_get_named_gpio_flags(node, "wifi_power_en_gpio", 0, &flags);
293
+ if (ret < 0) {
294
+ printk("%s() Can not read property wifi_power_en_gpio\n", __FUNCTION__);
295
+ } else {
296
+ pdata->wifi_power_en_gpio = ret;
297
+
298
+ ret = devm_gpio_request(&pdev->dev, pdata->wifi_power_en_gpio, "wifi_power_en_gpio");
299
+ if(ret < 0){
300
+ printk("%s() devm_gpio_request wifi_power_en_gpio request ERROR\n", __FUNCTION__);
301
+ }
302
+ ret = gpio_direction_output(pdata->wifi_power_en_gpio,1);
303
+ if(ret < 0){
304
+ printk("%s() gpio_direction_output wifi_power_en_gpio set ERROR\n", __FUNCTION__);
330305 }
331306 }
332307
333308
309
+ //spk_out_gpio
310
+ ret = of_get_named_gpio_flags(node, "spk_out_gpio", 0, &flags);
311
+ if (ret < 0) {
312
+ printk("%s() Can not read property spk_out_gpio\n", __FUNCTION__);
313
+ } else {
314
+ pdata->spk_out_gpio = ret;
315
+
316
+ ret = devm_gpio_request(&pdev->dev, pdata->spk_out_gpio, "spk_out_gpio");
317
+ if(ret < 0){
318
+ printk("%s() devm_gpio_request spk_out_gpio request ERROR\n", __FUNCTION__);
319
+ }
320
+ ret = gpio_direction_output(pdata->spk_out_gpio,0);
321
+ if(ret < 0){
322
+ printk("%s() gpio_direction_output spk_out_gpio set ERROR\n", __FUNCTION__);
323
+ }
324
+ }
334325 //air_mode_4g_gpio
335326 ret = of_get_named_gpio_flags(node, "air_mode_4g_gpio", 0, &flags);
336327 if (ret < 0) {