-
Notifications
You must be signed in to change notification settings - Fork 140
arm64: dts: qcom: msm8916/39-samsung-a2015/fortuna: Add PMIC and charger #323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arm64: dts: qcom: msm8916/39-samsung-a2015/fortuna: Add PMIC and charger #323
Conversation
@Jakko3 Do you mind taking a look at the rt5033 battery/charging part of these changes? Would appreciate your review :) |
82b2d62
to
414b336
Compare
0265501
to
291e753
Compare
Currently I'm on vacation, just sporadically online. Apologies to @wonderfulShrineMaidenOfParadise if my reply time is long and progress becomes slow because of this. Cc: @Grimler91 (tested rt5033-charger on samsung-a5 and currently looks into rt5033-leds), @Minha-D (asked about rt5033-charger implementation in dts of samsung-fortuna3g elsewhere) flash-led-controller
mfd, charger, battery
vbus-supply
Sorry for the many comments and questions. The integration into all those devices is well appreciated. Sources
|
291e753
to
740d757
Compare
Exactly. I would expect future rt5033-led driver implementation reverts and replaces my earlier patch, 7bd932d
I don't understand this. Do you mean adding a prefix
You have the point. I would change it in a2015/e2015/grandmax.
I missed it. It has been dropped.
After deletion of the https://github.com/msm8916-mainline/linux/pull/323/files#diff-a870c982d091ac61eae478bc6c3215140ef62c9422ac9b28d6b15cee294c8b86R18-L19
The usage of I2C buses for NFC and MFD are completely swapped on gprimeltecan. https://github.com/msm8916-mainline/linux-downstream/blob/SM-G530W/arch/arm/boot/dts/samsung/msm8916/msm8916-sec-fortuna-tmo-r02.dtsi#L50-L83
It's assigned to enable
I assume |
Thanks for the accurate answers.
Sounds fine to me.
There are two things:
I guess this makes sense. As a "guideline" I would say 1) each battery node should be a complete one with all five values, 2) the battery nodes shouldn't be overriden. If battery nodes can be shared in "common" files without overriding them in device-specific files, it should be fine. The The other three values
There is another set of five "richtek,..." battery parameters in the charger node of gprimeltecan.
Sounds reasonable. If this works, I'm fine with that.
I lost the overview ;) I don't have a specific opinion here. If it works, I'm ok with it.
Sounds like a good thing.
Powering the USB OTG devices works also without assining In case you upstream those patches at some point, could you apply the one for samsung-serranove as well? That way the devices are kept all on the same state, also upstream. |
a85b318
to
17b79cc
Compare
Applied.
Applied. But I am not sure about fortuna/rossa parts, since it's really a mess made by Samsung.
Another miss :p
I am confused with this as well.
There is nothing more to do with MFD on serranove, I guess. Could you test flash LED part? |
17b79cc
to
4495805
Compare
The As far as I understand, the SAFE_LDO regulator is actually a special kind of regulator which gets enabled whenever the incoming VBUS (i.e. from an USB charging cable) is in valid bounds. It's from a totally different vendor but the datasheet of MAX77829 has some hints at page 37:
On some Samsung devices this seems to be used for some special magic that makes the touchscreen aware that a charging cable is inserted (no idea why it needs to know that). If SAFE_OUT was declared as |
Looking through the downstream sources, I find the following values. No guarantees this is correct, cross-checking is appreciated.
A special comment on the "charge-term-current" values: When the downstream rt5033-charger driver passes that point, it charges additional approx. 42 mins beyond that. That way it reaches 100 % capacity for sure. Some more information on that I wrote in the cover sheet of the upstreaming patchset v1. Such fine-tuning tweaks are not implemented in the upstream driver (could be implemented as improvement, though). Therefore the "charge-term-current" is rather a bit too early. 150 mA is the lowest possible value by the rt5033 chip. The 200 mA values could be lowered to 150 mA to reach a higher capacity percentage and more relaxed re-charging cycles (longer not-charging/charging periods in "fully" charged state). For the time being, I would stick to the values provided by the downstream sources. That's easier to decide and possibly easier to argue when upstreaming. However, if someone of you tests those devices and confirms that 150 mA results in a nicer end-of-charge behavior (re-charging cycles should become visible when monitoring the voltage_avg), we can also change all of them to 150 mA.
I haven't tested yet. Currently I'm on the road and can't test. When I'm back home and find some time, I'll test and let you know. However, don't wait for me. |
4495805
to
a08dac8
Compare
Some stuff I spotted in the current set: e5
gprime-common
fortuna3g
fortunaltezt
gprimeltecan
heatqlte
a7
|
Wrong values should be fixed now. Nice catches. The 3 properties will stick together if they are set in
I am not sure what's the issue about overrides. My current idea is to share common part/properties for "host" devices (e2015 for example), and then override in "guest" (grandmax for example) devices. Not sure if About heatqlte model name, Samsung Galaxy Ace 4 LTE seems to be correct. References: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way would you feel like to use the code review feature?
a08dac8
to
b0301ef
Compare
With those nested dts(i) files over 3 levels and all kind of device code names, it's easy to loose overview which battery parameter goes into which device. It has a potential of being error-prone – which is a notable safety issue when it comes to Li-Ion battery charging. Also if someone adds a new device based on one of the common dtsi files (also e.g. locally at home for initial device testing) and doesn't add yet a (partial) battery node to that device dts file: When the current override approach is implemented, that device gets charged right away with the values in the common dtsi file. Assume grandmax would be added newly on top of e2015-common, in the first tries without a battery node yet, that device would get charged with 1500 mA (but the battery can take only 1000 mA). Or assume a new device gets added on top of cprime-common and the person "forgets" or is unsure about the battery node, that battery will get charged to 4.4 V, even if the battery can only take 4.35 V like e.g. Ace 4. Thinking about it, for safety reasons the "variable" battery values should always be in the file of the specific device dts file. That way it's clear and safe. If the (partial) battey node is missing, the charger driver fails. Personally I would even go a step further and would place the complete battery node seperately in each specific device dts file (not splitting the battery node at all). Like placing a battery into the device. Maybe I'm asking too much by this.
Good hint. It's not clear, web-searching for SM-G357FZ results partially in "Samsung Galaxy Ace Style" and partially in "Samsung Galaxy Ace 4". For sure it's part of the Ace 4 series. So there is no need to change it.
Yes, right, thanks for the hint ;) I'm not familiar with it and once desperately failed on pmOS GitLab trying to do this. As I'm currently on the road and short on time, I stick to the text comments for now. I'll try the code review feature at another occasion. Comments on the current set:
|
It seems a2015 LED parts have no obvious issue, and I will send it to upstream soon.
@Jakko3 I get your point, so it's about safety for future works. I understand your concern. However, does it stop people from doing dangerous things?
For example, when I tried to port A7, I even booted it with
As far as I know, there are some MSM8916 phones yet to be ported. fortuna series is not in upstream yet anyway, and we still have much time and room for discussions :D |
I think there are two things I'm worried about:
On the first point: In the current commit set some devices have values directly implemented in their dts files (like a7), some devices have overriden values (like grandmax, heatqlte values are even overriden twice) and some devices have no values in their dts (like fortuna3g, fortunaltezt, gprimeltecan). While I honor the efficiency of your implementation, it is hard keep track. Placing the values in each device dts is more clear and straight foreward. On the second point: To inherit charging values is dangerous. Especially if it can happen without knowledge. The rt5033-charger driver fails if one of the five charging values is missing and states this in dmesg [edit: and falls back to the default charging values of the rt5033 chip, which is slow charging, unfortunately up to 4.4 V]. If someone doesn't provide charging values for a new device, the rt5033-charging driver should fail. The situation 2. you mentioned above would prevent this and increase the risk something is wrong while everything on rt5033 looks ok in dmesg. If people do copy-paste, we cannot prevent them copying wrong values. However, refering to point one: If each device dts contains charging values, people at least see that they are copy-pasting charging values. In the current implementation this is not fully clear in all cases. In downstream each device (even local variants) has a separate dtsi file for the battery charging values as such. |
b0301ef
to
b53c4d7
Compare
I don't see any point to insist on common dtsi, since it slows the progress @Jakko3 out of curious. If I pick up a Core Prime battery and use it |
Once again sorry for the delayed answer. I'm now back home. I tested the flash LED patch on samsung-serranove. It works! On the mfd/charger patches: Thanks for adding the variable battery parameters to every device seperately. I hope it's ok for you that way. I looked through the commits and it now looks good to me! On your question of switching the batteries of Core Prime and Grand Prime: That must not be done and is quite dangerous! The charging parameters are not correct anymore. Though it's the same if you run the phones on Android: The charging parameters are set in the kernel, putting in a wrong battery leads to charging that battery with wrong parameters, which is hazardous. The mainlined rt5033-charger driver could be extended and improved. E.g. there are some IRQ triggers available that could increase safety but are not implemented, see links 10-12 in the cover sheet of patchset v1. RT5033_CHTREGI_IRQ is thermal regulation IRQ, RT5033_VINOVPI_IRQ is overvoltage protection IRQ. In the Android driver, some of those things seem to be implemented in the general samsung battery infrastructure, see link 3 of the mentioned cover sheet. However, I don't know if they would help much when putting a completely different battery in the device, the charging parameters would still be wrong. |
It got a bit lost in my last comment: My part of the review is finished. I'm fine with the current implementation. |
And @wonderfulShrineMaidenOfParadise: Thanks for adding it to all these devices! |
Given the open questions with the flash LED on the mailing lists I would like to postpone that part until this is decided and just take the battery/charging stuff for now. Do you mind splitting up into two PRs again? |
b53c4d7
to
e9aa5ea
Compare
Opened #327 for RT5033 LED. |
6387cbd
to
ea6549f
Compare
eadea38
to
629a4d1
Compare
The phones listed below have Richteck RT5033 PMIC and charger. Add them to the device trees. - Samsung Galaxy A3/A5 2015 - Samsung Galaxy E5/E7 - Samsung Galaxy Grand Max Signed-off-by: Raymond Hackley <[email protected]>
Samsung Galaxy A7 has Richteck RT5033 PMIC and charger. Add them to the device tree. Signed-off-by: Raymond Hackley <[email protected]>
The phones listed below have Richteck RT5033 PMIC and charger. Add them to the device trees. - Samsung Galaxy Ace 4 - Samsung Galaxy Core Prime LTE - Samsung Galaxy Grand Prime Signed-off-by: Raymond Hackley <[email protected]>
629a4d1
to
591fa91
Compare
For A7 the "constant-charge-voltage-max" is now 4.3 V and the "charge-term-current" at 150 mA. For some of the other devices the "charge-term-current" is at 200 mA according to the table further above. I'd say this is ok for a release. Further testing of the charging behavior after the release is welcome, especially the recharging cycles behavior at "full" battery by monitoring the voltage in sysfs. For devices with "charge-term-current" at 200 mA, lowering this to 150 mA might improve the behavior. In case A7 doesn't show nice recharging cycles behavior, a "constant-charge-voltage-max" of 4.325 V could be tested and discussed. |
Upstreaming a2015 series |
[ Upstream commit a853450 ] When calling crypto_finalize_request, BH should be disabled to avoid triggering the following calltrace: ------------[ cut here ]------------ WARNING: CPU: 2 PID: 74 at crypto/crypto_engine.c:58 crypto_finalize_request+0xa0/0x118 Modules linked in: cryptodev(O) CPU: 2 PID: 74 Comm: firmware:zynqmp Tainted: G O 6.8.0-rc1-yocto-standard msm8916-mainline#323 Hardware name: ZynqMP ZCU102 Rev1.0 (DT) pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : crypto_finalize_request+0xa0/0x118 lr : crypto_finalize_request+0x104/0x118 sp : ffffffc085353ce0 x29: ffffffc085353ce0 x28: 0000000000000000 x27: ffffff8808ea8688 x26: ffffffc081715038 x25: 0000000000000000 x24: ffffff880100db00 x23: ffffff880100da80 x22: 0000000000000000 x21: 0000000000000000 x20: ffffff8805b14000 x19: ffffff880100da80 x18: 0000000000010450 x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 x14: 0000000000000003 x13: 0000000000000000 x12: ffffff880100dad0 x11: 0000000000000000 x10: ffffffc0832dcd08 x9 : ffffffc0812416d8 x8 : 00000000000001f4 x7 : ffffffc0830d2830 x6 : 0000000000000001 x5 : ffffffc082091000 x4 : ffffffc082091658 x3 : 0000000000000000 x2 : ffffffc7f9653000 x1 : 0000000000000000 x0 : ffffff8802d20000 Call trace: crypto_finalize_request+0xa0/0x118 crypto_finalize_aead_request+0x18/0x30 zynqmp_handle_aes_req+0xcc/0x388 crypto_pump_work+0x168/0x2d8 kthread_worker_fn+0xfc/0x3a0 kthread+0x118/0x138 ret_from_fork+0x10/0x20 irq event stamp: 40 hardirqs last enabled at (39): [<ffffffc0812416f8>] _raw_spin_unlock_irqrestore+0x70/0xb0 hardirqs last disabled at (40): [<ffffffc08122d208>] el1_dbg+0x28/0x90 softirqs last enabled at (36): [<ffffffc080017dec>] kernel_neon_begin+0x8c/0xf0 softirqs last disabled at (34): [<ffffffc080017dc0>] kernel_neon_begin+0x60/0xf0 ---[ end trace 0000000000000000 ]--- Fixes: 4d96f7d ("crypto: xilinx - Add Xilinx AES driver") Signed-off-by: Quanyang Wang <[email protected]> Signed-off-by: Herbert Xu <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
The phones listed below have Richteck RT5033 PMIC and charger.
Add them to the device trees.
Replaces #317
Cc: @Jakko3