[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKMwjwT-74=QRqH_ML9PMe6Bfq8WCJgxoYBjFFegH8EvGMamQA@mail.gmail.com>
Date: Tue, 17 Jun 2025 12:00:27 -0400
From: Job Sava <jsava@...ticallink.com>
To: Lee Jones <lee@...nel.org>
Cc: Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Julien Panis <jpanis@...libre.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-input@...r.kernel.org,
jcormier@...ticallink.com
Subject: Re: [PATCH 3/3] mfd: tps6594: Adds support for powering off the PMIC
On Fri, Jun 13, 2025 at 10:11 AM Lee Jones <lee@...nel.org> wrote:
>
> On Tue, 20 May 2025, Job Sava wrote:
>
> > When the FSM_I2C_TRIGGER register's bit 0 is set it triggers TRIGGER_I2C_0
> > and the PMIC is transitioned to the STANDBY state
> > (table 6-18: SLVSGG7 – DECEMBER 2023).
> >
> > An ON request is required to transition from STANDBY to ACTIVE.
> >
> > Signed-off-by: Job Sava <jsava@...ticallink.com>
> > ---
> > drivers/mfd/tps6594-core.c | 24 ++++++++++++++++++++++++
> > 1 file changed, 24 insertions(+)
> >
> > diff --git a/drivers/mfd/tps6594-core.c b/drivers/mfd/tps6594-core.c
> > index 1b0b3d1bf6c4..f4c434c0d87a 100644
> > --- a/drivers/mfd/tps6594-core.c
> > +++ b/drivers/mfd/tps6594-core.c
> > @@ -10,6 +10,7 @@
> > #include <linux/interrupt.h>
> > #include <linux/module.h>
> > #include <linux/of.h>
> > +#include <linux/reboot.h>
> >
> > #include <linux/mfd/core.h>
> > #include <linux/mfd/tps6594.h>
> > @@ -615,6 +616,19 @@ static int tps6594_enable_crc(struct tps6594 *tps)
> > return ret;
> > }
> >
> > +static int tps6594_soft_shutdown(struct tps6594 *tps)
>
> Why do you have a whole separate function that itself is only called
> once and only conducts a single one call to one other function?
I copied this code from the tps65219 pmic driver, which setup the
functions in this way. I will merge the two functions.
>
> > +{
> > + return regmap_update_bits(tps->regmap, TPS6594_REG_FSM_I2C_TRIGGERS,
> > + TPS6594_BIT_TRIGGER_I2C(0),
> > + TPS6594_BIT_TRIGGER_I2C(0));
> > +}
> > +
> > +static int tps6594_power_off_handler(struct sys_off_data *data)
> > +{
> > + tps6594_soft_shutdown(data->cb_data);
> > + return NOTIFY_DONE;
> > +}
> > +
> > int tps6594_device_init(struct tps6594 *tps, bool enable_crc)
> > {
> > struct device *dev = tps->dev;
> > @@ -623,6 +637,7 @@ int tps6594_device_init(struct tps6594 *tps, bool enable_crc)
> > const struct mfd_cell *cells;
> > int n_cells;
> > bool pwr_button;
> > + bool system_power_controller;
> >
> > if (enable_crc) {
> > ret = tps6594_enable_crc(tps);
> > @@ -681,6 +696,15 @@ int tps6594_device_init(struct tps6594 *tps, bool enable_crc)
> > return dev_err_probe(dev, ret, "Failed to add RTC child device\n");
> > }
> >
> > + system_power_controller = of_property_read_bool(dev->of_node, "system-power-controller");
> > + if (system_power_controller) {
> > + ret = devm_register_power_off_handler(tps->dev,
> > + tps6594_power_off_handler,
> > + tps);
>
> This alignment is odd.
Will have this fixed for the next patch.
>
> > + if (ret)
> > + return dev_err_probe(dev, ret, "Failed to register power-off handler\n");
> > + }
> > +
> > return 0;
> > }
> > EXPORT_SYMBOL_GPL(tps6594_device_init);
> >
> > --
> > 2.43.0
> >
>
> --
> Lee Jones [李琼斯]
Thank you
-Job
Powered by blists - more mailing lists