From: "Álvaro Fernández Rojas" <noltari@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
jdelvare@suse.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, corbet@lwn.net,
linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH] drivers: hwmon: add EMC2101 driver
Date: Fri, 4 Jul 2025 09:26:16 +0200 [thread overview]
Message-ID: <CAKR-sGcLkihNKAQpPR6y3u2aCA6xmTd0mp2Ko15e3QZWrc4Dgg@mail.gmail.com> (raw)
In-Reply-To: <9df1cc49-34bd-42d4-96dc-ec9b512e0c5f@roeck-us.net>
Hi Guenter,
El vie, 4 jul 2025 a las 2:25, Guenter Roeck (<linux@roeck-us.net>) escribió:
>
> On Thu, Jul 03, 2025 at 09:23:41AM +0200, Álvaro Fernández Rojas wrote:
> > >
> > > Add a comment describing what you are protecting here. It looks so far
> > > like you could just use regmap and drop the mutex, but I didn't check
> > > thoroughly.
> >
> > The EMC2101 datasheet is explicit about the Look Up Table registers
> > (REG_FAN_LUT_TEMP and REG_FAN_LUT_SPEED) being RO if FAN_LUT_DISABLE
> > isn't set, so I believe that we need the mutex even if we switch to
> > regmap.
> > I will add an explanation with that in the next version.
> > Should I still switch the implementation to regmap considering that we
> > need a mutex?
> >
> What does r/w vs. r/o register access have to do with locking ?
FAN_LUT_DISABLE bit can be set or cleared when pwm_enable is modified,
but we need it to be set in order to be able to modify
REG_FAN_LUT_TEMP and REG_FAN_LUT_SPEED registers.
If FAN_LUT_DISABLE bit isn't set, any attempt to modify
REG_FAN_LUT_TEMP and REG_FAN_LUT_SPEED registers won't work because
they would be RO.
Therefore, we need a lock to ensure that FAN_LUT_DISABLE is kept while
modifying those registers.
Please, take a look at emc2101_pwm_enable_write() and
__pwm_auto_point_temp_store().
>
> Guenter
Best regards,
Álvaro.
next prev parent reply other threads:[~2025-07-04 7:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-01 18:12 [PATCH v2 0/3] hwmon: add Microchip EMC2101 driver Álvaro Fernández Rojas
2025-07-01 18:12 ` [PATCH v2 1/3] docs: hwmon: add emc2101.rst to docs Álvaro Fernández Rojas
2025-07-01 18:12 ` [PATCH v2 2/3] dt-bindings: hwmon: Add Microchip EMC2101 support Álvaro Fernández Rojas
2025-07-01 19:33 ` Rob Herring (Arm)
2025-07-02 7:16 ` Krzysztof Kozlowski
2025-07-01 18:12 ` [PATCH] drivers: hwmon: add EMC2101 driver Álvaro Fernández Rojas
2025-07-02 8:35 ` Krzysztof Kozlowski
2025-07-03 7:23 ` Álvaro Fernández Rojas
2025-07-04 0:25 ` Guenter Roeck
2025-07-04 7:26 ` Álvaro Fernández Rojas [this message]
2025-07-04 13:00 ` Guenter Roeck
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=CAKR-sGcLkihNKAQpPR6y3u2aCA6xmTd0mp2Ko15e3QZWrc4Dgg@mail.gmail.com \
--to=noltari@gmail.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=jdelvare@suse.com \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=robh@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).