diff mbox series

[1/2] input: egalax_ts: switch to i2c interface before wake up

Message ID 1581410472-3225-1-git-send-email-haibo.chen@nxp.com (mailing list archive)
State New, archived
Headers show
Series [1/2] input: egalax_ts: switch to i2c interface before wake up | expand

Commit Message

Bough Chen Feb. 11, 2020, 8:41 a.m. UTC
From: Haibo Chen <haibo.chen@nxp.com>

For HannStar (HSD100PXN1 Rev: 1-A00C11 F/W:0634) LVDS touch screen,
it has a special request for the EETI touch controller. The host
needs to trigger I2C event to device FW at booting first, and then
the FW can switch to I2C interface. Otherwise, the FW can’t  work
with I2C interface, and can't generate any interrupt when touch
the screen.

This patch send an I2C command before the device wake up, make sure
the device switch to I2C interface first.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/input/touchscreen/egalax_ts.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Bough Chen March 10, 2020, 1:58 a.m. UTC | #1
Ping...

Hi Dmitry,

Can you help review these two patches?

Haibo Chen
> -----Original Message-----
> From: haibo.chen@nxp.com <haibo.chen@nxp.com>
> Sent: 2020年2月11日 16:41
> To: dmitry.torokhov@gmail.com; linux-input@vger.kernel.org
> Cc: BOUGH CHEN <haibo.chen@nxp.com>; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: [PATCH 1/2] input: egalax_ts: switch to i2c interface before wake up
> 
> From: Haibo Chen <haibo.chen@nxp.com>
> 
> For HannStar (HSD100PXN1 Rev: 1-A00C11 F/W:0634) LVDS touch screen, it
> has a special request for the EETI touch controller. The host needs to trigger
> I2C event to device FW at booting first, and then the FW can switch to I2C
> interface. Otherwise, the FW can’t  work with I2C interface, and can't
> generate any interrupt when touch the screen.
> 
> This patch send an I2C command before the device wake up, make sure the
> device switch to I2C interface first.
> 
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> ---
>  drivers/input/touchscreen/egalax_ts.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/input/touchscreen/egalax_ts.c
> b/drivers/input/touchscreen/egalax_ts.c
> index 83ac8c128192..5e35ca5edc7b 100644
> --- a/drivers/input/touchscreen/egalax_ts.c
> +++ b/drivers/input/touchscreen/egalax_ts.c
> @@ -183,6 +183,20 @@ static int egalax_ts_probe(struct i2c_client *client,
>  	ts->client = client;
>  	ts->input_dev = input_dev;
> 
> +	/* HannStar (HSD100PXN1 Rev: 1-A00C11 F/W:0634) LVDS touch
> +	 * screen needs to trigger I2C event to device FW at booting
> +	 * first, and then the FW can switch to I2C interface.
> +	 * Otherwise, the FW can’t  work with I2C interface. So here
> +	 * just use the exist function egalax_firmware_version() to
> +	 * send a I2C command to the device, make sure the device FW
> +	 * switch to I2C interface.
> +	 */
> +	error = egalax_firmware_version(client);
> +	if (error) {
> +		dev_err(&client->dev, "Failed to switch to I2C interface\n");
> +		return error;
> +	}
> +
>  	/* controller may be in sleep, wake it up. */
>  	error = egalax_wake_up_device(client);
>  	if (error) {
> --
> 2.17.1
Dmitry Torokhov March 10, 2020, 4:22 a.m. UTC | #2
Hi Haibo,

On Tue, Feb 11, 2020 at 04:41:11PM +0800, haibo.chen@nxp.com wrote:
> From: Haibo Chen <haibo.chen@nxp.com>
> 
> For HannStar (HSD100PXN1 Rev: 1-A00C11 F/W:0634) LVDS touch screen,
> it has a special request for the EETI touch controller. The host
> needs to trigger I2C event to device FW at booting first, and then
> the FW can switch to I2C interface. Otherwise, the FW can’t  work
> with I2C interface, and can't generate any interrupt when touch
> the screen.
> 
> This patch send an I2C command before the device wake up, make sure
> the device switch to I2C interface first.
> 
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> ---
>  drivers/input/touchscreen/egalax_ts.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c
> index 83ac8c128192..5e35ca5edc7b 100644
> --- a/drivers/input/touchscreen/egalax_ts.c
> +++ b/drivers/input/touchscreen/egalax_ts.c
> @@ -183,6 +183,20 @@ static int egalax_ts_probe(struct i2c_client *client,
>  	ts->client = client;
>  	ts->input_dev = input_dev;
>  
> +	/* HannStar (HSD100PXN1 Rev: 1-A00C11 F/W:0634) LVDS touch
> +	 * screen needs to trigger I2C event to device FW at booting
> +	 * first, and then the FW can switch to I2C interface.
> +	 * Otherwise, the FW can’t  work with I2C interface. So here
> +	 * just use the exist function egalax_firmware_version() to
> +	 * send a I2C command to the device, make sure the device FW
> +	 * switch to I2C interface.
> +	 */
> +	error = egalax_firmware_version(client);
> +	if (error) {
> +		dev_err(&client->dev, "Failed to switch to I2C interface\n");
> +		return error;
> +	}
> +
>  	/* controller may be in sleep, wake it up. */
>  	error = egalax_wake_up_device(client);
>  	if (error) {

I think this should be part of egalax_wake_up_device(), in case where we
do not have dedicated reset gpio. Also, instead of abusing firmware
read, would a dummy byte read be enough (i2c_probe_func_quick_read)?

Thanks.
Bough Chen March 10, 2020, 7:01 a.m. UTC | #3
> -----Original Message-----
> From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Sent: 2020年3月10日 12:22
> To: BOUGH CHEN <haibo.chen@nxp.com>
> Cc: linux-input@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>
> Subject: Re: [PATCH 1/2] input: egalax_ts: switch to i2c interface before
> wake up
> 
> Hi Haibo,
> 
> On Tue, Feb 11, 2020 at 04:41:11PM +0800, haibo.chen@nxp.com wrote:
> > From: Haibo Chen <haibo.chen@nxp.com>
> >
> > For HannStar (HSD100PXN1 Rev: 1-A00C11 F/W:0634) LVDS touch screen,
> it
> > has a special request for the EETI touch controller. The host needs to
> > trigger I2C event to device FW at booting first, and then the FW can
> > switch to I2C interface. Otherwise, the FW can’t  work with I2C
> > interface, and can't generate any interrupt when touch the screen.
> >
> > This patch send an I2C command before the device wake up, make sure
> > the device switch to I2C interface first.
> >
> > Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> > ---
> >  drivers/input/touchscreen/egalax_ts.c | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git a/drivers/input/touchscreen/egalax_ts.c
> > b/drivers/input/touchscreen/egalax_ts.c
> > index 83ac8c128192..5e35ca5edc7b 100644
> > --- a/drivers/input/touchscreen/egalax_ts.c
> > +++ b/drivers/input/touchscreen/egalax_ts.c
> > @@ -183,6 +183,20 @@ static int egalax_ts_probe(struct i2c_client
> *client,
> >  	ts->client = client;
> >  	ts->input_dev = input_dev;
> >
> > +	/* HannStar (HSD100PXN1 Rev: 1-A00C11 F/W:0634) LVDS touch
> > +	 * screen needs to trigger I2C event to device FW at booting
> > +	 * first, and then the FW can switch to I2C interface.
> > +	 * Otherwise, the FW can’t  work with I2C interface. So here
> > +	 * just use the exist function egalax_firmware_version() to
> > +	 * send a I2C command to the device, make sure the device FW
> > +	 * switch to I2C interface.
> > +	 */
> > +	error = egalax_firmware_version(client);
> > +	if (error) {
> > +		dev_err(&client->dev, "Failed to switch to I2C interface\n");
> > +		return error;
> > +	}
> > +
> >  	/* controller may be in sleep, wake it up. */
> >  	error = egalax_wake_up_device(client);
> >  	if (error) {
> 
> I think this should be part of egalax_wake_up_device(), in case where we do
> not have dedicated reset gpio. Also, instead of abusing firmware read, would
> a dummy byte read be enough (i2c_probe_func_quick_read)?

That's reasonable, I will move the change to egalax_wake_up_device(). I will have a try whether a dummy byte read can work.
Really thanks for your suggestion!

Regards,
Haibo Chen
> Thanks.
> 
> --
> Dmitry
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c
index 83ac8c128192..5e35ca5edc7b 100644
--- a/drivers/input/touchscreen/egalax_ts.c
+++ b/drivers/input/touchscreen/egalax_ts.c
@@ -183,6 +183,20 @@  static int egalax_ts_probe(struct i2c_client *client,
 	ts->client = client;
 	ts->input_dev = input_dev;
 
+	/* HannStar (HSD100PXN1 Rev: 1-A00C11 F/W:0634) LVDS touch
+	 * screen needs to trigger I2C event to device FW at booting
+	 * first, and then the FW can switch to I2C interface.
+	 * Otherwise, the FW can’t  work with I2C interface. So here
+	 * just use the exist function egalax_firmware_version() to
+	 * send a I2C command to the device, make sure the device FW
+	 * switch to I2C interface.
+	 */
+	error = egalax_firmware_version(client);
+	if (error) {
+		dev_err(&client->dev, "Failed to switch to I2C interface\n");
+		return error;
+	}
+
 	/* controller may be in sleep, wake it up. */
 	error = egalax_wake_up_device(client);
 	if (error) {