From: Mark Brown <broonie@kernel.org> To: Jerome Neanne <jneanne@baylibre.com> Cc: lgirdwood@gmail.com, robh+dt@kernel.org, nm@ti.com, kristo@kernel.org, khilman@baylibre.com, narmstrong@baylibre.com, msp@baylibre.com, j-keerthy@ti.c, lee.jones@linaro.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v1 08/14] regulator: drivers: Add TI TPS65219 PMIC regulators support Date: Tue, 19 Jul 2022 14:32:58 +0100 [thread overview] Message-ID: <YtayikFdidxXXubS@sirena.org.uk> (raw) In-Reply-To: <20220719091742.3221-9-jneanne@baylibre.com> [-- Attachment #1.1: Type: text/plain, Size: 2350 bytes --] On Tue, Jul 19, 2022 at 11:17:36AM +0200, Jerome Neanne wrote: > @@ -0,0 +1,414 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * tps65219-regulator.c > + * Please make the entire comment a C++ one so things look more intentional. > +static int tps65219_pmic_set_voltage_sel(struct regulator_dev *dev, > + unsigned int selector) > +{ > + int ret; > + struct tps65219 *tps = rdev_get_drvdata(dev); > + > + /* Set the voltage based on vsel value */ > + ret = regmap_update_bits(tps->regmap, dev->desc->vsel_reg, > + dev->desc->vsel_mask, selector); > + if (ret) { > + dev_dbg(tps->dev, "%s failed for regulator %s: %d ", > + __func__, dev->desc->name, ret); > + } > + return ret; > +} This should just be able to use the standard regmap helper, as should the enable and disable operations? > +static int tps65219_set_mode(struct regulator_dev *dev, unsigned int mode) > +{ > + struct tps65219 *tps = rdev_get_drvdata(dev); > + > + switch (mode) { > + case REGULATOR_MODE_NORMAL: > + return regmap_set_bits(tps->regmap, TPS65219_REG_STBY_1_CONFIG, > + dev->desc->enable_mask); > + > + case REGULATOR_MODE_STANDBY: > + return regmap_clear_bits(tps->regmap, > + TPS65219_REG_STBY_1_CONFIG, > + dev->desc->enable_mask); > + } > + > + return -EINVAL; It'd be a little clearer to have that -EINVAL in a default statement. > +static irqreturn_t tps65219_regulator_irq_handler(int irq, void *data) > +{ > + struct tps65219_regulator_irq_data *irq_data = data; > + > + if (irq_data->type->event_name[0] == '\0') { > + /* This is the timeout interrupt */ > + dev_err(irq_data->dev, "System was put in shutdown during an active or standby transition.\n"); > + return IRQ_HANDLED; > + } > + > + dev_err(irq_data->dev, "Registered %s for %s\n", > + irq_data->type->event_name, irq_data->type->regulator_name); This should be reporting the events through the notification API, see regulator_notifier_call_chain(). That will require a bit of refactoring of the way the driver is registering interrupts unfortunately, at the minute it doesn't have data joining them up with the I'd also reword that log message to be something more like "Error %s reported for %s" - at the minute it looks more like a probe message. Otherwise this looks good. [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] [-- Attachment #2: Type: text/plain, Size: 176 bytes --] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org> To: Jerome Neanne <jneanne@baylibre.com> Cc: lgirdwood@gmail.com, robh+dt@kernel.org, nm@ti.com, kristo@kernel.org, khilman@baylibre.com, narmstrong@baylibre.com, msp@baylibre.com, j-keerthy@ti.c, lee.jones@linaro.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v1 08/14] regulator: drivers: Add TI TPS65219 PMIC regulators support Date: Tue, 19 Jul 2022 14:32:58 +0100 [thread overview] Message-ID: <YtayikFdidxXXubS@sirena.org.uk> (raw) In-Reply-To: <20220719091742.3221-9-jneanne@baylibre.com> [-- Attachment #1: Type: text/plain, Size: 2350 bytes --] On Tue, Jul 19, 2022 at 11:17:36AM +0200, Jerome Neanne wrote: > @@ -0,0 +1,414 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * tps65219-regulator.c > + * Please make the entire comment a C++ one so things look more intentional. > +static int tps65219_pmic_set_voltage_sel(struct regulator_dev *dev, > + unsigned int selector) > +{ > + int ret; > + struct tps65219 *tps = rdev_get_drvdata(dev); > + > + /* Set the voltage based on vsel value */ > + ret = regmap_update_bits(tps->regmap, dev->desc->vsel_reg, > + dev->desc->vsel_mask, selector); > + if (ret) { > + dev_dbg(tps->dev, "%s failed for regulator %s: %d ", > + __func__, dev->desc->name, ret); > + } > + return ret; > +} This should just be able to use the standard regmap helper, as should the enable and disable operations? > +static int tps65219_set_mode(struct regulator_dev *dev, unsigned int mode) > +{ > + struct tps65219 *tps = rdev_get_drvdata(dev); > + > + switch (mode) { > + case REGULATOR_MODE_NORMAL: > + return regmap_set_bits(tps->regmap, TPS65219_REG_STBY_1_CONFIG, > + dev->desc->enable_mask); > + > + case REGULATOR_MODE_STANDBY: > + return regmap_clear_bits(tps->regmap, > + TPS65219_REG_STBY_1_CONFIG, > + dev->desc->enable_mask); > + } > + > + return -EINVAL; It'd be a little clearer to have that -EINVAL in a default statement. > +static irqreturn_t tps65219_regulator_irq_handler(int irq, void *data) > +{ > + struct tps65219_regulator_irq_data *irq_data = data; > + > + if (irq_data->type->event_name[0] == '\0') { > + /* This is the timeout interrupt */ > + dev_err(irq_data->dev, "System was put in shutdown during an active or standby transition.\n"); > + return IRQ_HANDLED; > + } > + > + dev_err(irq_data->dev, "Registered %s for %s\n", > + irq_data->type->event_name, irq_data->type->regulator_name); This should be reporting the events through the notification API, see regulator_notifier_call_chain(). That will require a bit of refactoring of the way the driver is registering interrupts unfortunately, at the minute it doesn't have data joining them up with the I'd also reword that log message to be something more like "Error %s reported for %s" - at the minute it looks more like a probe message. Otherwise this looks good. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-07-19 13:34 UTC|newest] Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-19 9:17 [PATCH v1 00/14] Add support for TI TPS65219 PMIC Jerome Neanne 2022-07-19 9:17 ` Jerome Neanne 2022-07-19 9:17 ` [PATCH v1 01/14] MAINTAINERS: OMAP2+ support, add tps65218-pwrbutton Jerome Neanne 2022-07-19 9:17 ` Jerome Neanne 2022-07-19 9:17 ` [PATCH v1 02/14] regulator: dt-bindings: Add TI TPS65219 PMIC bindings Jerome Neanne 2022-07-19 9:17 ` Jerome Neanne 2022-07-19 12:55 ` Mark Brown 2022-07-19 12:55 ` Mark Brown 2022-07-19 9:17 ` [PATCH v1 03/14] regulator: dt-bindings: Add interrupts support to " Jerome Neanne 2022-07-19 9:17 ` Jerome Neanne 2022-07-19 12:58 ` Mark Brown 2022-07-19 12:58 ` Mark Brown 2022-07-20 23:37 ` Rob Herring 2022-07-20 23:37 ` Rob Herring 2022-07-19 9:17 ` [PATCH v1 04/14] regulator: dt-bindings: tps65219: Add power-button property Jerome Neanne 2022-07-19 9:17 ` Jerome Neanne 2022-07-20 23:39 ` Rob Herring 2022-07-20 23:39 ` Rob Herring 2022-07-21 7:09 ` Markus Schneider-Pargmann 2022-07-21 7:09 ` Markus Schneider-Pargmann 2022-07-19 9:17 ` [PATCH v1 05/14] mfd: drivers: Add TI TPS65219 PMIC support Jerome Neanne 2022-07-19 9:17 ` Jerome Neanne 2022-07-19 9:17 ` [PATCH v1 06/14] mfd: drivers: Add interrupts support to TI TPS65219 PMIC Jerome Neanne 2022-07-19 9:17 ` Jerome Neanne 2022-07-19 9:17 ` [PATCH v1 07/14] mfd: tps65219: Add power-button support Jerome Neanne 2022-07-19 9:17 ` Jerome Neanne 2022-07-19 9:17 ` [PATCH v1 08/14] regulator: drivers: Add TI TPS65219 PMIC regulators support Jerome Neanne 2022-07-19 9:17 ` Jerome Neanne 2022-07-19 13:32 ` Mark Brown [this message] 2022-07-19 13:32 ` Mark Brown 2022-07-22 10:12 ` jerome Neanne 2022-07-22 10:12 ` jerome Neanne 2022-07-22 12:39 ` Mark Brown 2022-07-22 12:39 ` Mark Brown 2022-07-22 13:30 ` jerome Neanne 2022-07-22 13:30 ` jerome Neanne 2022-07-22 18:40 ` Mark Brown 2022-07-22 18:40 ` Mark Brown 2022-07-19 9:17 ` [PATCH v1 09/14] Input: Add tps65219 interrupt driven powerbutton Jerome Neanne 2022-07-19 9:17 ` Jerome Neanne 2022-07-19 9:17 ` [PATCH v1 10/14] arm64: defconfig: Add tps65219 as modules Jerome Neanne 2022-07-19 9:17 ` Jerome Neanne 2022-07-19 9:17 ` [PATCH v1 11/14] arm64: dts: ti: Add TI TPS65219 PMIC support for AM642 SK board Jerome Neanne 2022-07-19 9:17 ` Jerome Neanne 2022-07-19 13:00 ` Nishanth Menon 2022-07-19 13:00 ` Nishanth Menon [not found] ` <CAOP-2kHgEhm+Ym8o7A49qP-oabO0i+89PGoWO0c9_2xz7oU89w@mail.gmail.com> 2022-07-19 13:17 ` Nishanth Menon 2022-07-19 13:17 ` Nishanth Menon 2022-07-19 9:17 ` [PATCH v1 12/14] arm64: dts: ti: Add pinmux and irq mapping for TPS65219 external interrupts Jerome Neanne 2022-07-19 9:17 ` Jerome Neanne 2022-07-19 9:17 ` [PATCH v1 13/14] arm64: dts: ti: k3-am642-sk: Enable tps65219 power-button Jerome Neanne 2022-07-19 9:17 ` Jerome Neanne 2022-07-19 9:17 ` [PATCH v1 14/14] arm64: defconfig: Add tps65219 power-button as module Jerome Neanne 2022-07-19 9:17 ` Jerome Neanne
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=YtayikFdidxXXubS@sirena.org.uk \ --to=broonie@kernel.org \ --cc=devicetree@vger.kernel.org \ --cc=j-keerthy@ti.c \ --cc=jneanne@baylibre.com \ --cc=khilman@baylibre.com \ --cc=kristo@kernel.org \ --cc=lee.jones@linaro.org \ --cc=lgirdwood@gmail.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=msp@baylibre.com \ --cc=narmstrong@baylibre.com \ --cc=nm@ti.com \ --cc=robh+dt@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.