linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Rosin <peda@axentia.se>
To: Jonathan Cameron <jic23@kernel.org>, Jacopo Mondi <jacopo@jmondi.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Matt Ranostay <matt.ranostay@konsulko.com>,
	Magnus Damm <magnus.damm@gmail.com>,
	linux-iio@vger.kernel.org, linux-i2c@vger.kernel.org,
	Wolfram Sang <wsa@kernel.org>
Subject: Re: [PATCH v3.1 2/3] iio: chemical: Add Senseair Sunrise 006-0-007 driver
Date: Mon, 6 Sep 2021 08:56:10 +0200	[thread overview]
Message-ID: <02f30a94-4b37-fb7a-da7f-d557fb22b431@axentia.se> (raw)
In-Reply-To: <5e9dce02-2884-d91e-78ef-da2f32258ea3@axentia.se>

On 2021-09-06 01:03, Peter Rosin wrote:
> On 2021-09-05 12:04, Jonathan Cameron wrote:
>> On Tue, 31 Aug 2021 09:40:11 +0200
>> Jacopo Mondi <jacopo@jmondi.org> wrote:
>>
>>> Hi Jonathan,
>>>    two more clarification requests, sorry to bother :)
>> No problem.  First one: No idea +CC wolfram and i2c list.
>>>
>>> On Mon, Aug 30, 2021 at 06:11:17PM +0100, Jonathan Cameron wrote:
>>>> On Mon, 30 Aug 2021 18:20:51 +0200  
>>>>>>> +static int sunrise_write_word(struct sunrise_dev *sunrise, u8 reg, u16 data)
>>>>>>> +{
>>>>>>> +	__be16 be_data = cpu_to_be16(data);
>>>>>>> +	int ret;
>>>>>>> +
>>>>>>> +	sunrise_wakeup(sunrise);  
>>>>>>
>>>>>> Hmm. Technically there isn't anything stopping another user of the i2c bus sneaking in
>>>>>> between the wakeup and the following command.  That would make the device going back
>>>>>> to sleep a lot more likely.  I can't off the top of my head remember if regmap lets
>>>>>> you lock the bus.  If not, you'll have to use the underlying i2c bus locking functions.
>>>>>> https://elixir.bootlin.com/linux/latest/source/drivers/iio/temperature/mlx90614.c#L432
>>>>>> gives an example.

Forgot to mention, regmap does let you do that. See e.g.
drivers/media/dvb-frontends/rtl2830.c which wraps regmap_update_bits,
regmap_bulk_write and regmap_bulk_read within a local I2C segment
lock along with a special regmap_bus that does unlocked I2C trasfers.

I think the driver does this because it has an I2C gate that needs to
be opened with a regmap interaction that in turn needs to be back to
back with the "real" regmap access, or else the gate closes again.

Cheers,
Peter

  reply	other threads:[~2021-09-06  6:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210822184927.94673-3-jacopo@jmondi.org>
     [not found] ` <20210823073639.13688-1-jacopo@jmondi.org>
     [not found]   ` <20210829175413.7ce30bfa@jic23-huawei>
     [not found]     ` <20210830162051.rjqlhwvtguaivt3p@uno.localdomain>
     [not found]       ` <20210830181117.6808f085@jic23-huawei>
     [not found]         ` <20210831074011.d6f5rsix2mgxqba5@uno.localdomain>
2021-09-05 10:04           ` [PATCH v3.1 2/3] iio: chemical: Add Senseair Sunrise 006-0-007 driver Jonathan Cameron
2021-09-05 23:03             ` Peter Rosin
2021-09-06  6:56               ` Peter Rosin [this message]
2021-09-08 11:00               ` Jacopo Mondi
2021-09-08 15:29                 ` Peter Rosin
2021-09-08 15:58                   ` Andy Shevchenko
2021-09-08 16:08                   ` Jacopo Mondi

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=02f30a94-4b37-fb7a-da7f-d557fb22b431@axentia.se \
    --to=peda@axentia.se \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jacopo@jmondi.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=matt.ranostay@konsulko.com \
    --cc=wsa@kernel.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;
as well as URLs for NNTP newsgroup(s).