* [PATCH v2 1/2] spi: introduce SPI_MODE_X_MASK macro
2020-10-27 9:57 [PATCH v2 0/2] SPI/ Input: ads7846: properly handle spi->mode flags Oleksij Rempel
@ 2020-10-27 9:57 ` Oleksij Rempel
2020-10-27 9:57 ` [PATCH v2 2/2] Input: ads7846: do not overwrite spi->mode flags set by spi framework Oleksij Rempel
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Oleksij Rempel @ 2020-10-27 9:57 UTC (permalink / raw)
To: Dmitry Torokhov, Alexandru Ardelean, Mark Brown
Cc: Oleksij Rempel, kernel, linux-kernel, linux-input, linux-spi,
David Jander
Provide a macro to filter all SPI_MODE_0,1,2,3 mode in one run.
The latest SPI framework will parse the devicetree in following call
sequence: of_register_spi_device() -> of_spi_parse_dt()
So, driver do not need to pars the devicetree and will get prepared
flags in the probe.
On one hand it is good far most drivers. On other hand some drivers need to
filter flags provide by SPI framework and apply know to work flags. This drivers
may use SPI_MODE_X_MASK to filter MODE flags and set own, known flags:
spi->flags &= ~SPI_MODE_X_MASK;
spi->flags |= SPI_MODE_0;
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
include/linux/spi/spi.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 99380c0825db..8097f27702f3 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -171,6 +171,7 @@ struct spi_device {
#define SPI_MODE_1 (0|SPI_CPHA)
#define SPI_MODE_2 (SPI_CPOL|0)
#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA)
+#define SPI_MODE_X_MASK (SPI_CPOL|SPI_CPHA)
#define SPI_CS_HIGH 0x04 /* chipselect active high? */
#define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */
#define SPI_3WIRE 0x10 /* SI/SO signals shared */
--
2.28.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] Input: ads7846: do not overwrite spi->mode flags set by spi framework
2020-10-27 9:57 [PATCH v2 0/2] SPI/ Input: ads7846: properly handle spi->mode flags Oleksij Rempel
2020-10-27 9:57 ` [PATCH v2 1/2] spi: introduce SPI_MODE_X_MASK macro Oleksij Rempel
@ 2020-10-27 9:57 ` Oleksij Rempel
2020-11-09 11:02 ` Oleksij Rempel
2020-11-11 18:51 ` Dmitry Torokhov
2020-11-11 15:48 ` [PATCH v2 0/2] SPI/ Input: ads7846: properly handle spi->mode flags Mark Brown
2020-11-12 19:39 ` Mark Brown
3 siblings, 2 replies; 7+ messages in thread
From: Oleksij Rempel @ 2020-10-27 9:57 UTC (permalink / raw)
To: Dmitry Torokhov, Alexandru Ardelean, Mark Brown
Cc: Oleksij Rempel, kernel, linux-kernel, linux-input, linux-spi,
David Jander
Do not overwrite spi->mode flags set by spi framework, otherwise the
chip select polarity will get lost.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/input/touchscreen/ads7846.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 8fd7fc39c4fd..f2dc2c8ab5ec 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -1288,7 +1288,8 @@ static int ads7846_probe(struct spi_device *spi)
* may not. So we stick to very-portable 8 bit words, both RX and TX.
*/
spi->bits_per_word = 8;
- spi->mode = SPI_MODE_0;
+ spi->mode &= ~SPI_MODE_X_MASK;
+ spi->mode |= SPI_MODE_0;
err = spi_setup(spi);
if (err < 0)
return err;
--
2.28.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] Input: ads7846: do not overwrite spi->mode flags set by spi framework
2020-10-27 9:57 ` [PATCH v2 2/2] Input: ads7846: do not overwrite spi->mode flags set by spi framework Oleksij Rempel
@ 2020-11-09 11:02 ` Oleksij Rempel
2020-11-11 18:51 ` Dmitry Torokhov
1 sibling, 0 replies; 7+ messages in thread
From: Oleksij Rempel @ 2020-11-09 11:02 UTC (permalink / raw)
To: Dmitry Torokhov, Alexandru Ardelean, Mark Brown
Cc: kernel, linux-kernel, linux-input, linux-spi, David Jander
Hello Dmitry,
ping for this patch as well.
Regards,
Oleksij
On Tue, Oct 27, 2020 at 10:57:24AM +0100, Oleksij Rempel wrote:
> Do not overwrite spi->mode flags set by spi framework, otherwise the
> chip select polarity will get lost.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> drivers/input/touchscreen/ads7846.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
> index 8fd7fc39c4fd..f2dc2c8ab5ec 100644
> --- a/drivers/input/touchscreen/ads7846.c
> +++ b/drivers/input/touchscreen/ads7846.c
> @@ -1288,7 +1288,8 @@ static int ads7846_probe(struct spi_device *spi)
> * may not. So we stick to very-portable 8 bit words, both RX and TX.
> */
> spi->bits_per_word = 8;
> - spi->mode = SPI_MODE_0;
> + spi->mode &= ~SPI_MODE_X_MASK;
> + spi->mode |= SPI_MODE_0;
> err = spi_setup(spi);
> if (err < 0)
> return err;
> --
> 2.28.0
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] Input: ads7846: do not overwrite spi->mode flags set by spi framework
2020-10-27 9:57 ` [PATCH v2 2/2] Input: ads7846: do not overwrite spi->mode flags set by spi framework Oleksij Rempel
2020-11-09 11:02 ` Oleksij Rempel
@ 2020-11-11 18:51 ` Dmitry Torokhov
1 sibling, 0 replies; 7+ messages in thread
From: Dmitry Torokhov @ 2020-11-11 18:51 UTC (permalink / raw)
To: Oleksij Rempel
Cc: Alexandru Ardelean, Mark Brown, kernel, linux-kernel,
linux-input, linux-spi, David Jander
On Tue, Oct 27, 2020 at 10:57:24AM +0100, Oleksij Rempel wrote:
> Do not overwrite spi->mode flags set by spi framework, otherwise the
> chip select polarity will get lost.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Mark, could you please pick up this one through your tree as well? I do
not believe that outstanding patches that I have in my queue for this
driver will clash with it.
Thanks!
> ---
> drivers/input/touchscreen/ads7846.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
> index 8fd7fc39c4fd..f2dc2c8ab5ec 100644
> --- a/drivers/input/touchscreen/ads7846.c
> +++ b/drivers/input/touchscreen/ads7846.c
> @@ -1288,7 +1288,8 @@ static int ads7846_probe(struct spi_device *spi)
> * may not. So we stick to very-portable 8 bit words, both RX and TX.
> */
> spi->bits_per_word = 8;
> - spi->mode = SPI_MODE_0;
> + spi->mode &= ~SPI_MODE_X_MASK;
> + spi->mode |= SPI_MODE_0;
> err = spi_setup(spi);
> if (err < 0)
> return err;
> --
> 2.28.0
>
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] SPI/ Input: ads7846: properly handle spi->mode flags
2020-10-27 9:57 [PATCH v2 0/2] SPI/ Input: ads7846: properly handle spi->mode flags Oleksij Rempel
2020-10-27 9:57 ` [PATCH v2 1/2] spi: introduce SPI_MODE_X_MASK macro Oleksij Rempel
2020-10-27 9:57 ` [PATCH v2 2/2] Input: ads7846: do not overwrite spi->mode flags set by spi framework Oleksij Rempel
@ 2020-11-11 15:48 ` Mark Brown
2020-11-12 19:39 ` Mark Brown
3 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2020-11-11 15:48 UTC (permalink / raw)
To: Dmitry Torokhov, Oleksij Rempel, Alexandru Ardelean
Cc: linux-spi, kernel, David Jander, linux-input, linux-kernel
On Tue, 27 Oct 2020 10:57:22 +0100, Oleksij Rempel wrote:
> changes v2:
> - add SPI_MODE_X_MASK macro
> - ads7846: clear SPI_MODE_X_MASK bits to set driver specific mode.
>
> Oleksij Rempel (2):
> spi: introduce SPI_MODE_X_MASK macro
> Input: ads7846: do not overwrite spi->mode flags set by spi framework
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: introduce SPI_MODE_X_MASK macro
commit: 029b42d8519cef70c4fb5fcaccd08f1053ed2bf0
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] SPI/ Input: ads7846: properly handle spi->mode flags
2020-10-27 9:57 [PATCH v2 0/2] SPI/ Input: ads7846: properly handle spi->mode flags Oleksij Rempel
` (2 preceding siblings ...)
2020-11-11 15:48 ` [PATCH v2 0/2] SPI/ Input: ads7846: properly handle spi->mode flags Mark Brown
@ 2020-11-12 19:39 ` Mark Brown
3 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2020-11-12 19:39 UTC (permalink / raw)
To: Oleksij Rempel, Alexandru Ardelean, Dmitry Torokhov
Cc: kernel, David Jander, linux-input, linux-kernel, linux-spi
On Tue, 27 Oct 2020 10:57:22 +0100, Oleksij Rempel wrote:
> changes v2:
> - add SPI_MODE_X_MASK macro
> - ads7846: clear SPI_MODE_X_MASK bits to set driver specific mode.
>
> Oleksij Rempel (2):
> spi: introduce SPI_MODE_X_MASK macro
> Input: ads7846: do not overwrite spi->mode flags set by spi framework
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] Input: ads7846: do not overwrite spi->mode flags set by spi framework
commit: 376ccca853fdb9959f7ac5185a428a9f91e71e86
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
^ permalink raw reply [flat|nested] 7+ messages in thread