Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107429426
D23093.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D23093.diff
View Options
Index: head/share/man/man9/fdt_pinctrl.9
===================================================================
--- head/share/man/man9/fdt_pinctrl.9
+++ head/share/man/man9/fdt_pinctrl.9
@@ -125,6 +125,36 @@
}
static int
+foo_is_gpio(device_t dev, device_t gpiodev, bool *is_gpio)
+{
+ return (foo_is_pin_func_gpio(is_gpio));
+}
+
+static int
+foo_set_flags(device_t dev, device_t gpiodev, uint32_t pin, uint32_t flags)
+{
+ int rv;
+
+ rv = foo_is_pin_func_gpio(is_gpio);
+ if (rv != 0)
+ return (rv);
+ foo_set_flags(pin, flags);
+ return (0);
+}
+
+static int
+foo_get_flags(device_t dev, device_t gpiodev, uint32_t pin, uint32_t *flags)
+{
+ int rv;
+
+ rv = foo_is_pin_func_gpio(is_gpio);
+ if (rv != 0)
+ return (rv);
+ foo_get_flags(pin, flags);
+ return (0);
+}
+
+static int
foo_attach(device_t dev)
{
...
@@ -144,6 +174,9 @@
/* fdt_pinctrl interface */
DEVMETHOD(fdt_pinctrl_configure, foo_configure_pins),
+ DEVMETHOD(fdt_pinctrl_is_gpio, foo_is_gpio),
+ DEVMETHOD(fdt_pinctrl_set_flags, foo_set_flags),
+ DEVMETHOD(fdt_pinctrl_get_flags, foo_get_flags),
/* Terminate method list */
DEVMETHOD_END
Index: head/sys/dev/fdt/fdt_pinctrl_if.m
===================================================================
--- head/sys/dev/fdt/fdt_pinctrl_if.m
+++ head/sys/dev/fdt/fdt_pinctrl_if.m
@@ -36,6 +36,31 @@
INTERFACE fdt_pinctrl;
+CODE {
+ static int
+ fdt_pinctrl_default_is_gpio(device_t pinctrl, device_t gpio, bool *is_gpio)
+ {
+
+ return (EOPNOTSUPP);
+ }
+
+ static int
+ fdt_pinctrl_default_set_flags(device_t pinctrl, device_t gpio, uint32_t pin,
+ uint32_t flags)
+ {
+
+ return (EOPNOTSUPP);
+ }
+
+ static int
+ fdt_pinctrl_default_get_flags(device_t pinctrl, device_t gpio, uint32_t pin,
+ uint32_t *flags)
+ {
+
+ return (EOPNOTSUPP);
+ }
+};
+
# Needed for timestamping device probe/attach calls
HEADER {
#include <sys/tslog.h>
@@ -57,3 +82,36 @@
phandle_t cfgxref;
};
+
+#
+# Test if the pin is in gpio mode
+# Called from a gpio device
+#
+METHOD int is_gpio {
+ device_t pinctrl;
+ device_t gpio;
+ uint32_t pin;
+ bool *is_gpio;
+} DEFAULT fdt_pinctrl_default_is_gpio;
+
+#
+# Set the flags of a pin
+# Called from a gpio device
+#
+METHOD int set_flags {
+ device_t pinctrl;
+ device_t gpio;
+ uint32_t pin;
+ uint32_t flags;
+} DEFAULT fdt_pinctrl_default_set_flags;
+
+#
+# Get the flags of a pin
+# Called from a gpio device
+#
+METHOD int get_flags {
+ device_t pinctrl;
+ device_t gpio;
+ uint32_t pin;
+ uint32_t *flags;
+} DEFAULT fdt_pinctrl_default_get_flags;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 15, 1:13 AM (9 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15803578
Default Alt Text
D23093.diff (2 KB)
Attached To
Mode
D23093: fdt_pinctrl: Add new methods for gpios
Attached
Detach File
Event Timeline
Log In to Comment