From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Marek Vasut <marex@denx.de>
Cc: linux-input@vger.kernel.org, ch@denx.de,
Joe Hung <joe_hung@ilitek.com>, Luca Hsu <luca_hsu@ilitek.com>
Subject: Re: [PATCH v2 2/3] Input: ili210x - export ili251x version details via sysfs
Date: Mon, 30 Aug 2021 16:20:22 -0700 [thread overview]
Message-ID: <YS1ntnYD2ic5MGYy@google.com> (raw)
In-Reply-To: <991280e5-fd54-75d5-d2f2-bb2673303881@denx.de>
On Tue, Aug 31, 2021 at 01:02:57AM +0200, Marek Vasut wrote:
> On 8/30/21 11:01 PM, Dmitry Torokhov wrote:
>
> [...]
>
> > > @@ -351,6 +360,108 @@ static int ili251x_firmware_update_resolution(struct device *dev)
> > > return 0;
> > > }
> > > +static ssize_t ili251x_firmware_version_show(struct device *dev,
> > > + struct device_attribute *attr,
> > > + char *buf)
> > > +{
> > > + struct i2c_client *client = to_i2c_client(dev);
> > > + struct ili210x *priv = i2c_get_clientdata(client);
> > > + u8 fw[8];
> > > + int ret;
> > > +
> > > + /* Get firmware version */
> > > + mutex_lock(&priv->lock);
> > > + ret = priv->chip->read_reg(client, REG_FIRMWARE_VERSION,
> > > + &fw, sizeof(fw));
> > > + mutex_unlock(&priv->lock);
> >
> > Could we query firmware version and mode at probe time (and also later
> > after firmware update attempt) so that we do not need to introduce
> > locking against interrupt handler?
>
> This is a threaded interrupt handler and I don't expect much lock contention
> here.
>
> The sysfs attribute readout would race with the interrupt handler and if it
> wasn't for the firmware update support, we could very well cache all those
> values. Except, the firmware update can change them all. Worse, if the
> interrupt were to fire during an update, it could break that update, and I
> want to prevent that from happening.
Usually we simply disable interrupts from the device when updating
firmware.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2021-08-30 23:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-27 21:12 [PATCH v2 1/3] Input: ili210x - use resolution from ili251x firmware Marek Vasut
2021-08-27 21:12 ` [PATCH v2 2/3] Input: ili210x - export ili251x version details via sysfs Marek Vasut
2021-08-30 21:01 ` Dmitry Torokhov
2021-08-30 23:02 ` Marek Vasut
2021-08-30 23:20 ` Dmitry Torokhov [this message]
2021-08-30 23:33 ` Marek Vasut
2021-08-30 23:45 ` Dmitry Torokhov
2021-08-27 21:12 ` [PATCH v2 3/3] Input: ili210x - add ili251x firmware update support Marek Vasut
2021-08-30 21:14 ` Dmitry Torokhov
2021-08-30 23:27 ` Marek Vasut
2021-08-31 2:05 ` Dmitry Torokhov
2021-08-30 20:55 ` [PATCH v2 1/3] Input: ili210x - use resolution from ili251x firmware Dmitry Torokhov
2021-08-30 22:49 ` Marek Vasut
2021-08-30 23:21 ` Dmitry Torokhov
2021-08-30 23:31 ` Marek Vasut
2021-08-30 23:46 ` Dmitry Torokhov
2021-08-31 0:01 ` Marek Vasut
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=YS1ntnYD2ic5MGYy@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=ch@denx.de \
--cc=joe_hung@ilitek.com \
--cc=linux-input@vger.kernel.org \
--cc=luca_hsu@ilitek.com \
--cc=marex@denx.de \
/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;
as well as URLs for NNTP newsgroup(s).