1-Wire support 2nd try
This commit is contained in:
parent
efdb565873
commit
5bc0616544
@ -1,6 +1,6 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Linux/arm 3.4.40 Kernel Configuration
|
||||
# Linux/arm 3.4.110 Kernel Configuration
|
||||
#
|
||||
CONFIG_ARM=y
|
||||
CONFIG_ARM_HAS_SG_CHAIN=y
|
||||
@ -556,8 +556,7 @@ CONFIG_NEON=y
|
||||
CONFIG_BINFMT_ELF=y
|
||||
CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
|
||||
CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
|
||||
CONFIG_HAVE_AOUT=y
|
||||
# CONFIG_BINFMT_AOUT is not set
|
||||
# CONFIG_HAVE_AOUT is not set
|
||||
# CONFIG_BINFMT_MISC is not set
|
||||
|
||||
#
|
||||
@ -1196,6 +1195,7 @@ CONFIG_MD_RAID456=m
|
||||
# CONFIG_MULTICORE_RAID456 is not set
|
||||
CONFIG_MD_MULTIPATH=m
|
||||
# CONFIG_MD_FAULTY is not set
|
||||
CONFIG_BLK_DEV_DM_BUILTIN=y
|
||||
CONFIG_BLK_DEV_DM=y
|
||||
# CONFIG_DM_DEBUG is not set
|
||||
CONFIG_DM_CRYPT=y
|
||||
@ -1749,8 +1749,7 @@ CONFIG_GPIOLIB=y
|
||||
#
|
||||
CONFIG_GPIO_SUNXI=m
|
||||
CONFIG_W1=y
|
||||
CONFIG_W1_CON=y
|
||||
CONFIG_W1_SUNXI=y
|
||||
CONFIG_W1_SUNXI=m
|
||||
|
||||
#
|
||||
# 1-wire Bus Masters
|
||||
@ -1774,6 +1773,22 @@ CONFIG_W1_SLAVE_THERM=y
|
||||
# CONFIG_W1_SLAVE_DS2781 is not set
|
||||
# CONFIG_W1_SLAVE_BQ27000 is not set
|
||||
CONFIG_POWER_SUPPLY=y
|
||||
# CONFIG_POWER_SUPPLY_DEBUG is not set
|
||||
# CONFIG_PDA_POWER is not set
|
||||
# CONFIG_APM_POWER is not set
|
||||
# CONFIG_TEST_POWER is not set
|
||||
# CONFIG_BATTERY_DS2780 is not set
|
||||
# CONFIG_BATTERY_DS2781 is not set
|
||||
# CONFIG_BATTERY_DS2782 is not set
|
||||
# CONFIG_BATTERY_SBS is not set
|
||||
# CONFIG_BATTERY_BQ27x00 is not set
|
||||
# CONFIG_BATTERY_MAX17040 is not set
|
||||
# CONFIG_BATTERY_MAX17042 is not set
|
||||
# CONFIG_BATTERY_ANDROID is not set
|
||||
# CONFIG_CHARGER_MAX8903 is not set
|
||||
# CONFIG_CHARGER_LP8727 is not set
|
||||
# CONFIG_CHARGER_GPIO is not set
|
||||
# CONFIG_CHARGER_SMB347 is not set
|
||||
CONFIG_HWMON=y
|
||||
# CONFIG_HWMON_VID is not set
|
||||
# CONFIG_HWMON_DEBUG_CHIP is not set
|
||||
@ -2593,6 +2608,7 @@ CONFIG_SND_SOC_I2C_AND_SPI=y
|
||||
# CONFIG_SOUND_PRIME is not set
|
||||
CONFIG_HID_SUPPORT=y
|
||||
CONFIG_HID=y
|
||||
# CONFIG_HID_BATTERY_STRENGTH is not set
|
||||
CONFIG_HIDRAW=y
|
||||
CONFIG_UHID=y
|
||||
|
||||
@ -3047,7 +3063,6 @@ CONFIG_DMA_VIRTUAL_CHANNELS=y
|
||||
#
|
||||
# DMA Clients
|
||||
#
|
||||
# CONFIG_NET_DMA is not set
|
||||
# CONFIG_ASYNC_TX_DMA is not set
|
||||
CONFIG_SUNXI_DMA=y
|
||||
# CONFIG_DMATEST is not set
|
||||
|
||||
133
patch/kernel/sun8i-default/w1_h3.patch
Normal file
133
patch/kernel/sun8i-default/w1_h3.patch
Normal file
@ -0,0 +1,133 @@
|
||||
diff -Nur a/drivers/w1/Kconfig b/drivers/w1/Kconfig
|
||||
--- a/drivers/w1/Kconfig 2015-01-27 03:29:32.000000000 +0100
|
||||
+++ b/drivers/w1/Kconfig 2016-01-31 00:49:00.000000000 +0100
|
||||
@@ -25,6 +25,32 @@
|
||||
2. Userspace commands. Includes read/write and search/alarm search commands.
|
||||
3. Replies to userspace commands.
|
||||
|
||||
+config W1_SUNXI
|
||||
+ depends on GPIO_SUNXI
|
||||
+ tristate "1-wire sunxi support"
|
||||
+ default n
|
||||
+ --- help ---
|
||||
+ This adds a way to register a platform device for 1-wire bus.
|
||||
+ It introduces a new section "[w1_para]" in the FEX to configure the
|
||||
+ GPIO pin number used for the bus, with the attribute named "gpio".
|
||||
+ The GPIO pin must also be defined in the "[gpio_para]" section.
|
||||
+
|
||||
+ 1-wire device can then be accessed using the w1-gpio driver.
|
||||
+
|
||||
+ Example configuration :
|
||||
+ [w1_para]
|
||||
+ gpio = 3
|
||||
+
|
||||
+ [gpio_para]
|
||||
+ gpio_used = 1
|
||||
+ gpio_num = 3
|
||||
+ ...
|
||||
+ gpio_pin_3 = port:PH7<0><default><default><0>
|
||||
+
|
||||
+ It is also possible to configure the GPIO pin number with the
|
||||
+ module paramerer "gpio". In this case, if the pin is valid,
|
||||
+ it will be used instead of what is configured in the FEX script.
|
||||
+
|
||||
source drivers/w1/masters/Kconfig
|
||||
source drivers/w1/slaves/Kconfig
|
||||
|
||||
diff -Nur a/drivers/w1/Makefile b/drivers/w1/Makefile
|
||||
--- a/drivers/w1/Makefile 2015-01-27 03:29:32.000000000 +0100
|
||||
+++ b/drivers/w1/Makefile 2016-02-11 18:52:00.000000000 +0100
|
||||
@@ -3,6 +3,7 @@
|
||||
#
|
||||
|
||||
obj-$(CONFIG_W1) += wire.o
|
||||
+obj-$(CONFIG_W1_SUNXI) += w1_sunxi.o
|
||||
wire-objs := w1.o w1_int.o w1_family.o w1_netlink.o w1_io.o
|
||||
|
||||
obj-y += masters/ slaves/
|
||||
diff -Nur a/drivers/w1/w1_sunxi.c b/drivers/w1/w1_sunxi.c
|
||||
--- a/drivers/w1/w1_sunxi.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ b/drivers/w1/w1_sunxi.c 2016-01-31 00:49:00.000000000 +0100
|
||||
@@ -0,0 +1,82 @@
|
||||
+#include <linux/device.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/w1-gpio.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/gpio.h>
|
||||
+//#include <plat/sys_config.h>
|
||||
+#include <mach/sys_config.h>
|
||||
+#include <mach/platform.h>
|
||||
+
|
||||
+static int gpio = -1;
|
||||
+module_param(gpio, int, 0444);
|
||||
+MODULE_PARM_DESC(gpio, "w1 gpio pin number");
|
||||
+
|
||||
+static struct w1_gpio_platform_data w1_gpio_pdata = {
|
||||
+ .pin = -1,
|
||||
+ .is_open_drain = 0,
|
||||
+};
|
||||
+
|
||||
+static void w1_gpio_release(struct device *dev)
|
||||
+{
|
||||
+ printk("w1_gpio_release good !\n");
|
||||
+}
|
||||
+
|
||||
+static struct platform_device w1_device = {
|
||||
+ .name = "w1-gpio",
|
||||
+ .id = -1,
|
||||
+ .dev = {
|
||||
+ .platform_data = &w1_gpio_pdata,
|
||||
+ .release = w1_gpio_release,
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+static int __init w1_sunxi_init(void)
|
||||
+{
|
||||
+ int ret;
|
||||
+ script_item_u val;
|
||||
+ script_item_value_type_e type;
|
||||
+
|
||||
+ w1_gpio_pdata.pin = gpio;
|
||||
+
|
||||
+ if (!gpio_is_valid(w1_gpio_pdata.pin)) {
|
||||
+ // *** We have to determine the pin num from fex definition
|
||||
+ /*val.val = 0;
|
||||
+ type = script_get_item("w1_para", "w1_used", &val);
|
||||
+ if((SCIRPT_ITEM_VALUE_TYPE_INT != type) || (val.val != 1)) {
|
||||
+ printk(KERN_ERR "W1: not used in fex configuration (%d, %d - %d)\n", type, id, val.val);
|
||||
+ return -EINVAL;
|
||||
+ }*/
|
||||
+
|
||||
+ val.val = gpio;
|
||||
+ type = script_get_item("w1_para", "gpio", &val);
|
||||
+ if(SCIRPT_ITEM_VALUE_TYPE_INT != type) {
|
||||
+ printk(KERN_ERR "W1_SUNXI: invalid gpio pin in fex configuration\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ w1_gpio_pdata.pin = val.val;
|
||||
+ if (!gpio_is_valid(w1_gpio_pdata.pin)) {
|
||||
+ printk(KERN_ERR "W1_SUNXI: invalid gpio pin in fex configuration %d\n", val.val);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ }
|
||||
+ ret = platform_device_register(&w1_device);
|
||||
+ if (ret) {
|
||||
+ printk(KERN_ERR "W1_SUNXI: error registering w1-gpio device on GPIO-%d\n", w1_gpio_pdata.pin);
|
||||
+ return ret;
|
||||
+ }
|
||||
+ printk(KERN_INFO "W1_SUNXI: Added w1-gpio on GPIO-%d\n", w1_gpio_pdata.pin);
|
||||
+ gpio_free(w1_gpio_pdata.pin);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void __exit w1_sunxi_exit(void)
|
||||
+{
|
||||
+ platform_device_unregister(&w1_device);
|
||||
+}
|
||||
+
|
||||
+module_init(w1_sunxi_init);
|
||||
+module_exit(w1_sunxi_exit);
|
||||
+
|
||||
+MODULE_DESCRIPTION("GPIO w1 sunxi platform device");
|
||||
+MODULE_AUTHOR("Damien Nicolet <zardam@gmail.com> mod by LoBo <loboris@gmail.com");
|
||||
+MODULE_LICENSE("GPL");
|
||||
@ -1,139 +0,0 @@
|
||||
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
|
||||
index e0e33c7..5232b7d 100644
|
||||
--- a/drivers/gpio/Makefile
|
||||
+++ b/drivers/gpio/Makefile
|
||||
@@ -64,4 +64,4 @@ obj-$(CONFIG_GPIO_WM831X) += gpio-wm831x.o
|
||||
obj-$(CONFIG_GPIO_WM8350) += gpio-wm8350.o
|
||||
obj-$(CONFIG_GPIO_WM8994) += gpio-wm8994.o
|
||||
obj-$(CONFIG_GPIO_XILINX) += gpio-xilinx.o
|
||||
-obj-$(CONFIG_GPIO_SUNXI) += gpio-sunxi.o
|
||||
+obj-$(CONFIG_GPIO_SUNXI) += gpio-sunxi.o
|
||||
diff --git a/drivers/w1/Kconfig b/drivers/w1/Kconfig
|
||||
index fd2c7bd..cc8a62b 100644
|
||||
--- a/drivers/w1/Kconfig
|
||||
+++ b/drivers/w1/Kconfig
|
||||
@@ -25,6 +25,33 @@ config W1_CON
|
||||
2. Userspace commands. Includes read/write and search/alarm search commands.
|
||||
3. Replies to userspace commands.
|
||||
|
||||
+config W1_SUNXI
|
||||
+ depends on GPIO_SUNXI
|
||||
+ tristate "1-wire sunxi support"
|
||||
+ default n
|
||||
+ --- help ---
|
||||
+ This adds a way to register a platform device for 1-wire bus.
|
||||
+ It introduces a new section "[w1_para]" in the FEX to configure the
|
||||
+ GPIO pin number used for the bus, with the attribute named "gpio".
|
||||
+ The GPIO pin must also be defined in the "[gpio_para]" section.
|
||||
+
|
||||
+ 1-wire device can then be accessed using the w1-gpio driver.
|
||||
+
|
||||
+ Example configuration :
|
||||
+ [w1_para]
|
||||
+ gpio = 3
|
||||
+
|
||||
+ [gpio_para]
|
||||
+ gpio_used = 1
|
||||
+ gpio_num = 3
|
||||
+ ...
|
||||
+ gpio_pin_3 = port:PH7<0><default><default><0>
|
||||
+
|
||||
+ It is also possible to configure the GPIO pin number with the
|
||||
+ module paramerer "gpio". In this case, if the pin is valid,
|
||||
+ it will be used instead of what is configured in the FEX script.
|
||||
+
|
||||
+
|
||||
source drivers/w1/masters/Kconfig
|
||||
source drivers/w1/slaves/Kconfig
|
||||
|
||||
diff --git a/drivers/w1/Makefile b/drivers/w1/Makefile
|
||||
index 6bb0b54..a0be53c 100644
|
||||
--- a/drivers/w1/Makefile
|
||||
+++ b/drivers/w1/Makefile
|
||||
@@ -3,6 +3,7 @@
|
||||
#
|
||||
|
||||
obj-$(CONFIG_W1) += wire.o
|
||||
+obj-$(CONFIG_W1_SUNXI) += w1_sunxi.o
|
||||
wire-objs := w1.o w1_int.o w1_family.o w1_netlink.o w1_io.o
|
||||
|
||||
obj-y += masters/ slaves/
|
||||
new file mode 100644
|
||||
index 0000000..de24f06
|
||||
--- /dev/null
|
||||
+++ b/drivers/w1/w1_sunxi.c
|
||||
@@ -0,0 +1,48 @@
|
||||
+#include <linux/device.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/w1-gpio.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/gpio.h>
|
||||
+#include <mach/sys_config.h>
|
||||
+#include <mach/platform.h>
|
||||
+
|
||||
+static int gpio = -1;
|
||||
+module_param(gpio, int, 0444);
|
||||
+MODULE_PARM_DESC(gpio, "w1 gpio pin number");
|
||||
+
|
||||
+static struct w1_gpio_platform_data w1_gpio_pdata = {
|
||||
+ .pin = -1,
|
||||
+ .is_open_drain = 0,
|
||||
+};
|
||||
+
|
||||
+static void w1_gpio_release(struct device *dev)
|
||||
+{
|
||||
+ printk("w1_gpio_release good !\n");
|
||||
+}
|
||||
+
|
||||
+static struct platform_device w1_device = {
|
||||
+ .name = "w1-gpio",
|
||||
+ .id = -1,
|
||||
+ .dev = {
|
||||
+ .platform_data = &w1_gpio_pdata,
|
||||
+ .release = w1_gpio_release,
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+static int __init w1_sunxi_init(void)
|
||||
+{
|
||||
+ int ret;
|
||||
+ script_item_u val;
|
||||
+ script_item_value_type_e type;
|
||||
+
|
||||
+ w1_gpio_pdata.pin = gpio;
|
||||
+
|
||||
+ if (!gpio_is_valid(w1_gpio_pdata.pin)) {
|
||||
+
|
||||
+ val.val = gpio;
|
||||
+ type = script_get_item("w1_para", "gpio", &val);
|
||||
+ if(SCIRPT_ITEM_VALUE_TYPE_INT != type) {
|
||||
+ printk(KERN_ERR "W1_SUNXI: invalid gpio pin in fex configuration\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ w1_gpio_pdata.pin = val.val;
|
||||
+ if (!gpio_is_valid(w1_gpio_pdata.pin)) {
|
||||
+ printk(KERN_ERR "W1_SUNXI: invalid gpio pin in fex configuration %d\n", val.val);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ }
|
||||
+ ret = platform_device_register(&w1_device);
|
||||
+ if (ret) {
|
||||
+ printk(KERN_ERR "W1_SUNXI: error registering w1-gpio device on GPIO-%d\n", w1_gpio_pdata.pin);
|
||||
+ return ret;
|
||||
+ }
|
||||
+ printk(KERN_INFO "W1_SUNXI: Added w1-gpio on GPIO-%d\n", w1_gpio_pdata.pin);
|
||||
+ gpio_free(w1_gpio_pdata.pin);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void __exit w1_sunxi_exit(void)
|
||||
+{
|
||||
+ platform_device_unregister(&w1_device);
|
||||
+}
|
||||
+
|
||||
+module_init(w1_sunxi_init);
|
||||
+module_exit(w1_sunxi_exit);
|
||||
+
|
||||
+MODULE_DESCRIPTION("GPIO w1 sunxi platform device");
|
||||
+MODULE_AUTHOR("Damien Nicolet <zardam@gmail.com> mod by LoBo <loboris@gmail.com");
|
||||
+MODULE_LICENSE("GPL");
|
||||
Loading…
Reference in New Issue
Block a user