From: Andrew Duggan <aduggan@synaptics.com>
To: Nick Dyer <nick@shmanahar.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Christopher Heiny <cheiny@synaptics.com>,
Guenter Roeck <linux@roeck-us.net>
Cc: Chris Healy <cphealy@gmail.com>, <linux-input@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] Input: synaptics-rmi4 - stop scanning PDT after two empty pages
Date: Wed, 26 Oct 2016 12:27:30 -0700 [thread overview]
Message-ID: <48c87bf2-a2ae-9964-fe01-e4a511c1ea2c@synaptics.com> (raw)
In-Reply-To: <1477427791-1094-1-git-send-email-nick@shmanahar.org>
On 10/25/2016 01:36 PM, Nick Dyer wrote:
> We have encountered some RMI4 firmwares where there are blank pages in
> between PDT pages which contain functions. This change makes them
> correctly enumerate all functions on the device.
>
> Tested on S7817 (has empty page 2).
>
> Signed-off-by: Nick Dyer <nick@shmanahar.org>
Reviewed-by: Andrew Duggan <aduggan@synaptics.com>
> ---
> drivers/input/rmi4/rmi_driver.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
> index 4a88312..425bd19 100644
> --- a/drivers/input/rmi4/rmi_driver.c
> +++ b/drivers/input/rmi4/rmi_driver.c
> @@ -422,6 +422,7 @@ static void rmi_driver_copy_pdt_to_fd(const struct pdt_entry *pdt,
>
> static int rmi_scan_pdt_page(struct rmi_device *rmi_dev,
> int page,
> + int *empty_pages,
> void *ctx,
> int (*callback)(struct rmi_device *rmi_dev,
> void *ctx,
> @@ -449,7 +450,16 @@ static int rmi_scan_pdt_page(struct rmi_device *rmi_dev,
> return retval;
> }
>
> - return (data->f01_bootloader_mode || addr == pdt_start) ?
> + /*
> + * Count number of empty PDT pages. If a gap of two pages
> + * or more is found, stop scanning.
> + */
> + if (addr == pdt_start)
> + ++*empty_pages;
> + else
> + *empty_pages = 0;
> +
> + return (data->f01_bootloader_mode || *empty_pages >= 2) ?
> RMI_SCAN_DONE : RMI_SCAN_CONTINUE;
> }
>
> @@ -459,10 +469,12 @@ static int rmi_scan_pdt(struct rmi_device *rmi_dev, void *ctx,
> const struct pdt_entry *entry))
> {
> int page;
> + int empty_pages = 0;
> int retval = RMI_SCAN_DONE;
>
> for (page = 0; page <= RMI4_MAX_PAGE; page++) {
> - retval = rmi_scan_pdt_page(rmi_dev, page, ctx, callback);
> + retval = rmi_scan_pdt_page(rmi_dev, page, &empty_pages,
> + ctx, callback);
> if (retval != RMI_SCAN_CONTINUE)
> break;
> }
prev parent reply other threads:[~2016-10-26 19:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-25 20:36 Nick Dyer
2016-10-25 21:14 ` Chris Healy
2016-10-26 19:27 ` Andrew Duggan [this message]
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=48c87bf2-a2ae-9964-fe01-e4a511c1ea2c@synaptics.com \
--to=aduggan@synaptics.com \
--cc=cheiny@synaptics.com \
--cc=cphealy@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=nick@shmanahar.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome