| .. | .. |
|---|
| 13 | 13 | #include <linux/string.h>
|
|---|
| 14 | 14 | #include <linux/uaccess.h>
|
|---|
| 15 | 15 | #include <linux/device.h>
|
|---|
| 16 | +#include <linux/proc_fs.h>
|
|---|
| 16 | 17 |
|
|---|
| 17 | 18 | #define GPIO_FUNCTION_OUTPUT 0
|
|---|
| 18 | 19 | #define GPIO_FUNCTION_INPUT 1
|
|---|
| .. | .. |
|---|
| 20 | 21 | #define HIGH "1"
|
|---|
| 21 | 22 | #define LOW "0"
|
|---|
| 22 | 23 |
|
|---|
| 23 | | -static int flash_flag = 0;
|
|---|
| 24 | +//static int flash_flag = 0;
|
|---|
| 24 | 25 |
|
|---|
| 25 | 26 | struct ndj_gpio {
|
|---|
| 26 | 27 | int gpio_num; //gpio num
|
|---|
| .. | .. |
|---|
| 94 | 95 | };
|
|---|
| 95 | 96 |
|
|---|
| 96 | 97 | #endif
|
|---|
| 97 | | -static int event_flag = 0;
|
|---|
| 98 | +//static int event_flag = 0;
|
|---|
| 98 | 99 | static int open_now = 0;
|
|---|
| 99 | 100 | static char* file_name = NULL;
|
|---|
| 100 | 101 |
|
|---|
| .. | .. |
|---|
| 152 | 153 | }
|
|---|
| 153 | 154 |
|
|---|
| 154 | 155 |
|
|---|
| 155 | | -static const struct file_operations gpio_ops = {
|
|---|
| 156 | | - .owner = THIS_MODULE,
|
|---|
| 157 | | - .open = gpio_open,
|
|---|
| 158 | | - .write = gpio_write,
|
|---|
| 159 | | - .read = gpio_read,
|
|---|
| 156 | +static const struct proc_ops gpio_ops = {
|
|---|
| 157 | + .proc_open = gpio_open,
|
|---|
| 158 | + .proc_write = gpio_write,
|
|---|
| 159 | + .proc_read = gpio_read,
|
|---|
| 160 | 160 | };
|
|---|
| 161 | 161 |
|
|---|
| 162 | 162 | static int ndj_gpio_probe(struct platform_device *pdev) {
|
|---|
| 163 | 163 | struct device_node *np = pdev->dev.of_node;
|
|---|
| 164 | 164 | struct device_node *child_np;
|
|---|
| 165 | | - struct device *dev = &pdev->dev;
|
|---|
| 166 | 165 | static struct proc_dir_entry *root_entry_gpio;
|
|---|
| 167 | 166 | enum of_gpio_flags gpio_flags;
|
|---|
| 168 | 167 | int ret = 0;
|
|---|
| 169 | 168 | int gpio_cnt = 0;
|
|---|
| 170 | 169 | char gpio_name_num[20];
|
|---|
| 171 | 170 | int gpio_in_cnt = 0;
|
|---|
| 172 | | - int cnt =0;
|
|---|
| 173 | | - int i=0;
|
|---|
| 174 | | - enum of_gpio_flags flags;
|
|---|
| 175 | 171 |
|
|---|
| 176 | 172 | gpio_data = devm_kzalloc(&pdev->dev, sizeof(struct ndj_gpio_data),GFP_KERNEL);
|
|---|
| 177 | 173 | if (!gpio_data) {
|
|---|
| .. | .. |
|---|
| 286 | 282 |
|
|---|
| 287 | 283 | static int ndj_gpio_suspend(struct platform_device *pdev, pm_message_t state)
|
|---|
| 288 | 284 | {
|
|---|
| 289 | | - int ret;
|
|---|
| 290 | | - struct nk_io_pdata *pdata;
|
|---|
| 285 | +// int ret;
|
|---|
| 286 | +// struct nk_io_pdata *pdata;
|
|---|
| 291 | 287 | printk("nk_suspend !!!!\n");
|
|---|
| 292 | 288 | return 0;
|
|---|
| 293 | 289 | }
|
|---|
| 294 | 290 |
|
|---|
| 295 | 291 | static int ndj_gpio_resume(struct platform_device *pdev)
|
|---|
| 296 | 292 | {
|
|---|
| 297 | | - int ret,reset_pin;
|
|---|
| 293 | +// int ret,reset_pin;
|
|---|
| 298 | 294 | printk("nk_io resume !!!!\n");
|
|---|
| 299 | 295 | return 0;
|
|---|
| 300 | 296 | }
|
|---|
| .. | .. |
|---|
| 325 | 321 |
|
|---|
| 326 | 322 | module_platform_driver(ndj_gpio_driver);
|
|---|
| 327 | 323 | MODULE_LICENSE("GPL");
|
|---|
| 328 | | -MODULE_LICENSE("GPL"); |
|---|
| 324 | +MODULE_LICENSE("GPL");
|
|---|