devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Angel Iglesias <ang.iglesiasg@gmail.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Andreas Klinger <ak@it-klinger.de>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] iio: pressure: Support ROHM BU1390
Date: Mon, 18 Sep 2023 14:42:11 +0300	[thread overview]
Message-ID: <4084c827-abf6-0f15-7957-13db50912943@gmail.com> (raw)
In-Reply-To: <20230917102615.618dd01a@jic23-huawei>

On 9/17/23 12:26, Jonathan Cameron wrote:
> On Thu, 14 Sep 2023 14:47:44 +0300
> Matti Vaittinen <mazziesaccount@gmail.com> wrote:
> 
>> On 9/10/23 16:22, Jonathan Cameron wrote:
>>> On Wed, 6 Sep 2023 15:37:48 +0300
>>> Matti Vaittinen <mazziesaccount@gmail.com> wrote:
>>>    
>>>> Support for the ROHM BM1390 pressure sensor. The BM1390GLV-Z can measure
>>>> pressures ranging from 300 hPa to 1300 hPa with configurable measurement
>>>> averaging and internal FIFO. The sensor does also provide temperature
>>>> measurements.
>>>>
>>>> Sensor does also contain IIR filter implemented in HW. The data-sheet
>>>> says the IIR filter can be configured to be "weak", "middle" or
>>>> "strong". Some RMS noise figures are provided in data sheet but no
>>>> accurate maths for the filter configurations is provided. Hence, the IIR
>>>> filter configuration is not supported by this driver and the filter is
>>>> configured to the "middle" setting (at least not for now).
>>
>>>> +
>>>> +static irqreturn_t bm1390_irq_thread_handler(int irq, void *private)
>>>> +{
>>>> +	struct iio_dev *idev = private;
>>>> +	struct bm1390_data *data = iio_priv(idev);
>>>> +	int ret = IRQ_NONE;
>>>> +
>>>> +	mutex_lock(&data->mutex);
>>>> +
>>>> +	if (data->trigger_enabled) {
>>>> +		iio_trigger_poll_nested(data->trig);
>>>> +		ret = IRQ_HANDLED;
>>>> +	}
>>>> +
>>>> +	if (data->state == BM1390_STATE_FIFO) {
>>>
>>> Can this and trigger_enabled be true?
>>
>> Thanks for asking this question. Intention was that these are mutually
>> exclusive. However, I think that the check
>> if (iio_device_get_current_mode(idev) == INDIO_BUFFER_TRIGGERED)
>> in bm1390_buffer_postenable(), before calling the bm1390_fifo_enable()
>> is not 100% race free.
>>
>> I, however, like the idea of having this check in the buffer-enable
>> function - I think it makes the design much more obvious. What I will do
>> is adding another check for:
>> 	if (data->trigger_enable) {
>> 		ret = -EBUSY;
>> 		goto unlock_out;
>> 	}
>>
>> inside the bm1390_fifo_enable() to the section which holds the mutex.
> 
> You could make the exclusive nature obvious in the thread_handler by using an
> else if () above.

Right. Thanks.

> 
>>
>>
>> Yours,
>> 	-- Matti
>>
>>
>>
> 

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~


  reply	other threads:[~2023-09-18 11:42 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-06 12:36 [PATCH 0/3] Support ROHM BM1390 pressure sensor Matti Vaittinen
2023-09-06 12:37 ` [PATCH 1/3] dt-bindings: Add " Matti Vaittinen
2023-09-07 10:08   ` Conor Dooley
2023-09-08  5:10     ` Matti Vaittinen
2023-09-08  7:14   ` Benjamin Bara
2023-09-08  7:18     ` Matti Vaittinen
2023-09-06 12:37 ` [PATCH 2/3] iio: pressure: Support ROHM BU1390 Matti Vaittinen
2023-09-06 15:48   ` Andy Shevchenko
2023-09-07  5:57     ` Matti Vaittinen
2023-09-07 13:57       ` Andy Shevchenko
2023-09-08  6:12         ` Matti Vaittinen
2023-09-08 18:44           ` Jonathan Cameron
2023-09-11  5:32             ` Matti Vaittinen
2023-09-08  6:24         ` Matti Vaittinen
2023-09-08 18:33       ` Jonathan Cameron
2023-09-08 18:45   ` Jonathan Cameron
2023-09-11  5:15     ` Matti Vaittinen
2023-09-10 13:22   ` Jonathan Cameron
2023-09-11 10:40     ` Matti Vaittinen
2023-09-12 14:38       ` Jonathan Cameron
2023-09-14 11:47     ` Matti Vaittinen
2023-09-17  9:26       ` Jonathan Cameron
2023-09-18 11:42         ` Matti Vaittinen [this message]
2023-09-06 12:40 ` [PATCH 3/3] MAINTAINERS: Add ROHM BM1390 Matti Vaittinen

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=4084c827-abf6-0f15-7957-13db50912943@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=ak@it-klinger.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ang.iglesiasg@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=robh+dt@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).