All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Ulrik De Bie <ulrik.debie-os@e2big.org>
Cc: linux-input@vger.kernel.org, Hans de Goede <hdegoede@redhat.com>,
	David Herrmann <dh.herrmann@gmail.com>
Subject: Re: [PATCH 2/5] Input: elantech - Fix crc_enabled for Fujitsu H730
Date: Sat, 8 Nov 2014 00:22:47 -0800	[thread overview]
Message-ID: <20141108082247.GB21475@dtor-ws> (raw)
In-Reply-To: <1409407846-15449-3-git-send-email-ulrik.debie-os@e2big.org>

On Sat, Aug 30, 2014 at 04:10:43PM +0200, Ulrik De Bie wrote:
> The Fujitsu H730 does not work with crc_enabled = 0, even though the
> crc_enabled bit in the firmware version indicated it would. When switching
> this value to crc_enabled to 1, the touchpad works. This patch uses
> DMI to detect H730.
> 
> Reported-by: Stefan Valouch <stefan@valouch.com>
> Tested-by: Stefan Valouch <stefan@valouch.com>
> Tested-by: Alfredo Gemma <alfredo.gemma@gmail.com>
> Signed-off-by: Ulrik De Bie <ulrik.debie-os@e2big.org>

Applied with some edits to minimize patch size, thank you.

> ---
>  drivers/input/mouse/elantech.c | 65 ++++++++++++++++++++++++++++++------------
>  drivers/input/mouse/elantech.h |  2 +-
>  2 files changed, 48 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
> index f0a55b4d..67d56c0 100644
> --- a/drivers/input/mouse/elantech.c
> +++ b/drivers/input/mouse/elantech.c
> @@ -1235,6 +1235,52 @@ static int elantech_set_input_params(struct psmouse *psmouse)
>  	return 0;
>  }
>  
> +/*
> + * Some hw_version 3 models go into error state when we try to set
> + * bit 3 and/or bit 1 of r10.
> + */
> +static const struct dmi_system_id no_hw_res_dmi_table[] = {
> +#if defined(CONFIG_DMI) && defined(CONFIG_X86)
> +	{
> +		/* Gigabyte U2442 */
> +		.matches = {
> +			DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
> +			DMI_MATCH(DMI_PRODUCT_NAME, "U2442"),
> +		},
> +	},
> +#endif
> +	{ }
> +};
> +
> +/*
> + * Some hw_version 4 models do not work with crc_disabled
> + */
> +static const struct dmi_system_id elantech_dmi_crc_enabled[] = {
> +#if defined(CONFIG_DMI) && defined(CONFIG_X86)
> +	{
> +		/* Fujitsu H730 does not work with crc_enabled == 0 */
> +		.matches = {
> +			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
> +			DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H730"),
> +		},
> +	},
> +#endif
> +	{ }
> +};
> +
> +/*
> + * Autodetect crc_enabled and verify override DMI table
> + */
> +static unsigned char elantech_detect_crc_enabled(struct elantech_data *etd)
> +{
> +
> +#if defined(CONFIG_DMI) && defined(CONFIG_X86)
> +	if (dmi_check_system(elantech_dmi_crc_enabled))
> +		return 1;
> +#endif /* CONFIG_X86 */
> +
> +	return ((etd->fw_version & 0x4000) == 0x4000);
> +}
>  struct elantech_attr_data {
>  	size_t		field_offset;
>  	unsigned char	reg;
> @@ -1444,23 +1490,6 @@ static int elantech_reconnect(struct psmouse *psmouse)
>  }
>  
>  /*
> - * Some hw_version 3 models go into error state when we try to set
> - * bit 3 and/or bit 1 of r10.
> - */
> -static const struct dmi_system_id no_hw_res_dmi_table[] = {
> -#if defined(CONFIG_DMI) && defined(CONFIG_X86)
> -	{
> -		/* Gigabyte U2442 */
> -		.matches = {
> -			DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
> -			DMI_MATCH(DMI_PRODUCT_NAME, "U2442"),
> -		},
> -	},
> -#endif
> -	{ }
> -};
> -
> -/*
>   * determine hardware version and set some properties according to it.
>   */
>  static int elantech_set_properties(struct elantech_data *etd)
> @@ -1518,7 +1547,7 @@ static int elantech_set_properties(struct elantech_data *etd)
>  	 * The signatures of v3 and v4 packets change depending on the
>  	 * value of this hardware flag.
>  	 */
> -	etd->crc_enabled = ((etd->fw_version & 0x4000) == 0x4000);
> +	etd->crc_enabled = elantech_detect_crc_enabled(etd);
>  
>  	/* Enable real hardware resolution on hw_version 3 ? */
>  	etd->set_hw_resolution = !dmi_check_system(no_hw_res_dmi_table);
> diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
> index 6f3afec..c25127a 100644
> --- a/drivers/input/mouse/elantech.h
> +++ b/drivers/input/mouse/elantech.h
> @@ -128,11 +128,11 @@ struct elantech_data {
>  	unsigned char reg_25;
>  	unsigned char reg_26;
>  	unsigned char debug;
> +	unsigned char crc_enabled;
>  	unsigned char capabilities[3];
>  	bool paritycheck;
>  	bool jumpy_cursor;
>  	bool reports_pressure;
> -	bool crc_enabled;
>  	bool set_hw_resolution;
>  	unsigned char hw_version;
>  	unsigned int fw_version;
> -- 
> 2.1.0
> 

-- 
Dmitry

  reply	other threads:[~2014-11-08  8:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-30 14:10 [PATCH 0/5] Input: elantech - support the Fujitsu H730 laptop Ulrik De Bie
2014-08-30 14:10 ` [PATCH 1/5] Input: elantech - use elantech_report_trackpoint for hardware v4 too Ulrik De Bie
2014-11-08  8:21   ` Dmitry Torokhov
2014-11-20  6:58   ` Bisected two-finger scrolling regression on Lenovo Y50 (Re: [PATCH 1/5] Input: elantech - use elantech_report_trackpoint for hardware v4 too) Anders Kaseorg
2014-11-20  7:42     ` Dmitry Torokhov
2014-11-20  8:21       ` Anders Kaseorg
2014-08-30 14:10 ` [PATCH 2/5] Input: elantech - Fix crc_enabled for Fujitsu H730 Ulrik De Bie
2014-11-08  8:22   ` Dmitry Torokhov [this message]
2014-08-30 14:10 ` [PATCH 3/5] Input: elantech - report the middle button of the touchpad Ulrik De Bie
2014-11-08  8:23   ` Dmitry Torokhov
2014-11-09 21:38     ` [PATCH v2 0/3] support for the Fujitsu H730 laptop (update) Ulrik De Bie
2014-11-09 21:38       ` [PATCH v2 1/3] Input: elantech - report the middle button of the touchpad Ulrik De Bie
2014-11-09 21:38       ` [PATCH v2 2/3] Input: elantech - provide a sysfs knob for crc_enabled Ulrik De Bie
2014-11-09 21:38       ` [PATCH v2 3/3] Input: elantech - Update the documentation: trackpoint,v3/v4,crc_enabled Ulrik De Bie
2014-08-30 14:10 ` [PATCH 4/5] Input: elantech - provide a sysfs knob for crc_enabled Ulrik De Bie
2014-11-08  8:25   ` Dmitry Torokhov
2014-08-30 14:10 ` [PATCH 5/5] Input: elantech - Update the documentation: trackpoint,v3/v4,crc_enabled Ulrik De Bie
2014-08-31  9:54 ` [PATCH 0/5] Input: elantech - support the Fujitsu H730 laptop Hans de Goede
2014-08-31 15:14   ` ulrik.debie-os
2014-09-01  7:13     ` Hans de Goede
2014-10-04  9:33 ` Jan Kiszka
2014-10-04  9:36   ` Hans de Goede
2014-10-23 18:36     ` ulrik.debie-os
2014-10-23 18:39       ` Dmitry Torokhov
2014-11-06 19:20         ` ulrik.debie-os

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141108082247.GB21475@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=dh.herrmann@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-input@vger.kernel.org \
    --cc=ulrik.debie-os@e2big.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.