diff mbox series

[v2,2/2] Input: ads7846: do not overwrite spi->mode flags set by spi framework

Message ID 20201027095724.18654-3-o.rempel@pengutronix.de
State Accepted
Commit 376ccca853fdb9959f7ac5185a428a9f91e71e86
Headers show
Series SPI/ Input: ads7846: properly handle spi->mode flags | expand

Commit Message

Oleksij Rempel Oct. 27, 2020, 9:57 a.m. UTC
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(-)

Comments

Oleksij Rempel Nov. 9, 2020, 11:02 a.m. UTC | #1
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 |
Dmitry Torokhov Nov. 11, 2020, 6:51 p.m. UTC | #2
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
diff mbox series

Patch

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;