From: Frank Li <Frank.li@oss.nxp.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Pablo Mazzini <pmazzini@gmail.com>,
Alistair Francis <alistair@alistair23.me>,
Andreas Kemnade <andreas@kemnade.info>,
Mark Brown <broonie@kernel.org>,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/2] hwmon: sy7636a: read the temperature only while the rails are on
Date: Mon, 23 Nov 2026 15:47:30 -0500 [thread overview]
Message-ID: <awSmYnfbVnjnSwNB@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <9bd10826-7684-462a-808b-91b72c9d5689@roeck-us.net>
On Sat, Nov 14, 2026 at 08:33:47AM -0800, Guenter Roeck wrote:
> On Thu, Nov 12, 2026 at 08:52:27PM +0000, Pablo Mazzini wrote:
> > The driver enables VCOM at probe, which keeps the panel's high voltage
> > rails on for good. Read the temperature only while the rails are on, when
> > the chip samples it, and return -ENODATA otherwise. Read power good with
> > it in one transfer, so the value can not be from before the first sample
> > or after the rails went off.
> >
> > Signed-off-by: Pablo Mazzini <pmazzini@gmail.com>
>
> This patch depends on the rest of the patch series, so I can not apply it
> to a hwmon branch. Assuming it will be applied to some other branch,
Guenter:
Do you meand depend on CONFIG_MFD_SY7636A=y
https://lore.kernel.org/all/20261112205228.42630-3-pmazzini@gmail.com/
Frank
>
> Acked-by: Guenter Roeck <linux@roeck-us.net>
>
> Thanks,
> Guenter
>
> > ---
> > drivers/hwmon/sy7636a-hwmon.c | 35 ++++++++++++++++++++++++-----------
> > 1 file changed, 24 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/hwmon/sy7636a-hwmon.c b/drivers/hwmon/sy7636a-hwmon.c
> > index a0d0b4119bb3..a8bfbf1716a1 100644
> > --- a/drivers/hwmon/sy7636a-hwmon.c
> > +++ b/drivers/hwmon/sy7636a-hwmon.c
> > @@ -9,26 +9,43 @@
> > */
> >
> > #include <linux/auxiliary_bus.h>
> > +#include <linux/bits.h>
> > #include <linux/err.h>
> > #include <linux/hwmon.h>
> > #include <linux/module.h>
> > #include <linux/regmap.h>
> > -#include <linux/regulator/machine.h>
> >
> > -#define SY7636A_REG_TERMISTOR_READOUT 0x08
> > +#define SY7636A_REG_FAULT_FLAG 0x07
> > +#define SY7636A_FAULT_FLAG_PG BIT(0)
> >
> > static int sy7636a_read(struct device *dev, enum hwmon_sensor_types type,
> > u32 attr, int channel, long *temp)
> > {
> > struct regmap *regmap = dev_get_drvdata(dev);
> > - int ret, reg_val;
> > -
> > - ret = regmap_read(regmap,
> > - SY7636A_REG_TERMISTOR_READOUT, ®_val);
> > + u8 buf[2];
> > + int ret;
> > +
> > + /*
> > + * The thermistor is sampled while ON_OFF is set, but the first sample
> > + * is only ready after the ADC sampling and conversion time (ADC_SPL +
> > + * ADC_DEL in the datasheet); until then it holds its reset value, 0.
> > + * PG is only set once all rails are up, after the first sample, so
> > + * read it in the same transfer and report the temperature only while
> > + * it is set.
> > + *
> > + * With ON_OFF set but PG low (rails still ramping up, or a fault), no
> > + * temperature is reported even if one may be available. That is
> > + * accepted: the display driver reads the temperature only while it
> > + * holds the rails on, after power good.
> > + */
> > + ret = regmap_bulk_read(regmap, SY7636A_REG_FAULT_FLAG, buf, sizeof(buf));
> > if (ret)
> > return ret;
> >
> > - *temp = reg_val * 1000;
> > + if (!(buf[0] & SY7636A_FAULT_FLAG_PG))
> > + return -ENODATA;
> > +
> > + *temp = (s8)buf[1] * 1000;
> >
> > return 0;
> > }
> > @@ -72,10 +89,6 @@ static int sy7636a_sensor_probe(struct auxiliary_device *adev,
> > if (!regmap)
> > return -ENODEV;
> >
> > - err = devm_regulator_get_enable(&adev->dev, "vcom");
> > - if (err)
> > - return err;
> > -
> > hwmon_dev = devm_hwmon_device_register_with_info(&adev->dev,
> > "sy7636a_temperature", regmap,
> > &sy7636a_chip_info, NULL);
next prev parent reply other threads:[~2026-11-23 20:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 20:52 [PATCH v4 0/2] sy7636a: power the panel only during updates Pablo Mazzini
2026-11-12 20:52 ` [PATCH v4 1/2] hwmon: sy7636a: read the temperature only while the rails are on Pablo Mazzini
2026-11-14 16:33 ` Guenter Roeck
2026-11-23 20:47 ` Frank Li [this message]
2026-11-23 21:04 ` Pablo Mazzini
2026-11-12 20:52 ` [PATCH v4 2/2] ARM: imx_v6_v7_defconfig: drop the SY7636A MFD option Pablo Mazzini
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=awSmYnfbVnjnSwNB@lizhi-Precision-Tower-5810 \
--to=frank.li@oss.nxp.com \
--cc=alistair@alistair23.me \
--cc=andreas@kemnade.info \
--cc=broonie@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=pmazzini@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
all inboxes | Powered by JetHome®