xiaoxiang781216 commented on code in PR #19871:
URL: https://github.com/apache/nuttx/pull/19871#discussion_r3798139927
##########
drivers/pinctrl/Kconfig:
##########
@@ -12,4 +12,20 @@ config PINCTRL
This selection enables selection of common PINCTRL options.
This option
should be enabled by all platforms that support PINCTRL
interfaces.
See include/nuttx/pinctrl/pinctrl.h for further PINCTRL driver
information.
+
+if PINCTRL
+
+config PINCTRL_PROCFS
+ bool "PINCTRL procfs entry"
+ default n
Review Comment:
depends on PINCTRL, and remove line 16
##########
include/nuttx/pinctrl/pinctrl.h:
##########
@@ -189,6 +225,48 @@ struct pinctrl_param_s
} para;
};
+/* What a controller can say about one pad. Self contained: the strings
+ * are embedded, so the same structure serves the get_pad method and the
+ * PINCTRLC_GETPAD ioctl across the user/kernel boundary. An empty name
+ * means unnamed.
+ */
+
+struct pinctrl_padinfo_s
+{
+ uint32_t have; /* PINCTRL_HAVE_* validity bits */
+ char name[PINCTRL_NAME_MAX]; /* Pad name */
+ uint32_t function; /* Current function select */
+ char funcname[PINCTRL_NAME_MAX]; /* What that function selects */
+ uint32_t strength; /* Drive strength, hardware units */
+ bool pullup; /* Pull up enabled */
+ bool pulldown; /* Pull down enabled */
+ uint32_t slewrate; /* Slew rate, hardware units */
+ bool input; /* Input buffer enabled */
+ bool schmitt; /* Schmitt trigger enabled */
+ char extra[PINCTRL_EXTRA_MAX]; /* Controller specific key:value
+ * fields, appended to the pad's
+ * /proc/pinctrl line */
+};
+
+/* PINCTRLC_GETPAD argument */
+
+struct pinctrl_getpad_s
+{
+ uint32_t pin; /* In */
+ struct pinctrl_padinfo_s info; /* Out */
+};
+
+/* One pad in a controller's name table; declare entries with
+ * PINCTRL_PADNAME().
+ */
+
+struct pinctrl_padname_s
+{
+ FAR const char *name; /* Pad name */
+ FAR const char *const *funcs; /* Function select names, in order */
+ uint8_t nfuncs; /* Entries in funcs */
Review Comment:
uint32_t
##########
include/nuttx/pinctrl/pinctrl.h:
##########
@@ -56,13 +58,47 @@
* Description: Select gpio function of pinctrl pin
* Argument: The uint32_t pinctrl number
*
+ * Command: PINCTRLC_GETPAD
+ * Description: Describe the current configuration of one pad
+ * Argument: A pointer to an instance of struct pinctrl_getpad_s
+ *
*/
#define PINCTRLC_SETFUNCTION _PINCTRLIOC(1)
#define PINCTRLC_SETSTRENGTH _PINCTRLIOC(2)
#define PINCTRLC_SETDRIVER _PINCTRLIOC(3)
#define PINCTRLC_SETSLEWRATE _PINCTRLIOC(4)
#define PINCTRLC_SELECTGPIO _PINCTRLIOC(5)
+#define PINCTRLC_GETPAD _PINCTRLIOC(6)
+
+/* Validity bits for struct pinctrl_padinfo_s. A field is meaningful only
+ * when its bit is set in the have member: a pad may have no function
+ * select, no bias, no drive strength.
+ */
+
+#define PINCTRL_HAVE_FUNCTION (1 << 0)
+#define PINCTRL_HAVE_STRENGTH (1 << 1)
+#define PINCTRL_HAVE_PULL (1 << 2)
+#define PINCTRL_HAVE_SLEWRATE (1 << 3)
+#define PINCTRL_HAVE_INPUT (1 << 4)
+#define PINCTRL_HAVE_SCHMITT (1 << 5)
+
+#define PINCTRL_NAME_MAX 24 /* Longest name plus a terminator */
+#define PINCTRL_EXTRA_MAX 48
+
+/* One pad in a controller's name table: the pad's name, then the name of
+ * each documented function select in select order. Pass NULL in a slot
+ * whose select the manual does not document. The compound literal sizes
+ * the array to exactly what is listed; at file scope it has static
+ * storage.
+ */
+
+#define PINCTRL_PADNAME(padname, ...) \
+ { \
+ (padname), (FAR const char *const[]){__VA_ARGS__}, \
+ sizeof((FAR const char *const[]){__VA_ARGS__}) / \
Review Comment:
nitems
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]