map220v / sm8150-mainline

WIP Mainline kernel for Xiaomi Pad 5
Other
29 stars 15 forks source link

Does ln8000 control battery temperature, and stops charge on overheat #8

Closed catmengi closed 3 months ago

catmengi commented 3 months ago

Does ln8000 control battery temperature on charging, and can it low power or stop charging on battery overheat?

map220v commented 3 months ago

Ln8000 can monitor battery temperature, but it's disabled in xiaomi's device tree and here too.

catmengi commented 3 months ago

Does when my battery overheat it will not low power or stop charging? Or pm8150b_thermal should disable charging/low power? Or it it just keep overheating or shutdown tablet? What it will do

catmengi commented 3 months ago

If you can please explain me what this line in pm8150b_fg should mean: //power-supplies = <&ln8000_charger>;

map220v commented 3 months ago

Does when my battery overheat it will not low power or stop charging? Or pm8150b_thermal should disable charging/low power? Or it it just keep overheating or shutdown tablet? What it will do

Idk if it will or will not disable charging, nabu batteries shouldn't overheat that much for that to become necessary.

If you can please explain me what this line in pm8150b_fg should mean: //power-supplies = <&ln8000_charger>;

It's required for pm8150b fuelgauge driver to properly display charging status, also it's actually should be "power-supplies = <&pm8150b_charger>", because only pm8150b charger can properly trigger interrupt and tell that charging is started, ln8000 is unreliable for charging state detection, because it doesn't trigger it's interrupt in most cases when it detects power on vbus(in xiaomi's kernel it's even has wrong interrupt in device tree, so ln8000 interrupt code never gets called)

catmengi commented 3 months ago

Does charging starts by pm8150b_charger then by ln8000? If i change power-supplies = <&ln8000_charger>; to power-supplies = <&pm8150b_charger>; will it display charging status? Or it already display it normaly.

map220v commented 3 months ago

When you connect charger pm8150b reacts to vbus power and starts regular charging, it doesn't need driver to do this. Ln8000 that is used for fast charging doesn't enable charging automatically, and it requires driver that will enable charging based on fuelgauge charging status.

Without "power-supplies" fuelgauge driver in this kernel will instead try to detect charging status by checking batteries current.

catmengi commented 3 months ago

When you connect charger pm8150b reacts to vbus power and starts regular charging, it doesn't need driver to do this. Ln8000 that is used for fast charging doesn't enable charging automatically, and it requires driver that will enable charging based on fuelgauge charging status.

Without "power-supplies" fuelgauge driver in this kernel will instead try to detect charging status by checking batteries current.

Does pm8150b disables after start of ln8000? Or it stil detect charging status when ln8000 is charging batteries?

map220v commented 3 months ago

pm8150b always works when device powered on, and it will always detect charging status even when device is powered off or doesn't have any power.

catmengi commented 3 months ago

And the last question about charging, i saw in dts that usb typec have power and data roles as dual, can i charge my table and use it usb host at the same time(of course in linux)

map220v commented 3 months ago

Yes, you can change for example data-role to host and power-role to sink, refer to this bindings documentation https://www.kernel.org/doc/Documentation/devicetree/bindings/connector/usb-connector.yaml

catmengi commented 3 months ago

Yes, you can change for example data-role to host and power-role to sink, refer to this bindings documentation https://www.kernel.org/doc/Documentation/devicetree/bindings/connector/usb-connector.yaml

Is this done automatically? Or i need to do this manualy, by writing to /sys/class/typec/port*

map220v commented 3 months ago

It is automatic when dual role is set, it will use power role sink if you connect charger or source if you connect usb device to tablet that requires power.