Thread (138 messages) 138 messages, 6 authors, 2013-10-25

Re: [PATCH 02/03] pinmux: Add TB10x pinmux driver

From: Linus Walleij <hidden>
Date: 2013-10-09 12:30:50
Also in: lkml

On Tue, Oct 8, 2013 at 2:25 PM, Christian Ruppert
[off-list ref] wrote:
The pinmux driver of the Abilis Systems TB10x platform based on ARC700 CPUs.
Used to control the pinmux and is a prerequisite for the GPIO driver.

Signed-off-by: Christian Ruppert <redacted>
Signed-off-by: Pierrick Hascoet <redacted>
Overall this is looking pretty nice!
+static int tb10x_dt_node_to_map(struct pinctrl_dev *pctl,
+                               struct device_node *np_config,
+                               struct pinctrl_map **map, unsigned *num_maps)
+{
+       struct pinctrl_map *m;
+       const char *string;
+
+       if (of_property_read_string(np_config, "abilis,function", &string)) {
+               pr_err("%s: No abilis,function property in device tree.\n",
+                       np_config->full_name);
+               return -EINVAL;
+       }
+
+       m = kzalloc(sizeof(struct pinctrl_map), GFP_KERNEL);
+       if (!m)
+               return -ENOMEM;
Could you make use of:

#include "pinctrl-utils.h"

pinctrl_utils_reserve_map()
pinctrl_utils_add_map_mux()
pinctrl_utils_dt_free_map()

?
+static int tb10x_gpio_request_enable(struct pinctrl_dev *pctl,
+                                       struct pinctrl_gpio_range *range,
+                                       unsigned pin)
+{
+       struct tb10x_pinctrl *state = pinctrl_dev_get_drvdata(pctl);
+       int muxport = -1;
+       int muxmode = -1;
+       int i;
+
+       mutex_lock(&state->mutex);
+
+       /* Figure out to which port the requested GPIO belongs and how to
+        * configure that port.
+        * This loop also checks for pin conflicts between GPIOs and other
+        * functions.
+        */
/*
 * I really like all comments with a blank
 * line at the top and bottom like this.
 */

Yours,
Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help