mbox series

[v2,0/4] Google Pixel 6 (oriole): max77759 fuel gauge enablement and driver support

Message ID 20250102-b4-gs101_max77759_fg-v2-0-87959abeb7ff@uclouvain.be
Headers show
Series Google Pixel 6 (oriole): max77759 fuel gauge enablement and driver support | expand

Message

Thomas Antoine via B4 Relay Jan. 2, 2025, 11:15 a.m. UTC
The Google Pixel 6 has a Maxim max77759 which provides a fuel gauge with
an interface with a lot in common with the Maxim max1720x.

Modify the Maxim max1720x driver to be compatible with the Maxim max77759 and
enable it for the gs101-oriole board.

Signed-off-by: Thomas Antoine <t.antoine@uclouvain.be>
---
Changes in v2:
- Add fallback for voltage measurement (André Draszik)
- Add regmap for the max77759 (André Draszik)
- Add chip identification for the max77759 (André Draszik, Peter Griffin)
- Move RSense value to a devicetree property shunt-resistor-micro-ohms
  (Dimitri Fedrau, André Draszik)
- Use allOf:if to narrow binding per variant (Krzysztof Kozlowski)
- Remove binding example (Krzysztof Kozlowski)
- Change defconfig order to follow savedefconfig (Krzysztof Kozlowski)
- Fix style errors
- Link to v1: https://lore.kernel.org/r/20241202-b4-gs101_max77759_fg-v1-0-98d2fa7bfe30@uclouvain.be

---
Thomas Antoine (4):
      power: supply: add support for max77759 fuel gauge
      dt-bindings: power: supply: add max77759-fg flavor
      arm64: defconfig: enable Maxim max1720x driver
      arm64: dts: exynos: gs101-oriole: enable Maxim max77759 fuel gauge

 .../bindings/power/supply/maxim,max17201.yaml      |  56 ++++--
 arch/arm64/boot/dts/exynos/google/gs101-oriole.dts |  10 ++
 arch/arm64/configs/defconfig                       |   1 +
 drivers/power/supply/max1720x_battery.c            | 189 ++++++++++++++++++---
 4 files changed, 218 insertions(+), 38 deletions(-)
---
base-commit: 12e0a4072e8edc49c99418a4303bd7b96916de95
change-id: 20241202-b4-gs101_max77759_fg-402e231a4b33

Best regards,

Comments

Thomas Antoine Jan. 3, 2025, 4:16 p.m. UTC | #1
On 1/2/25 17:08, Krzysztof Kozlowski wrote:
> On 02/01/2025 12:15, Thomas Antoine via B4 Relay wrote:
>> From: Thomas Antoine <t.antoine@uclouvain.be>
>>
>> The max77759 is an IC used to manage the power supply of the battery and
> 
> Still not the name I asked to use.

Indeed, I missed that, I will fix this.

[...]
  
>> -allOf:
>> -  - $ref: power-supply.yaml#
>> -
>>  properties:
>>    compatible:
>>      oneOf:
>>        - const: maxim,max17201
>> +      - const: maxim,max77759-fg
>>        - items:
>>            - enum:
>>                - maxim,max17205
>>            - const: maxim,max17201
>>  
>> -  reg:
>> -    items:
>> -      - description: ModelGauge m5 registers
>> -      - description: Nonvolatile registers
> 
> Widest constraints always stay here.
> 
> See:
> https://elixir.bootlin.com/linux/v6.11-rc6/source/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml#L127
> 
> I did not say to remove it. I asked you to add allOf section restricting it.

Thanks for the example. I think I understand now. I will put the reg section
back and use min/maxItems in the allOf:if: to set the number of reg/reg-names
to 1 for the MAX77759.

Do I keep shunt-resistor-micro-ohms as I did it here? I could move it in
properties: and only make it required by the max77759 in the allOf:if:. However, 
I think this would make it seem as if the MAX17201 optionally accepts it when
it would do nothing in practice so I'm not sure what is the best choice.

>> -
>> -  reg-names:
>> -    items:
>> -      - const: m5
>> -      - const: nvmem
>> -
>>    interrupts:
>>      maxItems: 1
>>  
>> +allOf:
> 
> This goes after required: block. See example-schema.
> 
>> +  - $ref: power-supply.yaml#
>> +  - if:
> Best regards,
> Krzysztof

Will fix.

Best regards,
Thomas
Krzysztof Kozlowski Jan. 4, 2025, 9:23 a.m. UTC | #2
On 03/01/2025 17:16, Thomas Antoine wrote:
>>> -  reg:
>>> -    items:
>>> -      - description: ModelGauge m5 registers
>>> -      - description: Nonvolatile registers
>>
>> Widest constraints always stay here.
>>
>> See:
>> https://elixir.bootlin.com/linux/v6.11-rc6/source/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml#L127
>>
>> I did not say to remove it. I asked you to add allOf section restricting it.
> 
> Thanks for the example. I think I understand now. I will put the reg section
> back and use min/maxItems in the allOf:if: to set the number of reg/reg-names
> to 1 for the MAX77759.
> 
> Do I keep shunt-resistor-micro-ohms as I did it here? I could move it in


Depends, where does it come from? What does the other referenced schema say?


Best regards,
Krzysztof