mirror of
https://github.com/coolsnowwolf/lede
synced 2025-01-08 11:47:42 +08:00
generic: 6.12: fixes broken patches
This commit is contained in:
parent
23d466fba0
commit
927e1b695c
@ -15,7 +15,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
|||||||
|
|
||||||
#include "gpiolib.h"
|
#include "gpiolib.h"
|
||||||
#include "gpiolib-of.h"
|
#include "gpiolib-of.h"
|
||||||
@@ -1187,3 +1189,72 @@ void of_gpiochip_remove(struct gpio_chip
|
@@ -1187,3 +1189,73 @@ void of_gpiochip_remove(struct gpio_chip
|
||||||
{
|
{
|
||||||
of_node_put(dev_of_node(&chip->gpiodev->dev));
|
of_node_put(dev_of_node(&chip->gpiodev->dev));
|
||||||
}
|
}
|
||||||
@ -44,17 +44,19 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
|||||||
+ of_property_read_string(cnp, "gpio-export,name", &name);
|
+ of_property_read_string(cnp, "gpio-export,name", &name);
|
||||||
+
|
+
|
||||||
+ if (!name)
|
+ if (!name)
|
||||||
+ // max_gpio = of_gpio_count(cnp);
|
+ max_gpio = of_gpio_named_count(cnp, "gpios");
|
||||||
+
|
+
|
||||||
+ for (i = 0; i < max_gpio; i++) {
|
+ for (i = 0; i < max_gpio; i++) {
|
||||||
|
+ struct gpio_desc *desc;
|
||||||
+ unsigned flags = 0;
|
+ unsigned flags = 0;
|
||||||
+ enum of_gpio_flags of_flags;
|
+ enum of_gpio_flags of_flags;
|
||||||
+
|
+
|
||||||
+ gpio = of_get_named_gpio(cnp, i, &of_flags);
|
+ desc = of_get_named_gpiod_flags(cnp, "gpios", i, &of_flags);
|
||||||
+ if (!gpio_is_valid(gpio))
|
+ if (IS_ERR(desc))
|
||||||
+ return gpio;
|
+ return PTR_ERR(desc);
|
||||||
|
+ gpio = desc_to_gpio(desc);
|
||||||
+
|
+
|
||||||
+ if (of_flags == OF_GPIO_ACTIVE_LOW)
|
+ if (of_flags & OF_GPIO_ACTIVE_LOW)
|
||||||
+ flags |= GPIOF_ACTIVE_LOW;
|
+ flags |= GPIOF_ACTIVE_LOW;
|
||||||
+
|
+
|
||||||
+ if (!of_property_read_u32(cnp, "gpio-export,output", &val))
|
+ if (!of_property_read_u32(cnp, "gpio-export,output", &val))
|
||||||
@ -66,7 +68,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
|||||||
+ continue;
|
+ continue;
|
||||||
+
|
+
|
||||||
+ dmc = of_property_read_bool(cnp, "gpio-export,direction_may_change");
|
+ dmc = of_property_read_bool(cnp, "gpio-export,direction_may_change");
|
||||||
+ gpio_export_with_name(gpio, dmc, name);
|
+ gpio_export_with_name(gpio_to_desc(gpio), dmc, name);
|
||||||
+ nb++;
|
+ nb++;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
@ -79,7 +81,6 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
|||||||
+static struct platform_driver gpio_export_driver = {
|
+static struct platform_driver gpio_export_driver = {
|
||||||
+ .driver = {
|
+ .driver = {
|
||||||
+ .name = "gpio-export",
|
+ .name = "gpio-export",
|
||||||
+ .owner = THIS_MODULE,
|
|
||||||
+ .of_match_table = of_match_ptr(gpio_export_ids),
|
+ .of_match_table = of_match_ptr(gpio_export_ids),
|
||||||
+ },
|
+ },
|
||||||
+ .probe = of_gpio_export_probe,
|
+ .probe = of_gpio_export_probe,
|
||||||
@ -88,22 +89,24 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
|||||||
+module_platform_driver(gpio_export_driver);
|
+module_platform_driver(gpio_export_driver);
|
||||||
+
|
+
|
||||||
+#endif
|
+#endif
|
||||||
\ No newline at end of file
|
|
||||||
--- a/include/linux/gpio/consumer.h
|
--- a/include/linux/gpio/consumer.h
|
||||||
+++ b/include/linux/gpio/consumer.h
|
+++ b/include/linux/gpio/consumer.h
|
||||||
@@ -628,6 +628,7 @@ static inline int devm_acpi_dev_add_driv
|
@@ -628,7 +628,10 @@ static inline int devm_acpi_dev_add_driv
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS)
|
#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS)
|
||||||
|
|
||||||
+int _gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name);
|
+int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name);
|
||||||
int gpiod_export(struct gpio_desc *desc, bool direction_may_change);
|
int gpiod_export(struct gpio_desc *desc, bool direction_may_change);
|
||||||
|
+int gpio_export_with_name(struct gpio_desc *desc, bool direction_may_change,
|
||||||
|
+ const char *name);
|
||||||
int gpiod_export_link(struct device *dev, const char *name,
|
int gpiod_export_link(struct device *dev, const char *name,
|
||||||
struct gpio_desc *desc);
|
struct gpio_desc *desc);
|
||||||
@@ -637,6 +638,13 @@ void gpiod_unexport(struct gpio_desc *de
|
void gpiod_unexport(struct gpio_desc *desc);
|
||||||
|
@@ -637,11 +640,25 @@ void gpiod_unexport(struct gpio_desc *de
|
||||||
|
|
||||||
#include <asm/errno.h>
|
#include <asm/errno.h>
|
||||||
|
|
||||||
+static inline int _gpiod_export(struct gpio_desc *desc,
|
+static inline int __gpiod_export(struct gpio_desc *desc,
|
||||||
+ bool direction_may_change,
|
+ bool direction_may_change,
|
||||||
+ const char *name)
|
+ const char *name)
|
||||||
+{
|
+{
|
||||||
@ -113,6 +116,18 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
|||||||
static inline int gpiod_export(struct gpio_desc *desc,
|
static inline int gpiod_export(struct gpio_desc *desc,
|
||||||
bool direction_may_change)
|
bool direction_may_change)
|
||||||
{
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+static inline int gpio_export_with_name(struct gpio_desc *desc,
|
||||||
|
+ bool direction_may_change,
|
||||||
|
+ const char *name)
|
||||||
|
+{
|
||||||
|
+ return -ENOSYS;
|
||||||
|
+}
|
||||||
|
|
||||||
|
static inline int gpiod_export_link(struct device *dev, const char *name,
|
||||||
|
struct gpio_desc *desc)
|
||||||
--- a/drivers/gpio/gpiolib-sysfs.c
|
--- a/drivers/gpio/gpiolib-sysfs.c
|
||||||
+++ b/drivers/gpio/gpiolib-sysfs.c
|
+++ b/drivers/gpio/gpiolib-sysfs.c
|
||||||
@@ -571,7 +571,7 @@ static struct class gpio_class = {
|
@@ -571,7 +571,7 @@ static struct class gpio_class = {
|
||||||
@ -133,7 +148,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
|||||||
|
|
||||||
dev = device_create_with_groups(&gpio_class, &gdev->dev,
|
dev = device_create_with_groups(&gpio_class, &gdev->dev,
|
||||||
MKDEV(0, 0), data, gpio_groups,
|
MKDEV(0, 0), data, gpio_groups,
|
||||||
@@ -650,6 +652,12 @@ err_unlock:
|
@@ -650,8 +652,21 @@ err_unlock:
|
||||||
gpiod_dbg(desc, "%s: status %d\n", __func__, status);
|
gpiod_dbg(desc, "%s: status %d\n", __func__, status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -145,4 +160,13 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
|||||||
+}
|
+}
|
||||||
EXPORT_SYMBOL_GPL(gpiod_export);
|
EXPORT_SYMBOL_GPL(gpiod_export);
|
||||||
|
|
||||||
|
+int gpio_export_with_name(struct gpio_desc *desc, bool direction_may_change,
|
||||||
|
+ const char *name)
|
||||||
|
+{
|
||||||
|
+ return __gpiod_export(desc, direction_may_change, name);
|
||||||
|
+}
|
||||||
|
+EXPORT_SYMBOL_GPL(gpio_export_with_name);
|
||||||
|
+
|
||||||
static int match_export(struct device *dev, const void *desc)
|
static int match_export(struct device *dev, const void *desc)
|
||||||
|
{
|
||||||
|
struct gpiod_data *data = dev_get_drvdata(dev);
|
||||||
|
@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||||||
{
|
{
|
||||||
if (!nor->params->set_4byte_addr_mode)
|
if (!nor->params->set_4byte_addr_mode)
|
||||||
nor->params->set_4byte_addr_mode = spi_nor_set_4byte_addr_mode_en4b_ex4b;
|
nor->params->set_4byte_addr_mode = spi_nor_set_4byte_addr_mode_en4b_ex4b;
|
||||||
+ nor->flags |= SNOR_F_HAS_LOCK;
|
+ nor->flags |= SNOR_F_HAS_LOCK;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ Signed-off-by: Nick Hainke <vincent@systemli.org>
|
|||||||
{
|
{
|
||||||
if (!nor->params->set_4byte_addr_mode)
|
if (!nor->params->set_4byte_addr_mode)
|
||||||
nor->params->set_4byte_addr_mode = spi_nor_set_4byte_addr_mode_en4b_ex4b;
|
nor->params->set_4byte_addr_mode = spi_nor_set_4byte_addr_mode_en4b_ex4b;
|
||||||
+ nor->flags &= ~SNOR_F_HAS_16BIT_SR;
|
+ nor->flags &= ~SNOR_F_HAS_16BIT_SR;
|
||||||
nor->flags |= SNOR_F_HAS_LOCK;
|
nor->flags |= SNOR_F_HAS_LOCK;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user