Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1739871
| From | Maxime Ripard <maxime.ripard@free-electrons.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 02/10] pinctrl: axp209: add pinctrl features |
| Date | 2017-09-26 15:10 +0200 |
| Message-ID | <utXMB-5dg-17@gated-at.bofh.it> (permalink) |
| References | <utX0e-4FS-7@gated-at.bofh.it> <utX9V-4JB-43@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
On Tue, Sep 26, 2017 at 12:17:12PM +0000, Quentin Schulz wrote:
> +static const struct axp20x_desc_pin axp209_pins[] = {
> + AXP20X_PIN(AXP20X_PINCTRL_PIN(0, "GPIO0"),
> + AXP20X_FUNCTION(0x0, "gpio_out"),
> + AXP20X_FUNCTION(0x2, "gpio_in"),
> + AXP20X_FUNCTION(0x3, "ldo"),
> + AXP20X_FUNCTION(0x4, "adc")),
> + AXP20X_PIN(AXP20X_PINCTRL_PIN(1, "GPIO1"),
> + AXP20X_FUNCTION(0x0, "gpio_out"),
> + AXP20X_FUNCTION(0x2, "gpio_in"),
> + AXP20X_FUNCTION(0x3, "ldo"),
> + AXP20X_FUNCTION(0x4, "adc")),
> + AXP20X_PIN(AXP20X_PINCTRL_PIN(2, "GPIO2"),
> + AXP20X_FUNCTION(0x0, "gpio_out"),
> + AXP20X_FUNCTION(0x2, "gpio_in")),
> +};
If all the functions are the same, and at the same offset, can't we
just hardcode it, instead of having (and duplicate) all the logic
below?
> + pctrl_desc = devm_kzalloc(&pdev->dev, sizeof(*pctrl_desc), GFP_KERNEL);
> + if (!pctrl_desc)
> + return -ENOMEM;
> +
> + pctrl_desc->name = dev_name(&pdev->dev);
> + pctrl_desc->owner = THIS_MODULE;
> + pctrl_desc->pins = pins;
> + pctrl_desc->npins = gpio->desc->npins;
> + pctrl_desc->pctlops = &axp20x_pctrl_ops;
> + pctrl_desc->pmxops = &axp20x_pmx_ops;
The strict flag needs to be set too in order to avoid concurrent uses
of GPIO and other functions.
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 00/10] add pinmuxing support for pins in AXP209 and AXP813 PMICs Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-09-26 14:30 +0200
[PATCH v2 03/10] pinctrl: axp209: use drv_data of pinctrl_pin_desc to store pin reg Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-09-26 14:30 +0200
Re: [PATCH v2 03/10] pinctrl: axp209: use drv_data of pinctrl_pin_desc to store pin reg Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-09-26 15:10 +0200
Re: [PATCH v2 03/10] pinctrl: axp209: use drv_data of pinctrl_pin_desc to store pin reg Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-09-26 15:20 +0200
Re: [PATCH v2 03/10] pinctrl: axp209: use drv_data of pinctrl_pin_desc to store pin reg Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-09-26 15:50 +0200
[PATCH v2 04/10] pinctrl: axp209: rename everything from gpio to pctl Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-09-26 14:30 +0200
[PATCH v2 02/10] pinctrl: axp209: add pinctrl features Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-09-26 14:30 +0200
Re: [PATCH v2 02/10] pinctrl: axp209: add pinctrl features Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-09-26 15:10 +0200
Re: [PATCH v2 02/10] pinctrl: axp209: add pinctrl features Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-09-26 15:20 +0200
Re: [PATCH v2 02/10] pinctrl: axp209: add pinctrl features Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-09-26 15:30 +0200
Re: [PATCH v2 02/10] pinctrl: axp209: add pinctrl features Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-09-26 15:40 +0200
Re: [PATCH v2 02/10] pinctrl: axp209: add pinctrl features Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-09-27 11:30 +0200
csiph-web