Re: [PATCH] power: supply: bq27xxx: Return the value instead of -ENODATA

2021-03-31 Thread Hermes Zhang
On 3/31/21 10:02 PM, Pali Rohár wrote: > @@ -1655,9 +1655,6 @@ static int bq27xxx_battery_read_time(struct > bq27xxx_device_info *di, u8 reg) > return tval; > } > > - if (tval == 65535) > - return -ENODATA; > - > return tval * 60; > I'm not sure if this

[PATCH] power: supply: bq27xxx: Return the value instead of -ENODATA

2021-03-31 Thread Hermes Zhang
From: Hermes Zhang It might be better to return value (e.g. 65535) instead of an error (e.g. No data available) for the time property. Normally a common function will handle the read string and parse to integer for all the properties, but will have problem when read the time property because

Re: [PATCH v2 1/2] dt-binding: leds: Document leds-multi-gpio bindings

2021-03-29 Thread Hermes Zhang
On 3/28/21 2:12 AM, Rob Herring wrote: >> + >> + led-gpios: >> +description: Array of one or more GPIOs pins used to control the LED. >> +minItems: 1 >> +maxItems: 8 # Should be enough >> + >> + led-states: >> +description: | >> + The array list the supported states here

Re: [PATCH v2 2/2] leds: leds-multi-gpio: Add multiple GPIOs LED driver

2021-03-29 Thread Hermes Zhang
On 3/26/21 9:49 PM, Pavel Machek wrote: >> +of_property_read_string(node, "default-state", ); >> +if (!strcmp(state, "on")) >> +multi_gpio_led_set(>cdev, priv->cdev.max_brightness); >> +else >> +multi_gpio_led_set(>cdev, 0); > No need for default-state handling,

[PATCH v3] leds: leds-multi-gpio: Add multiple GPIOs LED driver

2021-03-29 Thread Hermes Zhang
From: Hermes Zhang Introduce a new multiple GPIOs LED driver. This LED will made of multiple GPIOs (up to 8) and will map different brightness to different GPIOs states which defined in dts file. Signed-off-by: Hermes Zhang --- Notes: changes v3: - Remove LEDS_SIMPLE menu - Minro

Re: [PATCH v2 2/2] leds: leds-multi-gpio: Add multiple GPIOs LED driver

2021-03-26 Thread Hermes Zhang
On 3/26/21 1:56 PM, Alexander Dahl wrote: >> + >> +module_platform_driver(multi_gpio_led_driver); >> + >> +MODULE_AUTHOR("Hermes Zhang "); >> +MODULE_DESCRIPTION("Multiple GPIOs LED driver"); >> +MODULE_LICENSE("GPL v2"); >> +

[PATCH v2 2/2] leds: leds-multi-gpio: Add multiple GPIOs LED driver

2021-03-25 Thread Hermes Zhang
From: Hermes Zhang Introduce a new multiple GPIOs LED driver. This LED will made of multiple GPIOs (up to 8) and will map different brightness to different GPIOs states which defined in dts file. Signed-off-by: Hermes Zhang --- drivers/leds/Kconfig | 3 + drivers/leds

[PATCH v2 1/2] dt-binding: leds: Document leds-multi-gpio bindings

2021-03-25 Thread Hermes Zhang
From: Hermes Zhang This binding represents LED devices which are controller with multiple GPIO lines in order to achieve more than two brightness states. Signed-off-by: Hermes Zhang --- .../bindings/leds/leds-multi-gpio.yaml| 50 +++ 1 file changed, 50 insertions

[PATCH v2 0/2] New multiple GPIOs LED driver

2021-03-25 Thread Hermes Zhang
From: Hermes Zhang changes v2: - use max_brightness(=2^gpio number) instead of LED_FULL - alloc priv at once - move driver code to new simple folder - update commit message for dt-binding commit - move dt-binding commit before driver code Hermes Zhang (2): dt-binding: leds: Document leds

Re: [PATCH 1/2] leds: leds-multi-gpio: Add multiple GPIOs LED driver

2021-03-25 Thread Hermes Zhang
Hi Marek, On 3/24/21 5:34 PM, Marek Behun wrote: >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include > Why do you include slab.h? Yeah, I will clean it in next commit. >> + >> + >> +static void

[PATCH 2/2] dt-binding: leds: Document leds-multi-gpio bindings

2021-03-24 Thread Hermes Zhang
From: Hermes Zhang Document the device tree bindings of the multiple GPIOs LED driver Documentation/devicetree/bindings/leds/leds-multi-gpio.yaml. Signed-off-by: Hermes Zhang --- .../bindings/leds/leds-multi-gpio.yaml| 50 +++ 1 file changed, 50 insertions(+) create

[PATCH 1/2] leds: leds-multi-gpio: Add multiple GPIOs LED driver

2021-03-24 Thread Hermes Zhang
From: Hermes Zhang Introduce a new multiple GPIOs LED driver. This LED will made of multiple GPIOs (up to 8) and will map different brightness to different GPIOs states which defined in dts file. Signed-off-by: Hermes Zhang --- drivers/leds/Kconfig | 12 +++ drivers/leds/Makefile

[PATCH 0/2] New multiple GPIOs LED driver

2021-03-24 Thread Hermes Zhang
From: Hermes Zhang *** BLURB HERE *** New multiple GPIOs LED driver Hermes Zhang (2): leds: leds-multi-gpio: Add multiple GPIOs LED driver dt-binding: leds: Document leds-multi-gpio bindings .../bindings/leds/leds-multi-gpio.yaml| 50 +++ drivers/leds/Kconfig

RE: [PATCH v3] dt-binding: leds: Document leds-multi-gpio bindings

2021-03-24 Thread Hermes Zhang
> > > > Notes: > > Add maxItems > > What about the other part of the series? I think you should send both > patches together with an introduction message on both. If you only change > one patch for a new version spin of the series, just send the other one > unchanged. > > (It makes no sense

RE: [PATCH v2] dt-binding: leds: Document leds-multi-gpio bindings

2021-03-23 Thread Hermes Zhang
> > > > Hi Rob, > > > > Thanks. Yes, now I can see the warning, but I could not understand what > was wrong? Could you give some hint? > > I think you need 'maxItems' in addition to minItems. Exactly! Thanks for the suggestion. Best Regards, Hermes

[PATCH v3] dt-binding: leds: Document leds-multi-gpio bindings

2021-03-23 Thread Hermes Zhang
From: Hermes Zhang Document the device tree bindings of the multiple GPIOs LED driver Documentation/devicetree/bindings/leds/leds-multi-gpio.yaml. Signed-off-by: Hermes Zhang --- Notes: Add maxItems .../bindings/leds/leds-multi-gpio.yaml| 50 +++ 1 file changed

RE: [PATCH v2] dt-binding: leds: Document leds-multi-gpio bindings

2021-03-22 Thread Hermes Zhang
> -Original Message- > From: Rob Herring > Sent: 2021年3月23日 1:38 > My bot found errors running 'make dt_binding_check' on your patch: > > yamllint warnings/errors: > > dtschema/dtc warnings/errors: > /builds/robherring/linux-dt- >

[PATCH v2] dt-binding: leds: Document leds-multi-gpio bindings

2021-03-22 Thread Hermes Zhang
From: Hermes Zhang Document the device tree bindings of the multiple GPIOs LED driver Documentation/devicetree/bindings/leds/leds-multi-gpio.yaml. Signed-off-by: Hermes Zhang --- Notes: Fix typo and missing item .../bindings/leds/leds-multi-gpio.yaml| 49 +++ 1

[PATCH] dt-binding: leds: Document leds-multi-gpio bindings

2021-03-22 Thread Hermes Zhang
From: Hermes Zhang Document the device tree bindings of the multiple GPIOs LED driver Documentation/devicetree/bindings/leds/leds-multi-gpio.yaml. Signed-off-by: Hermes Zhang --- .../bindings/leds/leds-multi-gpio.yaml| 47 +++ 1 file changed, 47 insertions(+) create

[PATCH] leds: leds-multi-gpio: Add multiple GPIOs LED driver

2021-03-22 Thread Hermes Zhang
From: Hermes Zhang Introduce a new multiple GPIOs LED driver. This LED will made of multiple GPIOs (up to 8) and will map different brightness to different GPIOs states which defined in dts file. Signed-off-by: Hermes Zhang --- drivers/leds/Kconfig | 12 +++ drivers/leds/Makefile

RE: [PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver

2021-03-17 Thread Hermes Zhang
> > + priv = devm_kzalloc(dev, sizeof(struct gpio_dual_leds_priv), > GFP_KERNEL); > > + if (!priv) > > + return -ENOMEM; > > + > > + priv->low_gpio = devm_gpiod_get(dev, "low", GPIOD_OUT_LOW); > > + ret = PTR_ERR_OR_ZERO(priv->low_gpio); > > + if (ret) { > > +

RE: [PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver

2021-03-12 Thread Hermes Zhang
Hi Alexander, > Am Donnerstag, 11. März 2021, 14:04:08 CET schrieb Hermes Zhang: > > From: Hermes Zhang > > > > Introduce a new Dual GPIO LED driver. These two GPIOs LED will act as > > one LED as normal GPIO LED but give the possibility to change the > > i

RE: [PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver

2021-03-11 Thread Hermes Zhang
> > Sorry, leds-regulator has only a binary state LED. > > Maybe you could extend leds-regulator to be able to use all regulator states? > > Or you can extend leds-gpio driver to support N states via log N gpios, > instead of adding new driver. It seems a good idea to extend leds-gpio, so in

[PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver

2021-03-11 Thread Hermes Zhang
From: Hermes Zhang Introduce a new Dual GPIO LED driver. These two GPIOs LED will act as one LED as normal GPIO LED but give the possibility to change the intensity in four levels: OFF, LOW, MIDDLE and HIGH. --- drivers/leds/Kconfig | 9 +++ drivers/leds/Makefile | 1

Re: [PATCH v2] power: supply: bq27xxx: Supporrt CHARGE_NOW for bq27z561/bq28z610/bq34z100

2020-12-22 Thread Hermes Zhang
On 12/22/20 7:53 PM, Pali Rohár wrote: > On Tuesday 22 December 2020 19:07:20 Hermes Zhang wrote: >> From: Hermes Zhang >> >> The CHARGE_NOW is map to REG_NAC for all the gauge chips beofre. But for >> some chips (e.g. bq27z561) which doesn't have the REG_NAC, we use RE

[PATCH v2] power: supply: bq27xxx: Supporrt CHARGE_NOW for bq27z561/bq28z610/bq34z100

2020-12-22 Thread Hermes Zhang
From: Hermes Zhang The CHARGE_NOW is map to REG_NAC for all the gauge chips beofre. But for some chips (e.g. bq27z561) which doesn't have the REG_NAC, we use REG_RC (remaining capacity) for CHARGE_NOW. Signed-off-by: Hermes Zhang --- Notes: Set correct REG_RC for all the chips if have

Re: [PATCH] power: supply: bq27xxx: Supporrt CHARGE_NOW for bq27z561/bq28z610/bq34z100

2020-12-21 Thread Hermes Zhang
On 12/18/20 5:42 PM, Pali Rohár wrote: > On Thursday 17 December 2020 12:03:24 Hermes Zhang wrote: >> Hi Pali, >> >> From the TI spec (e.g. >> https://www.ti.com/lit/ug/tidu077/tidu077.pdf?ts=1608206347022_url=https%253A%252F%252Fwww.google.com%252F) >> ,

RE: [PATCH] power: supply: bq27xxx: Supporrt CHARGE_NOW for bq27z561/bq28z610/bq34z100

2020-12-17 Thread Hermes Zhang
Regards, Hermes -Original Message- From: Pali Rohár Sent: 2020年12月17日 19:57 To: Hermes Zhang Cc: Dan Murphy ; Sebastian Reichel ; kernel ; Hermes Zhang ; linux...@vger.kernel.org; linux-kernel@vger.kernel.org Subject: Re: [PATCH] power: supply: bq27xxx: Supporrt CHARGE_NOW for bq27z561

[PATCH] power: supply: bq27xxx: Supporrt CHARGE_NOW for bq27z561/bq28z610/bq34z100

2020-12-17 Thread Hermes Zhang
From: Hermes Zhang The CHARGE_NOW is map to REG_NAC for all the gauge chips beofre. But for some chips (e.g. bq27z561) which doesn't have the REG_NAC, we use REG_RC (remaining capacity) for CHARGE_NOW. Signed-off-by: Hermes Zhang --- drivers/power/supply/bq27xxx_battery.c | 35