mirror of
https://e.coding.net/weidongshan/linux/doc_and_source_for_drivers.git
synced 2025-12-02 04:41:19 +08:00
完结 07_GPIO
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
|
||||
# 1. 使用不同的开发板内核时, 一定要修改KERN_DIR
|
||||
# 2. KERN_DIR中的内核要事先配置、编译, 为了能编译内核, 要先设置下列环境变量:
|
||||
# 2.1 ARCH, 比如: export ARCH=arm64
|
||||
# 2.2 CROSS_COMPILE, 比如: export CROSS_COMPILE=aarch64-linux-gnu-
|
||||
# 2.3 PATH, 比如: export PATH=$PATH:/home/book/100ask_roc-rk3399-pc/ToolChain-6.3.1/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin
|
||||
# 注意: 不同的开发板不同的编译器上述3个环境变量不一定相同,
|
||||
# 请参考各开发板的高级用户使用手册
|
||||
|
||||
KERN_DIR = /home/book/100ask_imx6ull-sdk/Linux-4.9.88 # 板子所用内核源码的目录
|
||||
|
||||
all:
|
||||
make -C $(KERN_DIR) M=`pwd` modules
|
||||
$(CROSS_COMPILE)gcc -o ledtest ledtest.c
|
||||
|
||||
clean:
|
||||
make -C $(KERN_DIR) M=`pwd` modules clean
|
||||
rm -rf modules.order
|
||||
rm -f ledtest
|
||||
|
||||
# 参考内核源码drivers/char/ipmi/Makefile
|
||||
# 要想把a.c, b.c编译成ab.ko, 可以这样指定:
|
||||
# ab-y := a.o b.o
|
||||
# obj-m += ab.o
|
||||
|
||||
|
||||
|
||||
obj-m += leddrv.o
|
||||
|
||||
161
IMX6ULL/source/07_GPIO/04_gpio_use_pinctrl_ok/01_led/leddrv.c
Normal file
161
IMX6ULL/source/07_GPIO/04_gpio_use_pinctrl_ok/01_led/leddrv.c
Normal file
@@ -0,0 +1,161 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/major.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/stat.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/kmod.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/of.h>
|
||||
|
||||
|
||||
/* 1. 确定主设备号 */
|
||||
static int major = 0;
|
||||
static struct class *led_class;
|
||||
static struct gpio_desc *led_gpio;
|
||||
|
||||
|
||||
/* 3. 实现对应的open/read/write等函数,填入file_operations结构体 */
|
||||
static ssize_t led_drv_read (struct file *file, char __user *buf, size_t size, loff_t *offset)
|
||||
{
|
||||
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* write(fd, &val, 1); */
|
||||
static ssize_t led_drv_write (struct file *file, const char __user *buf, size_t size, loff_t *offset)
|
||||
{
|
||||
int err;
|
||||
char status;
|
||||
|
||||
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
err = copy_from_user(&status, buf, 1);
|
||||
|
||||
/* 根据次设备号和status控制LED */
|
||||
gpiod_set_value(led_gpio, status);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int led_drv_open (struct inode *node, struct file *file)
|
||||
{
|
||||
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
/* 根据次设备号初始化LED */
|
||||
gpiod_direction_output(led_gpio, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int led_drv_close (struct inode *node, struct file *file)
|
||||
{
|
||||
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 定义自己的file_operations结构体 */
|
||||
static struct file_operations led_drv = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = led_drv_open,
|
||||
.read = led_drv_read,
|
||||
.write = led_drv_write,
|
||||
.release = led_drv_close,
|
||||
};
|
||||
|
||||
/* 4. 从platform_device获得GPIO
|
||||
* 把file_operations结构体告诉内核:注册驱动程序
|
||||
*/
|
||||
static int chip_demo_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
|
||||
/* 4.1 设备树中定义有: led-gpios=<...>; */
|
||||
led_gpio = gpiod_get(&pdev->dev, "led", 0);
|
||||
if (IS_ERR(led_gpio)) {
|
||||
dev_err(&pdev->dev, "Failed to get GPIO for led\n");
|
||||
return PTR_ERR(led_gpio);
|
||||
}
|
||||
|
||||
/* 4.2 注册file_operations */
|
||||
major = register_chrdev(0, "100ask_led", &led_drv); /* /dev/led */
|
||||
|
||||
led_class = class_create(THIS_MODULE, "100ask_led_class");
|
||||
if (IS_ERR(led_class)) {
|
||||
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
unregister_chrdev(major, "led");
|
||||
gpiod_put(led_gpio);
|
||||
return PTR_ERR(led_class);
|
||||
}
|
||||
|
||||
device_create(led_class, NULL, MKDEV(major, 0), NULL, "100ask_led%d", 0); /* /dev/100ask_led0 */
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static int chip_demo_gpio_remove(struct platform_device *pdev)
|
||||
{
|
||||
device_destroy(led_class, MKDEV(major, 0));
|
||||
class_destroy(led_class);
|
||||
unregister_chrdev(major, "100ask_led");
|
||||
gpiod_put(led_gpio);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static const struct of_device_id ask100_leds[] = {
|
||||
{ .compatible = "100ask,leddrv" },
|
||||
{ },
|
||||
};
|
||||
|
||||
/* 1. 定义platform_driver */
|
||||
static struct platform_driver chip_demo_gpio_driver = {
|
||||
.probe = chip_demo_gpio_probe,
|
||||
.remove = chip_demo_gpio_remove,
|
||||
.driver = {
|
||||
.name = "100ask_led",
|
||||
.of_match_table = ask100_leds,
|
||||
},
|
||||
};
|
||||
|
||||
/* 2. 在入口函数注册platform_driver */
|
||||
static int __init led_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
|
||||
err = platform_driver_register(&chip_demo_gpio_driver);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/* 3. 有入口函数就应该有出口函数:卸载驱动程序时,就会去调用这个出口函数
|
||||
* 卸载platform_driver
|
||||
*/
|
||||
static void __exit led_exit(void)
|
||||
{
|
||||
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
|
||||
platform_driver_unregister(&chip_demo_gpio_driver);
|
||||
}
|
||||
|
||||
|
||||
/* 7. 其他完善:提供设备信息,自动创建设备节点 */
|
||||
|
||||
module_init(led_init);
|
||||
module_exit(led_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/major.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/stat.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/kmod.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
|
||||
|
||||
/* 1. 确定主设备号 */
|
||||
static int major = 0;
|
||||
static struct class *led_class;
|
||||
static struct gpio_desc *led_gpio;
|
||||
|
||||
|
||||
/* 3. 实现对应的open/read/write等函数,填入file_operations结构体 */
|
||||
static ssize_t led_drv_read (struct file *file, char __user *buf, size_t size, loff_t *offset)
|
||||
{
|
||||
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* write(fd, &val, 1); */
|
||||
static ssize_t led_drv_write (struct file *file, const char __user *buf, size_t size, loff_t *offset)
|
||||
{
|
||||
int err;
|
||||
char status;
|
||||
struct inode *inode = file_inode(file);
|
||||
int minor = iminor(inode);
|
||||
|
||||
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
err = copy_from_user(&status, buf, 1);
|
||||
|
||||
/* 根据次设备号和status控制LED */
|
||||
gpiod_set_value(led_gpio, status);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int led_drv_open (struct inode *node, struct file *file)
|
||||
{
|
||||
int minor = iminor(node);
|
||||
|
||||
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
/* 根据次设备号初始化LED */
|
||||
gpiod_direction_output(led_gpio, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int led_drv_close (struct inode *node, struct file *file)
|
||||
{
|
||||
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 定义自己的file_operations结构体 */
|
||||
static struct file_operations led_drv = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = led_drv_open,
|
||||
.read = led_drv_read,
|
||||
.write = led_drv_write,
|
||||
.release = led_drv_close,
|
||||
};
|
||||
|
||||
/* 4. 从platform_device获得GPIO
|
||||
* 把file_operations结构体告诉内核:注册驱动程序
|
||||
*/
|
||||
static int chip_demo_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
int err;
|
||||
|
||||
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
|
||||
/* 4.1 设备树中定义有: led-gpios=<...>; */
|
||||
led_gpio = gpiod_get(&pdev->dev, "led", 0);
|
||||
if (IS_ERR(led_gpio)) {
|
||||
dev_err(&pdev->dev, "Failed to get GPIO for led\n");
|
||||
return PTR_ERR(led_gpio);
|
||||
}
|
||||
|
||||
/* 4.2 注册file_operations */
|
||||
major = register_chrdev(0, "100ask_led", &led_drv); /* /dev/led */
|
||||
|
||||
led_class = class_create(THIS_MODULE, "100ask_led_class");
|
||||
if (IS_ERR(led_class)) {
|
||||
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
unregister_chrdev(major, "led");
|
||||
gpiod_free(led_gpio);
|
||||
return PTR_ERR(led_class);
|
||||
}
|
||||
|
||||
device_create(led_class, NULL, MKDEV(major, 0), NULL, "100ask_led%d", 0); /* /dev/100ask_led0 */
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static int chip_demo_gpio_remove(struct platform_device *pdev)
|
||||
{
|
||||
device_destroy(led_class, MKDEV(major, 0));
|
||||
class_destroy(led_class);
|
||||
unregister_chrdev(major, "100ask_led");
|
||||
gpiod_free(led_gpio);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static const struct of_device_id ask100_leds[] = {
|
||||
{ .compatible = "100ask,leddrv" },
|
||||
{ },
|
||||
};
|
||||
|
||||
/* 1. 定义platform_driver */
|
||||
static struct platform_driver chip_demo_gpio_driver = {
|
||||
.probe = chip_demo_gpio_probe,
|
||||
.remove = chip_demo_gpio_remove,
|
||||
.driver = {
|
||||
.name = "100ask_led",
|
||||
.of_match_table = ask100_leds,
|
||||
},
|
||||
};
|
||||
|
||||
/* 2. 在入口函数注册platform_driver */
|
||||
static int __init led_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
|
||||
err = platform_driver_register(&chip_demo_gpio_driver);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/* 3. 有入口函数就应该有出口函数:卸载驱动程序时,就会去调用这个出口函数
|
||||
* 卸载platform_driver
|
||||
*/
|
||||
static void __exit led_exit(void)
|
||||
{
|
||||
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
|
||||
platform_driver_unregister(&chip_demo_gpio_driver);
|
||||
}
|
||||
|
||||
|
||||
/* 7. 其他完善:提供设备信息,自动创建设备节点 */
|
||||
|
||||
module_init(led_init);
|
||||
module_exit(led_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* ./ledtest /dev/100ask_led0 on
|
||||
* ./ledtest /dev/100ask_led0 off
|
||||
*/
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int fd;
|
||||
char status;
|
||||
|
||||
/* 1. 判断参数 */
|
||||
if (argc != 3)
|
||||
{
|
||||
printf("Usage: %s <dev> <on | off>\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* 2. 打开文件 */
|
||||
fd = open(argv[1], O_RDWR);
|
||||
if (fd == -1)
|
||||
{
|
||||
printf("can not open file %s\n", argv[1]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* 3. 写文件 */
|
||||
if (0 == strcmp(argv[2], "on"))
|
||||
{
|
||||
status = 1;
|
||||
write(fd, &status, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = 0;
|
||||
write(fd, &status, 1);
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
# 1. 使用不同的开发板内核时, 一定要修改KERN_DIR
|
||||
# 2. KERN_DIR中的内核要事先配置、编译, 为了能编译内核, 要先设置下列环境变量:
|
||||
# 2.1 ARCH, 比如: export ARCH=arm64
|
||||
# 2.2 CROSS_COMPILE, 比如: export CROSS_COMPILE=aarch64-linux-gnu-
|
||||
# 2.3 PATH, 比如: export PATH=$PATH:/home/book/100ask_roc-rk3399-pc/ToolChain-6.3.1/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin
|
||||
# 注意: 不同的开发板不同的编译器上述3个环境变量不一定相同,
|
||||
# 请参考各开发板的高级用户使用手册
|
||||
|
||||
KERN_DIR = /home/book/100ask_imx6ull-sdk/Linux-4.9.88
|
||||
|
||||
all:
|
||||
make -C $(KERN_DIR) M=`pwd` modules
|
||||
|
||||
clean:
|
||||
make -C $(KERN_DIR) M=`pwd` modules clean
|
||||
rm -rf modules.order
|
||||
|
||||
obj-m += virtual_pinctrl_driver.o
|
||||
obj-m += virtual_pinctrl_client.o
|
||||
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
* Core private header for the pin control subsystem
|
||||
*
|
||||
* Copyright (C) 2011 ST-Ericsson SA
|
||||
* Written on behalf of Linaro for ST-Ericsson
|
||||
*
|
||||
* Author: Linus Walleij <linus.walleij@linaro.org>
|
||||
*
|
||||
* License terms: GNU General Public License (GPL) version 2
|
||||
*/
|
||||
|
||||
#include <linux/kref.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/radix-tree.h>
|
||||
#include <linux/pinctrl/pinconf.h>
|
||||
#include <linux/pinctrl/machine.h>
|
||||
|
||||
struct pinctrl_gpio_range;
|
||||
|
||||
/**
|
||||
* struct pinctrl_dev - pin control class device
|
||||
* @node: node to include this pin controller in the global pin controller list
|
||||
* @desc: the pin controller descriptor supplied when initializing this pin
|
||||
* controller
|
||||
* @pin_desc_tree: each pin descriptor for this pin controller is stored in
|
||||
* this radix tree
|
||||
* @gpio_ranges: a list of GPIO ranges that is handled by this pin controller,
|
||||
* ranges are added to this list at runtime
|
||||
* @dev: the device entry for this pin controller
|
||||
* @owner: module providing the pin controller, used for refcounting
|
||||
* @driver_data: driver data for drivers registering to the pin controller
|
||||
* subsystem
|
||||
* @p: result of pinctrl_get() for this device
|
||||
* @hog_default: default state for pins hogged by this device
|
||||
* @hog_sleep: sleep state for pins hogged by this device
|
||||
* @mutex: mutex taken on each pin controller specific action
|
||||
* @device_root: debugfs root for this device
|
||||
*/
|
||||
struct pinctrl_dev {
|
||||
struct list_head node;
|
||||
struct pinctrl_desc *desc;
|
||||
struct radix_tree_root pin_desc_tree;
|
||||
struct list_head gpio_ranges;
|
||||
struct device *dev;
|
||||
struct module *owner;
|
||||
void *driver_data;
|
||||
struct pinctrl *p;
|
||||
struct pinctrl_state *hog_default;
|
||||
struct pinctrl_state *hog_sleep;
|
||||
struct mutex mutex;
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct dentry *device_root;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* struct pinctrl - per-device pin control state holder
|
||||
* @node: global list node
|
||||
* @dev: the device using this pin control handle
|
||||
* @states: a list of states for this device
|
||||
* @state: the current state
|
||||
* @dt_maps: the mapping table chunks dynamically parsed from device tree for
|
||||
* this device, if any
|
||||
* @users: reference count
|
||||
*/
|
||||
struct pinctrl {
|
||||
struct list_head node;
|
||||
struct device *dev;
|
||||
struct list_head states;
|
||||
struct pinctrl_state *state;
|
||||
struct list_head dt_maps;
|
||||
struct kref users;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct pinctrl_state - a pinctrl state for a device
|
||||
* @node: list node for struct pinctrl's @states field
|
||||
* @name: the name of this state
|
||||
* @settings: a list of settings for this state
|
||||
*/
|
||||
struct pinctrl_state {
|
||||
struct list_head node;
|
||||
const char *name;
|
||||
struct list_head settings;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct pinctrl_setting_mux - setting data for MAP_TYPE_MUX_GROUP
|
||||
* @group: the group selector to program
|
||||
* @func: the function selector to program
|
||||
*/
|
||||
struct pinctrl_setting_mux {
|
||||
unsigned group;
|
||||
unsigned func;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct pinctrl_setting_configs - setting data for MAP_TYPE_CONFIGS_*
|
||||
* @group_or_pin: the group selector or pin ID to program
|
||||
* @configs: a pointer to an array of config parameters/values to program into
|
||||
* hardware. Each individual pin controller defines the format and meaning
|
||||
* of config parameters.
|
||||
* @num_configs: the number of entries in array @configs
|
||||
*/
|
||||
struct pinctrl_setting_configs {
|
||||
unsigned group_or_pin;
|
||||
unsigned long *configs;
|
||||
unsigned num_configs;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct pinctrl_setting - an individual mux or config setting
|
||||
* @node: list node for struct pinctrl_settings's @settings field
|
||||
* @type: the type of setting
|
||||
* @pctldev: pin control device handling to be programmed. Not used for
|
||||
* PIN_MAP_TYPE_DUMMY_STATE.
|
||||
* @dev_name: the name of the device using this state
|
||||
* @data: Data specific to the setting type
|
||||
*/
|
||||
struct pinctrl_setting {
|
||||
struct list_head node;
|
||||
enum pinctrl_map_type type;
|
||||
struct pinctrl_dev *pctldev;
|
||||
const char *dev_name;
|
||||
union {
|
||||
struct pinctrl_setting_mux mux;
|
||||
struct pinctrl_setting_configs configs;
|
||||
} data;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct pin_desc - pin descriptor for each physical pin in the arch
|
||||
* @pctldev: corresponding pin control device
|
||||
* @name: a name for the pin, e.g. the name of the pin/pad/finger on a
|
||||
* datasheet or such
|
||||
* @dynamic_name: if the name of this pin was dynamically allocated
|
||||
* @drv_data: driver-defined per-pin data. pinctrl core does not touch this
|
||||
* @mux_usecount: If zero, the pin is not claimed, and @owner should be NULL.
|
||||
* If non-zero, this pin is claimed by @owner. This field is an integer
|
||||
* rather than a boolean, since pinctrl_get() might process multiple
|
||||
* mapping table entries that refer to, and hence claim, the same group
|
||||
* or pin, and each of these will increment the @usecount.
|
||||
* @mux_owner: The name of device that called pinctrl_get().
|
||||
* @mux_setting: The most recent selected mux setting for this pin, if any.
|
||||
* @gpio_owner: If pinctrl_request_gpio() was called for this pin, this is
|
||||
* the name of the GPIO that "owns" this pin.
|
||||
*/
|
||||
struct pin_desc {
|
||||
struct pinctrl_dev *pctldev;
|
||||
const char *name;
|
||||
bool dynamic_name;
|
||||
void *drv_data;
|
||||
/* These fields only added when supporting pinmux drivers */
|
||||
#ifdef CONFIG_PINMUX
|
||||
unsigned mux_usecount;
|
||||
const char *mux_owner;
|
||||
const struct pinctrl_setting_mux *mux_setting;
|
||||
const char *gpio_owner;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* struct pinctrl_maps - a list item containing part of the mapping table
|
||||
* @node: mapping table list node
|
||||
* @maps: array of mapping table entries
|
||||
* @num_maps: the number of entries in @maps
|
||||
*/
|
||||
struct pinctrl_maps {
|
||||
struct list_head node;
|
||||
struct pinctrl_map const *maps;
|
||||
unsigned num_maps;
|
||||
};
|
||||
|
||||
struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name);
|
||||
struct pinctrl_dev *get_pinctrl_dev_from_of_node(struct device_node *np);
|
||||
int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name);
|
||||
const char *pin_get_name(struct pinctrl_dev *pctldev, const unsigned pin);
|
||||
int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
|
||||
const char *pin_group);
|
||||
|
||||
static inline struct pin_desc *pin_desc_get(struct pinctrl_dev *pctldev,
|
||||
unsigned int pin)
|
||||
{
|
||||
return radix_tree_lookup(&pctldev->pin_desc_tree, pin);
|
||||
}
|
||||
|
||||
extern struct pinctrl_gpio_range *
|
||||
pinctrl_find_gpio_range_from_pin_nolock(struct pinctrl_dev *pctldev,
|
||||
unsigned int pin);
|
||||
|
||||
int pinctrl_register_map(struct pinctrl_map const *maps, unsigned num_maps,
|
||||
bool dup);
|
||||
void pinctrl_unregister_map(struct pinctrl_map const *map);
|
||||
|
||||
extern int pinctrl_force_sleep(struct pinctrl_dev *pctldev);
|
||||
extern int pinctrl_force_default(struct pinctrl_dev *pctldev);
|
||||
|
||||
extern struct mutex pinctrl_maps_mutex;
|
||||
extern struct list_head pinctrl_maps;
|
||||
|
||||
#define for_each_maps(_maps_node_, _i_, _map_) \
|
||||
list_for_each_entry(_maps_node_, &pinctrl_maps, node) \
|
||||
for (_i_ = 0, _map_ = &_maps_node_->maps[_i_]; \
|
||||
_i_ < _maps_node_->num_maps; \
|
||||
_i_++, _map_ = &_maps_node_->maps[_i_])
|
||||
@@ -0,0 +1,67 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/pinctrl/machine.h>
|
||||
#include <linux/pinctrl/pinconf.h>
|
||||
#include <linux/pinctrl/pinctrl.h>
|
||||
#include <linux/pinctrl/pinmux.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
static const struct of_device_id virtual_client_of_match[] = {
|
||||
{ .compatible = "100ask,virtual_i2c", },
|
||||
{ },
|
||||
};
|
||||
|
||||
static int virtual_client_probe(struct platform_device *pdev)
|
||||
{
|
||||
printk("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
return 0;
|
||||
}
|
||||
static int virtual_client_remove(struct platform_device *pdev)
|
||||
{
|
||||
|
||||
printk("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static struct platform_driver virtual_client_driver = {
|
||||
.probe = virtual_client_probe,
|
||||
.remove = virtual_client_remove,
|
||||
.driver = {
|
||||
.name = "100ask_virtual_client",
|
||||
.of_match_table = of_match_ptr(virtual_client_of_match),
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* 1. 入口函数 */
|
||||
static int __init virtual_client_init(void)
|
||||
{
|
||||
printk("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
/* 1.1 注册一个platform_driver */
|
||||
return platform_driver_register(&virtual_client_driver);
|
||||
}
|
||||
|
||||
|
||||
/* 2. 出口函数 */
|
||||
static void __exit virtual_client_exit(void)
|
||||
{
|
||||
printk("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
/* 2.1 反注册platform_driver */
|
||||
platform_driver_unregister(&virtual_client_driver);
|
||||
}
|
||||
|
||||
module_init(virtual_client_init);
|
||||
module_exit(virtual_client_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,329 @@
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/pinctrl/machine.h>
|
||||
#include <linux/pinctrl/pinconf.h>
|
||||
#include <linux/pinctrl/pinctrl.h>
|
||||
#include <linux/pinctrl/pinmux.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
#include "core.h"
|
||||
|
||||
|
||||
static struct pinctrl_dev *g_pinctrl_dev;
|
||||
|
||||
static const struct pinctrl_pin_desc pins[] = {
|
||||
{0, "pin0", NULL},
|
||||
{1, "pin1", NULL},
|
||||
{2, "pin2", NULL},
|
||||
{3, "pin3", NULL},
|
||||
};
|
||||
|
||||
static unsigned long g_configs[4];
|
||||
|
||||
struct virtual_functions_desc {
|
||||
const char *func_name;
|
||||
const char **groups;
|
||||
int num_groups;
|
||||
};
|
||||
|
||||
|
||||
static const char *func0_grps[] = {"pin0", "pin1", "pin2", "pin3"};
|
||||
static const char *func1_grps[] = {"pin0", "pin1"};
|
||||
static const char *func2_grps[] = {"pin2", "pin3"};
|
||||
|
||||
static struct virtual_functions_desc g_funcs_des[] = {
|
||||
{"gpio", func0_grps, 4},
|
||||
{"i2c", func1_grps, 2},
|
||||
{"uart", func2_grps, 2},
|
||||
};
|
||||
|
||||
|
||||
static const struct of_device_id virtual_pinctrl_of_match[] = {
|
||||
{ .compatible = "100ask,virtual_pinctrl", },
|
||||
{ },
|
||||
};
|
||||
|
||||
static int virtual_get_groups_count(struct pinctrl_dev *pctldev)
|
||||
{
|
||||
return pctldev->desc->npins;
|
||||
}
|
||||
|
||||
static const char *virtual_get_group_name(struct pinctrl_dev *pctldev,
|
||||
unsigned selector)
|
||||
{
|
||||
return pctldev->desc->pins[selector].name;
|
||||
}
|
||||
|
||||
static int virtual_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector,
|
||||
const unsigned **pins,
|
||||
unsigned *npins)
|
||||
{
|
||||
if (selector >= pctldev->desc->npins)
|
||||
return -EINVAL;
|
||||
|
||||
*pins = &pctldev->desc->pins[selector].number;
|
||||
*npins = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void virtual_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
|
||||
unsigned offset)
|
||||
{
|
||||
seq_printf(s, "%s", dev_name(pctldev->dev));
|
||||
}
|
||||
|
||||
/*
|
||||
i2cgrp {
|
||||
functions = "i2c", "i2c";
|
||||
groups = "pin0", "pin1";
|
||||
configs = <0x11223344 0x55667788>;
|
||||
};
|
||||
|
||||
one pin ==> two pinctrl_map (one for mux, one for config)
|
||||
|
||||
*/
|
||||
static int virtual_dt_node_to_map(struct pinctrl_dev *pctldev,
|
||||
struct device_node *np,
|
||||
struct pinctrl_map **map, unsigned *num_maps)
|
||||
{
|
||||
int i;
|
||||
int num_pins = 0;
|
||||
const char *pin;
|
||||
const char *function;
|
||||
unsigned int config;
|
||||
struct pinctrl_map *new_map;
|
||||
unsigned long *configs;
|
||||
|
||||
/* 1. 确定pin个数/分配pinctrl_map */
|
||||
while (1)
|
||||
{
|
||||
if (of_property_read_string_index(np, "groups", num_pins, &pin) == 0)
|
||||
num_pins++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
new_map = kmalloc(sizeof(struct pinctrl_map) * num_pins * 2, GFP_KERNEL);
|
||||
|
||||
|
||||
for (i = 0; i < num_pins; i++)
|
||||
{
|
||||
/* 2. get pin/function/config */
|
||||
of_property_read_string_index(np, "groups", i, &pin);
|
||||
of_property_read_string_index(np, "functions", i, &function);
|
||||
of_property_read_u32_index(np, "configs", i, &config);
|
||||
|
||||
|
||||
/* 3. 存入pinctrl_map */
|
||||
configs = kmalloc(sizeof(*configs), GFP_KERNEL);
|
||||
|
||||
new_map[i*2].type = PIN_MAP_TYPE_MUX_GROUP;
|
||||
new_map[i*2].data.mux.function = function;
|
||||
new_map[i*2].data.mux.group = pin;
|
||||
|
||||
new_map[i*2+1].type = PIN_MAP_TYPE_CONFIGS_PIN;
|
||||
new_map[i*2+1].data.configs.group_or_pin = pin;
|
||||
new_map[i*2+1].data.configs.configs = configs;
|
||||
configs[0] = config;
|
||||
new_map[i*2+1].data.configs.num_configs = 1;
|
||||
|
||||
}
|
||||
|
||||
*map = new_map;
|
||||
*num_maps = num_pins * 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
static void virtual_dt_free_map(struct pinctrl_dev *pctldev,
|
||||
struct pinctrl_map *map, unsigned num_maps)
|
||||
{
|
||||
while (num_maps--)
|
||||
{
|
||||
if (map->type == PIN_MAP_TYPE_CONFIGS_PIN)
|
||||
kfree(map->data.configs.configs);
|
||||
|
||||
kfree(map);
|
||||
map++;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct pinctrl_ops virtual_pctrl_ops = {
|
||||
.get_groups_count = virtual_get_groups_count,
|
||||
.get_group_name = virtual_get_group_name,
|
||||
.get_group_pins = virtual_get_group_pins,
|
||||
.pin_dbg_show = virtual_pin_dbg_show,
|
||||
.dt_node_to_map = virtual_dt_node_to_map,
|
||||
.dt_free_map = virtual_dt_free_map,
|
||||
|
||||
};
|
||||
|
||||
static int virtual_pmx_get_funcs_count(struct pinctrl_dev *pctldev)
|
||||
{
|
||||
return ARRAY_SIZE(g_funcs_des);
|
||||
}
|
||||
|
||||
static const char *virtual_pmx_get_func_name(struct pinctrl_dev *pctldev,
|
||||
unsigned selector)
|
||||
{
|
||||
return g_funcs_des[selector].func_name;
|
||||
}
|
||||
|
||||
static int virtual_pmx_get_groups(struct pinctrl_dev *pctldev, unsigned selector,
|
||||
const char * const **groups,
|
||||
unsigned * const num_groups)
|
||||
{
|
||||
*groups = g_funcs_des[selector].groups;
|
||||
*num_groups = g_funcs_des[selector].num_groups;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int virtual_pmx_set(struct pinctrl_dev *pctldev, unsigned selector,
|
||||
unsigned group)
|
||||
{
|
||||
printk("set %s as %s\n", pctldev->desc->pins[group].name, g_funcs_des[selector].func_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int virtual_pmx_gpio_request_enable (struct pinctrl_dev *pctldev,
|
||||
struct pinctrl_gpio_range *range,
|
||||
unsigned offset)
|
||||
{
|
||||
printk("set and enable pin %s as GPIO\n", pctldev->desc->pins[offset].name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static const struct pinmux_ops virtual_pmx_ops = {
|
||||
.get_functions_count = virtual_pmx_get_funcs_count,
|
||||
.get_function_name = virtual_pmx_get_func_name,
|
||||
.get_function_groups = virtual_pmx_get_groups,
|
||||
.set_mux = virtual_pmx_set,
|
||||
.gpio_request_enable = virtual_pmx_gpio_request_enable,
|
||||
};
|
||||
|
||||
|
||||
static int virtual_pinconf_get(struct pinctrl_dev *pctldev,
|
||||
unsigned pin_id, unsigned long *config)
|
||||
{
|
||||
*config = g_configs[pin_id];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int virtual_pinconf_set(struct pinctrl_dev *pctldev,
|
||||
unsigned pin_id, unsigned long *configs,
|
||||
unsigned num_configs)
|
||||
{
|
||||
if (num_configs != 1)
|
||||
return -EINVAL;
|
||||
|
||||
g_configs[pin_id] = *configs;
|
||||
|
||||
printk("config %s as 0x%lx\n", pctldev->desc->pins[pin_id].name, *configs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void virtual_pinconf_dbg_show(struct pinctrl_dev *pctldev,
|
||||
struct seq_file *s, unsigned pin_id)
|
||||
{
|
||||
seq_printf(s, "0x%lx", g_configs[pin_id]);
|
||||
}
|
||||
|
||||
static void virtual_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
|
||||
struct seq_file *s, unsigned pin_id)
|
||||
{
|
||||
seq_printf(s, "0x%lx", g_configs[pin_id]);
|
||||
}
|
||||
|
||||
|
||||
static const struct pinconf_ops virtual_pinconf_ops = {
|
||||
.pin_config_get = virtual_pinconf_get,
|
||||
.pin_config_set = virtual_pinconf_set,
|
||||
.pin_config_dbg_show = virtual_pinconf_dbg_show,
|
||||
.pin_config_group_dbg_show = virtual_pinconf_group_dbg_show,
|
||||
};
|
||||
|
||||
|
||||
|
||||
static int virtual_pinctrl_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct pinctrl_desc *pictrl;
|
||||
|
||||
printk("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
|
||||
/* a. 分配pinctrl_desc */
|
||||
pictrl = devm_kzalloc(&pdev->dev, sizeof(*pictrl), GFP_KERNEL);
|
||||
|
||||
/* b. 设置pinctrl_desc */
|
||||
pictrl->name = dev_name(&pdev->dev);
|
||||
pictrl->owner = THIS_MODULE;
|
||||
|
||||
/* b.1 pins and group */
|
||||
pictrl->pins = pins;
|
||||
pictrl->npins = ARRAY_SIZE(pins);
|
||||
|
||||
pictrl->pctlops = &virtual_pctrl_ops;
|
||||
|
||||
/* b.2 pin mux */
|
||||
pictrl->pmxops = &virtual_pmx_ops;
|
||||
|
||||
/* b.3 pin config */
|
||||
pictrl->confops = &virtual_pinconf_ops;
|
||||
|
||||
/* c. 注册pinctrl_desc */
|
||||
g_pinctrl_dev = devm_pinctrl_register(&pdev->dev, pictrl, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
static int virtual_pinctrl_remove(struct platform_device *pdev)
|
||||
{
|
||||
|
||||
printk("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static struct platform_driver virtual_pinctrl_driver = {
|
||||
.probe = virtual_pinctrl_probe,
|
||||
.remove = virtual_pinctrl_remove,
|
||||
.driver = {
|
||||
.name = "100ask_virtual_pinctrl",
|
||||
.of_match_table = of_match_ptr(virtual_pinctrl_of_match),
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* 1. 入口函数 */
|
||||
static int __init virtual_pinctrl_init(void)
|
||||
{
|
||||
printk("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
/* 1.1 注册一个platform_driver */
|
||||
return platform_driver_register(&virtual_pinctrl_driver);
|
||||
}
|
||||
|
||||
|
||||
/* 2. 出口函数 */
|
||||
static void __exit virtual_pinctrl_exit(void)
|
||||
{
|
||||
printk("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
/* 2.1 反注册platform_driver */
|
||||
platform_driver_unregister(&virtual_pinctrl_driver);
|
||||
}
|
||||
|
||||
module_init(virtual_pinctrl_init);
|
||||
module_exit(virtual_pinctrl_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
# 1. 使用不同的开发板内核时, 一定要修改KERN_DIR
|
||||
# 2. KERN_DIR中的内核要事先配置、编译, 为了能编译内核, 要先设置下列环境变量:
|
||||
# 2.1 ARCH, 比如: export ARCH=arm64
|
||||
# 2.2 CROSS_COMPILE, 比如: export CROSS_COMPILE=aarch64-linux-gnu-
|
||||
# 2.3 PATH, 比如: export PATH=$PATH:/home/book/100ask_roc-rk3399-pc/ToolChain-6.3.1/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin
|
||||
# 注意: 不同的开发板不同的编译器上述3个环境变量不一定相同,
|
||||
# 请参考各开发板的高级用户使用手册
|
||||
|
||||
KERN_DIR = /home/book/100ask_imx6ull-sdk/Linux-4.9.88
|
||||
|
||||
all:
|
||||
make -C $(KERN_DIR) M=`pwd` modules
|
||||
|
||||
clean:
|
||||
make -C $(KERN_DIR) M=`pwd` modules clean
|
||||
rm -rf modules.order
|
||||
|
||||
obj-m += virtual_gpio_driver.o
|
||||
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/gpio/driver.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
static struct gpio_chip * g_virt_gpio;
|
||||
static int g_gpio_val = 0;
|
||||
|
||||
static const struct of_device_id virtual_gpio_of_match[] = {
|
||||
{ .compatible = "100ask,virtual_gpio", },
|
||||
{ },
|
||||
};
|
||||
|
||||
static int virt_gpio_direction_output(struct gpio_chip *gc,
|
||||
unsigned offset, int val)
|
||||
{
|
||||
printk("set pin %d as output %s\n", offset, val ? "high" : "low");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int virt_gpio_direction_input(struct gpio_chip *chip,
|
||||
unsigned offset)
|
||||
{
|
||||
printk("set pin %d as input\n", offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int virt_gpio_get_value(struct gpio_chip *gc, unsigned offset)
|
||||
{
|
||||
int val;
|
||||
val = (g_gpio_val & (1<<offset)) ? 1 : 0;
|
||||
printk("get pin %d, it's val = %d\n", offset, val);
|
||||
return val;
|
||||
}
|
||||
|
||||
static void virt_gpio_set_value(struct gpio_chip *gc,
|
||||
unsigned offset, int val)
|
||||
{
|
||||
printk("set pin %d as %d\n", offset, val);
|
||||
if (val)
|
||||
g_gpio_val |= (1 << offset);
|
||||
else
|
||||
g_gpio_val &= ~(1 << offset);
|
||||
}
|
||||
|
||||
static int virtual_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
int ret;
|
||||
unsigned int val;
|
||||
|
||||
printk("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
|
||||
/* 1. 分配gpio_chip */
|
||||
g_virt_gpio = devm_kzalloc(&pdev->dev, sizeof(*g_virt_gpio), GFP_KERNEL);
|
||||
|
||||
/* 2. 设置gpio_chip */
|
||||
|
||||
/* 2.1 设置函数 */
|
||||
g_virt_gpio->label = pdev->name;
|
||||
g_virt_gpio->direction_output = virt_gpio_direction_output;
|
||||
g_virt_gpio->direction_input = virt_gpio_direction_input;
|
||||
g_virt_gpio->get = virt_gpio_get_value;
|
||||
g_virt_gpio->set = virt_gpio_set_value;
|
||||
g_virt_gpio->request = gpiochip_generic_request;
|
||||
|
||||
g_virt_gpio->parent = &pdev->dev;
|
||||
g_virt_gpio->owner = THIS_MODULE;
|
||||
|
||||
/* 2.2 设置base、ngpio值 */
|
||||
g_virt_gpio->base = -1;
|
||||
ret = of_property_read_u32(pdev->dev.of_node, "ngpios", &val);
|
||||
g_virt_gpio->ngpio = val;
|
||||
|
||||
/* 3. 注册gpio_chip */
|
||||
ret = devm_gpiochip_add_data(&pdev->dev, g_virt_gpio, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
static int virtual_gpio_remove(struct platform_device *pdev)
|
||||
{
|
||||
printk("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static struct platform_driver virtual_gpio_driver = {
|
||||
.probe = virtual_gpio_probe,
|
||||
.remove = virtual_gpio_remove,
|
||||
.driver = {
|
||||
.name = "100ask_virtual_gpio",
|
||||
.of_match_table = of_match_ptr(virtual_gpio_of_match),
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* 1. 入口函数 */
|
||||
static int __init virtual_gpio_init(void)
|
||||
{
|
||||
printk("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
/* 1.1 注册一个platform_driver */
|
||||
return platform_driver_register(&virtual_gpio_driver);
|
||||
}
|
||||
|
||||
|
||||
/* 2. 出口函数 */
|
||||
static void __exit virtual_gpio_exit(void)
|
||||
{
|
||||
printk("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
/* 2.1 反注册platform_driver */
|
||||
platform_driver_unregister(&virtual_gpio_driver);
|
||||
}
|
||||
|
||||
module_init(virtual_gpio_init);
|
||||
module_exit(virtual_gpio_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user