lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f2f98a4e626e15ebf747f5564557f23405e69e92.camel@physik.fu-berlin.de>
Date: Thu, 26 Sep 2024 14:30:45 +0200
From: John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>, Yoshinori Sato
	 <ysato@...rs.sourceforge.jp>, Rich Felker <dalias@...c.org>
Cc: linux-sh@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-input@...r.kernel.org
Subject: Re: [PATCH] sh: ecovec24: use static device properties to describe
 the touchscreen

Hi Dmitry,

On Tue, 2024-08-20 at 19:02 -0700, Dmitry Torokhov wrote:
> Convert the board to use static device properties instead of platform
> data to describe the touchscreen, so that support for platform data can
> be removed from tsc2007 driver (ecovec24 is the last board using this
> mechanism of describing tsc2007).
> 
> Device properties do not allow custom board methods, so the method for
> getting "pen down" state was removed (the driver is capable of working
> without it). If this functionality is needed proper pin control/gpio
> support needs to be implemented so that the same pin can serve as an
> input GPIO and an interrupt.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
> ---
>  arch/sh/boards/mach-ecovec24/setup.c | 38 ++++++++--------------------
>  1 file changed, 11 insertions(+), 27 deletions(-)
> 
> diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
> index 6f13557eecd6..4833bec0c3c5 100644
> --- a/arch/sh/boards/mach-ecovec24/setup.c
> +++ b/arch/sh/boards/mach-ecovec24/setup.c
> @@ -26,6 +26,7 @@
>  #include <linux/platform_data/tmio.h>
>  #include <linux/platform_data/tsc2007.h>
>  #include <linux/platform_device.h>
> +#include <linux/property.h>
>  #include <linux/regulator/fixed.h>
>  #include <linux/regulator/machine.h>
>  #include <linux/sh_eth.h>
> @@ -589,39 +590,21 @@ static struct platform_device keysc_device = {
>  /* TouchScreen */
>  #define IRQ0 evt2irq(0x600)
>  
> -static int ts_get_pendown_state(struct device *dev)
> -{
> -	int val = 0;
> -	gpio_free(GPIO_FN_INTC_IRQ0);
> -	gpio_request(GPIO_PTZ0, NULL);
> -	gpio_direction_input(GPIO_PTZ0);
> -
> -	val = gpio_get_value(GPIO_PTZ0);
> -
> -	gpio_free(GPIO_PTZ0);
> -	gpio_request(GPIO_FN_INTC_IRQ0, NULL);
> -
> -	return val ? 0 : 1;
> -}
> -
> -static int ts_init(void)
> -{
> -	gpio_request(GPIO_FN_INTC_IRQ0, NULL);
> -	return 0;
> -}
> +static const struct property_entry tsc2007_properties[] = {
> +	PROPERTY_ENTRY_U32("ti,x-plate-ohms", 180),
> +	{ }
> +};
>  
> -static struct tsc2007_platform_data tsc2007_info = {
> -	.model			= 2007,
> -	.x_plate_ohms		= 180,
> -	.get_pendown_state	= ts_get_pendown_state,
> -	.init_platform_hw	= ts_init,
> +static const struct software_node tsc2007_swnode = {
> +	.name = "tsc2007",
> +	.properties = tsc2007_properties,
>  };
>  
>  static struct i2c_board_info ts_i2c_clients = {
>  	I2C_BOARD_INFO("tsc2007", 0x48),
>  	.type		= "tsc2007",
> -	.platform_data	= &tsc2007_info,
>  	.irq		= IRQ0,
> +	.swnode		= &tsc2007_swnode,
>  };
>  
>  static struct regulator_consumer_supply cn12_power_consumers[] =
> @@ -1241,8 +1224,9 @@ static int __init arch_setup(void)
>  		gpio_direction_output(GPIO_PTF4, 1);
>  
>  		/* enable TouchScreen */
> -		i2c_register_board_info(0, &ts_i2c_clients, 1);
> +		gpio_request(GPIO_FN_INTC_IRQ0, NULL);
>  		irq_set_irq_type(IRQ0, IRQ_TYPE_LEVEL_LOW);
> +		i2c_register_board_info(0, &ts_i2c_clients, 1);
>  	}
>  
>  	/* enable CEU0 */
> -- 
> 2.46.0.184.g6999bdac58-goog

Thanks for your patch!

I am not 100% sure whether removing the method for "pen down" won't have
any negative impact on the driver capabilities.

Could you elaborate on this change a little more? Sorry for being so late!

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ