From: Amit Sunil Dhamne <amitsd@google.com>
To: "André Draszik" <andre.draszik@linaro.org>,
"Sebastian Reichel" <sre@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Lee Jones" <lee@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Badhri Jagan Sridharan" <badhri@google.com>,
"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
"Peter Griffin" <peter.griffin@linaro.org>,
"Tudor Ambarus" <tudor.ambarus@linaro.org>,
"Alim Akhtar" <alim.akhtar@samsung.com>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
devicetree@vger.kernel.org, linux-usb@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org,
RD Babiera <rdbabiera@google.com>, Kyle Tso <kyletso@google.com>
Subject: Re: [PATCH 4/6] mfd: max77759: modify irq configs
Date: Wed, 26 Nov 2025 20:15:38 -0800 [thread overview]
Message-ID: <6f2f075b-3570-4424-9cc7-695fb8c3b988@google.com> (raw)
In-Reply-To: <e25ff0e5ff103433942fc7744eea4a3c61ce1daf.camel@linaro.org>
On 11/25/25 10:44 PM, André Draszik wrote:
> Hi Amit,
>
> On Tue, 2025-11-25 at 17:10 -0800, Amit Sunil Dhamne wrote:
>> Hi André,
>>
>> On 11/23/25 10:21 PM, André Draszik wrote:
>>> Hi Amit,
>>>
>>> Thanks for your patches to enable the charger!
>> Ack!
>>
>>
>>>> From: Amit Sunil Dhamne <amitsd@google.com>
>>>>
>>>> Define specific bit-level masks for charger's registers and modify the
>>>> irq mask for charger irq_chip. Also, configure the max77759 interrupt
>>>> lines as active low to all interrupt registrations to ensure the
>>>> interrupt controllers are configured with the correct trigger type.
>>>>
>>>> Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
>>>> ---
>>>> drivers/mfd/max77759.c | 24 +++++++++++++++++-------
>>>> include/linux/mfd/max77759.h | 9 +++++++++
>>>> 2 files changed, 26 insertions(+), 7 deletions(-)
>>>>
>>>> diff --git a/drivers/mfd/max77759.c b/drivers/mfd/max77759.c
>>>> index 6cf6306c4a3b..5fe22884f362 100644
>>>> --- a/drivers/mfd/max77759.c
>>>> +++ b/drivers/mfd/max77759.c
>>>> @@ -256,8 +256,17 @@ static const struct regmap_irq max77759_topsys_irqs[] = {
>>>> };
>>>>
>>>> static const struct regmap_irq max77759_chgr_irqs[] = {
>>>> - REGMAP_IRQ_REG(MAX77759_CHARGER_INT_1, 0, GENMASK(7, 0)),
>>>> - REGMAP_IRQ_REG(MAX77759_CHARGER_INT_2, 1, GENMASK(7, 0)),
>>>> + REGMAP_IRQ_REG(MAX77759_CHARGER_INT_1, 0,
>>>> + MAX77759_CHGR_REG_CHG_INT_AICL |
>>>> + MAX77759_CHGR_REG_CHG_INT_CHGIN |
>>>> + MAX77759_CHGR_REG_CHG_INT_CHG |
>>>> + MAX77759_CHGR_REG_CHG_INT_INLIM),
>>>> + REGMAP_IRQ_REG(MAX77759_CHARGER_INT_2, 1,
>>>> + MAX77759_CHGR_REG_CHG_INT2_BAT_OILO |
>>>> + MAX77759_CHGR_REG_CHG_INT2_CHG_STA_CC |
>>>> + MAX77759_CHGR_REG_CHG_INT2_CHG_STA_CV |
>>>> + MAX77759_CHGR_REG_CHG_INT2_CHG_STA_TO |
>>>> + MAX77759_CHGR_REG_CHG_INT2_CHG_STA_DONE),
>>>> };
> You should also add the remaining bits in each register here, so that the
> regulator-irq can mask them when no user exists. It will only touch the
> bits it knows about, so the state of the mask register is non-
> deterministic with this change as-is (depends on how the bootloader
> configured it).
>
> [...]
I see what you're saying. I will remove this and keep it the way it was
before.
>
>>>
>>>> diff --git a/include/linux/mfd/max77759.h b/include/linux/mfd/max77759.h
>>>> index c6face34e385..0ef29a48deec 100644
>>>> --- a/include/linux/mfd/max77759.h
>>>> +++ b/include/linux/mfd/max77759.h
>>>> @@ -62,7 +62,16 @@
>>>> #define MAX77759_CHGR_REG_CHG_INT 0xb0
>>>> #define MAX77759_CHGR_REG_CHG_INT2 0xb1
>>>> #define MAX77759_CHGR_REG_CHG_INT_MASK 0xb2
>>>> +#define MAX77759_CHGR_REG_CHG_INT_AICL BIT(7)
>>>> +#define MAX77759_CHGR_REG_CHG_INT_CHGIN BIT(6)
>>>> +#define MAX77759_CHGR_REG_CHG_INT_CHG BIT(4)
>>>> +#define MAX77759_CHGR_REG_CHG_INT_INLIM BIT(2)
>>>> #define MAX77759_CHGR_REG_CHG_INT2_MASK 0xb3
>>>> +#define MAX77759_CHGR_REG_CHG_INT2_BAT_OILO BIT(4)
>>>> +#define MAX77759_CHGR_REG_CHG_INT2_CHG_STA_CC BIT(3)
>>>> +#define MAX77759_CHGR_REG_CHG_INT2_CHG_STA_CV BIT(2)
>>>> +#define MAX77759_CHGR_REG_CHG_INT2_CHG_STA_TO BIT(1)
>>>> +#define MAX77759_CHGR_REG_CHG_INT2_CHG_STA_DONE BIT(0)
>>> Even if wireless out of scope, it'd still be nice to add macros for
>>> the remaining bits to make this complete and avoid having to update
>>> these again in case wireless support gets added in the future.
>> I would prefer to only define the macros I am currently using to keep
>> the review focused, unless you consider this a strict requirement.
> It makes sense to add them now, as per above.
Okay. I will add them.
>
>
>
>>> Also, would be nice to keep existing style and indent the bits from
>>> the registers (see existing bit definitions in this file a few lines
>>> further up).
>>> Finally, can you add the bits below the respective register (0xb0 / 0xb1)
>>> please, to keep suffix meaningful, and to follow existing style for cases
>>> like this (see MAX77759_MAXQ_REG_UIC_INT1).
>> I will fix the indentation and ordering in the next revision.
>>
>> Regarding bit definitions: In [PATCH 5/6], the max77759_charger.c driver
>> defines bits for the register addresses defined in this file. Currently,
>> those macros are only used locally by the max77759 charger driver. Would
>> you prefer I move those definitions to this header file as well?
> Yes, would be nice to have them all in one place (in this file). That said,
> CHG_INT, CHG_INT_MASK, and CHG_INT_OK all have the same layout and share
> the same bits, so I personally would probably reuse the ones you added for
> INT for all three of them - MASK (as you did already), and also for the OK
> register. But up to you.
Sounds good.
Thanks,
Amit
> Cheers,
> Andre'
next prev parent reply other threads:[~2025-11-27 4:15 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-23 8:35 [PATCH 0/6] Introduce MAX77759 charger driver Amit Sunil Dhamne via B4 Relay
2025-11-23 8:35 ` [PATCH 1/6] dt-bindings: power: supply: Add Maxim MAX77759 charger Amit Sunil Dhamne via B4 Relay
2025-11-23 9:28 ` Krzysztof Kozlowski
2025-11-24 2:34 ` Amit Sunil Dhamne
2025-11-25 9:56 ` Krzysztof Kozlowski
2025-11-25 23:48 ` Amit Sunil Dhamne
2025-12-02 13:00 ` Krzysztof Kozlowski
2025-12-04 21:06 ` Amit Sunil Dhamne
2025-11-23 8:35 ` [PATCH 2/6] dt-bindings: mfd: maxim,max77759: add charger child node Amit Sunil Dhamne via B4 Relay
2025-11-23 9:30 ` Krzysztof Kozlowski
2025-11-26 0:02 ` Amit Sunil Dhamne
2025-11-23 8:35 ` [PATCH 3/6] dt-bindings: usb: maxim,max33359: Add supply property for VBUS in OTG mode Amit Sunil Dhamne via B4 Relay
2025-11-24 7:53 ` Krzysztof Kozlowski
2025-11-25 20:13 ` Amit Sunil Dhamne
2025-11-26 16:18 ` André Draszik
2025-11-26 20:27 ` Amit Sunil Dhamne
2025-11-26 10:01 ` Heikki Krogerus
2025-11-26 20:50 ` Amit Sunil Dhamne
2025-11-23 8:35 ` [PATCH 4/6] mfd: max77759: modify irq configs Amit Sunil Dhamne via B4 Relay
2025-11-24 6:21 ` André Draszik
2025-11-24 7:39 ` Krzysztof Kozlowski
2025-11-26 1:19 ` Amit Sunil Dhamne
2025-11-26 1:10 ` Amit Sunil Dhamne
2025-11-26 6:44 ` André Draszik
2025-11-26 7:36 ` André Draszik
2025-11-27 4:15 ` Amit Sunil Dhamne [this message]
2025-11-24 7:38 ` Krzysztof Kozlowski
2025-11-23 8:35 ` [PATCH 5/6] power: supply: max77759: add charger driver Amit Sunil Dhamne via B4 Relay
2025-11-26 7:36 ` André Draszik
2025-11-26 7:38 ` kernel test robot
2025-11-26 22:04 ` Amit Sunil Dhamne
2025-11-23 8:35 ` [PATCH 6/6] usb: typec: tcpm/tcpci_maxim: deprecate WAR for setting charger mode Amit Sunil Dhamne via B4 Relay
2025-11-24 9:09 ` André Draszik
2025-11-26 2:32 ` Amit Sunil Dhamne
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=6f2f075b-3570-4424-9cc7-695fb8c3b988@google.com \
--to=amitsd@google.com \
--cc=alim.akhtar@samsung.com \
--cc=andre.draszik@linaro.org \
--cc=badhri@google.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=krzk+dt@kernel.org \
--cc=kyletso@google.com \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=peter.griffin@linaro.org \
--cc=rdbabiera@google.com \
--cc=robh@kernel.org \
--cc=sre@kernel.org \
--cc=tudor.ambarus@linaro.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
all inboxes | Powered by JetHome®