* [PATCH pinctrl/fixes] pinctrl: aspeed: Fix spurious mux failures on the AST2500
From: Andrew Jeffery @ 2019-08-29 7:17 UTC (permalink / raw)
To: linux-gpio
Cc: Andrew Jeffery, linus.walleij, joel, linux-aspeed, openbmc,
linux-arm-kernel, linux-kernel, John Wang
Commit 674fa8daa8c9 ("pinctrl: aspeed-g5: Delay acquisition of regmaps")
was determined to be a partial fix to the problem of acquiring the LPC
Host Controller and GFX regmaps: The AST2500 pin controller may need to
fetch syscon regmaps during expression evaluation as well as when
setting mux state. For example, this case is hit by attempting to export
pins exposing the LPC Host Controller as GPIOs.
An optional eval() hook is added to the Aspeed pinmux operation struct
and called from aspeed_sig_expr_eval() if the pointer is set by the
SoC-specific driver. This enables the AST2500 to perform the custom
action of acquiring its regmap dependencies as required.
John Wang tested the fix on an Inspur FP5280G2 machine (AST2500-based)
where the issue was found, and I've booted the fix on Witherspoon
(AST2500) and Palmetto (AST2400) machines, and poked at relevant pins
under QEMU by forcing mux configurations via devmem before exporting
GPIOs to exercise the driver.
Fixes: 7d29ed88acbb ("pinctrl: aspeed: Read and write bits in LPC and GFX controllers")
Fixes: 674fa8daa8c9 ("pinctrl: aspeed-g5: Delay acquisition of regmaps")
Reported-by: John Wang <wangzqbj@inspur.com>
Tested-by: John Wang <wangzqbj@inspur.com>
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
Hi Linus,
The timing of merging the AST2600 (g6) driver and 674fa8daa8c9 ("pinctrl:
aspeed-g5: Delay acquisition of regmaps") caused a bit of a rough spot a
few weeks back. This fix doesn't cause any such disruption - I've
developed it on top of pinctrl/fixes and back-merged the result into
pinctrl/devel to test for build breakage (via CONFIG_COMPILE_TEST to
enable all of the g4, g5 and g6 drivers). All three ASPEED pinctrl
drivers built successfully, so it should be enough to simply take this
patch through pinctrl/fixes and leave pinctrl/devel as is for the 5.4
merge window.
---
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 30 +++++++++++++++++++++-
drivers/pinctrl/aspeed/pinmux-aspeed.c | 7 +++--
drivers/pinctrl/aspeed/pinmux-aspeed.h | 7 ++---
3 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c
index ba6438ac4d72..ff84d1afd229 100644
--- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c
+++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c
@@ -2552,7 +2552,7 @@ static struct regmap *aspeed_g5_acquire_regmap(struct aspeed_pinmux_data *ctx,
if (IS_ERR(map))
return map;
} else
- map = ERR_PTR(-ENODEV);
+ return ERR_PTR(-ENODEV);
ctx->maps[ASPEED_IP_LPC] = map;
dev_dbg(ctx->dev, "Acquired LPC regmap");
@@ -2562,6 +2562,33 @@ static struct regmap *aspeed_g5_acquire_regmap(struct aspeed_pinmux_data *ctx,
return ERR_PTR(-EINVAL);
}
+static int aspeed_g5_sig_expr_eval(struct aspeed_pinmux_data *ctx,
+ const struct aspeed_sig_expr *expr,
+ bool enabled)
+{
+ int ret;
+ int i;
+
+ for (i = 0; i < expr->ndescs; i++) {
+ const struct aspeed_sig_desc *desc = &expr->descs[i];
+ struct regmap *map;
+
+ map = aspeed_g5_acquire_regmap(ctx, desc->ip);
+ if (IS_ERR(map)) {
+ dev_err(ctx->dev,
+ "Failed to acquire regmap for IP block %d\n",
+ desc->ip);
+ return PTR_ERR(map);
+ }
+
+ ret = aspeed_sig_desc_eval(desc, enabled, ctx->maps[desc->ip]);
+ if (ret <= 0)
+ return ret;
+ }
+
+ return 1;
+}
+
/**
* Configure a pin's signal by applying an expression's descriptor state for
* all descriptors in the expression.
@@ -2647,6 +2674,7 @@ static int aspeed_g5_sig_expr_set(struct aspeed_pinmux_data *ctx,
}
static const struct aspeed_pinmux_ops aspeed_g5_ops = {
+ .eval = aspeed_g5_sig_expr_eval,
.set = aspeed_g5_sig_expr_set,
};
diff --git a/drivers/pinctrl/aspeed/pinmux-aspeed.c b/drivers/pinctrl/aspeed/pinmux-aspeed.c
index 839c01b7953f..57305ca838a7 100644
--- a/drivers/pinctrl/aspeed/pinmux-aspeed.c
+++ b/drivers/pinctrl/aspeed/pinmux-aspeed.c
@@ -78,11 +78,14 @@ int aspeed_sig_desc_eval(const struct aspeed_sig_desc *desc,
* neither the enabled nor disabled state. Thus we must explicitly test for
* either condition as required.
*/
-int aspeed_sig_expr_eval(const struct aspeed_pinmux_data *ctx,
+int aspeed_sig_expr_eval(struct aspeed_pinmux_data *ctx,
const struct aspeed_sig_expr *expr, bool enabled)
{
+ int ret;
int i;
- int ret;
+
+ if (ctx->ops->eval)
+ return ctx->ops->eval(ctx, expr, enabled);
for (i = 0; i < expr->ndescs; i++) {
const struct aspeed_sig_desc *desc = &expr->descs[i];
diff --git a/drivers/pinctrl/aspeed/pinmux-aspeed.h b/drivers/pinctrl/aspeed/pinmux-aspeed.h
index 52d299b59ce2..db3457c86f48 100644
--- a/drivers/pinctrl/aspeed/pinmux-aspeed.h
+++ b/drivers/pinctrl/aspeed/pinmux-aspeed.h
@@ -702,6 +702,8 @@ struct aspeed_pin_function {
struct aspeed_pinmux_data;
struct aspeed_pinmux_ops {
+ int (*eval)(struct aspeed_pinmux_data *ctx,
+ const struct aspeed_sig_expr *expr, bool enabled);
int (*set)(struct aspeed_pinmux_data *ctx,
const struct aspeed_sig_expr *expr, bool enabled);
};
@@ -722,9 +724,8 @@ struct aspeed_pinmux_data {
int aspeed_sig_desc_eval(const struct aspeed_sig_desc *desc, bool enabled,
struct regmap *map);
-int aspeed_sig_expr_eval(const struct aspeed_pinmux_data *ctx,
- const struct aspeed_sig_expr *expr,
- bool enabled);
+int aspeed_sig_expr_eval(struct aspeed_pinmux_data *ctx,
+ const struct aspeed_sig_expr *expr, bool enabled);
static inline int aspeed_sig_expr_set(struct aspeed_pinmux_data *ctx,
const struct aspeed_sig_expr *expr,
--
2.20.1
^ permalink raw reply related
* [PATCH] pinctrl-mcp23s08: Fix property-name in dt-example
From: Peter Vernia @ 2019-08-28 19:56 UTC (permalink / raw)
To: peter.vernia
Cc: linus.walleij, robh+dt, mark.rutland, linux-gpio, devicetree,
linux-kernel, poeschel
The device-tree properties documentation-file specifies the property
"microchip,spi-present-mask" as required for MCP23SXX chips. However,
the device-tree-source example below it uses only "spi-present-mask".
Without "microchip," on the front, the driver will print "missing
spi-present-mask" when it initializes.
Update the device-tree example with the correct property-name.
Signed-off-by: Peter Vernia <peter.vernia@gmail.com>
---
Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt
index 625a22e2f211..8b94aa8f5971 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt
@@ -82,7 +82,7 @@ gpiom1: gpio@0 {
compatible = "microchip,mcp23s17";
gpio-controller;
#gpio-cells = <2>;
- spi-present-mask = <0x01>;
+ microchip,spi-present-mask = <0x01>;
reg = <0>;
spi-max-frequency = <1000000>;
};
--
2.20.1
^ permalink raw reply related
* Re: [PATCH v2] gpiolib: acpi: Add gpiolib_acpi_run_edge_events_on_boot option and blacklist
From: Ian W MORRISON @ 2019-08-28 13:16 UTC (permalink / raw)
To: Hans de Goede
Cc: Andy Shevchenko, Mika Westerberg, Bartosz Golaszewski,
Linus Walleij, linux-gpio, linux-acpi, stable, Daniel Drake
In-Reply-To: <c07a8e2e-61a7-7ce7-4f73-48978be98d27@redhat.com>
On Wed, 28 Aug 2019 at 22:21, Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi,
>
> On 28-08-19 14:20, Hans de Goede wrote:
> > Hi,
> >
> > On 28-08-19 13:37, Andy Shevchenko wrote:
> >> On Tue, Aug 27, 2019 at 10:28:35PM +0200, Hans de Goede wrote:
> >>> Another day; another DSDT bug we need to workaround...
> >>>
> >>> Since commit ca876c7483b6 ("gpiolib-acpi: make sure we trigger edge events
> >>> at least once on boot") we call _AEI edge handlers at boot.
> >>>
> >>> In some rare cases this causes problems. One example of this is the Minix
> >>> Neo Z83-4 mini PC, this device has a clear DSDT bug where it has some copy
> >>> and pasted code for dealing with Micro USB-B connector host/device role
> >>> switching, while the mini PC does not even have a micro-USB connector.
> >>> This code, which should not be there, messes with the DDC data pin from
> >>> the HDMI connector (switching it to GPIO mode) breaking HDMI support.
> >>>
> >>> To avoid problems like this, this commit adds a new
> >>> gpiolib_acpi.run_edge_events_on_boot kernel commandline option, which
> >>> allows disabling the running of _AEI edge event handlers at boot.
> >>>
> >>> The default value is -1/auto which uses a DMI based blacklist, the initial
> >>> version of this blacklist contains the Neo Z83-4 fixing the HDMI breakage.
> >>
> >> Thank you!
> >>
> >> Assuming it works for Ian,
> >> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> >
> > Note I have access to a Minix Neo Z83-4 myself now and I did test that
> > this fixes it and that passing gpiolib_acpi.run_edge_events_on_boot=0
> > breaks HDMI again (so the option works).
>
> Erm that should be gpiolib_acpi.run_edge_events_on_boot=1 (not 0) breaks
> HDMI.
>
Many thanks again Hans. I've also tested the patch including the various command
line options on my MINIX Z83-4 and they work fine.
Best regards,
Ian
^ permalink raw reply
* Applied "spi: bcm2835: Convert to use CS GPIO descriptors" to the spi tree
From: Mark Brown @ 2019-08-28 13:13 UTC (permalink / raw)
To: Linus Walleij
Cc: Bartosz Golaszewski, Chris Boot, linux-gpio, linux-spi,
Lukas Wunner, Mark Brown, Martin Sperl, Stefan Wahren
In-Reply-To: <20190804003852.1312-1-linus.walleij@linaro.org>
The patch
spi: bcm2835: Convert to use CS GPIO descriptors
has been applied to the spi tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.4
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
From 3bd158c56a56e8767e569d7fbc66efbedc478077 Mon Sep 17 00:00:00 2001
From: Linus Walleij <linus.walleij@linaro.org>
Date: Sun, 4 Aug 2019 02:38:52 +0200
Subject: [PATCH] spi: bcm2835: Convert to use CS GPIO descriptors
This converts the BCM2835 SPI master driver to use GPIO
descriptors for chip select handling.
The BCM2835 driver was relying on the core to drive the
CS high/low so very small changes were needed for this
part. If it managed to request the CS from the device tree
node, all is pretty straight forward.
However for native GPIOs this driver has a quite unorthodox
loopback to request some GPIOs from the SoC GPIO chip by
looking it up from the device tree using gpiochip_find()
and then offseting hard into its numberspace. This has
been augmented a bit by using gpiochip_request_own_desc()
but this code really needs to be verified. If "native CS"
is actually an SoC GPIO, why is it even done this way?
Should this GPIO not just be defined in the device tree
like any other CS GPIO? I'm confused.
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Martin Sperl <kernel@martin.sperl.org>
Cc: Chris Boot <bootc@bootc.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20190804003852.1312-1-linus.walleij@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
---
drivers/spi/spi-bcm2835.c | 58 +++++++++++++++++++++++++++------------
1 file changed, 40 insertions(+), 18 deletions(-)
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index 4b89e0a04ffd..fd2bfb4aa8c3 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -25,7 +25,9 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
-#include <linux/of_gpio.h>
+#include <linux/gpio/consumer.h>
+#include <linux/gpio/machine.h> /* FIXME: using chip internals */
+#include <linux/gpio/driver.h> /* FIXME: using chip internals */
#include <linux/of_irq.h>
#include <linux/spi/spi.h>
@@ -931,14 +933,19 @@ static int chip_match_name(struct gpio_chip *chip, void *data)
static int bcm2835_spi_setup(struct spi_device *spi)
{
- int err;
struct gpio_chip *chip;
+ enum gpio_lookup_flags lflags;
+
/*
* sanity checking the native-chipselects
*/
if (spi->mode & SPI_NO_CS)
return 0;
- if (gpio_is_valid(spi->cs_gpio))
+ /*
+ * The SPI core has successfully requested the CS GPIO line from the
+ * device tree, so we are done.
+ */
+ if (spi->cs_gpiod)
return 0;
if (spi->chip_select > 1) {
/* error in the case of native CS requested with CS > 1
@@ -949,29 +956,43 @@ static int bcm2835_spi_setup(struct spi_device *spi)
"setup: only two native chip-selects are supported\n");
return -EINVAL;
}
- /* now translate native cs to GPIO */
+
+ /*
+ * Translate native CS to GPIO
+ *
+ * FIXME: poking around in the gpiolib internals like this is
+ * not very good practice. Find a way to locate the real problem
+ * and fix it. Why is the GPIO descriptor in spi->cs_gpiod
+ * sometimes not assigned correctly? Erroneous device trees?
+ */
/* get the gpio chip for the base */
chip = gpiochip_find("pinctrl-bcm2835", chip_match_name);
if (!chip)
return 0;
- /* and calculate the real CS */
- spi->cs_gpio = chip->base + 8 - spi->chip_select;
+ /*
+ * Retrieve the corresponding GPIO line used for CS.
+ * The inversion semantics will be handled by the GPIO core
+ * code, so we pass GPIOS_OUT_LOW for "unasserted" and
+ * the correct flag for inversion semantics. The SPI_CS_HIGH
+ * on spi->mode cannot be checked for polarity in this case
+ * as the flag use_gpio_descriptors enforces SPI_CS_HIGH.
+ */
+ if (of_property_read_bool(spi->dev.of_node, "spi-cs-high"))
+ lflags = GPIO_ACTIVE_HIGH;
+ else
+ lflags = GPIO_ACTIVE_LOW;
+ spi->cs_gpiod = gpiochip_request_own_desc(chip, 8 - spi->chip_select,
+ DRV_NAME,
+ lflags,
+ GPIOD_OUT_LOW);
+ if (IS_ERR(spi->cs_gpiod))
+ return PTR_ERR(spi->cs_gpiod);
/* and set up the "mode" and level */
- dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n",
- spi->chip_select, spi->cs_gpio);
-
- /* set up GPIO as output and pull to the correct level */
- err = gpio_direction_output(spi->cs_gpio,
- (spi->mode & SPI_CS_HIGH) ? 0 : 1);
- if (err) {
- dev_err(&spi->dev,
- "could not set CS%i gpio %i as output: %i",
- spi->chip_select, spi->cs_gpio, err);
- return err;
- }
+ dev_info(&spi->dev, "setting up native-CS%i to use GPIO\n",
+ spi->chip_select);
return 0;
}
@@ -989,6 +1010,7 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ctlr);
+ ctlr->use_gpio_descriptors = true;
ctlr->mode_bits = BCM2835_SPI_MODE_BITS;
ctlr->bits_per_word_mask = SPI_BPW_MASK(8);
ctlr->num_chipselect = 3;
--
2.20.1
^ permalink raw reply related
* Applied "spi: fsl: Convert to use CS GPIO descriptors" to the spi tree
From: Mark Brown @ 2019-08-28 13:13 UTC (permalink / raw)
To: Linus Walleij
Cc: Bartosz Golaszewski, Fabio Estevam, linux-gpio, linux-spi,
Mark Brown, NXP Linux Team, Pengutronix Kernel Team, Sascha Hauer,
Shawn Guo
In-Reply-To: <20190804003539.985-1-linus.walleij@linaro.org>
The patch
spi: fsl: Convert to use CS GPIO descriptors
has been applied to the spi tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.4
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
From 0f0581b24bd019dfe32878e4c1bde266c7364e02 Mon Sep 17 00:00:00 2001
From: Linus Walleij <linus.walleij@linaro.org>
Date: Sun, 4 Aug 2019 02:35:39 +0200
Subject: [PATCH] spi: fsl: Convert to use CS GPIO descriptors
This converts the Freescale SPI master driver to use GPIO
descriptors for chip select handling.
The Freescale (fsl) driver has a lot of quirks to look up
"gpios" rather than "cs-gpios" from the device tree.
After the prior patch that will make gpiolib return the
GPIO descriptor for "gpios" in response to a request for
"cs-gpios", this code can be cut down quite a bit.
The driver has custom handling of chip select rather
than using the core (which may be possible but not
done in this patch) so it still needs to refer directly
to spi->cs_gpiod to set the chip select.
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20190804003539.985-1-linus.walleij@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
---
drivers/spi/spi-fsl-lib.h | 3 -
drivers/spi/spi-fsl-spi.c | 193 +++++---------------------------------
2 files changed, 25 insertions(+), 171 deletions(-)
diff --git a/drivers/spi/spi-fsl-lib.h b/drivers/spi/spi-fsl-lib.h
index 3576167283dc..015a1abb6a84 100644
--- a/drivers/spi/spi-fsl-lib.h
+++ b/drivers/spi/spi-fsl-lib.h
@@ -91,9 +91,6 @@ static inline u32 mpc8xxx_spi_read_reg(__be32 __iomem *reg)
struct mpc8xxx_spi_probe_info {
struct fsl_spi_platform_data pdata;
- int ngpios;
- int *gpios;
- bool *alow_flags;
__be32 __iomem *immr_spi_cs;
};
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
index 1d9b33aa1a3b..4b80ace1d137 100644
--- a/drivers/spi/spi-fsl-spi.c
+++ b/drivers/spi/spi-fsl-spi.c
@@ -18,7 +18,7 @@
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/fsl_devices.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/kernel.h>
@@ -28,7 +28,6 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
-#include <linux/of_gpio.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
@@ -481,32 +480,6 @@ static int fsl_spi_setup(struct spi_device *spi)
return retval;
}
- if (mpc8xxx_spi->type == TYPE_GRLIB) {
- if (gpio_is_valid(spi->cs_gpio)) {
- int desel;
-
- retval = gpio_request(spi->cs_gpio,
- dev_name(&spi->dev));
- if (retval)
- return retval;
-
- desel = !(spi->mode & SPI_CS_HIGH);
- retval = gpio_direction_output(spi->cs_gpio, desel);
- if (retval) {
- gpio_free(spi->cs_gpio);
- return retval;
- }
- } else if (spi->cs_gpio != -ENOENT) {
- if (spi->cs_gpio < 0)
- return spi->cs_gpio;
- return -EINVAL;
- }
- /* When spi->cs_gpio == -ENOENT, a hole in the phandle list
- * indicates to use native chipselect if present, or allow for
- * an always selected chip
- */
- }
-
/* Initialize chipselect - might be active for SPI_CS_HIGH mode */
fsl_spi_chipselect(spi, BITBANG_CS_INACTIVE);
@@ -515,12 +488,8 @@ static int fsl_spi_setup(struct spi_device *spi)
static void fsl_spi_cleanup(struct spi_device *spi)
{
- struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master);
struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi);
- if (mpc8xxx_spi->type == TYPE_GRLIB && gpio_is_valid(spi->cs_gpio))
- gpio_free(spi->cs_gpio);
-
kfree(cs);
spi_set_ctldata(spi, NULL);
}
@@ -586,8 +555,8 @@ static void fsl_spi_grlib_cs_control(struct spi_device *spi, bool on)
u32 slvsel;
u16 cs = spi->chip_select;
- if (gpio_is_valid(spi->cs_gpio)) {
- gpio_set_value(spi->cs_gpio, on);
+ if (spi->cs_gpiod) {
+ gpiod_set_value(spi->cs_gpiod, on);
} else if (cs < mpc8xxx_spi->native_chipselects) {
slvsel = mpc8xxx_spi_read_reg(®_base->slvsel);
slvsel = on ? (slvsel | (1 << cs)) : (slvsel & ~(1 << cs));
@@ -718,139 +687,19 @@ static struct spi_master * fsl_spi_probe(struct device *dev,
static void fsl_spi_cs_control(struct spi_device *spi, bool on)
{
- struct device *dev = spi->dev.parent->parent;
- struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
- struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
- u16 cs = spi->chip_select;
-
- if (cs < pinfo->ngpios) {
- int gpio = pinfo->gpios[cs];
- bool alow = pinfo->alow_flags[cs];
-
- gpio_set_value(gpio, on ^ alow);
+ if (spi->cs_gpiod) {
+ gpiod_set_value(spi->cs_gpiod, on);
} else {
- if (WARN_ON_ONCE(cs > pinfo->ngpios || !pinfo->immr_spi_cs))
+ struct device *dev = spi->dev.parent->parent;
+ struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
+ struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
+
+ if (WARN_ON_ONCE(!pinfo->immr_spi_cs))
return;
iowrite32be(on ? SPI_BOOT_SEL_BIT : 0, pinfo->immr_spi_cs);
}
}
-static int of_fsl_spi_get_chipselects(struct device *dev)
-{
- struct device_node *np = dev->of_node;
- struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
- struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
- bool spisel_boot = IS_ENABLED(CONFIG_FSL_SOC) &&
- of_property_read_bool(np, "fsl,spisel_boot");
- int ngpios;
- int i = 0;
- int ret;
-
- ngpios = of_gpio_count(np);
- ngpios = max(ngpios, 0);
- if (ngpios == 0 && !spisel_boot) {
- /*
- * SPI w/o chip-select line. One SPI device is still permitted
- * though.
- */
- pdata->max_chipselect = 1;
- return 0;
- }
-
- pinfo->ngpios = ngpios;
- pinfo->gpios = kmalloc_array(ngpios, sizeof(*pinfo->gpios),
- GFP_KERNEL);
- if (!pinfo->gpios)
- return -ENOMEM;
- memset(pinfo->gpios, -1, ngpios * sizeof(*pinfo->gpios));
-
- pinfo->alow_flags = kcalloc(ngpios, sizeof(*pinfo->alow_flags),
- GFP_KERNEL);
- if (!pinfo->alow_flags) {
- ret = -ENOMEM;
- goto err_alloc_flags;
- }
-
- for (; i < ngpios; i++) {
- int gpio;
- enum of_gpio_flags flags;
-
- gpio = of_get_gpio_flags(np, i, &flags);
- if (!gpio_is_valid(gpio)) {
- dev_err(dev, "invalid gpio #%d: %d\n", i, gpio);
- ret = gpio;
- goto err_loop;
- }
-
- ret = gpio_request(gpio, dev_name(dev));
- if (ret) {
- dev_err(dev, "can't request gpio #%d: %d\n", i, ret);
- goto err_loop;
- }
-
- pinfo->gpios[i] = gpio;
- pinfo->alow_flags[i] = flags & OF_GPIO_ACTIVE_LOW;
-
- ret = gpio_direction_output(pinfo->gpios[i],
- pinfo->alow_flags[i]);
- if (ret) {
- dev_err(dev,
- "can't set output direction for gpio #%d: %d\n",
- i, ret);
- goto err_loop;
- }
- }
-
-#if IS_ENABLED(CONFIG_FSL_SOC)
- if (spisel_boot) {
- pinfo->immr_spi_cs = ioremap(get_immrbase() + IMMR_SPI_CS_OFFSET, 4);
- if (!pinfo->immr_spi_cs) {
- ret = -ENOMEM;
- i = ngpios - 1;
- goto err_loop;
- }
- }
-#endif
-
- pdata->max_chipselect = ngpios + spisel_boot;
- pdata->cs_control = fsl_spi_cs_control;
-
- return 0;
-
-err_loop:
- while (i >= 0) {
- if (gpio_is_valid(pinfo->gpios[i]))
- gpio_free(pinfo->gpios[i]);
- i--;
- }
-
- kfree(pinfo->alow_flags);
- pinfo->alow_flags = NULL;
-err_alloc_flags:
- kfree(pinfo->gpios);
- pinfo->gpios = NULL;
- return ret;
-}
-
-static int of_fsl_spi_free_chipselects(struct device *dev)
-{
- struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
- struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
- int i;
-
- if (!pinfo->gpios)
- return 0;
-
- for (i = 0; i < pdata->max_chipselect; i++) {
- if (gpio_is_valid(pinfo->gpios[i]))
- gpio_free(pinfo->gpios[i]);
- }
-
- kfree(pinfo->gpios);
- kfree(pinfo->alow_flags);
- return 0;
-}
-
static int of_fsl_spi_probe(struct platform_device *ofdev)
{
struct device *dev = &ofdev->dev;
@@ -866,9 +715,21 @@ static int of_fsl_spi_probe(struct platform_device *ofdev)
type = fsl_spi_get_type(&ofdev->dev);
if (type == TYPE_FSL) {
- ret = of_fsl_spi_get_chipselects(dev);
- if (ret)
- goto err;
+ struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
+#if IS_ENABLED(CONFIG_FSL_SOC)
+ struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
+ bool spisel_boot = of_property_read_bool(np, "fsl,spisel_boot");
+
+ if (spisel_boot) {
+ pinfo->immr_spi_cs = ioremap(get_immrbase() + IMMR_SPI_CS_OFFSET, 4);
+ if (!pinfo->immr_spi_cs) {
+ ret = -ENOMEM;
+ goto err;
+ }
+ }
+#endif
+
+ pdata->cs_control = fsl_spi_cs_control;
}
ret = of_address_to_resource(np, 0, &mem);
@@ -891,8 +752,6 @@ static int of_fsl_spi_probe(struct platform_device *ofdev)
err:
irq_dispose_mapping(irq);
- if (type == TYPE_FSL)
- of_fsl_spi_free_chipselects(dev);
return ret;
}
@@ -902,8 +761,6 @@ static int of_fsl_spi_remove(struct platform_device *ofdev)
struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(master);
fsl_spi_cpm_free(mpc8xxx_spi);
- if (mpc8xxx_spi->type == TYPE_FSL)
- of_fsl_spi_free_chipselects(&ofdev->dev);
return 0;
}
--
2.20.1
^ permalink raw reply related
* Re: [PATCH v2] gpiolib: acpi: Add gpiolib_acpi_run_edge_events_on_boot option and blacklist
From: Hans de Goede @ 2019-08-28 12:21 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Mika Westerberg, Bartosz Golaszewski, Linus Walleij, linux-gpio,
linux-acpi, stable, Daniel Drake, Ian W MORRISON
In-Reply-To: <005b954d-46ad-5e45-6a9c-0b1efe020b92@redhat.com>
Hi,
On 28-08-19 14:20, Hans de Goede wrote:
> Hi,
>
> On 28-08-19 13:37, Andy Shevchenko wrote:
>> On Tue, Aug 27, 2019 at 10:28:35PM +0200, Hans de Goede wrote:
>>> Another day; another DSDT bug we need to workaround...
>>>
>>> Since commit ca876c7483b6 ("gpiolib-acpi: make sure we trigger edge events
>>> at least once on boot") we call _AEI edge handlers at boot.
>>>
>>> In some rare cases this causes problems. One example of this is the Minix
>>> Neo Z83-4 mini PC, this device has a clear DSDT bug where it has some copy
>>> and pasted code for dealing with Micro USB-B connector host/device role
>>> switching, while the mini PC does not even have a micro-USB connector.
>>> This code, which should not be there, messes with the DDC data pin from
>>> the HDMI connector (switching it to GPIO mode) breaking HDMI support.
>>>
>>> To avoid problems like this, this commit adds a new
>>> gpiolib_acpi.run_edge_events_on_boot kernel commandline option, which
>>> allows disabling the running of _AEI edge event handlers at boot.
>>>
>>> The default value is -1/auto which uses a DMI based blacklist, the initial
>>> version of this blacklist contains the Neo Z83-4 fixing the HDMI breakage.
>>
>> Thank you!
>>
>> Assuming it works for Ian,
>> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Note I have access to a Minix Neo Z83-4 myself now and I did test that
> this fixes it and that passing gpiolib_acpi.run_edge_events_on_boot=0
> breaks HDMI again (so the option works).
Erm that should be gpiolib_acpi.run_edge_events_on_boot=1 (not 0) breaks
HDMI.
Regards,
Hans
>>> Cc: stable@vger.kernel.org
>>> Cc: Daniel Drake <drake@endlessm.com>
>>> Cc: Ian W MORRISON <ianwmorrison@gmail.com>
>>> Reported-by: Ian W MORRISON <ianwmorrison@gmail.com>
>>> Suggested-by: Ian W MORRISON <ianwmorrison@gmail.com>
>>> Fixes: ca876c7483b6 ("gpiolib-acpi: make sure we trigger edge events at least once on boot")
>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>> ---
>>> Changes in v2:
>>> - Use a module_param instead of __setup
>>> - Do DMI check only once from a postcore_initcall
>>> ---
>>> drivers/gpio/gpiolib-acpi.c | 42 +++++++++++++++++++++++++++++++++----
>>> 1 file changed, 38 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
>>> index 39f2f9035c11..bda28eb82c3f 100644
>>> --- a/drivers/gpio/gpiolib-acpi.c
>>> +++ b/drivers/gpio/gpiolib-acpi.c
>>> @@ -7,6 +7,7 @@
>>> * Mika Westerberg <mika.westerberg@linux.intel.com>
>>> */
>>> +#include <linux/dmi.h>
>>> #include <linux/errno.h>
>>> #include <linux/gpio/consumer.h>
>>> #include <linux/gpio/driver.h>
>>> @@ -19,6 +20,11 @@
>>> #include "gpiolib.h"
>>> +static int run_edge_events_on_boot = -1;
>>> +module_param(run_edge_events_on_boot, int, 0444);
>>> +MODULE_PARM_DESC(run_edge_events_on_boot,
>>> + "Run edge _AEI event-handlers at boot: 0=no, 1=yes, -1=auto");
>>> +
>>> /**
>>> * struct acpi_gpio_event - ACPI GPIO event handler data
>>> *
>>> @@ -170,10 +176,13 @@ static void acpi_gpiochip_request_irq(struct acpi_gpio_chip *acpi_gpio,
>>> event->irq_requested = true;
>>> /* Make sure we trigger the initial state of edge-triggered IRQs */
>>> - value = gpiod_get_raw_value_cansleep(event->desc);
>>> - if (((event->irqflags & IRQF_TRIGGER_RISING) && value == 1) ||
>>> - ((event->irqflags & IRQF_TRIGGER_FALLING) && value == 0))
>>> - event->handler(event->irq, event);
>>> + if (run_edge_events_on_boot &&
>>> + (event->irqflags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING))) {
>>> + value = gpiod_get_raw_value_cansleep(event->desc);
>>> + if (((event->irqflags & IRQF_TRIGGER_RISING) && value == 1) ||
>>> + ((event->irqflags & IRQF_TRIGGER_FALLING) && value == 0))
>>> + event->handler(event->irq, event);
>>> + }
>>> }
>>> static void acpi_gpiochip_request_irqs(struct acpi_gpio_chip *acpi_gpio)
>>> @@ -1283,3 +1292,28 @@ static int acpi_gpio_handle_deferred_request_irqs(void)
>>> }
>>> /* We must use _sync so that this runs after the first deferred_probe run */
>>> late_initcall_sync(acpi_gpio_handle_deferred_request_irqs);
>>> +
>>> +static const struct dmi_system_id run_edge_events_on_boot_blacklist[] = {
>>> + {
>>> + .matches = {
>>> + DMI_MATCH(DMI_SYS_VENDOR, "MINIX"),
>>> + DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"),
>>> + }
>>> + },
>>> + {} /* Terminating entry */
>>> +};
>>> +
>>> +static int acpi_gpio_setup_params(void)
>>> +{
>>> + if (run_edge_events_on_boot < 0) {
>>> + if (dmi_check_system(run_edge_events_on_boot_blacklist))
>>> + run_edge_events_on_boot = 0;
>>> + else
>>> + run_edge_events_on_boot = 1;
>>> + }
>>> +
>>> + return 0;
>>> +}
>>> +
>>> +/* Directly after dmi_setup() which runs as core_initcall() */
>>> +postcore_initcall(acpi_gpio_setup_params);
>>> --
>>> 2.23.0
>>>
>>
^ permalink raw reply
* Re: [PATCH v2] gpiolib: acpi: Add gpiolib_acpi_run_edge_events_on_boot option and blacklist
From: Hans de Goede @ 2019-08-28 12:20 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Mika Westerberg, Bartosz Golaszewski, Linus Walleij, linux-gpio,
linux-acpi, stable, Daniel Drake, Ian W MORRISON
In-Reply-To: <20190828113748.GK2680@smile.fi.intel.com>
Hi,
On 28-08-19 13:37, Andy Shevchenko wrote:
> On Tue, Aug 27, 2019 at 10:28:35PM +0200, Hans de Goede wrote:
>> Another day; another DSDT bug we need to workaround...
>>
>> Since commit ca876c7483b6 ("gpiolib-acpi: make sure we trigger edge events
>> at least once on boot") we call _AEI edge handlers at boot.
>>
>> In some rare cases this causes problems. One example of this is the Minix
>> Neo Z83-4 mini PC, this device has a clear DSDT bug where it has some copy
>> and pasted code for dealing with Micro USB-B connector host/device role
>> switching, while the mini PC does not even have a micro-USB connector.
>> This code, which should not be there, messes with the DDC data pin from
>> the HDMI connector (switching it to GPIO mode) breaking HDMI support.
>>
>> To avoid problems like this, this commit adds a new
>> gpiolib_acpi.run_edge_events_on_boot kernel commandline option, which
>> allows disabling the running of _AEI edge event handlers at boot.
>>
>> The default value is -1/auto which uses a DMI based blacklist, the initial
>> version of this blacklist contains the Neo Z83-4 fixing the HDMI breakage.
>
> Thank you!
>
> Assuming it works for Ian,
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Note I have access to a Minix Neo Z83-4 myself now and I did test that
this fixes it and that passing gpiolib_acpi.run_edge_events_on_boot=0
breaks HDMI again (so the option works).
Regards,
Hans
>
>>
>> Cc: stable@vger.kernel.org
>> Cc: Daniel Drake <drake@endlessm.com>
>> Cc: Ian W MORRISON <ianwmorrison@gmail.com>
>> Reported-by: Ian W MORRISON <ianwmorrison@gmail.com>
>> Suggested-by: Ian W MORRISON <ianwmorrison@gmail.com>
>> Fixes: ca876c7483b6 ("gpiolib-acpi: make sure we trigger edge events at least once on boot")
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> Changes in v2:
>> - Use a module_param instead of __setup
>> - Do DMI check only once from a postcore_initcall
>> ---
>> drivers/gpio/gpiolib-acpi.c | 42 +++++++++++++++++++++++++++++++++----
>> 1 file changed, 38 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
>> index 39f2f9035c11..bda28eb82c3f 100644
>> --- a/drivers/gpio/gpiolib-acpi.c
>> +++ b/drivers/gpio/gpiolib-acpi.c
>> @@ -7,6 +7,7 @@
>> * Mika Westerberg <mika.westerberg@linux.intel.com>
>> */
>>
>> +#include <linux/dmi.h>
>> #include <linux/errno.h>
>> #include <linux/gpio/consumer.h>
>> #include <linux/gpio/driver.h>
>> @@ -19,6 +20,11 @@
>>
>> #include "gpiolib.h"
>>
>> +static int run_edge_events_on_boot = -1;
>> +module_param(run_edge_events_on_boot, int, 0444);
>> +MODULE_PARM_DESC(run_edge_events_on_boot,
>> + "Run edge _AEI event-handlers at boot: 0=no, 1=yes, -1=auto");
>> +
>> /**
>> * struct acpi_gpio_event - ACPI GPIO event handler data
>> *
>> @@ -170,10 +176,13 @@ static void acpi_gpiochip_request_irq(struct acpi_gpio_chip *acpi_gpio,
>> event->irq_requested = true;
>>
>> /* Make sure we trigger the initial state of edge-triggered IRQs */
>> - value = gpiod_get_raw_value_cansleep(event->desc);
>> - if (((event->irqflags & IRQF_TRIGGER_RISING) && value == 1) ||
>> - ((event->irqflags & IRQF_TRIGGER_FALLING) && value == 0))
>> - event->handler(event->irq, event);
>> + if (run_edge_events_on_boot &&
>> + (event->irqflags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING))) {
>> + value = gpiod_get_raw_value_cansleep(event->desc);
>> + if (((event->irqflags & IRQF_TRIGGER_RISING) && value == 1) ||
>> + ((event->irqflags & IRQF_TRIGGER_FALLING) && value == 0))
>> + event->handler(event->irq, event);
>> + }
>> }
>>
>> static void acpi_gpiochip_request_irqs(struct acpi_gpio_chip *acpi_gpio)
>> @@ -1283,3 +1292,28 @@ static int acpi_gpio_handle_deferred_request_irqs(void)
>> }
>> /* We must use _sync so that this runs after the first deferred_probe run */
>> late_initcall_sync(acpi_gpio_handle_deferred_request_irqs);
>> +
>> +static const struct dmi_system_id run_edge_events_on_boot_blacklist[] = {
>> + {
>> + .matches = {
>> + DMI_MATCH(DMI_SYS_VENDOR, "MINIX"),
>> + DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"),
>> + }
>> + },
>> + {} /* Terminating entry */
>> +};
>> +
>> +static int acpi_gpio_setup_params(void)
>> +{
>> + if (run_edge_events_on_boot < 0) {
>> + if (dmi_check_system(run_edge_events_on_boot_blacklist))
>> + run_edge_events_on_boot = 0;
>> + else
>> + run_edge_events_on_boot = 1;
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +/* Directly after dmi_setup() which runs as core_initcall() */
>> +postcore_initcall(acpi_gpio_setup_params);
>> --
>> 2.23.0
>>
>
^ permalink raw reply
* Re: [PATCH 1/2] gpio: gpio-pca953x.c: Correct type of reg_direction
From: Bartosz Golaszewski @ 2019-08-28 12:16 UTC (permalink / raw)
To: David Jander; +Cc: Linus Walleij, linux-gpio, LKML
In-Reply-To: <20190828131330.6a28e5cc@erd988>
śr., 28 sie 2019 o 13:13 David Jander <david@protonic.nl> napisał(a):
>
> On Wed, 28 Aug 2019 12:56:28 +0200
> Bartosz Golaszewski <bgolaszewski@baylibre.com> wrote:
>
> > śr., 28 sie 2019 o 10:38 Bartosz Golaszewski
> > <bgolaszewski@baylibre.com> napisał(a):
> > >
> > > wt., 27 sie 2019 o 08:46 David Jander <david@protonic.nl> napisał(a):
> > > >
> > > > The type of reg_direction needs to match the type of the regmap, which is
> > > > u8.
> > > >
> > > > Signed-off-by: David Jander <david@protonic.nl>
> > > > ---
> > > > drivers/gpio/gpio-pca953x.c | 6 +++---
> > > > 1 file changed, 3 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> > > > index 378b206d2dc9..30072a570bc2 100644
> > > > --- a/drivers/gpio/gpio-pca953x.c
> > > > +++ b/drivers/gpio/gpio-pca953x.c
> > > > @@ -604,7 +604,7 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
> > > > u8 new_irqs;
> > > > int level, i;
> > > > u8 invert_irq_mask[MAX_BANK];
> > > > - int reg_direction[MAX_BANK];
> > > > + u8 reg_direction[MAX_BANK];
> > > >
> > > > regmap_bulk_read(chip->regmap, chip->regs->direction, reg_direction,
> > > > NBANK(chip));
> > > > @@ -679,7 +679,7 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, u8 *pending)
> > > > bool pending_seen = false;
> > > > bool trigger_seen = false;
> > > > u8 trigger[MAX_BANK];
> > > > - int reg_direction[MAX_BANK];
> > > > + u8 reg_direction[MAX_BANK];
> > > > int ret, i;
> > > >
> > > > if (chip->driver_data & PCA_PCAL) {
> > > > @@ -768,7 +768,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
> > > > {
> > > > struct i2c_client *client = chip->client;
> > > > struct irq_chip *irq_chip = &chip->irq_chip;
> > > > - int reg_direction[MAX_BANK];
> > > > + u8 reg_direction[MAX_BANK];
> > > > int ret, i;
> > > >
> > > > if (!client->irq)
> > > > --
> > > > 2.19.1
> > > >
> > >
> > > Applied for v5.4.
> >
> > Actually the second patch depends on the first one, so moved it over to fixes.
>
> Btw, they are both bugfixes, IMHO it would be valuable to have them in 5.3rc
> if possible... there is some severe breakage there right now.
>
> Best regards,
>
> --
> David Jander
>
Yes, that's why I said I moved it to fixes.
Bart
^ permalink raw reply
* Re: [PATCH v2] gpiolib: acpi: Add gpiolib_acpi_run_edge_events_on_boot option and blacklist
From: Andy Shevchenko @ 2019-08-28 11:37 UTC (permalink / raw)
To: Hans de Goede
Cc: Mika Westerberg, Bartosz Golaszewski, Linus Walleij, linux-gpio,
linux-acpi, stable, Daniel Drake, Ian W MORRISON
In-Reply-To: <20190827202835.213456-1-hdegoede@redhat.com>
On Tue, Aug 27, 2019 at 10:28:35PM +0200, Hans de Goede wrote:
> Another day; another DSDT bug we need to workaround...
>
> Since commit ca876c7483b6 ("gpiolib-acpi: make sure we trigger edge events
> at least once on boot") we call _AEI edge handlers at boot.
>
> In some rare cases this causes problems. One example of this is the Minix
> Neo Z83-4 mini PC, this device has a clear DSDT bug where it has some copy
> and pasted code for dealing with Micro USB-B connector host/device role
> switching, while the mini PC does not even have a micro-USB connector.
> This code, which should not be there, messes with the DDC data pin from
> the HDMI connector (switching it to GPIO mode) breaking HDMI support.
>
> To avoid problems like this, this commit adds a new
> gpiolib_acpi.run_edge_events_on_boot kernel commandline option, which
> allows disabling the running of _AEI edge event handlers at boot.
>
> The default value is -1/auto which uses a DMI based blacklist, the initial
> version of this blacklist contains the Neo Z83-4 fixing the HDMI breakage.
Thank you!
Assuming it works for Ian,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Cc: stable@vger.kernel.org
> Cc: Daniel Drake <drake@endlessm.com>
> Cc: Ian W MORRISON <ianwmorrison@gmail.com>
> Reported-by: Ian W MORRISON <ianwmorrison@gmail.com>
> Suggested-by: Ian W MORRISON <ianwmorrison@gmail.com>
> Fixes: ca876c7483b6 ("gpiolib-acpi: make sure we trigger edge events at least once on boot")
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> - Use a module_param instead of __setup
> - Do DMI check only once from a postcore_initcall
> ---
> drivers/gpio/gpiolib-acpi.c | 42 +++++++++++++++++++++++++++++++++----
> 1 file changed, 38 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
> index 39f2f9035c11..bda28eb82c3f 100644
> --- a/drivers/gpio/gpiolib-acpi.c
> +++ b/drivers/gpio/gpiolib-acpi.c
> @@ -7,6 +7,7 @@
> * Mika Westerberg <mika.westerberg@linux.intel.com>
> */
>
> +#include <linux/dmi.h>
> #include <linux/errno.h>
> #include <linux/gpio/consumer.h>
> #include <linux/gpio/driver.h>
> @@ -19,6 +20,11 @@
>
> #include "gpiolib.h"
>
> +static int run_edge_events_on_boot = -1;
> +module_param(run_edge_events_on_boot, int, 0444);
> +MODULE_PARM_DESC(run_edge_events_on_boot,
> + "Run edge _AEI event-handlers at boot: 0=no, 1=yes, -1=auto");
> +
> /**
> * struct acpi_gpio_event - ACPI GPIO event handler data
> *
> @@ -170,10 +176,13 @@ static void acpi_gpiochip_request_irq(struct acpi_gpio_chip *acpi_gpio,
> event->irq_requested = true;
>
> /* Make sure we trigger the initial state of edge-triggered IRQs */
> - value = gpiod_get_raw_value_cansleep(event->desc);
> - if (((event->irqflags & IRQF_TRIGGER_RISING) && value == 1) ||
> - ((event->irqflags & IRQF_TRIGGER_FALLING) && value == 0))
> - event->handler(event->irq, event);
> + if (run_edge_events_on_boot &&
> + (event->irqflags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING))) {
> + value = gpiod_get_raw_value_cansleep(event->desc);
> + if (((event->irqflags & IRQF_TRIGGER_RISING) && value == 1) ||
> + ((event->irqflags & IRQF_TRIGGER_FALLING) && value == 0))
> + event->handler(event->irq, event);
> + }
> }
>
> static void acpi_gpiochip_request_irqs(struct acpi_gpio_chip *acpi_gpio)
> @@ -1283,3 +1292,28 @@ static int acpi_gpio_handle_deferred_request_irqs(void)
> }
> /* We must use _sync so that this runs after the first deferred_probe run */
> late_initcall_sync(acpi_gpio_handle_deferred_request_irqs);
> +
> +static const struct dmi_system_id run_edge_events_on_boot_blacklist[] = {
> + {
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "MINIX"),
> + DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"),
> + }
> + },
> + {} /* Terminating entry */
> +};
> +
> +static int acpi_gpio_setup_params(void)
> +{
> + if (run_edge_events_on_boot < 0) {
> + if (dmi_check_system(run_edge_events_on_boot_blacklist))
> + run_edge_events_on_boot = 0;
> + else
> + run_edge_events_on_boot = 1;
> + }
> +
> + return 0;
> +}
> +
> +/* Directly after dmi_setup() which runs as core_initcall() */
> +postcore_initcall(acpi_gpio_setup_params);
> --
> 2.23.0
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH v2] gpiolib: acpi: Add gpiolib_acpi_run_edge_events_on_boot option and blacklist
From: Mika Westerberg @ 2019-08-28 11:37 UTC (permalink / raw)
To: Hans de Goede
Cc: Andy Shevchenko, Bartosz Golaszewski, Linus Walleij, linux-gpio,
linux-acpi, stable, Daniel Drake, Ian W MORRISON
In-Reply-To: <20190827202835.213456-1-hdegoede@redhat.com>
On Tue, Aug 27, 2019 at 10:28:35PM +0200, Hans de Goede wrote:
> Another day; another DSDT bug we need to workaround...
>
> Since commit ca876c7483b6 ("gpiolib-acpi: make sure we trigger edge events
> at least once on boot") we call _AEI edge handlers at boot.
>
> In some rare cases this causes problems. One example of this is the Minix
> Neo Z83-4 mini PC, this device has a clear DSDT bug where it has some copy
> and pasted code for dealing with Micro USB-B connector host/device role
> switching, while the mini PC does not even have a micro-USB connector.
> This code, which should not be there, messes with the DDC data pin from
> the HDMI connector (switching it to GPIO mode) breaking HDMI support.
>
> To avoid problems like this, this commit adds a new
> gpiolib_acpi.run_edge_events_on_boot kernel commandline option, which
> allows disabling the running of _AEI edge event handlers at boot.
>
> The default value is -1/auto which uses a DMI based blacklist, the initial
> version of this blacklist contains the Neo Z83-4 fixing the HDMI breakage.
>
> Cc: stable@vger.kernel.org
> Cc: Daniel Drake <drake@endlessm.com>
> Cc: Ian W MORRISON <ianwmorrison@gmail.com>
> Reported-by: Ian W MORRISON <ianwmorrison@gmail.com>
> Suggested-by: Ian W MORRISON <ianwmorrison@gmail.com>
> Fixes: ca876c7483b6 ("gpiolib-acpi: make sure we trigger edge events at least once on boot")
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply
* Re: [PATCH 1/2] gpio: gpio-pca953x.c: Correct type of reg_direction
From: David Jander @ 2019-08-28 11:13 UTC (permalink / raw)
To: Bartosz Golaszewski; +Cc: Linus Walleij, linux-gpio, LKML
In-Reply-To: <CAMpxmJXQ=M9PeMFBf70aE5Jgg3c6P2=4QF5CxWpenh+2WXLhnA@mail.gmail.com>
On Wed, 28 Aug 2019 12:56:28 +0200
Bartosz Golaszewski <bgolaszewski@baylibre.com> wrote:
> śr., 28 sie 2019 o 10:38 Bartosz Golaszewski
> <bgolaszewski@baylibre.com> napisał(a):
> >
> > wt., 27 sie 2019 o 08:46 David Jander <david@protonic.nl> napisał(a):
> > >
> > > The type of reg_direction needs to match the type of the regmap, which is
> > > u8.
> > >
> > > Signed-off-by: David Jander <david@protonic.nl>
> > > ---
> > > drivers/gpio/gpio-pca953x.c | 6 +++---
> > > 1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> > > index 378b206d2dc9..30072a570bc2 100644
> > > --- a/drivers/gpio/gpio-pca953x.c
> > > +++ b/drivers/gpio/gpio-pca953x.c
> > > @@ -604,7 +604,7 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
> > > u8 new_irqs;
> > > int level, i;
> > > u8 invert_irq_mask[MAX_BANK];
> > > - int reg_direction[MAX_BANK];
> > > + u8 reg_direction[MAX_BANK];
> > >
> > > regmap_bulk_read(chip->regmap, chip->regs->direction, reg_direction,
> > > NBANK(chip));
> > > @@ -679,7 +679,7 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, u8 *pending)
> > > bool pending_seen = false;
> > > bool trigger_seen = false;
> > > u8 trigger[MAX_BANK];
> > > - int reg_direction[MAX_BANK];
> > > + u8 reg_direction[MAX_BANK];
> > > int ret, i;
> > >
> > > if (chip->driver_data & PCA_PCAL) {
> > > @@ -768,7 +768,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
> > > {
> > > struct i2c_client *client = chip->client;
> > > struct irq_chip *irq_chip = &chip->irq_chip;
> > > - int reg_direction[MAX_BANK];
> > > + u8 reg_direction[MAX_BANK];
> > > int ret, i;
> > >
> > > if (!client->irq)
> > > --
> > > 2.19.1
> > >
> >
> > Applied for v5.4.
>
> Actually the second patch depends on the first one, so moved it over to fixes.
Btw, they are both bugfixes, IMHO it would be valuable to have them in 5.3rc
if possible... there is some severe breakage there right now.
Best regards,
--
David Jander
^ permalink raw reply
* Re: [PATCH 1/2] gpio: gpio-pca953x.c: Correct type of reg_direction
From: Bartosz Golaszewski @ 2019-08-28 10:56 UTC (permalink / raw)
To: David Jander; +Cc: Linus Walleij, linux-gpio, LKML
In-Reply-To: <CAMpxmJV2XC+CK1SfJnH2YuaD2Gh=fiBQY+WPbjnqkvxGW6ZH_w@mail.gmail.com>
śr., 28 sie 2019 o 10:38 Bartosz Golaszewski
<bgolaszewski@baylibre.com> napisał(a):
>
> wt., 27 sie 2019 o 08:46 David Jander <david@protonic.nl> napisał(a):
> >
> > The type of reg_direction needs to match the type of the regmap, which is
> > u8.
> >
> > Signed-off-by: David Jander <david@protonic.nl>
> > ---
> > drivers/gpio/gpio-pca953x.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> > index 378b206d2dc9..30072a570bc2 100644
> > --- a/drivers/gpio/gpio-pca953x.c
> > +++ b/drivers/gpio/gpio-pca953x.c
> > @@ -604,7 +604,7 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
> > u8 new_irqs;
> > int level, i;
> > u8 invert_irq_mask[MAX_BANK];
> > - int reg_direction[MAX_BANK];
> > + u8 reg_direction[MAX_BANK];
> >
> > regmap_bulk_read(chip->regmap, chip->regs->direction, reg_direction,
> > NBANK(chip));
> > @@ -679,7 +679,7 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, u8 *pending)
> > bool pending_seen = false;
> > bool trigger_seen = false;
> > u8 trigger[MAX_BANK];
> > - int reg_direction[MAX_BANK];
> > + u8 reg_direction[MAX_BANK];
> > int ret, i;
> >
> > if (chip->driver_data & PCA_PCAL) {
> > @@ -768,7 +768,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
> > {
> > struct i2c_client *client = chip->client;
> > struct irq_chip *irq_chip = &chip->irq_chip;
> > - int reg_direction[MAX_BANK];
> > + u8 reg_direction[MAX_BANK];
> > int ret, i;
> >
> > if (!client->irq)
> > --
> > 2.19.1
> >
>
> Applied for v5.4.
Actually the second patch depends on the first one, so moved it over to fixes.
Bart
>
> Thanks!
> Bart
^ permalink raw reply
* Re: [PATCH 2/2] gpio: pca953x.c: Use pca953x_read_regs instead of regmap_bulk_read
From: Bartosz Golaszewski @ 2019-08-28 8:42 UTC (permalink / raw)
To: David Jander; +Cc: Linus Walleij, linux-gpio, LKML
In-Reply-To: <20190827064629.90214-2-david@protonic.nl>
wt., 27 sie 2019 o 08:47 David Jander <david@protonic.nl> napisał(a):
>
> The register number needs to be translated for chips with more than 8
> ports. This patch fixes a bug causing all chips with more than 8 GPIO pins
> to not work correctly.
>
> Signed-off-by: David Jander <david@protonic.nl>
> ---
> drivers/gpio/gpio-pca953x.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> index 30072a570bc2..48fea4c68e8d 100644
> --- a/drivers/gpio/gpio-pca953x.c
> +++ b/drivers/gpio/gpio-pca953x.c
> @@ -606,8 +606,7 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
> u8 invert_irq_mask[MAX_BANK];
> u8 reg_direction[MAX_BANK];
>
> - regmap_bulk_read(chip->regmap, chip->regs->direction, reg_direction,
> - NBANK(chip));
> + pca953x_read_regs(chip, chip->regs->direction, reg_direction);
>
> if (chip->driver_data & PCA_PCAL) {
> /* Enable latch on interrupt-enabled inputs */
> @@ -710,8 +709,7 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, u8 *pending)
> return false;
>
> /* Remove output pins from the equation */
> - regmap_bulk_read(chip->regmap, chip->regs->direction, reg_direction,
> - NBANK(chip));
> + pca953x_read_regs(chip, chip->regs->direction, reg_direction);
> for (i = 0; i < NBANK(chip); i++)
> cur_stat[i] &= reg_direction[i];
>
> @@ -789,8 +787,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
> * interrupt. We have to rely on the previous read for
> * this purpose.
> */
> - regmap_bulk_read(chip->regmap, chip->regs->direction, reg_direction,
> - NBANK(chip));
> + pca953x_read_regs(chip, chip->regs->direction, reg_direction);
> for (i = 0; i < NBANK(chip); i++)
> chip->irq_stat[i] &= reg_direction[i];
> mutex_init(&chip->irq_lock);
> --
> 2.19.1
>
Applied to fixes. Thanks!
Bart
^ permalink raw reply
* Re: [PATCH 1/2] gpio: gpio-pca953x.c: Correct type of reg_direction
From: Bartosz Golaszewski @ 2019-08-28 8:38 UTC (permalink / raw)
To: David Jander; +Cc: Linus Walleij, linux-gpio, LKML
In-Reply-To: <20190827064629.90214-1-david@protonic.nl>
wt., 27 sie 2019 o 08:46 David Jander <david@protonic.nl> napisał(a):
>
> The type of reg_direction needs to match the type of the regmap, which is
> u8.
>
> Signed-off-by: David Jander <david@protonic.nl>
> ---
> drivers/gpio/gpio-pca953x.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> index 378b206d2dc9..30072a570bc2 100644
> --- a/drivers/gpio/gpio-pca953x.c
> +++ b/drivers/gpio/gpio-pca953x.c
> @@ -604,7 +604,7 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
> u8 new_irqs;
> int level, i;
> u8 invert_irq_mask[MAX_BANK];
> - int reg_direction[MAX_BANK];
> + u8 reg_direction[MAX_BANK];
>
> regmap_bulk_read(chip->regmap, chip->regs->direction, reg_direction,
> NBANK(chip));
> @@ -679,7 +679,7 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, u8 *pending)
> bool pending_seen = false;
> bool trigger_seen = false;
> u8 trigger[MAX_BANK];
> - int reg_direction[MAX_BANK];
> + u8 reg_direction[MAX_BANK];
> int ret, i;
>
> if (chip->driver_data & PCA_PCAL) {
> @@ -768,7 +768,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
> {
> struct i2c_client *client = chip->client;
> struct irq_chip *irq_chip = &chip->irq_chip;
> - int reg_direction[MAX_BANK];
> + u8 reg_direction[MAX_BANK];
> int ret, i;
>
> if (!client->irq)
> --
> 2.19.1
>
Applied for v5.4.
Thanks!
Bart
^ permalink raw reply
* linusw/fixes boot: 52 boots: 1 failed, 51 passed (v5.3-rc6)
From: kernelci.org bot @ 2019-08-28 5:24 UTC (permalink / raw)
To: linux-gpio, fellows
linusw/fixes boot: 52 boots: 1 failed, 51 passed (v5.3-rc6)
Full Boot Summary: https://kernelci.org/boot/all/job/linusw/branch/fixes/kernel/v5.3-rc6/
Full Build Summary: https://kernelci.org/build/linusw/branch/fixes/kernel/v5.3-rc6/
Tree: linusw
Branch: fixes
Git Describe: v5.3-rc6
Git Commit: a55aa89aab90fae7c815b0551b07be37db359d76
Git URL: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/
Tested: 37 unique boards, 15 SoC families, 3 builds out of 6
Boot Failure Detected:
arm64:
defconfig:
gcc-8:
meson-gxm-khadas-vim2: 1 failed lab
---
For more info write to <info@kernelci.org>
^ permalink raw reply
* linusw/fixes build: 6 builds: 0 failed, 6 passed, 30 warnings (v5.3-rc6)
From: kernelci.org bot @ 2019-08-28 4:40 UTC (permalink / raw)
To: linux-gpio, fellows
linusw/fixes build: 6 builds: 0 failed, 6 passed, 30 warnings (v5.3-rc6)
Full Build Summary: https://kernelci.org/build/linusw/branch/fixes/kernel/v5.3-rc6/
Tree: linusw
Branch: fixes
Git Describe: v5.3-rc6
Git Commit: a55aa89aab90fae7c815b0551b07be37db359d76
Git URL: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/
Built: 6 unique architectures
Warnings Detected:
arc:
nsim_hs_defconfig (gcc-8): 5 warnings
arm64:
defconfig (gcc-8): 3 warnings
arm:
multi_v7_defconfig (gcc-8): 19 warnings
mips:
32r2el_defconfig (gcc-8): 3 warnings
riscv:
x86_64:
Warnings summary:
5 <stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
2 drivers/pinctrl/qcom/pinctrl-spmi-gpio.c:820:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
2 drivers/pinctrl/qcom/pinctrl-spmi-gpio.c:815:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
2 drivers/pinctrl/pinctrl-rockchip.c:2783:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 include/linux/compiler.h:328:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 drivers/video/fbdev/sh_mobile_lcdcfb.c:2086:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 drivers/video/fbdev/sh_mobile_lcdcfb.c:1596:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 drivers/usb/phy/phy-ab8500-usb.c:459:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 drivers/usb/phy/phy-ab8500-usb.c:440:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 drivers/usb/phy/phy-ab8500-usb.c:424:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 drivers/usb/phy/phy-ab8500-usb.c:370:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 drivers/usb/phy/phy-ab8500-usb.c:352:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 drivers/usb/phy/phy-ab8500-usb.c:332:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 drivers/mmc/host/sdhci-s3c.c:613:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 drivers/mmc/host/atmel-mci.c:2426:40: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 drivers/mmc/host/atmel-mci.c:2422:28: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 drivers/mmc/host/atmel-mci.c:2415:30: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 drivers/gpu/drm/sti/sti_hdmi.c:855:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 drivers/gpu/drm/sti/sti_hdmi.c:853:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 drivers/gpu/drm/sti/sti_hdmi.c:851:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 drivers/dma/imx-dma.c:542:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 arch/arc/kernel/unwind.c:836:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
1 arch/arc/kernel/unwind.c:827:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
================================================================================
Detailed per-defconfig build reports:
--------------------------------------------------------------------------------
32r2el_defconfig (mips, gcc-8) — PASS, 0 errors, 3 warnings, 0 section mismatches
Warnings:
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
--------------------------------------------------------------------------------
defconfig (riscv, gcc-8) — PASS, 0 errors, 0 warnings, 0 section mismatches
--------------------------------------------------------------------------------
defconfig (arm64, gcc-8) — PASS, 0 errors, 3 warnings, 0 section mismatches
Warnings:
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c:815:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c:820:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/pinctrl/pinctrl-rockchip.c:2783:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
--------------------------------------------------------------------------------
multi_v7_defconfig (arm, gcc-8) — PASS, 0 errors, 19 warnings, 0 section mismatches
Warnings:
drivers/dma/imx-dma.c:542:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/mmc/host/sdhci-s3c.c:613:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/mmc/host/atmel-mci.c:2415:30: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/mmc/host/atmel-mci.c:2422:28: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/mmc/host/atmel-mci.c:2426:40: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c:815:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c:820:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/pinctrl/pinctrl-rockchip.c:2783:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/video/fbdev/sh_mobile_lcdcfb.c:2086:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/video/fbdev/sh_mobile_lcdcfb.c:1596:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/usb/phy/phy-ab8500-usb.c:424:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/usb/phy/phy-ab8500-usb.c:440:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/usb/phy/phy-ab8500-usb.c:459:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/usb/phy/phy-ab8500-usb.c:332:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/usb/phy/phy-ab8500-usb.c:352:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/usb/phy/phy-ab8500-usb.c:370:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/gpu/drm/sti/sti_hdmi.c:851:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/gpu/drm/sti/sti_hdmi.c:853:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/gpu/drm/sti/sti_hdmi.c:855:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
--------------------------------------------------------------------------------
nsim_hs_defconfig (arc, gcc-8) — PASS, 0 errors, 5 warnings, 0 section mismatches
Warnings:
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
include/linux/compiler.h:328:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
arch/arc/kernel/unwind.c:827:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
arch/arc/kernel/unwind.c:836:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
--------------------------------------------------------------------------------
x86_64_defconfig (x86_64, gcc-8) — PASS, 0 errors, 0 warnings, 0 section mismatches
---
For more info write to <info@kernelci.org>
^ permalink raw reply
* [PATCH v2] gpiolib: acpi: Add gpiolib_acpi_run_edge_events_on_boot option and blacklist
From: Hans de Goede @ 2019-08-27 20:28 UTC (permalink / raw)
To: Mika Westerberg, Andy Shevchenko, Bartosz Golaszewski,
Linus Walleij
Cc: Hans de Goede, linux-gpio, linux-acpi, stable, Daniel Drake,
Ian W MORRISON
Another day; another DSDT bug we need to workaround...
Since commit ca876c7483b6 ("gpiolib-acpi: make sure we trigger edge events
at least once on boot") we call _AEI edge handlers at boot.
In some rare cases this causes problems. One example of this is the Minix
Neo Z83-4 mini PC, this device has a clear DSDT bug where it has some copy
and pasted code for dealing with Micro USB-B connector host/device role
switching, while the mini PC does not even have a micro-USB connector.
This code, which should not be there, messes with the DDC data pin from
the HDMI connector (switching it to GPIO mode) breaking HDMI support.
To avoid problems like this, this commit adds a new
gpiolib_acpi.run_edge_events_on_boot kernel commandline option, which
allows disabling the running of _AEI edge event handlers at boot.
The default value is -1/auto which uses a DMI based blacklist, the initial
version of this blacklist contains the Neo Z83-4 fixing the HDMI breakage.
Cc: stable@vger.kernel.org
Cc: Daniel Drake <drake@endlessm.com>
Cc: Ian W MORRISON <ianwmorrison@gmail.com>
Reported-by: Ian W MORRISON <ianwmorrison@gmail.com>
Suggested-by: Ian W MORRISON <ianwmorrison@gmail.com>
Fixes: ca876c7483b6 ("gpiolib-acpi: make sure we trigger edge events at least once on boot")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
- Use a module_param instead of __setup
- Do DMI check only once from a postcore_initcall
---
drivers/gpio/gpiolib-acpi.c | 42 +++++++++++++++++++++++++++++++++----
1 file changed, 38 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 39f2f9035c11..bda28eb82c3f 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -7,6 +7,7 @@
* Mika Westerberg <mika.westerberg@linux.intel.com>
*/
+#include <linux/dmi.h>
#include <linux/errno.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
@@ -19,6 +20,11 @@
#include "gpiolib.h"
+static int run_edge_events_on_boot = -1;
+module_param(run_edge_events_on_boot, int, 0444);
+MODULE_PARM_DESC(run_edge_events_on_boot,
+ "Run edge _AEI event-handlers at boot: 0=no, 1=yes, -1=auto");
+
/**
* struct acpi_gpio_event - ACPI GPIO event handler data
*
@@ -170,10 +176,13 @@ static void acpi_gpiochip_request_irq(struct acpi_gpio_chip *acpi_gpio,
event->irq_requested = true;
/* Make sure we trigger the initial state of edge-triggered IRQs */
- value = gpiod_get_raw_value_cansleep(event->desc);
- if (((event->irqflags & IRQF_TRIGGER_RISING) && value == 1) ||
- ((event->irqflags & IRQF_TRIGGER_FALLING) && value == 0))
- event->handler(event->irq, event);
+ if (run_edge_events_on_boot &&
+ (event->irqflags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING))) {
+ value = gpiod_get_raw_value_cansleep(event->desc);
+ if (((event->irqflags & IRQF_TRIGGER_RISING) && value == 1) ||
+ ((event->irqflags & IRQF_TRIGGER_FALLING) && value == 0))
+ event->handler(event->irq, event);
+ }
}
static void acpi_gpiochip_request_irqs(struct acpi_gpio_chip *acpi_gpio)
@@ -1283,3 +1292,28 @@ static int acpi_gpio_handle_deferred_request_irqs(void)
}
/* We must use _sync so that this runs after the first deferred_probe run */
late_initcall_sync(acpi_gpio_handle_deferred_request_irqs);
+
+static const struct dmi_system_id run_edge_events_on_boot_blacklist[] = {
+ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "MINIX"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"),
+ }
+ },
+ {} /* Terminating entry */
+};
+
+static int acpi_gpio_setup_params(void)
+{
+ if (run_edge_events_on_boot < 0) {
+ if (dmi_check_system(run_edge_events_on_boot_blacklist))
+ run_edge_events_on_boot = 0;
+ else
+ run_edge_events_on_boot = 1;
+ }
+
+ return 0;
+}
+
+/* Directly after dmi_setup() which runs as core_initcall() */
+postcore_initcall(acpi_gpio_setup_params);
--
2.23.0
^ permalink raw reply related
* linusw/for-next boot: 56 boots: 1 failed, 54 passed with 1 untried/unknown (v5.3-rc1-46-gf4e9bcc05f4e)
From: kernelci.org bot @ 2019-08-27 20:24 UTC (permalink / raw)
To: linux-gpio, fellows
linusw/for-next boot: 56 boots: 1 failed, 54 passed with 1 untried/unknown (v5.3-rc1-46-gf4e9bcc05f4e)
Full Boot Summary: https://kernelci.org/boot/all/job/linusw/branch/for-next/kernel/v5.3-rc1-46-gf4e9bcc05f4e/
Full Build Summary: https://kernelci.org/build/linusw/branch/for-next/kernel/v5.3-rc1-46-gf4e9bcc05f4e/
Tree: linusw
Branch: for-next
Git Describe: v5.3-rc1-46-gf4e9bcc05f4e
Git Commit: f4e9bcc05f4e8d543afbfc0ca1fd4435a2204776
Git URL: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/
Tested: 39 unique boards, 16 SoC families, 3 builds out of 6
Boot Regressions Detected:
arm:
multi_v7_defconfig:
gcc-8:
sun5i-a13-olinuxino-micro:
lab-baylibre: new failure (last pass: v5.3-rc4-40-g67d5826a3303)
arm64:
defconfig:
gcc-8:
apq8016-sbc:
lab-mhart: new failure (last pass: v5.3-rc4-40-g67d5826a3303)
Boot Failure Detected:
arm64:
defconfig:
gcc-8:
apq8016-sbc: 1 failed lab
---
For more info write to <info@kernelci.org>
^ permalink raw reply
* linusw/for-next build: 6 builds: 0 failed, 6 passed, 13 warnings (v5.3-rc1-46-gf4e9bcc05f4e)
From: kernelci.org bot @ 2019-08-27 19:39 UTC (permalink / raw)
To: linux-gpio, fellows
linusw/for-next build: 6 builds: 0 failed, 6 passed, 13 warnings (v5.3-rc1-46-gf4e9bcc05f4e)
Full Build Summary: https://kernelci.org/build/linusw/branch/for-next/kernel/v5.3-rc1-46-gf4e9bcc05f4e/
Tree: linusw
Branch: for-next
Git Describe: v5.3-rc1-46-gf4e9bcc05f4e
Git Commit: f4e9bcc05f4e8d543afbfc0ca1fd4435a2204776
Git URL: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/
Built: 6 unique architectures
Warnings Detected:
arc:
nsim_hs_defconfig (gcc-8): 2 warnings
arm64:
arm:
multi_v7_defconfig (gcc-8): 6 warnings
mips:
32r2el_defconfig (gcc-8): 3 warnings
riscv:
defconfig (gcc-8): 2 warnings
x86_64:
Warnings summary:
7 <stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
1 arch/arm/boot/dts/bcm47094-linksys-panamera.dts:129.4-18: Warning (reg_format): /mdio-bus-mux/mdio@200:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
1 arch/arm/boot/dts/bcm47094-linksys-panamera.dts:128.22-132.5: Warning (avoid_default_addr_size): /mdio-bus-mux/mdio@200: Relying on default #size-cells value
1 arch/arm/boot/dts/bcm47094-linksys-panamera.dts:128.22-132.5: Warning (avoid_default_addr_size): /mdio-bus-mux/mdio@200: Relying on default #address-cells value
1 arch/arm/boot/dts/bcm47094-linksys-panamera.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
1 arch/arm/boot/dts/bcm47094-linksys-panamera.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
1 arch/arm/boot/dts/bcm47094-linksys-panamera.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
================================================================================
Detailed per-defconfig build reports:
--------------------------------------------------------------------------------
32r2el_defconfig (mips, gcc-8) — PASS, 0 errors, 3 warnings, 0 section mismatches
Warnings:
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
--------------------------------------------------------------------------------
defconfig (riscv, gcc-8) — PASS, 0 errors, 2 warnings, 0 section mismatches
Warnings:
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
--------------------------------------------------------------------------------
defconfig (arm64, gcc-8) — PASS, 0 errors, 0 warnings, 0 section mismatches
--------------------------------------------------------------------------------
multi_v7_defconfig (arm, gcc-8) — PASS, 0 errors, 6 warnings, 0 section mismatches
Warnings:
arch/arm/boot/dts/bcm47094-linksys-panamera.dts:129.4-18: Warning (reg_format): /mdio-bus-mux/mdio@200:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
arch/arm/boot/dts/bcm47094-linksys-panamera.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
arch/arm/boot/dts/bcm47094-linksys-panamera.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
arch/arm/boot/dts/bcm47094-linksys-panamera.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
arch/arm/boot/dts/bcm47094-linksys-panamera.dts:128.22-132.5: Warning (avoid_default_addr_size): /mdio-bus-mux/mdio@200: Relying on default #address-cells value
arch/arm/boot/dts/bcm47094-linksys-panamera.dts:128.22-132.5: Warning (avoid_default_addr_size): /mdio-bus-mux/mdio@200: Relying on default #size-cells value
--------------------------------------------------------------------------------
nsim_hs_defconfig (arc, gcc-8) — PASS, 0 errors, 2 warnings, 0 section mismatches
Warnings:
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
--------------------------------------------------------------------------------
x86_64_defconfig (x86_64, gcc-8) — PASS, 0 errors, 0 warnings, 0 section mismatches
---
For more info write to <info@kernelci.org>
^ permalink raw reply
* Re: [PATCH] gpiolib: acpi: Add gpiolib_acpi_run_edge_events_on_boot option and blacklist
From: Hans de Goede @ 2019-08-27 14:41 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Mika Westerberg, Linus Walleij, Bartosz Golaszewski,
Benjamin Tissoires, linux-gpio, linux-acpi, linux-kernel, stable,
Daniel Drake, Ian W MORRISON
In-Reply-To: <20190826091110.GY30120@smile.fi.intel.com>
Hi Andy,
On 26-08-19 11:11, Andy Shevchenko wrote:
> On Fri, Aug 23, 2019 at 11:52:55PM +0200, Hans de Goede wrote:
>> Another day; another DSDT bug we need to workaround...
>>
>> Since commit ca876c7483b6 ("gpiolib-acpi: make sure we trigger edge events
>> at least once on boot") we call _AEI edge handlers at boot.
>>
>> In some rare cases this causes problems. One example of this is the Minix
>> Neo Z83-4 mini PC, this device has a clear DSDT bug where it has some copy
>> and pasted code for dealing with Micro USB-B connector host/device role
>> switching, while the mini PC does not even have a micro-USB connector.
>> This code, which should not be there, messes with the DDC data pin from
>> the HDMI connector (switching it to GPIO mode) breaking HDMI support.
>>
>> To avoid problems like this, this commit adds a new
>> gpiolib_acpi_run_edge_events_on_boot kernel commandline option which
>> can be "on", "off", or "auto" (default).
>>
>> In auto mode the default is on and a DMI based blacklist is used,
>> the initial version of this blacklist contains the Minix Neo Z83-4
>> fixing the HDMI being broken on this device.
>
>> +static int gpiolib_acpi_run_edge_events_on_boot = -1;
>> +
>> +static int __init gpiolib_acpi_run_edge_events_on_boot_setup(char *arg)
>> +{
>
>> + if (!strcmp(arg, "on"))
>> + gpiolib_acpi_run_edge_events_on_boot = 1;
>> + else if (!strcmp(arg, "off"))
>> + gpiolib_acpi_run_edge_events_on_boot = 0;
>
> kstrtobool() ?
>
>> + else if (!strcmp(arg, "auto"))
>> + gpiolib_acpi_run_edge_events_on_boot = -1;
>> +
>> + return 1;
>> +}
>
>> +
>> +__setup("gpiolib_acpi_run_edge_events_on_boot=",
>> + gpiolib_acpi_run_edge_events_on_boot_setup);
>
> Can't we use module_param() ?
> The resulting option would be 'gpiolib_acpi.foo=...'
I was expecting that would not work, since gpiolib is a bool
not a tristate, but it seems that if there is no module-name
to use as prefix for module-parameters the kernel simply uses
the .c file name, so this works and yes, this is better then
using __setup, will fix for v2.
>> +{
>
>> + if (gpiolib_acpi_run_edge_events_on_boot == -1) {
>> + if (dmi_check_system(run_edge_events_on_boot_blacklist))
>> + gpiolib_acpi_run_edge_events_on_boot = 0;
>> + else
>> + gpiolib_acpi_run_edge_events_on_boot = 1;
>> + }
>
> Can we run this at an initcall once and use variable instead of calling a
> method below?
I was a bit worried about init ordering, but I've checked and dmi_setup()
is done as a core_initcall, so we can do this once as a postcore_initcall
which should be early enough, will fix for v2.
>
>> + return gpiolib_acpi_run_edge_events_on_boot;
>> +}
>> +
>> static void acpi_gpiochip_request_irq(struct acpi_gpio_chip *acpi_gpio,
>> struct acpi_gpio_event *event)
>> {
>> @@ -170,10 +211,13 @@ static void acpi_gpiochip_request_irq(struct acpi_gpio_chip *acpi_gpio,
>> event->irq_requested = true;
>>
>> /* Make sure we trigger the initial state of edge-triggered IRQs */
>> - value = gpiod_get_raw_value_cansleep(event->desc);
>> - if (((event->irqflags & IRQF_TRIGGER_RISING) && value == 1) ||
>> - ((event->irqflags & IRQF_TRIGGER_FALLING) && value == 0))
>> - event->handler(event->irq, event);
>> + if (acpi_gpiochip_run_edge_events_on_boot() &&
>> + (event->irqflags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING))) {
>> + value = gpiod_get_raw_value_cansleep(event->desc);
>> + if (((event->irqflags & IRQF_TRIGGER_RISING) && value == 1) ||
>> + ((event->irqflags & IRQF_TRIGGER_FALLING) && value == 0))
>> + event->handler(event->irq, event);
>> + }
>
Regards,
Hans
^ permalink raw reply
* Re: [PATCH 0/3] CP115 pinctrl support
From: Gregory CLEMENT @ 2019-08-27 14:24 UTC (permalink / raw)
To: Linus Walleij, Miquel Raynal
Cc: Yan Markman, Thomas Petazzoni, Rob Herring, Mark Rutland,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Antoine Tenart, Maxime Chevallier, Nadav Haklai,
open list:GPIO SUBSYSTEM, Linux ARM, Grzegorz Jaszczyk,
Marcin Wojtas, Stefan Chulski
In-Reply-To: <CACRpkdZ+zSCSc9Q40=_+K0kfZ4evuOTAShVYWYvuSeOfgkxZng@mail.gmail.com>
Hi Linus,
> On Sat, Aug 24, 2019 at 1:33 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>> Linus Walleij <linus.walleij@linaro.org> wrote on Thu, 15 Aug 2019
>
>> > OK then maybe I am a bit impatient.
>>
>> Actually Gregory is on vacation until September, so if we still are in
>> time for this merge window I suppose you can take it.
>
> OK I applied the patches.
>
> If someone is upset we can always revert them in the -rc phase.
I had a look on the series and it looks good for me.
Gregory
>
> Yours,
> Linus Walleij
--
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com
^ permalink raw reply
* Re: [PATCH -next] pinctrl: sh-pfc: Fix missing unlock on error in sh_pfc_func_set_mux()
From: Geert Uytterhoeven @ 2019-08-27 11:36 UTC (permalink / raw)
To: Wei Yongjun
Cc: Geert Uytterhoeven, Linus Walleij, Yoshihiro Shimoda,
Linux-Renesas, open list:GPIO SUBSYSTEM, kernel-janitors
In-Reply-To: <20190827113527.99831-1-weiyongjun1@huawei.com>
On Tue, Aug 27, 2019 at 1:32 PM Wei Yongjun <weiyongjun1@huawei.com> wrote:
> Add the missing unlock before return from function sh_pfc_func_set_mux()
> in the error handling case.
>
> Fixes: 8a0cc47ccc7c ("pinctrl: sh-pfc: Rollback to mux if required when the gpio is freed")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Thanks, but this is a duplicate of
https://lore.kernel.org/linux-gpio/20190827093927.GB8443@mwanda/
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* [PATCH -next] pinctrl: sh-pfc: Fix missing unlock on error in sh_pfc_func_set_mux()
From: Wei Yongjun @ 2019-08-27 11:35 UTC (permalink / raw)
To: Geert Uytterhoeven, Linus Walleij, Yoshihiro Shimoda
Cc: Wei Yongjun, linux-renesas-soc, linux-gpio, kernel-janitors
Add the missing unlock before return from function sh_pfc_func_set_mux()
in the error handling case.
Fixes: 8a0cc47ccc7c ("pinctrl: sh-pfc: Rollback to mux if required when the gpio is freed")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
drivers/pinctrl/sh-pfc/pinctrl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/sh-pfc/pinctrl.c b/drivers/pinctrl/sh-pfc/pinctrl.c
index 99f4ebd69861..212a4a9c3a8f 100644
--- a/drivers/pinctrl/sh-pfc/pinctrl.c
+++ b/drivers/pinctrl/sh-pfc/pinctrl.c
@@ -361,8 +361,10 @@ static int sh_pfc_func_set_mux(struct pinctrl_dev *pctldev, unsigned selector,
* This driver cannot manage both gpio and mux when the gpio
* pin is already enabled. So, this function fails.
*/
- if (cfg->gpio_enabled)
- return -EBUSY;
+ if (cfg->gpio_enabled) {
+ ret = -EBUSY;
+ goto done;
+ }
ret = sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION);
if (ret < 0)
^ permalink raw reply related
* RE: [PATCH] pinctrl: sh-pfc: Unlock on error in sh_pfc_func_set_mux()
From: Yoshihiro Shimoda @ 2019-08-27 9:54 UTC (permalink / raw)
To: Dan Carpenter, Geert Uytterhoeven
Cc: Linus Walleij, linux-renesas-soc@vger.kernel.org,
linux-gpio@vger.kernel.org, kernel-janitors@vger.kernel.org
In-Reply-To: <20190827093927.GB8443@mwanda>
Hi Dan,
> From: Dan Carpenter, Sent: Tuesday, August 27, 2019 6:39 PM
>
> We need to unlock and enable IRQs before we return on this error path.
>
> Fixes: 8a0cc47ccc7c ("pinctrl: sh-pfc: Rollback to mux if required when the gpio is freed")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thank you for the patch!
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Best regards,
Yoshihiro Shimoda
^ permalink raw reply
* Re: [PATCH] pinctrl: sh-pfc: Unlock on error in sh_pfc_func_set_mux()
From: Geert Uytterhoeven @ 2019-08-27 9:49 UTC (permalink / raw)
To: Dan Carpenter, Linus Walleij
Cc: Geert Uytterhoeven, Yoshihiro Shimoda, Linux-Renesas,
open list:GPIO SUBSYSTEM, kernel-janitors
In-Reply-To: <20190827093927.GB8443@mwanda>
On Tue, Aug 27, 2019 at 11:39 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> We need to unlock and enable IRQs before we return on this error path.
Wow, how could we have missed that?!?
Thanks!
> Fixes: 8a0cc47ccc7c ("pinctrl: sh-pfc: Rollback to mux if required when the gpio is freed")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Linus: As we're already past rc6, I don't plan to send another pull
request for v5.4.
Hence can you please take this one directly?
Thanks!
> --- a/drivers/pinctrl/sh-pfc/pinctrl.c
> +++ b/drivers/pinctrl/sh-pfc/pinctrl.c
> @@ -361,8 +361,10 @@ static int sh_pfc_func_set_mux(struct pinctrl_dev *pctldev, unsigned selector,
> * This driver cannot manage both gpio and mux when the gpio
> * pin is already enabled. So, this function fails.
> */
> - if (cfg->gpio_enabled)
> - return -EBUSY;
> + if (cfg->gpio_enabled) {
> + ret = -EBUSY;
> + goto done;
> + }
>
> ret = sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION);
> if (ret < 0)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox