Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1335325
| From | Linus Walleij <linus.walleij@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] pinctrl: mediatek: fix direction control issue |
| Date | 2016-02-16 13:30 +0100 |
| Message-ID | <r2MVs-7Lj-1@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <qY1Va-8wg-33@gated-at.bofh.it> <qYiCB-2XI-1@gated-at.bofh.it> <qYP5w-Xo-5@gated-at.bofh.it> <r1blh-wq-7@gated-at.bofh.it> <r2JEf-5wa-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Feb 16, 2016 at 9:54 AM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> To make it more clear, for a GPIO pin to get input on MTK chip, we must:
>
> - Enable input for the pad (input-enable)
This should be done by the pin control portions of the driver in
response to the PIN_CONFIG_INPUT_ENABLE generic pin
config setting.
Possibly *also* by just writing the hardware registers
from the callbacks right below here:
> - Set mux to GPIO mode
This should be done by just writing the hardware registers
in these callbacks from struct pinmux_ops:
int (*gpio_request_enable) (struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range,
unsigned offset);
void (*gpio_disable_free) (struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range,
unsigned offset);
int (*gpio_set_direction) (struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range,
unsigned offset,
bool input);
In respons to these functions being called from the corresponding
GPIO driver:
extern int pinctrl_request_gpio(unsigned gpio);
extern void pinctrl_free_gpio(unsigned gpio);
extern int pinctrl_gpio_direction_input(unsigned gpio);
extern int pinctrl_gpio_direction_output(unsigned gpio);
> - Set GPIO direction to input
This should be done in these callbacks from struct gpio_chip:
int (*direction_input)(struct gpio_chip *chip,
unsigned offset);
int (*direction_output)(struct gpio_chip *chip,
unsigned offset, int value);
By just writing the hardware registers.
> Currently user need to add a dts node to set pinmux to GPIO mode with
> input-enable property, the driver need to call gpio_direction_input to
> set direction.
It seems like:
- Your GPIO driver is not calling the pinctrl_request_gpio/
pinctrl_gpio_direction_* etc.
- Your pinmux driver is not implementing the GPIO-specifif
.gpio_* functions
> Since input-enable and GPIO direction are 2 different things, we now
> think this patch is inappropriate. Instead, user should not required to
> add pinmux node in dts if all he want is use it as plain GPIO input.
If you sort out the above callbacks (also read
Documentation/pinctrl.txt about GPIO) I think it is
clear what you need to do.
Usually you should only need a special pinmux/pinconf node
for a GPIO line if you need to specify pull-up or similar electronic
things for that GPIO.
Yours,
Linus Walleij
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH 1/2] pinctrl: mediatek: fix direction control issue Hongzhou Yang <hongzhou.yang@mediatek.com> - 2016-02-12 03:10 +0100
Re: [PATCH 1/2] pinctrl: mediatek: fix direction control issue Yingjoe Chen <yingjoe.chen@mediatek.com> - 2016-02-16 10:00 +0100
Re: [PATCH 1/2] pinctrl: mediatek: fix direction control issue Linus Walleij <linus.walleij@linaro.org> - 2016-02-16 13:30 +0100
csiph-web