linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laxman Dewangan <ldewangan@nvidia.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Grant Grundler <grundler@chromium.org>,
	"jic23@cam.ac.uk" <jic23@cam.ac.uk>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"max@stro.at" <max@stro.at>,
	"jbrenner@taosinc.com" <jbrenner@taosinc.com>,
	"bfreed@chromium.org" <bfreed@chromium.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 2/2] staging: iio: light: isl29018: use regmap for register access
Date: Fri, 20 Apr 2012 08:34:09 +0530	[thread overview]
Message-ID: <4F90D229.9030401@nvidia.com> (raw)
In-Reply-To: <4F906DF6.4090906@metafoo.de>

On Friday 20 April 2012 01:26 AM, Lars-Peter Clausen wrote:
> On 04/19/2012 09:27 PM, Laxman Dewangan wrote:
>> On Thursday 19 April 2012 11:22 PM, Grant Grundler wrote:
>>> On Thu, Apr 19, 2012 at 4:15 AM, Laxman
>>> Dewangan<ldewangan@nvidia.com>   wrote:
>>>> +static bool is_volatile_reg(struct device *dev, unsigned int reg)
>>>> +{
>>>> +       switch (reg) {
>>>> +       case ISL29018_REG_ADD_DATA_LSB:
>>>> +       case ISL29018_REG_ADD_DATA_MSB:
>>>> +       case ISL29018_REG_ADD_COMMAND1:
>>>> +       case ISL29018_REG_TEST:
>>> Of these four, I think only ADD_COMMAND1 wasn't treated as volatile in
>>> the old code. Am I overlooking something?
>>>
>>> My concern is only about the additional I2C read traffic this patch
>>> might generate. It's possible *some* bits in that register are
>>> volatile and we could previously ignore them.
>>>
>> Register ADD_COMMAND1, bit 2 is interrupt flag bit which shows the
>> interrupt status and hence we can not cache it.
>> The ISL29018 datasheet says:
>> Interrupt flag; Bit 2. This is the status bit of the interrupt.
>> The bit is set to logic high when the interrupt thresholds
>> have been triggered, and logic low when not yet triggered.
>> Once triggered, INT pin stays low and the status bit stays
>> high. Both interrupt pin and the status bit are automatically
>> cleared at the end of Command Register I transfer.
> If the bit is cleared when reading the register I suppose it is not being worth
> much to mark the register as volatile since the bit will be cleared whenever
> you update the register. If there is only opmode and the irq bit in that
> register I'd keep the register volatile, but use regmap_write instead of
> regmap_update_bits.

There is 2-bits in ADD_COMMAND1  for interrupt persistence.
The interrupt pin and the interrupt flag is triggered/set when the data 
sensor
reading is out of the interrupt threshold window after m
consecutive number of integration cycles.


The driver is not supporting interrupt now. I think we can use 
regmap_write() in place of regmap_update_bits() keeping this volatile as 
you suggested.
When we add interrupt support on this driver, we will write the register 
after ORing with persistence bits. For that also it will not require to 
do caching of register.


      reply	other threads:[~2012-04-20  3:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-19 11:15 [PATCH V2 0/2] staging: iio: light: use regmap in isl29018 for register access Laxman Dewangan
2012-04-19 11:15 ` [PATCH V3 1/2] staging: iio: light: convert multiple spaces to tab Laxman Dewangan
2012-04-19 11:15 ` [PATCH v3 2/2] staging: iio: light: isl29018: use regmap for register access Laxman Dewangan
2012-04-19 17:52   ` Grant Grundler
2012-04-19 19:27     ` Laxman Dewangan
2012-04-19 19:56       ` Lars-Peter Clausen
2012-04-20  3:04         ` Laxman Dewangan [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=4F90D229.9030401@nvidia.com \
    --to=ldewangan@nvidia.com \
    --cc=bfreed@chromium.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=grundler@chromium.org \
    --cc=jbrenner@taosinc.com \
    --cc=jic23@cam.ac.uk \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=max@stro.at \
    /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).