Linux GPIO subsystem development
 help / color / mirror / Atom feed
* Re: [PATCH v3 4/6] gpio: max77620: Don't shadow error code of platform_get_irq()
From: Laxman Dewangan @ 2020-07-09 15:01 UTC (permalink / raw)
  To: Dmitry Osipenko, Thierry Reding, Jonathan Hunter,
	Bartosz Golaszewski, Linus Walleij, Andy Shevchenko
  Cc: linux-tegra, linux-gpio, linux-kernel
In-Reply-To: <20200708202355.28507-5-digetx@gmail.com>



On Thursday 09 July 2020 01:53 AM, Dmitry Osipenko wrote:
> External email: Use caution opening links or attachments
>
>
> The platform_get_irq() returns a positive interrupt number on success and
> negative error code on failure (zero shouldn't ever happen in practice, it
> would produce a noisy warning). Hence let's return the error code directly
> instead of overriding it with -ENODEV.
>
> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>


Looks good to me.
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>

^ permalink raw reply

* Re: [PATCH v3 5/6] gpio: max77620: Use irqchip template
From: Laxman Dewangan @ 2020-07-09 15:03 UTC (permalink / raw)
  To: Dmitry Osipenko, Thierry Reding, Jonathan Hunter,
	Bartosz Golaszewski, Linus Walleij, Andy Shevchenko
  Cc: linux-tegra, linux-gpio, linux-kernel
In-Reply-To: <20200708202355.28507-6-digetx@gmail.com>



On Thursday 09 July 2020 01:53 AM, Dmitry Osipenko wrote:
> External email: Use caution opening links or attachments
>
>
> This change addresses one of the GPIO-core TODOs for the MAX77620 driver
> which requires modern drivers to use the irqchip template. Instead of
> using the GPIO's irqchip-helpers for creating the IRQ domain, the
> gpio_irq_chip structure is now filled by the driver itself and then
> gpiochip_add_data() takes care of instantiating the IRQ domain for us.
>
> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>


Looks good to me.
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>


^ permalink raw reply

* Re: [PATCH v3 6/6] gpio: max77620: Initialize hardware state of interrupts
From: Laxman Dewangan @ 2020-07-09 15:03 UTC (permalink / raw)
  To: Dmitry Osipenko, Thierry Reding, Jonathan Hunter,
	Bartosz Golaszewski, Linus Walleij, Andy Shevchenko
  Cc: linux-tegra, linux-gpio, linux-kernel
In-Reply-To: <20200708202355.28507-7-digetx@gmail.com>



On Thursday 09 July 2020 01:53 AM, Dmitry Osipenko wrote:
> External email: Use caution opening links or attachments
>
>
> I noticed on Nexus 7 that after rebooting from downstream kernel to
> upstream, the GPIO interrupt is triggering non-stop despite interrupts
> being disabled for all of GPIOs. This happens because Nexus 7 uses a
> soft-reboot, meaning that bootloader should take care of resetting
> hardware, but the bootloader doesn't do it well. As a result, GPIO
> interrupt may be left ON at a boot time. Let's mask all GPIO interrupts
> at the driver's initialization time in order to resolve the issue.
>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>


Looks good to me.
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>


^ permalink raw reply

* Re: [PATCH v6 1/2] gpio: add GPO driver for PCA9570
From: Andy Shevchenko @ 2020-07-09 15:37 UTC (permalink / raw)
  To: Sungbo Eo
  Cc: Linus Walleij, Bartosz Golaszewski, Michael Walle,
	Linux Kernel Mailing List, open list:GPIO SUBSYSTEM
In-Reply-To: <20200709134829.216393-1-mans0n@gorani.run>

On Thu, Jul 9, 2020 at 4:48 PM Sungbo Eo <mans0n@gorani.run> wrote:
>
> NXP PCA9570 is a 4-bit I2C GPO expander without interrupt functionality.
> Its ports are controlled only by a data byte without register address.
>

LGTM, thanks!

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Datasheet: https://www.nxp.com/docs/en/data-sheet/PCA9570.pdf
> Signed-off-by: Sungbo Eo <mans0n@gorani.run>
> ---
> v6:
> * removed client
> * re-added mutex
> * removed template_chip
>
> v5:
> * amended the commit message
> * removed unnecessary castings
> * added data to of_match_table
>
> v4:
> * removed ->direction_input() and ->direction_output()
>   (Seems unnecessary to me)
> * removed ->set_multiple()
>   (I'm not sure this implementation is really correct)
> * added ->get()
>   (DS says we can read the status from the device)
> * read current status during probe
>
> v3:
> * remove mutex
> * rename buffer to out
> * simplify return statements
> * replace ->probe() to ->probe_new()
> * move ngpio to driver_data
>   (PCA9571 is 8-bit so I thought making ngpio configurable is a good idea)
>
> v2:
> * move the direction functions below the set functions
> * use devm_gpiochip_add_data() and remove the remove callback
>
> v1:
> Tested in kernel 5.4 on an ipq40xx platform.
>
> This is my first time submitting a whole driver patch, and I'm not really
> familiar with this PCA expander series.
> Please let me know how I can improve this patch further.
>
> FYI there's an unmerged patch for this chip.
> http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2017-May/105602.html
> I don't have PCA9571 either so I didn't add support for it.
> ---
>  drivers/gpio/Kconfig        |   8 ++
>  drivers/gpio/Makefile       |   1 +
>  drivers/gpio/gpio-pca9570.c | 146 ++++++++++++++++++++++++++++++++++++
>  3 files changed, 155 insertions(+)
>  create mode 100644 drivers/gpio/gpio-pca9570.c
>
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index c6b5c65c8405..d10dcb81b841 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -962,6 +962,14 @@ config GPIO_PCA953X_IRQ
>           Say yes here to enable the pca953x to be used as an interrupt
>           controller. It requires the driver to be built in the kernel.
>
> +config GPIO_PCA9570
> +       tristate "PCA9570 4-Bit I2C GPO expander"
> +       help
> +         Say yes here to enable the GPO driver for the NXP PCA9570 chip.
> +
> +         To compile this driver as a module, choose M here: the module will
> +         be called gpio-pca9570.
> +
>  config GPIO_PCF857X
>         tristate "PCF857x, PCA{85,96}7x, and MAX732[89] I2C GPIO expanders"
>         select GPIOLIB_IRQCHIP
> diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
> index 1e4894e0bf0f..33cb40c28a61 100644
> --- a/drivers/gpio/Makefile
> +++ b/drivers/gpio/Makefile
> @@ -110,6 +110,7 @@ obj-$(CONFIG_GPIO_OCTEON)           += gpio-octeon.o
>  obj-$(CONFIG_GPIO_OMAP)                        += gpio-omap.o
>  obj-$(CONFIG_GPIO_PALMAS)              += gpio-palmas.o
>  obj-$(CONFIG_GPIO_PCA953X)             += gpio-pca953x.o
> +obj-$(CONFIG_GPIO_PCA9570)             += gpio-pca9570.o
>  obj-$(CONFIG_GPIO_PCF857X)             += gpio-pcf857x.o
>  obj-$(CONFIG_GPIO_PCH)                 += gpio-pch.o
>  obj-$(CONFIG_GPIO_PCIE_IDIO_24)                += gpio-pcie-idio-24.o
> diff --git a/drivers/gpio/gpio-pca9570.c b/drivers/gpio/gpio-pca9570.c
> new file mode 100644
> index 000000000000..cb2b2f735c15
> --- /dev/null
> +++ b/drivers/gpio/gpio-pca9570.c
> @@ -0,0 +1,146 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Driver for PCA9570 I2C GPO expander
> + *
> + * Copyright (C) 2020 Sungbo Eo <mans0n@gorani.run>
> + *
> + * Based on gpio-tpic2810.c
> + * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
> + *     Andrew F. Davis <afd@ti.com>
> + */
> +
> +#include <linux/gpio/driver.h>
> +#include <linux/i2c.h>
> +#include <linux/module.h>
> +#include <linux/mutex.h>
> +#include <linux/property.h>
> +
> +/**
> + * struct pca9570 - GPIO driver data
> + * @chip: GPIO controller chip
> + * @lock: Protects write sequences
> + * @out: Buffer for device register
> + */
> +struct pca9570 {
> +       struct gpio_chip chip;
> +       struct mutex lock;
> +       u8 out;
> +};
> +
> +static int pca9570_read(struct pca9570 *gpio, u8 *value)
> +{
> +       struct i2c_client *client = to_i2c_client(gpio->chip.parent);
> +       int ret;
> +
> +       ret = i2c_smbus_read_byte(client);
> +       if (ret < 0)
> +               return ret;
> +
> +       *value = ret;
> +       return 0;
> +}
> +
> +static int pca9570_write(struct pca9570 *gpio, u8 value)
> +{
> +       struct i2c_client *client = to_i2c_client(gpio->chip.parent);
> +
> +       return i2c_smbus_write_byte(client, value);
> +}
> +
> +static int pca9570_get_direction(struct gpio_chip *chip,
> +                                unsigned offset)
> +{
> +       /* This device always output */
> +       return GPIO_LINE_DIRECTION_OUT;
> +}
> +
> +static int pca9570_get(struct gpio_chip *chip, unsigned offset)
> +{
> +       struct pca9570 *gpio = gpiochip_get_data(chip);
> +       u8 buffer;
> +       int ret;
> +
> +       ret = pca9570_read(gpio, &buffer);
> +       if (ret)
> +               return ret;
> +
> +       return !!(buffer & BIT(offset));
> +}
> +
> +static void pca9570_set(struct gpio_chip *chip, unsigned offset, int value)
> +{
> +       struct pca9570 *gpio = gpiochip_get_data(chip);
> +       u8 buffer;
> +       int ret;
> +
> +       mutex_lock(&gpio->lock);
> +
> +       buffer = gpio->out;
> +       if (value)
> +               buffer |= BIT(offset);
> +       else
> +               buffer &= ~BIT(offset);
> +
> +       ret = pca9570_write(gpio, buffer);
> +       if (ret)
> +               goto out;
> +
> +       gpio->out = buffer;
> +
> +out:
> +       mutex_unlock(&gpio->lock);
> +}
> +
> +static int pca9570_probe(struct i2c_client *client)
> +{
> +       struct pca9570 *gpio;
> +
> +       gpio = devm_kzalloc(&client->dev, sizeof(*gpio), GFP_KERNEL);
> +       if (!gpio)
> +               return -ENOMEM;
> +
> +       gpio->chip.label = client->name;
> +       gpio->chip.parent = &client->dev;
> +       gpio->chip.owner = THIS_MODULE;
> +       gpio->chip.get_direction = pca9570_get_direction;
> +       gpio->chip.get = pca9570_get;
> +       gpio->chip.set = pca9570_set;
> +       gpio->chip.base = -1;
> +       gpio->chip.ngpio = (uintptr_t)device_get_match_data(&client->dev);
> +       gpio->chip.can_sleep = true;
> +
> +       mutex_init(&gpio->lock);
> +
> +       /* Read the current output level */
> +       pca9570_read(gpio, &gpio->out);
> +
> +       i2c_set_clientdata(client, gpio);
> +
> +       return devm_gpiochip_add_data(&client->dev, &gpio->chip, gpio);
> +}
> +
> +static const struct i2c_device_id pca9570_id_table[] = {
> +       { "pca9570", 4 },
> +       { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(i2c, pca9570_id_table);
> +
> +static const struct of_device_id pca9570_of_match_table[] = {
> +       { .compatible = "nxp,pca9570", .data = (void *)4 },
> +       { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, pca9570_of_match_table);
> +
> +static struct i2c_driver pca9570_driver = {
> +       .driver = {
> +               .name = "pca9570",
> +               .of_match_table = pca9570_of_match_table,
> +       },
> +       .probe_new = pca9570_probe,
> +       .id_table = pca9570_id_table,
> +};
> +module_i2c_driver(pca9570_driver);
> +
> +MODULE_AUTHOR("Sungbo Eo <mans0n@gorani.run>");
> +MODULE_DESCRIPTION("GPIO expander driver for PCA9570");
> +MODULE_LICENSE("GPL v2");
> --
> 2.27.0
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply

* Re: [PATCH] gpiolib: Add some warn print for easier to debug
From: Andy Shevchenko @ 2020-07-09 15:40 UTC (permalink / raw)
  To: Bartosz Golaszewski; +Cc: mnlife, Linus Walleij, linux-gpio
In-Reply-To: <CAMpxmJWDiF+x5YzYcgcQgH9C6U3rpZLex19UGFAAj7Dh-+BA=Q@mail.gmail.com>

On Thu, Jul 9, 2020 at 4:27 PM Bartosz Golaszewski
<bgolaszewski@baylibre.com> wrote:
> On Tue, Jul 7, 2020 at 5:09 PM mnlife <mnlife@foxmail.com> wrote:

...

> > +               if (size >= sizeof(prop_name))
> > +                       dev_warn(dev, "prop_name %s is truncated with size %d\n",
> > +                                prop_name, size);

> To me this isn't a reason for a warning. If anything, this should
> simply be documented (if it's not already).

+1. This can only be useful in the development cycle.

CONFIG_DEBUG_GPIO easily catches this as well.


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply

* Re: [PATCH v3 2/6] gpio: max77620: Fix missing release of interrupt
From: Dmitry Osipenko @ 2020-07-09 16:36 UTC (permalink / raw)
  To: Laxman Dewangan, Thierry Reding, Jonathan Hunter,
	Bartosz Golaszewski, Linus Walleij, Andy Shevchenko
  Cc: linux-tegra, linux-gpio, linux-kernel
In-Reply-To: <80f4d1ff-8096-9060-3cf0-a59448866c40@nvidia.com>

09.07.2020 17:57, Laxman Dewangan пишет:
> 
> 
> On Thursday 09 July 2020 01:53 AM, Dmitry Osipenko wrote:
>> External email: Use caution opening links or attachments
>>
>>
>> The requested interrupt is never released by the driver. Fix this by
>> using the resource-managed variant of request_threaded_irq().
>>
>> Fixes: ab3dd9cc24d4 ("gpio: max77620: Fix interrupt handling")
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> 
> 
> Looks good to me.
> Acked-by: Laxman Dewangan <ldewangan@nvidia.com>

Hello, Laxman! Thank you very much for taking a look at this series!

I missed to add the stable tag to this patch, so will prepare a v4 with
the corrected tag. I'll also add yours acks and Andy's r-bs to the
patches. Thanks!

^ permalink raw reply

* Re: [PATCH v3 04/16] dt-bindings: pinctrl: sunxi: make gpio banks supplies required
From: Rob Herring @ 2020-07-09 16:52 UTC (permalink / raw)
  To: Frank Lee
  Cc: gregory.clement, megous, anarsoul, tiny.windzz, sboyd, jason,
	robh+dt, maz, wens, lee.jones, mripard, amit.kucheria, linux-i2c,
	icenowy, linux-gpio, srinivas.kandagatla, linux-pm,
	daniel.lezcano, liyong, huangshuosheng, linus.walleij, devicetree,
	linux-clk, bage, linux-arm-kernel, mturquette, rui.zhang, tglx,
	clabbe, linux-kernel, p.zabel, stefan
In-Reply-To: <20200708071942.22595-5-frank@allwinnertech.com>

On Wed, 08 Jul 2020 15:19:30 +0800, Frank Lee wrote:
> Since we don't really have to care about the existing DT for boards,
> it would be great to make the gpio banks supplies required.
> 
> Signed-off-by: Frank Lee <frank@allwinnertech.com>
> ---
>  .../devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml         | 1 +
>  1 file changed, 1 insertion(+)
> 


My bot found errors running 'make dt_binding_check' on your patch:

/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml: required:2: '^vcc-p[a-hlm]-supply$' does not match '^([a-zA-Z#][a-zA-Z0-9,+\\-._@]{0,63}|\\$nodename)$'
Documentation/devicetree/bindings/Makefile:20: recipe for target 'Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.example.dts' failed
make[1]: *** [Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.example.dts] Error 1
make[1]: *** Waiting for unfinished jobs....
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml: ignoring, error in schema: required: 2
warning: no schema found in file: ./Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml: ignoring, error in schema: required: 2
warning: no schema found in file: ./Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml
Makefile:1347: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2


See https://patchwork.ozlabs.org/patch/1325057

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure dt-schema is up to date:

pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade

Please check and re-submit.


^ permalink raw reply

* Re: [PATCH v3 04/16] dt-bindings: pinctrl: sunxi: make gpio banks supplies required
From: Rob Herring @ 2020-07-09 16:54 UTC (permalink / raw)
  To: Frank Lee
  Cc: mripard, wens, mturquette, sboyd, gregory.clement, tglx, jason,
	maz, srinivas.kandagatla, linus.walleij, anarsoul, tiny.windzz,
	rui.zhang, daniel.lezcano, amit.kucheria, lee.jones, p.zabel,
	clabbe, icenowy, megous, stefan, bage, devicetree,
	linux-arm-kernel, linux-kernel, linux-clk, linux-i2c, linux-gpio,
	linux-pm, huangshuosheng, liyong
In-Reply-To: <20200708071942.22595-5-frank@allwinnertech.com>

On Wed, Jul 08, 2020 at 03:19:30PM +0800, Frank Lee wrote:
> Since we don't really have to care about the existing DT for boards,
> it would be great to make the gpio banks supplies required.
> 
> Signed-off-by: Frank Lee <frank@allwinnertech.com>
> ---
>  .../devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml         | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml
> index 226aba0..c30a7b7 100644
> --- a/Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml
> +++ b/Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml
> @@ -134,6 +134,7 @@ patternProperties:
>  required:
>    - "#gpio-cells"
>    - "#interrupt-cells"
> +  - "^vcc-p[a-hlm]-supply$"

Patterns aren't supported here. It's something the json-schema folks 
are working on. For now, You have to list out the specific properties.

>    - compatible
>    - reg
>    - interrupts
> -- 
> 1.9.1
> 

^ permalink raw reply

* Re: [PATCH v3 06/16] dt-bindings: nvmem: SID: add binding for A100's SID controller
From: Rob Herring @ 2020-07-09 16:54 UTC (permalink / raw)
  To: Frank Lee
  Cc: linux-gpio, amit.kucheria, linux-arm-kernel, gregory.clement,
	linux-clk, robh+dt, huangshuosheng, devicetree, daniel.lezcano,
	wens, lee.jones, clabbe, p.zabel, icenowy, tiny.windzz,
	linux-kernel, jason, liyong, linux-i2c, bage, stefan,
	linus.walleij, rui.zhang, tglx, megous, linux-pm, mripard,
	anarsoul, mturquette, srinivas.kandagatla, maz, sboyd
In-Reply-To: <20200708071942.22595-7-frank@allwinnertech.com>

On Wed, 08 Jul 2020 15:19:32 +0800, Frank Lee wrote:
> Add a binding for A100's SID controller.
> 
> Signed-off-by: Frank Lee <frank@allwinnertech.com>
> ---
>  Documentation/devicetree/bindings/nvmem/allwinner,sun4i-a10-sid.yaml | 3 +++
>  1 file changed, 3 insertions(+)
> 


My bot found errors running 'make dt_binding_check' on your patch:

/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/nvmem/allwinner,sun4i-a10-sid.yaml: properties:compatible:enum:5: {'items': [{'const': 'allwinner,sun50i-a100-sid'}, {'const': 'allwinner,sun50i-a64-sid'}]} is not of type 'string'
Documentation/devicetree/bindings/Makefile:20: recipe for target 'Documentation/devicetree/bindings/nvmem/allwinner,sun4i-a10-sid.example.dts' failed
make[1]: *** [Documentation/devicetree/bindings/nvmem/allwinner,sun4i-a10-sid.example.dts] Error 1
make[1]: *** Waiting for unfinished jobs....
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/nvmem/allwinner,sun4i-a10-sid.yaml: ignoring, error in schema: properties: compatible: enum: 5
warning: no schema found in file: ./Documentation/devicetree/bindings/nvmem/allwinner,sun4i-a10-sid.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/nvmem/allwinner,sun4i-a10-sid.yaml: ignoring, error in schema: properties: compatible: enum: 5
warning: no schema found in file: ./Documentation/devicetree/bindings/nvmem/allwinner,sun4i-a10-sid.yaml
Makefile:1347: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2


See https://patchwork.ozlabs.org/patch/1325053

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure dt-schema is up to date:

pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade

Please check and re-submit.


^ permalink raw reply

* [PATCH v4 0/6] Improvements for MAX77620 GPIO driver
From: Dmitry Osipenko @ 2020-07-09 17:11 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Bartosz Golaszewski, Linus Walleij, Andy Shevchenko
  Cc: linux-tegra, linux-gpio, linux-kernel

Hello!

This series addresses a problem that I discovered on Nexus 7 device where
GPIO interrupts may be left enabled after bootloader and the driver isn't
prepared to this. It also makes a small improvements to the code, fixes the
non-released interrupt bug and converts driver to use irqchip template.

Changelog:

v4: - Added stable-tag to the patch "Fix missing release of interrupt".

    - Added acks and r-bs from Laxman Dewangan and Andy Shevchenko.

v3: - Addressed review comment that were made by Andy Shevchenko to v2:

        - Improved the commit message of the "Initialize hardware state of
          interrupts" patch.

        - Added these new patches:

           gpio: max77620: Don't set of_node
           gpio: max77620: Don't shadow error code of platform_get_irq()
           gpio: max77620: Use irqchip template

    - Added "Fix missing release of interrupt" patch.

v2: - Addressed review comment that were made by Andy Shevchenko to v1:

        - Generic init_hw() callback is used now for resetting interrupts.

        - These v1 patches are dropped:

           gpio: max77620: Replace interrupt-enable array with bitmap
           gpio: max77620: Don't handle disabled interrupts
           gpio: max77620: Move variable declaration

Dmitry Osipenko (6):
  gpio: max77620: Replace 8 with MAX77620_GPIO_NR
  gpio: max77620: Fix missing release of interrupt
  gpio: max77620: Don't set of_node
  gpio: max77620: Don't shadow error code of platform_get_irq()
  gpio: max77620: Use irqchip template
  gpio: max77620: Initialize hardware state of interrupts

 drivers/gpio/gpio-max77620.c | 65 ++++++++++++++++++++++++------------
 1 file changed, 44 insertions(+), 21 deletions(-)

-- 
2.26.0


^ permalink raw reply

* [PATCH v4 6/6] gpio: max77620: Initialize hardware state of interrupts
From: Dmitry Osipenko @ 2020-07-09 17:12 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Bartosz Golaszewski, Linus Walleij, Andy Shevchenko
  Cc: linux-tegra, linux-gpio, linux-kernel
In-Reply-To: <20200709171203.12950-1-digetx@gmail.com>

I noticed on Nexus 7 that after rebooting from downstream kernel to
upstream, the GPIO interrupt is triggering non-stop despite interrupts
being disabled for all of GPIOs. This happens because Nexus 7 uses a
soft-reboot, meaning that bootloader should take care of resetting
hardware, but the bootloader doesn't do it well. As a result, GPIO
interrupt may be left ON at a boot time. Let's mask all GPIO interrupts
at the driver's initialization time in order to resolve the issue.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/gpio/gpio-max77620.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-max77620.c
index 6c516aa7732d..e090979659eb 100644
--- a/drivers/gpio/gpio-max77620.c
+++ b/drivers/gpio/gpio-max77620.c
@@ -260,6 +260,30 @@ static int max77620_gpio_set_config(struct gpio_chip *gc, unsigned int offset,
 	return -ENOTSUPP;
 }
 
+static int max77620_gpio_irq_init_hw(struct gpio_chip *gc)
+{
+	struct max77620_gpio *gpio = gpiochip_get_data(gc);
+	unsigned int i;
+	int err;
+
+	/*
+	 * GPIO interrupts may be left ON after bootloader, hence let's
+	 * pre-initialize hardware to the expected state by disabling all
+	 * the interrupts.
+	 */
+	for (i = 0; i < MAX77620_GPIO_NR; i++) {
+		err = regmap_update_bits(gpio->rmap, GPIO_REG_ADDR(i),
+					 MAX77620_CNFG_GPIO_INT_MASK, 0);
+		if (err < 0) {
+			dev_err(gpio->dev,
+				"failed to disable interrupt: %d\n", err);
+			return err;
+		}
+	}
+
+	return 0;
+}
+
 static int max77620_gpio_probe(struct platform_device *pdev)
 {
 	struct max77620_chip *chip =  dev_get_drvdata(pdev->dev.parent);
@@ -295,6 +319,7 @@ static int max77620_gpio_probe(struct platform_device *pdev)
 	mgpio->gpio_chip.irq.chip = &max77620_gpio_irqchip;
 	mgpio->gpio_chip.irq.default_type = IRQ_TYPE_NONE;
 	mgpio->gpio_chip.irq.handler = handle_edge_irq;
+	mgpio->gpio_chip.irq.init_hw = max77620_gpio_irq_init_hw,
 	mgpio->gpio_chip.irq.threaded = true;
 
 	platform_set_drvdata(pdev, mgpio);
-- 
2.26.0


^ permalink raw reply related

* [PATCH v4 5/6] gpio: max77620: Use irqchip template
From: Dmitry Osipenko @ 2020-07-09 17:12 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Bartosz Golaszewski, Linus Walleij, Andy Shevchenko
  Cc: linux-tegra, linux-gpio, linux-kernel
In-Reply-To: <20200709171203.12950-1-digetx@gmail.com>

This change addresses one of the GPIO-core TODOs for the MAX77620 driver
which requires modern drivers to use the irqchip template. Instead of
using the GPIO's irqchip-helpers for creating the IRQ domain, the
gpio_irq_chip structure is now filled by the driver itself and then
gpiochip_add_data() takes care of instantiating the IRQ domain for us.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/gpio/gpio-max77620.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-max77620.c
index 9121d2507f60..6c516aa7732d 100644
--- a/drivers/gpio/gpio-max77620.c
+++ b/drivers/gpio/gpio-max77620.c
@@ -277,6 +277,7 @@ static int max77620_gpio_probe(struct platform_device *pdev)
 	if (!mgpio)
 		return -ENOMEM;
 
+	mutex_init(&mgpio->buslock);
 	mgpio->rmap = chip->rmap;
 	mgpio->dev = &pdev->dev;
 
@@ -291,6 +292,11 @@ static int max77620_gpio_probe(struct platform_device *pdev)
 	mgpio->gpio_chip.can_sleep = 1;
 	mgpio->gpio_chip.base = -1;
 
+	mgpio->gpio_chip.irq.chip = &max77620_gpio_irqchip;
+	mgpio->gpio_chip.irq.default_type = IRQ_TYPE_NONE;
+	mgpio->gpio_chip.irq.handler = handle_edge_irq;
+	mgpio->gpio_chip.irq.threaded = true;
+
 	platform_set_drvdata(pdev, mgpio);
 
 	ret = devm_gpiochip_add_data(&pdev->dev, &mgpio->gpio_chip, mgpio);
@@ -299,11 +305,6 @@ static int max77620_gpio_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	mutex_init(&mgpio->buslock);
-
-	gpiochip_irqchip_add_nested(&mgpio->gpio_chip, &max77620_gpio_irqchip,
-				    0, handle_edge_irq, IRQ_TYPE_NONE);
-
 	ret = devm_request_threaded_irq(&pdev->dev, gpio_irq, NULL,
 					max77620_gpio_irqhandler, IRQF_ONESHOT,
 					"max77620-gpio", mgpio);
@@ -312,9 +313,6 @@ static int max77620_gpio_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	gpiochip_set_nested_irqchip(&mgpio->gpio_chip, &max77620_gpio_irqchip,
-				    gpio_irq);
-
 	return 0;
 }
 
-- 
2.26.0


^ permalink raw reply related

* [PATCH v4 4/6] gpio: max77620: Don't shadow error code of platform_get_irq()
From: Dmitry Osipenko @ 2020-07-09 17:12 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Bartosz Golaszewski, Linus Walleij, Andy Shevchenko
  Cc: linux-tegra, linux-gpio, linux-kernel
In-Reply-To: <20200709171203.12950-1-digetx@gmail.com>

The platform_get_irq() returns a positive interrupt number on success and
negative error code on failure (zero shouldn't ever happen in practice, it
would produce a noisy warning). Hence let's return the error code directly
instead of overriding it with -ENODEV.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/gpio/gpio-max77620.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-max77620.c
index 39d431da2dbc..9121d2507f60 100644
--- a/drivers/gpio/gpio-max77620.c
+++ b/drivers/gpio/gpio-max77620.c
@@ -264,12 +264,14 @@ static int max77620_gpio_probe(struct platform_device *pdev)
 {
 	struct max77620_chip *chip =  dev_get_drvdata(pdev->dev.parent);
 	struct max77620_gpio *mgpio;
-	int gpio_irq;
+	unsigned int gpio_irq;
 	int ret;
 
-	gpio_irq = platform_get_irq(pdev, 0);
-	if (gpio_irq <= 0)
-		return -ENODEV;
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		return ret;
+
+	gpio_irq = ret;
 
 	mgpio = devm_kzalloc(&pdev->dev, sizeof(*mgpio), GFP_KERNEL);
 	if (!mgpio)
-- 
2.26.0


^ permalink raw reply related

* [PATCH v4 3/6] gpio: max77620: Don't set of_node
From: Dmitry Osipenko @ 2020-07-09 17:12 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Bartosz Golaszewski, Linus Walleij, Andy Shevchenko
  Cc: linux-tegra, linux-gpio, linux-kernel
In-Reply-To: <20200709171203.12950-1-digetx@gmail.com>

The gpiochip_add_data() takes care of setting the of_node to the parent's
device of_node, hence there is no need to do it manually in the driver's
code. This patch corrects the parent's device pointer and removes the
unnecessary setting of the of_node.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/gpio/gpio-max77620.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-max77620.c
index 7f7e8d4bf0d3..39d431da2dbc 100644
--- a/drivers/gpio/gpio-max77620.c
+++ b/drivers/gpio/gpio-max77620.c
@@ -279,7 +279,7 @@ static int max77620_gpio_probe(struct platform_device *pdev)
 	mgpio->dev = &pdev->dev;
 
 	mgpio->gpio_chip.label = pdev->name;
-	mgpio->gpio_chip.parent = &pdev->dev;
+	mgpio->gpio_chip.parent = pdev->dev.parent;
 	mgpio->gpio_chip.direction_input = max77620_gpio_dir_input;
 	mgpio->gpio_chip.get = max77620_gpio_get;
 	mgpio->gpio_chip.direction_output = max77620_gpio_dir_output;
@@ -288,9 +288,6 @@ static int max77620_gpio_probe(struct platform_device *pdev)
 	mgpio->gpio_chip.ngpio = MAX77620_GPIO_NR;
 	mgpio->gpio_chip.can_sleep = 1;
 	mgpio->gpio_chip.base = -1;
-#ifdef CONFIG_OF_GPIO
-	mgpio->gpio_chip.of_node = pdev->dev.parent->of_node;
-#endif
 
 	platform_set_drvdata(pdev, mgpio);
 
-- 
2.26.0


^ permalink raw reply related

* [PATCH v4 2/6] gpio: max77620: Fix missing release of interrupt
From: Dmitry Osipenko @ 2020-07-09 17:11 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Bartosz Golaszewski, Linus Walleij, Andy Shevchenko
  Cc: linux-tegra, linux-gpio, linux-kernel
In-Reply-To: <20200709171203.12950-1-digetx@gmail.com>

The requested interrupt is never released by the driver. Fix this by
using the resource-managed variant of request_threaded_irq().

Fixes: ab3dd9cc24d4 ("gpio: max77620: Fix interrupt handling")
Cc: <stable@vger.kernel.org> # 5.5+
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/gpio/gpio-max77620.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-max77620.c
index 4c0c9ec2587d..7f7e8d4bf0d3 100644
--- a/drivers/gpio/gpio-max77620.c
+++ b/drivers/gpio/gpio-max77620.c
@@ -305,8 +305,9 @@ static int max77620_gpio_probe(struct platform_device *pdev)
 	gpiochip_irqchip_add_nested(&mgpio->gpio_chip, &max77620_gpio_irqchip,
 				    0, handle_edge_irq, IRQ_TYPE_NONE);
 
-	ret = request_threaded_irq(gpio_irq, NULL, max77620_gpio_irqhandler,
-				   IRQF_ONESHOT, "max77620-gpio", mgpio);
+	ret = devm_request_threaded_irq(&pdev->dev, gpio_irq, NULL,
+					max77620_gpio_irqhandler, IRQF_ONESHOT,
+					"max77620-gpio", mgpio);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "failed to request IRQ: %d\n", ret);
 		return ret;
-- 
2.26.0


^ permalink raw reply related

* [PATCH v4 1/6] gpio: max77620: Replace 8 with MAX77620_GPIO_NR
From: Dmitry Osipenko @ 2020-07-09 17:11 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Bartosz Golaszewski, Linus Walleij, Andy Shevchenko
  Cc: linux-tegra, linux-gpio, linux-kernel
In-Reply-To: <20200709171203.12950-1-digetx@gmail.com>

The MAX77620_GPIO_NR enum value represents the total number of GPIOs,
let's use it instead of a raw value in order to improve the code's
readability a tad.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/gpio/gpio-max77620.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-max77620.c
index 313bd02dd893..4c0c9ec2587d 100644
--- a/drivers/gpio/gpio-max77620.c
+++ b/drivers/gpio/gpio-max77620.c
@@ -19,8 +19,8 @@ struct max77620_gpio {
 	struct regmap		*rmap;
 	struct device		*dev;
 	struct mutex		buslock; /* irq_bus_lock */
-	unsigned int		irq_type[8];
-	bool			irq_enabled[8];
+	unsigned int		irq_type[MAX77620_GPIO_NR];
+	bool			irq_enabled[MAX77620_GPIO_NR];
 };
 
 static irqreturn_t max77620_gpio_irqhandler(int irq, void *data)
@@ -38,7 +38,7 @@ static irqreturn_t max77620_gpio_irqhandler(int irq, void *data)
 
 	pending = value;
 
-	for_each_set_bit(offset, &pending, 8) {
+	for_each_set_bit(offset, &pending, MAX77620_GPIO_NR) {
 		unsigned int virq;
 
 		virq = irq_find_mapping(gpio->gpio_chip.irq.domain, offset);
-- 
2.26.0


^ permalink raw reply related

* Re: [PATCH v3 04/16] dt-bindings: pinctrl: sunxi: make gpio banks supplies required
From: Ondřej Jirman @ 2020-07-09 17:17 UTC (permalink / raw)
  To: Frank Lee
  Cc: robh+dt, mripard, wens, mturquette, sboyd, gregory.clement, tglx,
	jason, maz, srinivas.kandagatla, linus.walleij, anarsoul,
	tiny.windzz, rui.zhang, daniel.lezcano, amit.kucheria, lee.jones,
	p.zabel, clabbe, icenowy, stefan, bage, devicetree, linux-pm,
	liyong, linux-kernel, linux-gpio, huangshuosheng, linux-i2c,
	linux-clk, linux-arm-kernel
In-Reply-To: <20200708071942.22595-5-frank@allwinnertech.com>

Hello,

On Wed, Jul 08, 2020 at 03:19:30PM +0800, Frank Lee wrote:
> Since we don't really have to care about the existing DT for boards,
> it would be great to make the gpio banks supplies required.

What if the borad doesn't use one of the banks? How would
I describe such a board if defining supplies for all banks
is required?

regards,
	o.

> Signed-off-by: Frank Lee <frank@allwinnertech.com>
> ---
>  .../devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml         | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml
> index 226aba0..c30a7b7 100644
> --- a/Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml
> +++ b/Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml
> @@ -134,6 +134,7 @@ patternProperties:
>  required:
>    - "#gpio-cells"
>    - "#interrupt-cells"
> +  - "^vcc-p[a-hlm]-supply$"
>    - compatible
>    - reg
>    - interrupts
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [gpio:gpiochip-no-driver-h 4/4] drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c:91:6: warning: variable 'err' is uninitialized when used here
From: kernel test robot @ 2020-07-09 17:19 UTC (permalink / raw)
  To: Linus Walleij; +Cc: kbuild-all, clang-built-linux, linux-gpio

[-- Attachment #1: Type: text/plain, Size: 7540 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git gpiochip-no-driver-h
head:   76089802fe1b5db2ac8ad21da3b065f2513000eb
commit: 76089802fe1b5db2ac8ad21da3b065f2513000eb [4/4] unremove
config: mips-randconfig-r012-20200709 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 02946de3802d3bc65bc9f2eb9b8d4969b5a7add8)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        git checkout 76089802fe1b5db2ac8ad21da3b065f2513000eb
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c:91:6: warning: variable 'err' is uninitialized when used here [-Wuninitialized]
                             err);
                             ^~~
   include/net/cfg80211.h:7837:35: note: expanded from macro 'wiphy_err'
           dev_err(&(wiphy)->dev, format, ##args)
                                            ^~~~
   include/linux/dev_printk.h:104:32: note: expanded from macro 'dev_err'
           _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                         ^~~~~~~~~~~
   drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c:53:12: note: initialize the variable 'err' to silence this warning
           int i, err;
                     ^
                      = 0
   1 warning generated.

vim +/err +91 drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c

cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  50  
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  51  int brcms_led_register(struct brcms_info *wl)
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  52  {
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  53  	int i, err;
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  54  	struct brcms_led *radio_led = &wl->radio_led;
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  55  	/* get CC core */
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  56  	struct bcma_drv_cc *cc_drv  = &wl->wlc->hw->d11core->bus->drv_cc;
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  57  	struct gpio_chip *bcma_gpio = &cc_drv->gpio;
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  58  	struct ssb_sprom *sprom = &wl->wlc->hw->d11core->bus->sprom;
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  59  	u8 *leds[] = { &sprom->gpio0,
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  60  		&sprom->gpio1,
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  61  		&sprom->gpio2,
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  62  		&sprom->gpio3 };
bac167c2b9d351 drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c Linus Walleij 2020-07-06  63  	int hwnum = -1;
bac167c2b9d351 drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c Linus Walleij 2020-07-06  64  	enum gpio_lookup_flags lflags = GPIO_ACTIVE_HIGH;
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  65  
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  66  	if (!bcma_gpio || !gpio_is_valid(bcma_gpio->base))
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  67  		return -ENODEV;
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  68  
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  69  	/* find radio enabled LED */
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  70  	for (i = 0; i < BRCMS_LED_NO; i++) {
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  71  		u8 led = *leds[i];
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  72  		if ((led & BRCMS_LED_BEH_MASK) == BRCMS_LED_RADIO) {
bac167c2b9d351 drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c Linus Walleij 2020-07-06  73  			hwnum = i;
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  74  			if (led & BRCMS_LED_AL_MASK)
bac167c2b9d351 drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c Linus Walleij 2020-07-06  75  				lflags = GPIO_ACTIVE_LOW;
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  76  			break;
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  77  		}
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  78  	}
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  79  
bac167c2b9d351 drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c Linus Walleij 2020-07-06  80  	/* No LED, bail out */
bac167c2b9d351 drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c Linus Walleij 2020-07-06  81  	if (hwnum == -1)
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  82  		return -ENODEV;
cd864522b349cf drivers/net/wireless/brcm80211/brcmsmac/led.c          Piotr Haber   2013-03-03  83  
bac167c2b9d351 drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c Linus Walleij 2020-07-06  84  	/* Try to obtain this LED GPIO line */
bac167c2b9d351 drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c Linus Walleij 2020-07-06  85  	radio_led->gpiod = gpiochip_request_own_desc(bcma_gpio, hwnum,
bac167c2b9d351 drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c Linus Walleij 2020-07-06  86  						     "radio on", lflags,
bac167c2b9d351 drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c Linus Walleij 2020-07-06  87  						     GPIOD_OUT_LOW);
bac167c2b9d351 drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c Linus Walleij 2020-07-06  88  
bac167c2b9d351 drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c Linus Walleij 2020-07-06  89  	if (IS_ERR(radio_led->gpiod)) {
bac167c2b9d351 drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c Linus Walleij 2020-07-06  90  		wiphy_err(wl->wiphy, "requesting led GPIO failed (err: %d)\n",
bac167c2b9d351 drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c Linus Walleij 2020-07-06 @91  			  err);

:::::: The code at line 91 was first introduced by commit
:::::: bac167c2b9d351703c4f769f9feabfae89bac789 brcm80211: brcmsmac: Move LEDs to GPIO descriptors

:::::: TO: Linus Walleij <linus.walleij@linaro.org>
:::::: CC: Linus Walleij <linus.walleij@linaro.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30265 bytes --]

^ permalink raw reply

* [RFC] gpio-omap: handle bias flags
From: Drew Fustini @ 2020-07-09 17:30 UTC (permalink / raw)
  To: Tony Lindgren, Haojian Zhuang, Linus Walleij, linux-omap,
	linux-gpio
  Cc: Jason Kridner, Robert Nelson

Tony - what do you think of this approach?

I have added this in arch/arm/boot/dts/am335x-pocketbeagle.dts to
describe the pins which will be gpio lines accessed by userspace
through gpiod ioctl() calls:

&am33xx_pinmux {

	pinctrl-names = "default";
	pinctrl-0 =   < &gpio_pins >;

	gpio_pins: pinmux-gpio-pins {
		/* MUX_MODE7 is gpio mode */
		pinctrl-single,pins = <
			/* PIN 95 and PIN 94 */
			AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_INPUT, MUX_MODE7)
			AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT, MUX_MODE7)
			/* PIN 100 */
			AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKX, PIN_INPUT, MUX_MODE7)
			/* PIN 18 */
			AM33XX_PADCONF(AM335X_PIN_GPMC_A2, PIN_INPUT, MUX_MODE7)
		>;
		pinctrl-single,bias-pullup   = < 8 16  8 24>;
		pinctrl-single,bias-pulldown = < 8  0  8 24>;
	};

The "pinctrl-single,bias-pullup" and "pinctrl-single,bias-pulldown"
pinconf properties are set for the gpio_pins pin group.  The input
value 0x8 causes both to be inactive but still added to the
PIN_MAP_TYPE_CONFIGS_GROUP pinctrl map.  This is necessary for
pcs_pinconf_set() to be able to be able to set the bias config.

For AM335x, the pin conf register has the format [0]:

bit	attribute      value
  6	slew           { 0: fast, 1: slow }
  5     rx_active      { 0: rx disable, 1: rx enabled }
  4     pu_typesel     { 0: pulldown select, 1: pullup select }
  3     puden          { 0: pud enable, 1: disabled }
  2     mode           3 bits to selec mode 0 to 7
  1     mode
  0     mode

Here is how I derived the values:

pinctrl-single,bias-pullup   = <[input] [enabled] [disable] [mask]>;
pinctrl-single,bias-pullup   = <     8        16        8      24 >;

          2^5    2^4    2^3    2^2    2^1    2^0  | 
         0x20   0x10   0x08   0x04   0x02   0x01  |
           32     16      8      4      2      1  | 
-------------------------------------------------------  
input       x      0      1     x      x      x   |   8 
enabled     x      1      0     x      x      x   |  16
disabled    x      0      1     x      x      x   |   8
mask        x      1      1     x      x      x   |  24


pinctrl-single,bias-pulldown = <[input] [enabled] [disable] [mask]>;
pinctrl-single,bias-pulldown = <     8         0        8      24 >;

          2^5    2^4    2^3    2^2    2^1    2^0  | 
         0x20   0x10   0x08   0x04   0x02   0x01  |
           32     16      8      4      2      1  | 
-------------------------------------------------------  
input       x      0      1     x      x      x   |   8 
enabled     x      0      0     x      x      x   |   0 
disabled    x      0      1     x      x      x   |   8
mask        x      1      1     x      x      x   |  24

The pinconf bias properties get applied to the pin group during boot
when pcs_pinconf_group_set() calls pcs_pinconf_set() for each pin. Here
is the output from function_graph tracer:

              pinconf_apply_setting() {
                pcs_pinconf_group_set() {
                  pinctrl_generic_get_group_pins();
                  pcs_pinconf_set() {
                    pcs_get_function() {
                      pinmux_generic_get_function();
                    }
                    pcs_readl();
                    pcs_writel();
                    pcs_readl();
                    pcs_writel();
                  }
                  pcs_pinconf_set() {
                    pcs_get_function() {
                      pinmux_generic_get_function();
                    }
                    pcs_readl();
                    pcs_writel();
                    pcs_readl();
                    pcs_writel();
                  }
                  pcs_pinconf_set() {
                    pcs_get_function() {
                      pinmux_generic_get_function();
                    }
                    pcs_readl();
                    pcs_writel();
                    pcs_readl();
                    pcs_writel();
                  }
                  pcs_pinconf_set() {
                    pcs_get_function() {
                      pinmux_generic_get_function();
                    }
                    pcs_readl();
                    pcs_writel();
                    pcs_readl();
                    pcs_writel();
                  }
                }
              }

After boot, I then use gpiomon utility with bias flags:

	gpiomon -B pull-up 3 14

gpiochip 3 line 14 maps to pin 100 which is AM335X_PIN_MCASP0_ACLKX at
offset 0x990.  For this to succeed, I modified omap_gpio_set_config() in
gpio_omap.c to handle PIN_CONFIG_BIAS_PULL_{UP,DOWN} by calling
gpiochip_generic_config().  Here is output of function_grapher tracer:

             gpio_ioctl() {
               gpiochip_get_desc();
               gpiod_request() {
                 gpiod_request_commit() {
                   gpiochip_line_is_valid();
                   omap_gpio_request() {
                     omap_gpio_runtime_resume() {
                       omap_gpio_unidle() {
                         omap_gpio_restore_context();
                       }
                     }
                     omap_enable_gpio_module();
                   }
                   gpiod_get_direction() {
                     gpiod_to_chip();
                     omap_gpio_get_direction();
                   }
                 }
               }
               gpiod_direction_input() {
                 omap_gpio_input() {
                   omap_set_gpio_direction();
                 }
                 gpio_set_bias() {
                   gpio_set_config() {
                     gpio_do_set_config() {
                       omap_gpio_set_config() {
                         gpiochip_generic_config() {
                           pinctrl_gpio_set_config() {
                             pinctrl_get_device_gpio_range() {
                               pinctrl_match_gpio_range();
                             }
                             pinconf_set_config() {
                               pcs_pinconf_set() {
                                 pcs_get_function() {
                                   pinmux_generic_get_function();
                                 }
                                 pcs_readl();
                                 pcs_pinconf_clear_bias.constprop.0();
                                 pcs_writel();

Thanks,
Drew

[0] http://www.ti.com/lit/ds/symlink/am3358.pdf
---
 drivers/gpio/gpio-omap.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index b8e2ecc3eade..a471a152f318 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -896,12 +896,25 @@ static int omap_gpio_set_config(struct gpio_chip *chip, unsigned offset,
 				unsigned long config)
 {
 	u32 debounce;
+	int ret;
 
-	if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE)
-		return -ENOTSUPP;
+	if ((pinconf_to_config_param(config) == PIN_CONFIG_BIAS_DISABLE) ||
+	    (pinconf_to_config_param(config) == PIN_CONFIG_BIAS_PULL_UP) ||
+	    (pinconf_to_config_param(config) == PIN_CONFIG_BIAS_PULL_DOWN))
+	{
+		ret = gpiochip_generic_config(chip, offset, config);
+	}
+	else if (pinconf_to_config_param(config) == PIN_CONFIG_INPUT_DEBOUNCE)
+	{
+		debounce = pinconf_to_config_argument(config);
+		ret = omap_gpio_debounce(chip, offset, debounce);
+	}
+	else
+	{
+		ret = -ENOTSUPP;
+	}
 
-	debounce = pinconf_to_config_argument(config);
-	return omap_gpio_debounce(chip, offset, debounce);
+	return ret;
 }
 
 static void omap_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
-- 
2.25.1

^ permalink raw reply related

* [PATCH] gpio: omap: handle pin config bias flags
From: Drew Fustini @ 2020-07-09 22:34 UTC (permalink / raw)
  To: Tony Lindgren, Linus Walleij, Bartosz Golaszewski,
	Grygorii Strashko, Santosh Shilimkar, Kevin Hilman, linux-omap,
	linux-gpio, linux-kernel
  Cc: Drew Fustini

Modify omap_gpio_set_config() to handle pin config bias flags by calling
gpiochip_generic_config().

The pin group for the gpio line must have the corresponding pinconf
properties:

PIN_CONFIG_BIAS_PULL_UP requires "pinctrl-single,bias-pullup"
PIN_CONFIG_BIAS_PULL_DOWN requires "pinctrl-single,bias-pulldown"

This is necessary for pcs_pinconf_set() to find the requested bias
parameter in the PIN_MAP_TYPE_CONFIGS_GROUP pinctrl map.

Signed-off-by: Drew Fustini <drew@beagleboard.org>
---
 drivers/gpio/gpio-omap.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index b8e2ecc3eade..a471a152f318 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -896,12 +896,25 @@ static int omap_gpio_set_config(struct gpio_chip *chip, unsigned offset,
 				unsigned long config)
 {
 	u32 debounce;
+	int ret;
 
-	if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE)
-		return -ENOTSUPP;
+	if ((pinconf_to_config_param(config) == PIN_CONFIG_BIAS_DISABLE) ||
+	    (pinconf_to_config_param(config) == PIN_CONFIG_BIAS_PULL_UP) ||
+	    (pinconf_to_config_param(config) == PIN_CONFIG_BIAS_PULL_DOWN))
+	{
+		ret = gpiochip_generic_config(chip, offset, config);
+	}
+	else if (pinconf_to_config_param(config) == PIN_CONFIG_INPUT_DEBOUNCE)
+	{
+		debounce = pinconf_to_config_argument(config);
+		ret = omap_gpio_debounce(chip, offset, debounce);
+	}
+	else
+	{
+		ret = -ENOTSUPP;
+	}
 
-	debounce = pinconf_to_config_argument(config);
-	return omap_gpio_debounce(chip, offset, debounce);
+	return ret;
 }
 
 static void omap_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
-- 
2.25.1


^ permalink raw reply related

* [gpio:gpio-descriptors-usb] BUILD SUCCESS ae8d72dbd0ececc3e516a14ea479552b6633bf70
From: kernel test robot @ 2020-07-10  1:26 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio

tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git  gpio-descriptors-usb
branch HEAD: ae8d72dbd0ececc3e516a14ea479552b6633bf70  usb: ohci-omap: Convert to use GPIO descriptors

elapsed time: 770m

configs tested: 120
configs skipped: 9

The following configs have been built successfully.
More configs may be tested in the coming days.

arm                                 defconfig
arm                              allyesconfig
arm                              allmodconfig
arm                               allnoconfig
arm64                            allyesconfig
arm64                               defconfig
arm64                            allmodconfig
arm64                             allnoconfig
s390                          debug_defconfig
csky                             allyesconfig
m68k                          amiga_defconfig
powerpc                     ep8248e_defconfig
arm                   milbeaut_m10v_defconfig
mips                       rbtx49xx_defconfig
arm                        spear6xx_defconfig
m68k                       m5249evb_defconfig
arm                        multi_v7_defconfig
arm                            mmp2_defconfig
powerpc                         wii_defconfig
powerpc                       holly_defconfig
x86_64                              defconfig
sh                          rsk7264_defconfig
ia64                                defconfig
mips                      bmips_stb_defconfig
arm                        vexpress_defconfig
s390                                defconfig
powerpc                      tqm8xx_defconfig
powerpc                      ep88xc_defconfig
arm                         at91_dt_defconfig
alpha                               defconfig
alpha                            allyesconfig
m68k                          hp300_defconfig
powerpc                  mpc866_ads_defconfig
um                             i386_defconfig
openrisc                         allyesconfig
sh                        edosk7705_defconfig
i386                              allnoconfig
i386                             allyesconfig
i386                                defconfig
i386                              debian-10.3
ia64                             allmodconfig
ia64                              allnoconfig
ia64                             allyesconfig
m68k                             allmodconfig
m68k                              allnoconfig
m68k                           sun3_defconfig
m68k                                defconfig
m68k                             allyesconfig
nios2                               defconfig
nios2                            allyesconfig
openrisc                            defconfig
c6x                              allyesconfig
c6x                               allnoconfig
nds32                               defconfig
nds32                             allnoconfig
csky                                defconfig
xtensa                           allyesconfig
h8300                            allyesconfig
h8300                            allmodconfig
xtensa                              defconfig
arc                                 defconfig
arc                              allyesconfig
sh                               allmodconfig
sh                                allnoconfig
microblaze                        allnoconfig
mips                             allyesconfig
mips                              allnoconfig
mips                             allmodconfig
parisc                            allnoconfig
parisc                              defconfig
parisc                           allyesconfig
parisc                           allmodconfig
powerpc                             defconfig
powerpc                          allyesconfig
powerpc                          rhel-kconfig
powerpc                          allmodconfig
powerpc                           allnoconfig
i386                 randconfig-a002-20200709
i386                 randconfig-a001-20200709
i386                 randconfig-a006-20200709
i386                 randconfig-a005-20200709
i386                 randconfig-a004-20200709
i386                 randconfig-a003-20200709
x86_64               randconfig-a012-20200709
x86_64               randconfig-a016-20200709
x86_64               randconfig-a011-20200709
x86_64               randconfig-a014-20200709
x86_64               randconfig-a013-20200709
x86_64               randconfig-a015-20200709
i386                 randconfig-a011-20200709
i386                 randconfig-a015-20200709
i386                 randconfig-a014-20200709
i386                 randconfig-a016-20200709
i386                 randconfig-a012-20200709
i386                 randconfig-a013-20200709
riscv                            allyesconfig
riscv                             allnoconfig
riscv                               defconfig
riscv                            allmodconfig
s390                             allyesconfig
s390                              allnoconfig
s390                             allmodconfig
sparc                            allyesconfig
sparc                               defconfig
sparc64                             defconfig
sparc64                           allnoconfig
sparc64                          allyesconfig
sparc64                          allmodconfig
um                                allnoconfig
um                                  defconfig
um                               allyesconfig
um                               allmodconfig
x86_64                               rhel-7.6
x86_64                    rhel-7.6-kselftests
x86_64                               rhel-8.3
x86_64                                  kexec
x86_64                                   rhel
x86_64                         rhel-7.2-clear
x86_64                                    lkp
x86_64                              fedora-25

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply

* [gpio:lee-fixes] BUILD SUCCESS a7a9ad232f02e6aa659cc9b58b72b1a30dccd1a6
From: kernel test robot @ 2020-07-10  2:56 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio

tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git  lee-fixes
branch HEAD: a7a9ad232f02e6aa659cc9b58b72b1a30dccd1a6  gpio: gpio-mlxbf2.c: Provide __releases() annotation to stop confusing Sparse

elapsed time: 860m

configs tested: 125
configs skipped: 8

The following configs have been built successfully.
More configs may be tested in the coming days.

arm                                 defconfig
arm                              allyesconfig
arm                              allmodconfig
arm                               allnoconfig
arm64                            allyesconfig
arm64                               defconfig
arm64                            allmodconfig
arm64                             allnoconfig
mips                         rt305x_defconfig
sh                                  defconfig
nios2                            alldefconfig
m68k                         apollo_defconfig
mips                        omega2p_defconfig
powerpc                     mpc512x_defconfig
s390                          debug_defconfig
csky                             allyesconfig
m68k                          amiga_defconfig
powerpc                     ep8248e_defconfig
arm                   milbeaut_m10v_defconfig
mips                       rbtx49xx_defconfig
arm                        spear6xx_defconfig
m68k                       m5249evb_defconfig
arm                        multi_v7_defconfig
powerpc                       holly_defconfig
x86_64                              defconfig
arm                         ebsa110_defconfig
ia64                                defconfig
sh                          rsk7264_defconfig
mips                      bmips_stb_defconfig
arm                        vexpress_defconfig
s390                                defconfig
powerpc                      tqm8xx_defconfig
powerpc                      ep88xc_defconfig
arm                         at91_dt_defconfig
alpha                               defconfig
alpha                            allyesconfig
m68k                          hp300_defconfig
powerpc                  mpc866_ads_defconfig
um                             i386_defconfig
openrisc                         allyesconfig
sh                        edosk7705_defconfig
i386                              allnoconfig
i386                             allyesconfig
i386                                defconfig
i386                              debian-10.3
ia64                             allmodconfig
ia64                              allnoconfig
ia64                             allyesconfig
m68k                             allmodconfig
m68k                              allnoconfig
m68k                           sun3_defconfig
m68k                                defconfig
m68k                             allyesconfig
nios2                               defconfig
nios2                            allyesconfig
openrisc                            defconfig
c6x                              allyesconfig
c6x                               allnoconfig
nds32                               defconfig
nds32                             allnoconfig
csky                                defconfig
xtensa                           allyesconfig
h8300                            allyesconfig
h8300                            allmodconfig
xtensa                              defconfig
arc                                 defconfig
arc                              allyesconfig
sh                               allmodconfig
sh                                allnoconfig
microblaze                        allnoconfig
mips                             allyesconfig
mips                              allnoconfig
mips                             allmodconfig
parisc                            allnoconfig
parisc                              defconfig
parisc                           allyesconfig
parisc                           allmodconfig
powerpc                             defconfig
powerpc                          allyesconfig
powerpc                          rhel-kconfig
powerpc                          allmodconfig
powerpc                           allnoconfig
i386                 randconfig-a002-20200709
i386                 randconfig-a001-20200709
i386                 randconfig-a006-20200709
i386                 randconfig-a005-20200709
i386                 randconfig-a004-20200709
i386                 randconfig-a003-20200709
x86_64               randconfig-a012-20200709
x86_64               randconfig-a016-20200709
x86_64               randconfig-a011-20200709
x86_64               randconfig-a014-20200709
x86_64               randconfig-a013-20200709
x86_64               randconfig-a015-20200709
i386                 randconfig-a011-20200709
i386                 randconfig-a015-20200709
i386                 randconfig-a014-20200709
i386                 randconfig-a016-20200709
i386                 randconfig-a012-20200709
i386                 randconfig-a013-20200709
riscv                            allyesconfig
riscv                             allnoconfig
riscv                               defconfig
riscv                            allmodconfig
s390                             allyesconfig
s390                              allnoconfig
s390                             allmodconfig
sparc                            allyesconfig
sparc                               defconfig
sparc64                             defconfig
sparc64                           allnoconfig
sparc64                          allyesconfig
sparc64                          allmodconfig
um                                allnoconfig
um                                  defconfig
um                               allmodconfig
um                               allyesconfig
x86_64                               rhel-7.6
x86_64                    rhel-7.6-kselftests
x86_64                               rhel-8.3
x86_64                                  kexec
x86_64                                   rhel
x86_64                         rhel-7.2-clear
x86_64                                    lkp
x86_64                              fedora-25

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply

* Re: [PATCH v2 5/5] firmware: QCOM_SCM: Allow qcom_scm driver to be loadable as a permenent module
From: John Stultz @ 2020-07-10  3:28 UTC (permalink / raw)
  To: Will Deacon
  Cc: lkml, Andy Gross, Bjorn Andersson, Joerg Roedel, Thomas Gleixner,
	Jason Cooper, Marc Zyngier, Linus Walleij, Maulik Shah, Lina Iyer,
	Saravana Kannan, Todd Kjos, Greg Kroah-Hartman, linux-arm-msm,
	iommu, linux-gpio
In-Reply-To: <20200702141825.GA16941@willie-the-truck>

On Thu, Jul 2, 2020 at 7:18 AM Will Deacon <will@kernel.org> wrote:
> On Thu, Jun 25, 2020 at 12:10:39AM +0000, John Stultz wrote:
> > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
> > index b510f67dfa49..714893535dd2 100644
> > --- a/drivers/iommu/Kconfig
> > +++ b/drivers/iommu/Kconfig
> > @@ -381,6 +381,7 @@ config SPAPR_TCE_IOMMU
> >  config ARM_SMMU
> >       tristate "ARM Ltd. System MMU (SMMU) Support"
> >       depends on (ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)) && MMU
> > +     depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y
> >       select IOMMU_API
> >       select IOMMU_IO_PGTABLE_LPAE
> >       select ARM_DMA_USE_IOMMU if ARM
>
> This looks like a giant hack. Is there another way to handle this?

Sorry for the slow response here.

So, I agree the syntax looks strange (requiring a comment obviously
isn't a good sign), but it's a fairly common way to ensure drivers
don't get built in if they optionally depend on another driver that
can be built as a module.
  See "RFKILL || !RFKILL", "EXTCON || !EXTCON", or "USB_GADGET ||
!USB_GADGET" in various Kconfig files.

I'm open to using a different method, and in a different thread you
suggested using something like symbol_get(). I need to look into it
more, but that approach looks even more messy and prone to runtime
failures. Blocking the unwanted case at build time seems a bit cleaner
to me, even if the syntax is odd.

thanks
-john

^ permalink raw reply

* [pinctrl:for-next] BUILD SUCCESS b58a4d02c577f81e8153cf45bad9d8be23834efb
From: kernel test robot @ 2020-07-10  3:58 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio

tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git  for-next
branch HEAD: b58a4d02c577f81e8153cf45bad9d8be23834efb  Merge branch 'devel' into for-next

elapsed time: 721m

configs tested: 113
configs skipped: 8

The following configs have been built successfully.
More configs may be tested in the coming days.

arm                                 defconfig
arm                              allyesconfig
arm                              allmodconfig
arm                               allnoconfig
arm64                            allyesconfig
arm64                               defconfig
arm64                            allmodconfig
arm64                             allnoconfig
mips                         rt305x_defconfig
sh                                  defconfig
nios2                            alldefconfig
m68k                         apollo_defconfig
mips                        omega2p_defconfig
powerpc                     mpc512x_defconfig
s390                          debug_defconfig
m68k                          amiga_defconfig
powerpc                     ep8248e_defconfig
arm                   milbeaut_m10v_defconfig
mips                       rbtx49xx_defconfig
arm                        spear6xx_defconfig
m68k                       m5249evb_defconfig
arm                        multi_v7_defconfig
powerpc                       holly_defconfig
x86_64                              defconfig
arm                         ebsa110_defconfig
ia64                                defconfig
csky                                defconfig
powerpc                      tqm8xx_defconfig
powerpc                      ep88xc_defconfig
arm                         at91_dt_defconfig
m68k                          hp300_defconfig
powerpc                  mpc866_ads_defconfig
powerpc64                           defconfig
um                             i386_defconfig
openrisc                         allyesconfig
sh                        edosk7705_defconfig
m68k                          atari_defconfig
sh                             espt_defconfig
i386                              allnoconfig
i386                             allyesconfig
i386                                defconfig
i386                              debian-10.3
ia64                             allmodconfig
ia64                              allnoconfig
ia64                             allyesconfig
m68k                             allmodconfig
m68k                              allnoconfig
m68k                           sun3_defconfig
m68k                                defconfig
m68k                             allyesconfig
nds32                               defconfig
nds32                             allnoconfig
csky                             allyesconfig
alpha                               defconfig
alpha                            allyesconfig
xtensa                           allyesconfig
h8300                            allyesconfig
h8300                            allmodconfig
xtensa                              defconfig
arc                                 defconfig
arc                              allyesconfig
sh                               allmodconfig
sh                                allnoconfig
microblaze                        allnoconfig
nios2                               defconfig
nios2                            allyesconfig
openrisc                            defconfig
c6x                              allyesconfig
c6x                               allnoconfig
mips                             allyesconfig
mips                              allnoconfig
mips                             allmodconfig
parisc                            allnoconfig
parisc                              defconfig
parisc                           allyesconfig
parisc                           allmodconfig
powerpc                             defconfig
powerpc                          allyesconfig
powerpc                          rhel-kconfig
powerpc                          allmodconfig
powerpc                           allnoconfig
i386                 randconfig-a002-20200709
i386                 randconfig-a001-20200709
i386                 randconfig-a006-20200709
i386                 randconfig-a005-20200709
i386                 randconfig-a004-20200709
i386                 randconfig-a003-20200709
riscv                            allyesconfig
riscv                             allnoconfig
riscv                               defconfig
riscv                            allmodconfig
s390                             allyesconfig
s390                              allnoconfig
s390                             allmodconfig
s390                                defconfig
sparc                            allyesconfig
sparc                               defconfig
sparc64                             defconfig
sparc64                           allnoconfig
sparc64                          allyesconfig
sparc64                          allmodconfig
um                                allnoconfig
um                                  defconfig
um                               allmodconfig
um                               allyesconfig
x86_64                               rhel-7.6
x86_64                    rhel-7.6-kselftests
x86_64                               rhel-8.3
x86_64                                  kexec
x86_64                                   rhel
x86_64                         rhel-7.2-clear
x86_64                                    lkp
x86_64                              fedora-25

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply

* [gpio:for-next] BUILD SUCCESS 4672a4a9fbfe316e1153682b0790af6446255a50
From: kernel test robot @ 2020-07-10  4:05 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio

tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git  for-next
branch HEAD: 4672a4a9fbfe316e1153682b0790af6446255a50  Merge branch 'devel' into for-next

elapsed time: 721m

configs tested: 108
configs skipped: 8

The following configs have been built successfully.
More configs may be tested in the coming days.

arm                                 defconfig
arm                              allyesconfig
arm                              allmodconfig
arm                               allnoconfig
arm64                            allyesconfig
arm64                            allmodconfig
arm64                             allnoconfig
arm64                               defconfig
mips                         rt305x_defconfig
sh                                  defconfig
nios2                            alldefconfig
m68k                         apollo_defconfig
mips                        omega2p_defconfig
powerpc                     mpc512x_defconfig
arm                        spear6xx_defconfig
m68k                       m5249evb_defconfig
arm                        multi_v7_defconfig
powerpc                       holly_defconfig
x86_64                              defconfig
arm                         ebsa110_defconfig
ia64                                defconfig
csky                                defconfig
powerpc                      tqm8xx_defconfig
powerpc                      ep88xc_defconfig
arm                         at91_dt_defconfig
alpha                               defconfig
alpha                            allyesconfig
m68k                          hp300_defconfig
powerpc                  mpc866_ads_defconfig
powerpc64                           defconfig
um                             i386_defconfig
openrisc                         allyesconfig
sh                        edosk7705_defconfig
m68k                          atari_defconfig
sh                             espt_defconfig
i386                              allnoconfig
i386                             allyesconfig
i386                                defconfig
i386                              debian-10.3
ia64                             allmodconfig
ia64                              allnoconfig
ia64                             allyesconfig
m68k                             allmodconfig
m68k                              allnoconfig
m68k                           sun3_defconfig
m68k                                defconfig
m68k                             allyesconfig
nios2                               defconfig
nios2                            allyesconfig
openrisc                            defconfig
c6x                              allyesconfig
c6x                               allnoconfig
nds32                               defconfig
nds32                             allnoconfig
csky                             allyesconfig
xtensa                           allyesconfig
h8300                            allyesconfig
h8300                            allmodconfig
xtensa                              defconfig
arc                                 defconfig
arc                              allyesconfig
sh                               allmodconfig
sh                                allnoconfig
microblaze                        allnoconfig
mips                             allyesconfig
mips                              allnoconfig
mips                             allmodconfig
parisc                            allnoconfig
parisc                              defconfig
parisc                           allyesconfig
parisc                           allmodconfig
powerpc                             defconfig
powerpc                          allyesconfig
powerpc                          rhel-kconfig
powerpc                          allmodconfig
powerpc                           allnoconfig
i386                 randconfig-a002-20200709
i386                 randconfig-a001-20200709
i386                 randconfig-a006-20200709
i386                 randconfig-a005-20200709
i386                 randconfig-a004-20200709
i386                 randconfig-a003-20200709
riscv                            allyesconfig
riscv                             allnoconfig
riscv                               defconfig
riscv                            allmodconfig
s390                             allyesconfig
s390                              allnoconfig
s390                             allmodconfig
s390                                defconfig
sparc                            allyesconfig
sparc                               defconfig
sparc64                             defconfig
sparc64                           allnoconfig
sparc64                          allyesconfig
sparc64                          allmodconfig
um                               allmodconfig
um                                allnoconfig
um                                  defconfig
um                               allyesconfig
x86_64                               rhel-7.6
x86_64                    rhel-7.6-kselftests
x86_64                               rhel-8.3
x86_64                                  kexec
x86_64                                   rhel
x86_64                         rhel-7.2-clear
x86_64                                    lkp
x86_64                              fedora-25

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox