mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-26 17:01:14 +00:00
ca5c695a45
Deleted following upstreamed patches: bcm27xx: 950-0006-drm-vc4-hdmi-Fix-HPD-GPIO-detection.patch bcm27xx: 950-0420-drm-vc4-Adopt-the-dma-configuration-from-the-HVS-or-.patch bcm27xx: 950-0425-drm-vc4-A-present-but-empty-dmas-disables-audio.patch bcm27xx: 950-0432-vc4-drm-Avoid-full-hdmi-audio-fifo-writes.patch bcm27xx: 950-0433-vc4-drm-vc4_plane-Remove-subpixel-positioning-check.patch bcm27xx: 950-0435-drm-vc4-Correct-pixel-order-for-DSI0.patch bcm27xx: 950-0436-drm-vc4-Register-dsi0-as-the-correct-vc4-encoder-typ.patch bcm27xx: 950-0437-drm-vc4-Fix-dsi0-interrupt-support.patch bcm27xx: 950-0438-drm-vc4-Add-correct-stop-condition-to-vc4_dsi_encode.patch bcm27xx: 950-0443-drm-vc4-Fix-timings-for-interlaced-modes.patch bcm27xx: 950-0445-drm-vc4-Fix-margin-calculations-for-the-right-bottom.patch bcm27xx: 950-0475-drm-vc4-Reset-HDMI-MISC_CONTROL-register.patch bcm27xx: 950-0476-drm-vc4-Release-workaround-buffer-and-DMA-in-error-p.patch bcm27xx: 950-0477-drm-vc4-Correct-DSI-divider-calculations.patch bcm27xx: 950-0664-drm-vc4-dsi-Correct-max-divider-to-255-not-7.patch bcm53xx: 072-next-ARM_dts_BCM53015-add-mr26.patch mediatek: 920-linux-next-dts-mt7622-bpi-r64-fix-wps-button.patch Manually rebased following patches: bcm27xx: 950-0004-drm-vc4-hdmi-Remove-the-DDC-probing-for-status-detec.patch bcm27xx: 950-0700-net-phy-lan87xx-Decrease-phy-polling-rate.patch bcm27xx: 950-0711-drm-vc4-Rename-bridge-to-out_bridge.patch bcm27xx: 950-0713-drm-vc4-Remove-splitting-the-bridge-chain-from-the-d.patch bcm27xx: 950-0715-drm-vc4-Convert-vc4_dsi-to-using-a-bridge-instead-of.patch bcm27xx: 950-0787-vc4-drm-vc4_plane-Keep-fractional-source-coords-insi.patch bcm27xx: 950-0914-mmc-block-Don-t-do-single-sector-reads-during-recove.patch Runtime tested on turris-omnia and glinet-b1300. Tested-by: John Audia <therealgraysky@proton.me> [bcm2711/RPi4B, mt7622/RT3200] Signed-off-by: Petr Štetiar <ynezz@true.cz>
163 lines
4.6 KiB
Diff
163 lines
4.6 KiB
Diff
From cc809a441d8f2924f785eb863dfa6aef47a25b0b Mon Sep 17 00:00:00 2001
|
|
From: John Crispin <blogic@openwrt.org>
|
|
Date: Tue, 12 Aug 2014 20:49:27 +0200
|
|
Subject: [PATCH 30/36] GPIO: add named gpio exports
|
|
|
|
Signed-off-by: John Crispin <blogic@openwrt.org>
|
|
--- a/drivers/gpio/gpiolib-of.c
|
|
+++ b/drivers/gpio/gpiolib-of.c
|
|
@@ -19,6 +19,8 @@
|
|
#include <linux/pinctrl/pinctrl.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/gpio/machine.h>
|
|
+#include <linux/init.h>
|
|
+#include <linux/platform_device.h>
|
|
|
|
#include "gpiolib.h"
|
|
#include "gpiolib-of.h"
|
|
@@ -1059,3 +1061,72 @@ void of_gpio_dev_init(struct gpio_chip *
|
|
else
|
|
gc->of_node = gdev->dev.of_node;
|
|
}
|
|
+
|
|
+#ifdef CONFIG_GPIO_SYSFS
|
|
+
|
|
+static struct of_device_id gpio_export_ids[] = {
|
|
+ { .compatible = "gpio-export" },
|
|
+ { /* sentinel */ }
|
|
+};
|
|
+
|
|
+static int of_gpio_export_probe(struct platform_device *pdev)
|
|
+{
|
|
+ struct device_node *np = pdev->dev.of_node;
|
|
+ struct device_node *cnp;
|
|
+ u32 val;
|
|
+ int nb = 0;
|
|
+
|
|
+ for_each_child_of_node(np, cnp) {
|
|
+ const char *name = NULL;
|
|
+ int gpio;
|
|
+ bool dmc;
|
|
+ int max_gpio = 1;
|
|
+ int i;
|
|
+
|
|
+ of_property_read_string(cnp, "gpio-export,name", &name);
|
|
+
|
|
+ if (!name)
|
|
+ max_gpio = of_gpio_count(cnp);
|
|
+
|
|
+ for (i = 0; i < max_gpio; i++) {
|
|
+ unsigned flags = 0;
|
|
+ enum of_gpio_flags of_flags;
|
|
+
|
|
+ gpio = of_get_gpio_flags(cnp, i, &of_flags);
|
|
+ if (!gpio_is_valid(gpio))
|
|
+ return gpio;
|
|
+
|
|
+ if (of_flags == OF_GPIO_ACTIVE_LOW)
|
|
+ flags |= GPIOF_ACTIVE_LOW;
|
|
+
|
|
+ if (!of_property_read_u32(cnp, "gpio-export,output", &val))
|
|
+ flags |= val ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
|
|
+ else
|
|
+ flags |= GPIOF_IN;
|
|
+
|
|
+ if (devm_gpio_request_one(&pdev->dev, gpio, flags, name ? name : of_node_full_name(np)))
|
|
+ continue;
|
|
+
|
|
+ dmc = of_property_read_bool(cnp, "gpio-export,direction_may_change");
|
|
+ gpio_export_with_name(gpio, dmc, name);
|
|
+ nb++;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ dev_info(&pdev->dev, "%d gpio(s) exported\n", nb);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static struct platform_driver gpio_export_driver = {
|
|
+ .driver = {
|
|
+ .name = "gpio-export",
|
|
+ .owner = THIS_MODULE,
|
|
+ .of_match_table = of_match_ptr(gpio_export_ids),
|
|
+ },
|
|
+ .probe = of_gpio_export_probe,
|
|
+};
|
|
+
|
|
+module_platform_driver(gpio_export_driver);
|
|
+
|
|
+#endif
|
|
--- a/include/asm-generic/gpio.h
|
|
+++ b/include/asm-generic/gpio.h
|
|
@@ -125,6 +125,12 @@ static inline int gpio_export(unsigned g
|
|
return gpiod_export(gpio_to_desc(gpio), direction_may_change);
|
|
}
|
|
|
|
+int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name);
|
|
+static inline int gpio_export_with_name(unsigned gpio, bool direction_may_change, const char *name)
|
|
+{
|
|
+ return __gpiod_export(gpio_to_desc(gpio), direction_may_change, name);
|
|
+}
|
|
+
|
|
static inline int gpio_export_link(struct device *dev, const char *name,
|
|
unsigned gpio)
|
|
{
|
|
--- a/include/linux/gpio/consumer.h
|
|
+++ b/include/linux/gpio/consumer.h
|
|
@@ -715,6 +715,7 @@ static inline void devm_acpi_dev_remove_
|
|
|
|
#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);
|
|
int gpiod_export_link(struct device *dev, const char *name,
|
|
struct gpio_desc *desc);
|
|
@@ -722,6 +723,13 @@ void gpiod_unexport(struct gpio_desc *de
|
|
|
|
#else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */
|
|
|
|
+static inline int _gpiod_export(struct gpio_desc *desc,
|
|
+ bool direction_may_change,
|
|
+ const char *name)
|
|
+{
|
|
+ return -ENOSYS;
|
|
+}
|
|
+
|
|
static inline int gpiod_export(struct gpio_desc *desc,
|
|
bool direction_may_change)
|
|
{
|
|
--- a/drivers/gpio/gpiolib-sysfs.c
|
|
+++ b/drivers/gpio/gpiolib-sysfs.c
|
|
@@ -561,7 +561,7 @@ static struct class gpio_class = {
|
|
*
|
|
* Returns zero on success, else an error.
|
|
*/
|
|
-int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
|
|
+int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name)
|
|
{
|
|
struct gpio_chip *chip;
|
|
struct gpio_device *gdev;
|
|
@@ -623,6 +623,8 @@ int gpiod_export(struct gpio_desc *desc,
|
|
offset = gpio_chip_hwgpio(desc);
|
|
if (chip->names && chip->names[offset])
|
|
ioname = chip->names[offset];
|
|
+ if (name)
|
|
+ ioname = name;
|
|
|
|
dev = device_create_with_groups(&gpio_class, &gdev->dev,
|
|
MKDEV(0, 0), data, gpio_groups,
|
|
@@ -644,6 +646,12 @@ err_unlock:
|
|
gpiod_dbg(desc, "%s: status %d\n", __func__, status);
|
|
return status;
|
|
}
|
|
+EXPORT_SYMBOL_GPL(__gpiod_export);
|
|
+
|
|
+int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
|
|
+{
|
|
+ return __gpiod_export(desc, direction_may_change, NULL);
|
|
+}
|
|
EXPORT_SYMBOL_GPL(gpiod_export);
|
|
|
|
static int match_export(struct device *dev, const void *desc)
|