From: Jishnu Prakash <jishnu.prakash@oss.qualcomm.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Amit Kucheria" <amitk@kernel.org>,
"Thara Gopinath" <thara.gopinath@gmail.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Daniel Lezcano" <daniel.lezcano@kernel.org>,
"Zhang Rui" <rui.zhang@intel.com>,
"Lukasz Luba" <lukasz.luba@arm.com>,
linux-arm-msm@vger.kernel.org, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
"Kamal Wadhwa" <kamal.wadhwa@oss.qualcomm.com>,
"David Collins" <david.collins@oss.qualcomm.com>,
"Anjelique Melendez" <anjelique.melendez@oss.qualcomm.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Stephan Gerhold" <stephan.gerhold@linaro.org>
Subject: Re: [PATCH 1/2] iio: adc: qcom-spmi-adc5-gen3: Share SDAM0 IRQ with ADC_TM auxiliary driver
Date: Tue, 26 May 2026 16:23:41 +0530 [thread overview]
Message-ID: <e954c647-397b-499b-ba47-ebfc9a65c2b4@oss.qualcomm.com> (raw)
In-Reply-To: <20260522114722.49b6055e@jic23-huawei>
Hi Jonathan,
On 5/22/2026 4:17 PM, Jonathan Cameron wrote:
> On Thu, 21 May 2026 16:16:17 +0530
> Jishnu Prakash <jishnu.prakash@oss.qualcomm.com> wrote:
>
>> Hi Jonathan,
>>
>> On 5/15/2026 7:24 PM, Jonathan Cameron wrote:
>>> On Fri, 15 May 2026 14:23:44 +0530
>>> Jishnu Prakash <jishnu.prakash@oss.qualcomm.com> wrote:
>>>
...
>>>> diff --git a/drivers/iio/adc/qcom-spmi-adc5-gen3.c b/drivers/iio/adc/qcom-spmi-adc5-gen3.c
>>>> index f8168a14b907..a819c3e627a0 100644
>>>> --- a/drivers/iio/adc/qcom-spmi-adc5-gen3.c
>>>> +++ b/drivers/iio/adc/qcom-spmi-adc5-gen3.c
>>>
>>>> static int adc5_gen3_probe(struct platform_device *pdev)
>>>> {
>>>> struct device *dev = &pdev->dev;
>>>> @@ -818,7 +782,7 @@ static int adc5_gen3_probe(struct platform_device *pdev)
>>>> }
>>>>
>>>> ret = devm_request_irq(dev, adc->dev_data.base[ADC5_GEN3_VADC_SDAM].irq,
>>>> - adc5_gen3_isr, 0,
>>>> + adc5_gen3_isr, IRQF_ONESHOT | IRQF_SHARED,
>>>
>>> Sashikio points out that IRQF_ONESHOT is never correct for a non threaded
>>> interrupt. The point of that flag is to ensure we don't handle another interrupt
>>> until the thread is done. If there isn't a thread then it doesn't do anything
>>> (other than omit a warning!)
>>
>> I tried at first keeping only the IRQF_SHARED flag here, but it seems that
>> shared interrupts need to agree on the ONESHOT flag configuration, else the
>> second interrupt's IRQ request call fails.
>>
>> And the ADC_TM interrupt needs to be ONESHOT, since we don't want that interrupt to
>> be rearmed before we have notified the thermal framework from the threaded
>> part of the handler. So I had to add the IRQF_ONESHOT here too, though it is
>> not useful here.
> That's an interesting corner case. Maybe the warning needs to be more refined?
> (I don't think it checks for shared?)
Yes, at the point Sashiko indicated, it looks like there is no check for shared IRQ,
although it is checked later in the same function (__setup_irq).
>
>>
>> I think it's best to use a threaded IRQ handler in this driver too. I don't really
>> see any meaningful way to split the actions in the interrupt handler here into a primary
>> handler and a threaded handler, so is it fine if I just make the primary handler NULL
>> and move all the ISR functionality into the threaded handler part ?
>
> That's fine by me. Just add some comments on why.
Thanks for confirming, I'll push again with a comment explaining this change.
Thanks,
Jishnu
>
> J
>>
>> Thanks,
>> Jishnu
>>
>>
>>>
>>>> adc->dev_data.base[ADC5_GEN3_VADC_SDAM].irq_name,
>>>> adc);
>>>> if (ret)
>>>> diff --git a/include/linux/iio/adc/qcom-adc5-gen3-common.h b/include/linux/iio/adc/qcom-adc5-gen3-common.h
>>>> index 6303eaa6640b..39cbfcbdb101 100644
>>>> --- a/include/linux/iio/adc/qcom-adc5-gen3-common.h
>>>> +++ b/include/linux/iio/adc/qcom-adc5-gen3-common.h
>>>> @@ -205,7 +205,5 @@ int adc5_gen3_get_scaled_reading(struct device *dev,
>>>> int adc5_gen3_therm_code_to_temp(struct device *dev,
>>>> struct adc5_channel_common_prop *common_props,
>>>> u16 code, int *val);
>>>> -void adc5_gen3_register_tm_event_notifier(struct device *dev,
>>>> - void (*handler)(struct auxiliary_device *));
>>>>
>>>> #endif /* QCOM_ADC5_GEN3_COMMON_H */
>>>>
>>>
>>
>
next prev parent reply other threads:[~2026-05-26 10:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 8:53 [PATCH 0/2] thermal: qcom: add support for PMIC5 Gen3 ADC thermal monitoring Jishnu Prakash
2026-05-15 8:53 ` [PATCH 1/2] iio: adc: qcom-spmi-adc5-gen3: Share SDAM0 IRQ with ADC_TM auxiliary driver Jishnu Prakash
2026-05-15 13:54 ` Jonathan Cameron
2026-05-21 10:46 ` Jishnu Prakash
2026-05-22 10:47 ` Jonathan Cameron
2026-05-26 10:53 ` Jishnu Prakash [this message]
2026-05-17 7:08 ` Andy Shevchenko
2026-05-20 15:20 ` Daniel Lezcano
2026-05-15 8:53 ` [PATCH 2/2] thermal: qcom: add support for PMIC5 Gen3 ADC thermal monitoring Jishnu Prakash
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=e954c647-397b-499b-ba47-ebfc9a65c2b4@oss.qualcomm.com \
--to=jishnu.prakash@oss.qualcomm.com \
--cc=amitk@kernel.org \
--cc=andy@kernel.org \
--cc=anjelique.melendez@oss.qualcomm.com \
--cc=daniel.lezcano@kernel.org \
--cc=david.collins@oss.qualcomm.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=kamal.wadhwa@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=neil.armstrong@linaro.org \
--cc=nuno.sa@analog.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=stephan.gerhold@linaro.org \
--cc=thara.gopinath@gmail.com \
/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