From: Sebastian Reichel <sre@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Matti Vaittinen <mazziesaccount@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCHv1 01/11] dt-bindings: power: supply: adc-battery: add binding
Date: Sat, 11 Mar 2023 18:54:29 +0100 [thread overview]
Message-ID: <1fdf00a0-4830-465a-801c-147472fdcd22@mercury.local> (raw)
In-Reply-To: <CACRpkdYWP7Fc3yho5nDB3qU6rt5o4p2Zcz_RxOvOfsAwjXgqXw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2038 bytes --]
Hi Linus,
On Fri, Mar 10, 2023 at 09:14:39AM +0100, Linus Walleij wrote:
> Hi Sebastian,
>
> thanks for your patches!
>
> On Thu, Mar 9, 2023 at 11:50 PM Sebastian Reichel <sre@kernel.org> wrote:
>
> > Add binding for a battery that is only monitored via ADC
> > channels and simple status GPIOs.
> >
> > Signed-off-by: Sebastian Reichel <sre@kernel.org>
>
> This does look very useful.
:)
> > +title: ADC battery
> > +
> > +maintainers:
> > + - Sebastian Reichel <sre@kernel.org>
> > +
> > +description: |
> > + Basic Battery, which only reports (in circuit) voltage and optionally
> > + current via an ADC channel.
>
> I would over-specify: "voltage over the terminals" and
> "current out of the battery" so this cannot be misunderstood.
>
> + this text:
>
> It can also optionally indicate that the battery is full by pulling a GPIO
> line.
Ack.
>
> > + charged-gpios:
> > + description:
> > + GPIO which signals that the battery is fully charged.
>
> It doesn't say how, I guess either this is an analog circuit (!) or
> a charger IC? If it doesn't matter, no big deal, but if something is
> implicit here, then spell it out please.
In my case the GPIO is provided by a charger chip, that is not
software controllable (just reports charge-done & charger-connected
via GPIOs). I've seen something similar in a customer device some
years ago. I will add a sentence:
The GPIO is often provided by charger ICs, that are not software
controllable.
> > + fuel-gauge {
>
> This techno-lingo/slang term is a bit unfortunate, but if there are
> precedents then stick with it.
>
> The correct term could be something like battery-capacity-meter
> I suppose.
Right now in DT we have
- specific node name (e.g. chip names) that should be changed :)
- smart-battery
- battery
- fuel-gauge
I think fuel-gauge is the most sensible of that list, considering
hardware vendors usually call their chips battery fuel gauge.
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID
From: Sebastian Reichel <sre@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Matti Vaittinen <mazziesaccount@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCHv1 02/11] power: supply: core: auto-exposure of simple-battery data
Date: Sun, 12 Mar 2023 18:07:42 +0100 [thread overview]
Message-ID: <1fdf00a0-4830-465a-801c-147472fdcd22@mercury.local> (raw)
Message-ID: <20230312170742.fUeYZwikMcN8tyVpoGnzl42VW05rz70FCMCnajhHLs0@z> (raw)
In-Reply-To: <CACRpkdZofL-cuYcyNAwMAshoQAr3z7-boJoHftVnjt80YQmAOQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2263 bytes --]
Hi,
On Fri, Mar 10, 2023 at 09:20:09AM +0100, Linus Walleij wrote:
> On Thu, Mar 9, 2023 at 11:50 PM Sebastian Reichel <sre@kernel.org> wrote:
>
> > + /*
> > + * Set if constant battery information from firmware should be
> > + * exposed automatically. No driver specific code is required
> > + * in that case. If the driver also handles a property provided
> > + * by constant firmware data, the driver's handler is preferred.
> > + */
> > + bool expose_battery_info;
>
> Playing it safe with opt-in I see! But I would probably invert it and
> add a hide_battery_info for those that don't wanna expose it. It seems
> pretty useful to just expose this in general.
I just did not yet spend the time to understand if there are any
issues. I guess I can do it now and then remove the opt-in part.
> However I have no insight in what happens on laptops etc for this
> so I guess you have your reasons, either way:
ACPI based systems should be fine, since battery info does not
yet support ACPI and thus nothing changes for them.
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>
> > +extern bool power_supply_battery_info_has_prop(struct power_supply_battery_info *info,
> > + enum power_supply_property psp);
> > +extern int power_supply_battery_info_get_prop(struct power_supply_battery_info *info,
> > + enum power_supply_property psp,
> > + union power_supply_propval *val);
>
> I think the build robots complain because you need to add some stubs
> for the not enabled case.
I don't think so. They are only used from code needing POWER_SUPPLY
being enabled.
One reported error is about the array of battery_info properties not
being used when POWER_SUPPLY is disabled. I will move that array to a
better place.
The other error is about power_supply_get_property(), because I
accidently removed the EXPORT_SYMBOL_GPL(power_supply_get_property).
I did not notice myself, because I compiled a monolithic kernel for
the thermal camera for easy deployment.
Thanks for the review, much appreciated!
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/6] power: supply: rt9455_charger: mark OF related data as maybe unused
Date: Sun, 12 Mar 2023 23:27:32 +0100 [thread overview]
Message-ID: <1fdf00a0-4830-465a-801c-147472fdcd22@mercury.local> (raw)
Message-ID: <20230312222732.4raP72WYZLY3miTdYmltbTDCMnVwH2lXjLvn79658Nw@z> (raw)
In-Reply-To: <20230311111532.251604-1-krzysztof.kozlowski@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 1160 bytes --]
Hi,
Thanks, I queued all 6 patches to power-supply's for-next queue.
-- Sebastian
On Sat, Mar 11, 2023 at 12:15:27PM +0100, Krzysztof Kozlowski wrote:
> The driver can be compile tested with !CONFIG_OF making certain data
> unused:
>
> drivers/power/supply/rt9455_charger.c:1725:34: error: ‘rt9455_of_match’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
> drivers/power/supply/rt9455_charger.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/rt9455_charger.c b/drivers/power/supply/rt9455_charger.c
> index 31fb6526a1fd..0149e00f2bf8 100644
> --- a/drivers/power/supply/rt9455_charger.c
> +++ b/drivers/power/supply/rt9455_charger.c
> @@ -1722,7 +1722,7 @@ static const struct i2c_device_id rt9455_i2c_id_table[] = {
> };
> MODULE_DEVICE_TABLE(i2c, rt9455_i2c_id_table);
>
> -static const struct of_device_id rt9455_of_match[] = {
> +static const struct of_device_id rt9455_of_match[] __maybe_unused = {
> { .compatible = "richtek,rt9455", },
> { },
> };
> --
> 2.34.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Zheng Wang <zyytlz.wz@163.com>
Cc: njavali@marvell.com, mrangankar@marvell.com,
GR-QLogic-Storage-Upstream@marvell.com, jejb@linux.ibm.com,
martin.petersen@oracle.com, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org, hackerzheng666@gmail.com,
1395428693sheep@gmail.com, alex000young@gmail.com
Subject: Re: [PATCH v2] power: supply: da9150: Fix use after free bug in da9150_charger_remove due to race condition
Date: Sun, 12 Mar 2023 23:31:17 +0100 [thread overview]
Message-ID: <1fdf00a0-4830-465a-801c-147472fdcd22@mercury.local> (raw)
Message-ID: <20230312223117.8pAgfb6ESz2m0zUql53vrR_LwXOkoanS1pci6muBVNs@z> (raw)
In-Reply-To: <20230311174650.3979517-1-zyytlz.wz@163.com>
[-- Attachment #1: Type: text/plain, Size: 1938 bytes --]
Hi,
On Sun, Mar 12, 2023 at 01:46:50AM +0800, Zheng Wang wrote:
> In da9150_charger_probe, &charger->otg_work is bound with
> da9150_charger_otg_work. da9150_charger_otg_ncb may be
> called to start the work.
>
> If we remove the module which will call da9150_charger_remove
> to make cleanup, there may be a unfinished work. The possible
> sequence is as follows:
>
> Fix it by canceling the work before cleanup in the da9150_charger_remove
>
> CPU0 CPUc1
>
> |da9150_charger_otg_work
> da9150_charger_remove |
> power_supply_unregister |
> device_unregister |
> power_supply_dev_release|
> kfree(psy) |
> |
> | power_supply_changed(charger->usb);
> | //use
>
> Fixes: c1a281e34dae ("power: Add support for DA9150 Charger")
> Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
> ---
> v2:
> - fix wrong description in commit message and mov cancel_work_sync
> after usb_unregister_notifier suggested by Sebastian Reichel
> ---
Thanks, queued to power-supply's fixes branch. Please make sure you
send your patches to the correct destination next time (linux-scsi
should be linux-pm).
-- Sebastian
> drivers/power/supply/da9150-charger.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/power/supply/da9150-charger.c b/drivers/power/supply/da9150-charger.c
> index 14da5c595dd9..a87aeaea38e1 100644
> --- a/drivers/power/supply/da9150-charger.c
> +++ b/drivers/power/supply/da9150-charger.c
> @@ -657,6 +657,7 @@ static int da9150_charger_remove(struct platform_device *pdev)
>
> if (!IS_ERR_OR_NULL(charger->usb_phy))
> usb_unregister_notifier(charger->usb_phy, &charger->otg_nb);
> + cancel_work_sync(&charger->otg_work);
>
> power_supply_unregister(charger->battery);
> power_supply_unregister(charger->usb);
> --
> 2.25.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID
From: Sebastian Reichel <sre@kernel.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] power: reset: qcom-pon: drop of_match_ptr for ID table
Date: Sun, 12 Mar 2023 23:33:04 +0100 [thread overview]
Message-ID: <1fdf00a0-4830-465a-801c-147472fdcd22@mercury.local> (raw)
Message-ID: <20230312223304.-LiVxaLpc_cYwu8RnvC_dBuzfRBKlpB3fiREy3zVjwc@z> (raw)
In-Reply-To: <20230310200652.19926-1-krzysztof.kozlowski@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]
Hi,
On Fri, Mar 10, 2023 at 09:06:52PM +0100, Krzysztof Kozlowski wrote:
> The Qualcomm SoC power-on driver is specific to ARCH_QCOM which depends
> on OF thus the driver is OF-only. It's of_device_id table is built
> unconditionally, thus of_match_ptr() for ID table does not make sense.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
Thanks, queued to power-supply's for next branch.
-- Sebastian
> drivers/power/reset/qcom-pon.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c
> index 16bc01738be9..ebdcfb28c4a0 100644
> --- a/drivers/power/reset/qcom-pon.c
> +++ b/drivers/power/reset/qcom-pon.c
> @@ -91,7 +91,7 @@ static struct platform_driver pm8916_pon_driver = {
> .probe = pm8916_pon_probe,
> .driver = {
> .name = "pm8916-pon",
> - .of_match_table = of_match_ptr(pm8916_pon_id_table),
> + .of_match_table = pm8916_pon_id_table,
> },
> };
> module_platform_driver(pm8916_pon_driver);
> --
> 2.34.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Rob Herring <robh@kernel.org>
Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] power: supply: charger-manager: Use of_property_read_bool() for boolean properties
Date: Sun, 12 Mar 2023 23:36:09 +0100 [thread overview]
Message-ID: <1fdf00a0-4830-465a-801c-147472fdcd22@mercury.local> (raw)
Message-ID: <20230312223609.hELI-2zRLorgsRkJTniUWaiVApQG3trlKr37HvqGWio@z> (raw)
In-Reply-To: <20230310144735.1546888-1-robh@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 1319 bytes --]
Hi,
On Fri, Mar 10, 2023 at 08:47:35AM -0600, Rob Herring wrote:
> It is preferred to use typed property access functions (i.e.
> of_property_read_<type> functions) rather than low-level
> of_get_property/of_find_property functions for reading properties.
> Convert reading boolean properties to to of_property_read_bool().
>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
Thanks, queued.
-- Sebastian
> drivers/power/supply/charger-manager.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c
> index c9e8450c646f..5fa6ba7f41e1 100644
> --- a/drivers/power/supply/charger-manager.c
> +++ b/drivers/power/supply/charger-manager.c
> @@ -1331,7 +1331,7 @@ static struct charger_desc *of_cm_parse_desc(struct device *dev)
> of_property_read_string(np, "cm-thermal-zone", &desc->thermal_zone);
>
> of_property_read_u32(np, "cm-battery-cold", &desc->temp_min);
> - if (of_get_property(np, "cm-battery-cold-in-minus", NULL))
> + if (of_property_read_bool(np, "cm-battery-cold-in-minus"))
> desc->temp_min *= -1;
> of_property_read_u32(np, "cm-battery-hot", &desc->temp_max);
> of_property_read_u32(np, "cm-battery-temp-diff", &desc->temp_diff);
> --
> 2.39.2
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Bjorn Andersson <bjorn.andersson@linaro.org>,
Bjorn Andersson <andersson@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
linux-pm@vger.kernel.org
Subject: Re: drivers/power/supply/qcom_battmgr.c:357:31: sparse: sparse: incorrect type in initializer (different base types)
Date: Sun, 12 Mar 2023 23:46:41 +0100 [thread overview]
Message-ID: <1fdf00a0-4830-465a-801c-147472fdcd22@mercury.local> (raw)
Message-ID: <20230312224641.3WbzBbWetIFiN84PACfDGceXqfqzrPekIe6x9BQK3Xo@z> (raw)
In-Reply-To: <202303110050.1EF6YVC5-lkp@intel.com>
[-- Attachment #1: Type: text/plain, Size: 2350 bytes --]
Hi Bjorn,
Can you please send a follow up patch for the sparse warnings in
qcom_battmgr [0]? It looks like there are two issues:
1. qcom_battmgr_update_request.battery_id is u32 instead of __le32
2. qcom_battmgr_enable_worker is missing cpu_to_le32() when building
struct qcom_battmgr_enable_request
[0] https://lore.kernel.org/all/202303110050.1EF6YVC5-lkp@intel.com/
> sparse warnings: (new ones prefixed by >>)
> >> drivers/power/supply/qcom_battmgr.c:357:31: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int [usertype] battery_id @@ got restricted __le32 [usertype] @@
> drivers/power/supply/qcom_battmgr.c:357:31: sparse: expected unsigned int [usertype] battery_id
> drivers/power/supply/qcom_battmgr.c:357:31: sparse: got restricted __le32 [usertype]
> drivers/power/supply/qcom_battmgr.c:369:31: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int [usertype] battery_id @@ got restricted __le32 [usertype] @@
> drivers/power/supply/qcom_battmgr.c:369:31: sparse: expected unsigned int [usertype] battery_id
> drivers/power/supply/qcom_battmgr.c:369:31: sparse: got restricted __le32 [usertype]
> >> drivers/power/supply/qcom_battmgr.c:1285:30: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __le32 [usertype] owner @@ got int @@
> drivers/power/supply/qcom_battmgr.c:1285:30: sparse: expected restricted __le32 [usertype] owner
> drivers/power/supply/qcom_battmgr.c:1285:30: sparse: got int
> >> drivers/power/supply/qcom_battmgr.c:1286:29: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __le32 [usertype] type @@ got int @@
> drivers/power/supply/qcom_battmgr.c:1286:29: sparse: expected restricted __le32 [usertype] type
> drivers/power/supply/qcom_battmgr.c:1286:29: sparse: got int
> >> drivers/power/supply/qcom_battmgr.c:1287:31: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __le32 [usertype] opcode @@ got int @@
> drivers/power/supply/qcom_battmgr.c:1287:31: sparse: expected restricted __le32 [usertype] opcode
> drivers/power/supply/qcom_battmgr.c:1287:31: sparse: got int
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Hermes Zhang <chenhuiz@axis.com>
Cc: kernel@axis.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] power: supply: bq256xx: Support to disable charger
Date: Sun, 12 Mar 2023 23:50:13 +0100 [thread overview]
Message-ID: <1fdf00a0-4830-465a-801c-147472fdcd22@mercury.local> (raw)
Message-ID: <20230312225013.jE9ZCgXGESu6_6YAsZ4DtvdgdgYU6WUVspvNwES70dQ@z> (raw)
In-Reply-To: <20230309064104.79005-1-chenhuiz@axis.com>
[-- Attachment #1: Type: text/plain, Size: 6458 bytes --]
Hi,
On Thu, Mar 09, 2023 at 02:41:03PM +0800, Hermes Zhang wrote:
> To be able to control the charging process flexible, we need to able to
> disable the charger. This commit will allow to disable the charger by
> "echo 1 > /sys/class/power_supply/bq256xx-charger/charge_type"
> (1 = POWER_SUPPLY_CHARGE_TYPE_NONE) and enable the charger by set it to
> 2/3 (POWER_SUPPLY_CHARGE_TYPE_TRICKLE/POWER_SUPPLY_CHARGE_TYPE_FAST)
>
> Signed-off-by: Hermes Zhang <chenhuiz@axis.com>
> ---
Thanks, queued.
-- Sebastian
> drivers/power/supply/bq256xx_charger.c | 40 ++++++++++++++++++++++++++
> 1 file changed, 40 insertions(+)
>
> diff --git a/drivers/power/supply/bq256xx_charger.c b/drivers/power/supply/bq256xx_charger.c
> index 9cf4936440c9..e624834ae66c 100644
> --- a/drivers/power/supply/bq256xx_charger.c
> +++ b/drivers/power/supply/bq256xx_charger.c
> @@ -70,6 +70,9 @@
> #define BQ25611D_VBATREG_THRESH_uV 4290000
> #define BQ25618_VBATREG_THRESH_uV 4300000
>
> +#define BQ256XX_CHG_CONFIG_MASK BIT(4)
> +#define BQ256XX_CHG_CONFIG_BIT_SHIFT 4
> +
> #define BQ256XX_ITERM_MASK GENMASK(3, 0)
> #define BQ256XX_ITERM_STEP_uA 60000
> #define BQ256XX_ITERM_OFFSET_uA 60000
> @@ -259,6 +262,7 @@ struct bq256xx_device {
> * @bq256xx_set_iterm: pointer to instance specific set_iterm function
> * @bq256xx_set_iprechg: pointer to instance specific set_iprechg function
> * @bq256xx_set_vindpm: pointer to instance specific set_vindpm function
> + * @bq256xx_set_charge_type: pointer to instance specific set_charge_type function
> *
> * @bq256xx_def_ichg: default ichg value in microamps
> * @bq256xx_def_iindpm: default iindpm value in microamps
> @@ -290,6 +294,7 @@ struct bq256xx_chip_info {
> int (*bq256xx_set_iterm)(struct bq256xx_device *bq, int iterm);
> int (*bq256xx_set_iprechg)(struct bq256xx_device *bq, int iprechg);
> int (*bq256xx_set_vindpm)(struct bq256xx_device *bq, int vindpm);
> + int (*bq256xx_set_charge_type)(struct bq256xx_device *bq, int type);
>
> int bq256xx_def_ichg;
> int bq256xx_def_iindpm;
> @@ -449,6 +454,27 @@ static int bq256xx_get_state(struct bq256xx_device *bq,
> return 0;
> }
>
> +static int bq256xx_set_charge_type(struct bq256xx_device *bq, int type)
> +{
> + int chg_config = 0;
> +
> + switch (type) {
> + case POWER_SUPPLY_CHARGE_TYPE_NONE:
> + chg_config = 0x0;
> + break;
> + case POWER_SUPPLY_CHARGE_TYPE_TRICKLE:
> + case POWER_SUPPLY_CHARGE_TYPE_FAST:
> + chg_config = 0x1;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + return regmap_update_bits(bq->regmap, BQ256XX_CHARGER_CONTROL_0,
> + BQ256XX_CHG_CONFIG_MASK,
> + (chg_config ? 1 : 0) << BQ256XX_CHG_CONFIG_BIT_SHIFT);
> +}
> +
> static int bq256xx_get_ichg_curr(struct bq256xx_device *bq)
> {
> unsigned int charge_current_limit;
> @@ -915,6 +941,12 @@ static int bq256xx_set_charger_property(struct power_supply *psy,
> return ret;
> break;
>
> + case POWER_SUPPLY_PROP_CHARGE_TYPE:
> + ret = bq->chip_info->bq256xx_set_charge_type(bq, val->intval);
> + if (ret)
> + return ret;
> + break;
> +
> default:
> break;
> }
> @@ -1197,6 +1229,7 @@ static int bq256xx_property_is_writeable(struct power_supply *psy,
> case POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT:
> case POWER_SUPPLY_PROP_STATUS:
> case POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT:
> + case POWER_SUPPLY_PROP_CHARGE_TYPE:
> return true;
> default:
> return false;
> @@ -1286,6 +1319,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = {
> .bq256xx_set_iterm = bq256xx_set_term_curr,
> .bq256xx_set_iprechg = bq256xx_set_prechrg_curr,
> .bq256xx_set_vindpm = bq256xx_set_input_volt_lim,
> + .bq256xx_set_charge_type = bq256xx_set_charge_type,
>
> .bq256xx_def_ichg = BQ2560X_ICHG_DEF_uA,
> .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
> @@ -1316,6 +1350,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = {
> .bq256xx_set_iterm = bq256xx_set_term_curr,
> .bq256xx_set_iprechg = bq256xx_set_prechrg_curr,
> .bq256xx_set_vindpm = bq256xx_set_input_volt_lim,
> + .bq256xx_set_charge_type = bq256xx_set_charge_type,
>
> .bq256xx_def_ichg = BQ2560X_ICHG_DEF_uA,
> .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
> @@ -1346,6 +1381,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = {
> .bq256xx_set_iterm = bq256xx_set_term_curr,
> .bq256xx_set_iprechg = bq256xx_set_prechrg_curr,
> .bq256xx_set_vindpm = bq256xx_set_input_volt_lim,
> + .bq256xx_set_charge_type = bq256xx_set_charge_type,
>
> .bq256xx_def_ichg = BQ2560X_ICHG_DEF_uA,
> .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
> @@ -1376,6 +1412,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = {
> .bq256xx_set_iterm = bq256xx_set_term_curr,
> .bq256xx_set_iprechg = bq256xx_set_prechrg_curr,
> .bq256xx_set_vindpm = bq256xx_set_input_volt_lim,
> + .bq256xx_set_charge_type = bq256xx_set_charge_type,
>
> .bq256xx_def_ichg = BQ2560X_ICHG_DEF_uA,
> .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
> @@ -1406,6 +1443,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = {
> .bq256xx_set_iterm = bq256xx_set_term_curr,
> .bq256xx_set_iprechg = bq256xx_set_prechrg_curr,
> .bq256xx_set_vindpm = bq256xx_set_input_volt_lim,
> + .bq256xx_set_charge_type = bq256xx_set_charge_type,
>
> .bq256xx_def_ichg = BQ25611D_ICHG_DEF_uA,
> .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
> @@ -1436,6 +1474,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = {
> .bq256xx_set_iterm = bq25618_619_set_term_curr,
> .bq256xx_set_iprechg = bq25618_619_set_prechrg_curr,
> .bq256xx_set_vindpm = bq256xx_set_input_volt_lim,
> + .bq256xx_set_charge_type = bq256xx_set_charge_type,
>
> .bq256xx_def_ichg = BQ25618_ICHG_DEF_uA,
> .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
> @@ -1466,6 +1505,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = {
> .bq256xx_set_iterm = bq25618_619_set_term_curr,
> .bq256xx_set_iprechg = bq25618_619_set_prechrg_curr,
> .bq256xx_set_vindpm = bq256xx_set_input_volt_lim,
> + .bq256xx_set_charge_type = bq256xx_set_charge_type,
>
> .bq256xx_def_ichg = BQ25618_ICHG_DEF_uA,
> .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
> --
> 2.30.2
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID
From: Sebastian Reichel <sre@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Matti Vaittinen <mazziesaccount@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCHv1 04/11] power: supply: generic-adc-battery: fix unit scaling
Date: Tue, 14 Mar 2023 00:17:19 +0100 [thread overview]
Message-ID: <1fdf00a0-4830-465a-801c-147472fdcd22@mercury.local> (raw)
Message-ID: <20230313231719.0PnUNByjU_RIQ_mlLHgAvtB396axPCZSxCBDnAWkpj0@z> (raw)
In-Reply-To: <CACRpkdaa6ZOt7U+iLwjrTGx87BdgXX6wbW2Ab_bHye_TNzi9Tg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 730 bytes --]
Hi,
On Fri, Mar 10, 2023 at 09:23:06AM +0100, Linus Walleij wrote:
> On Thu, Mar 9, 2023 at 11:50 PM Sebastian Reichel <sre@kernel.org> wrote:
>
> > power-supply properties are reported in µV, µA and µW.
> > The IIO API provides mV, mA, mW, so the values need to
> > be multiplied by 1000.
> >
> > Signed-off-by: Sebastian Reichel <sre@kernel.org>
>
> Fixes: tag?
> Cc: stable@vger.kernel.org
>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>
> This code can not have seen much testing.
There is no mainline board using this driver and I think there
never was one. I did add a Fixes tag now, but its probably not worth
any backporting trouble considering it has no users.
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-03-11 17:54 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-09 22:50 [PATCHv1 00/11] Add DT support for generic ADC battery Sebastian Reichel
2023-03-09 22:50 ` [PATCHv1 01/11] dt-bindings: power: supply: adc-battery: add binding Sebastian Reichel
2023-03-10 8:14 ` Linus Walleij
2023-03-11 17:54 ` Sebastian Reichel [this message]
2023-03-12 17:07 ` [PATCHv1 02/11] power: supply: core: auto-exposure of simple-battery data Sebastian Reichel
2023-03-12 22:27 ` [PATCH 1/6] power: supply: rt9455_charger: mark OF related data as maybe unused Sebastian Reichel
2023-03-12 22:31 ` [PATCH v2] power: supply: da9150: Fix use after free bug in da9150_charger_remove due to race condition Sebastian Reichel
2023-03-12 22:33 ` [PATCH] power: reset: qcom-pon: drop of_match_ptr for ID table Sebastian Reichel
2023-03-12 22:36 ` [PATCH] power: supply: charger-manager: Use of_property_read_bool() for boolean properties Sebastian Reichel
2023-03-12 22:46 ` drivers/power/supply/qcom_battmgr.c:357:31: sparse: sparse: incorrect type in initializer (different base types) Sebastian Reichel
2023-03-12 22:50 ` [PATCH] power: supply: bq256xx: Support to disable charger Sebastian Reichel
2023-03-13 2:50 ` [PATCH v2] power: supply: da9150: Fix use after free bug in da9150_charger_remove due to race condition Zheng Hacker
2023-03-13 23:17 ` [PATCHv1 04/11] power: supply: generic-adc-battery: fix unit scaling Sebastian Reichel
2023-03-14 8:14 ` Linus Walleij
2023-03-12 11:29 ` [PATCHv1 01/11] dt-bindings: power: supply: adc-battery: add binding Krzysztof Kozlowski
2023-03-13 6:13 ` Matti Vaittinen
2023-03-09 22:50 ` [PATCHv1 02/11] power: supply: core: auto-exposure of simple-battery data Sebastian Reichel
2023-03-10 1:36 ` kernel test robot
2023-03-10 5:10 ` kernel test robot
2023-03-10 8:20 ` Linus Walleij
2023-03-13 6:45 ` Matti Vaittinen
2023-03-09 22:50 ` [PATCHv1 03/11] power: supply: generic-adc-battery: convert to managed resources Sebastian Reichel
2023-03-10 8:21 ` Linus Walleij
2023-03-13 7:14 ` Matti Vaittinen
2023-03-09 22:50 ` [PATCHv1 04/11] power: supply: generic-adc-battery: fix unit scaling Sebastian Reichel
2023-03-10 8:23 ` Linus Walleij
2023-03-13 7:52 ` Matti Vaittinen
2023-03-09 22:50 ` [PATCHv1 05/11] power: supply: generic-adc-battery: drop jitter delay support Sebastian Reichel
2023-03-10 8:24 ` Linus Walleij
2023-03-09 22:50 ` [PATCHv1 06/11] power: supply: generic-adc-battery: drop charge now support Sebastian Reichel
2023-03-10 8:29 ` Linus Walleij
2023-03-13 7:49 ` Matti Vaittinen
2023-03-13 8:33 ` Linus Walleij
2023-03-09 22:50 ` [PATCHv1 07/11] power: supply: generic-adc-battery: drop memory alloc error message Sebastian Reichel
2023-03-10 8:29 ` Linus Walleij
2023-03-13 7:50 ` Matti Vaittinen
2023-03-09 22:50 ` [PATCHv1 08/11] power: supply: generic-adc-battery: use simple-battery API Sebastian Reichel
2023-03-10 8:30 ` Linus Walleij
2023-03-09 22:50 ` [PATCHv1 09/11] power: supply: generic-adc-battery: simplify read_channel logic Sebastian Reichel
2023-03-10 8:31 ` Linus Walleij
2023-03-13 8:19 ` Matti Vaittinen
2023-03-09 22:50 ` [PATCHv1 10/11] power: supply: generic-adc-battery: add DT support Sebastian Reichel
2023-03-10 8:32 ` Linus Walleij
2023-03-13 8:22 ` Matti Vaittinen
2023-03-09 22:50 ` [PATCHv1 11/11] power: supply: generic-adc-battery: update copyright info Sebastian Reichel
2023-03-10 8:33 ` Linus Walleij
2023-03-13 8:25 ` Matti Vaittinen
-- strict thread matches above, loose matches on Subject: below --
2023-03-11 17:46 [PATCH v2] power: supply: da9150: Fix use after free bug in da9150_charger_remove due to race condition Zheng Wang
2023-03-11 11:15 [PATCH 1/6] power: supply: rt9455_charger: mark OF related data as maybe unused Krzysztof Kozlowski
2023-03-11 11:15 ` [PATCH 2/6] power: supply: twl4030_charger: " Krzysztof Kozlowski
2023-03-11 11:15 ` [PATCH 3/6] power: supply: lp8727_charger: " Krzysztof Kozlowski
2023-03-11 11:15 ` [PATCH 4/6] power: supply: ltc4162-l-charger: " Krzysztof Kozlowski
2023-03-11 11:15 ` [PATCH 5/6] power: supply: bq24257_charger: " Krzysztof Kozlowski
2023-03-11 11:15 ` [PATCH 6/6] power: supply: bq25890_charger: " Krzysztof Kozlowski
2023-03-10 20:06 [PATCH] power: reset: qcom-pon: drop of_match_ptr for ID table Krzysztof Kozlowski
2023-03-10 20:10 ` Konrad Dybcio
2023-03-10 20:48 ` Marijn Suijten
2023-03-10 20:54 ` Krzysztof Kozlowski
2023-03-10 17:04 drivers/power/supply/qcom_battmgr.c:357:31: sparse: sparse: incorrect type in initializer (different base types) kernel test robot
2023-03-10 14:47 [PATCH] power: supply: charger-manager: Use of_property_read_bool() for boolean properties Rob Herring
2023-03-09 6:41 [PATCH] power: supply: bq256xx: Support to disable charger Hermes Zhang
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=1fdf00a0-4830-465a-801c-147472fdcd22@mercury.local \
--to=sre@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mazziesaccount@gmail.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: 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®