ARM: dts: qcom: Add binding for the qcom coincell charger
PATCH 1/3 ARM: dts: qcom: Add binding for the qcom coincell charger
This binding is used to configure the driver for the coincell charger found in Qualcomm PMICs.
--- .../bindings/power/qcom,coincell-charger.txt | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/qcom,coincell-charger.txt
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt new file +44 -0
@@ -0,0 +1,44 @@ +Qualcomm Coincell Charger: + +The hardware block controls charging for a coincell or capacitor that is +used to provide power backup for certain features of the power management +IC (PMIC) + +- compatible: + Usage: required + Value type: <string> + Definition: must be: "qcom,pm8941-coincell" + +- reg: + Usage: required + Value type: <u32> + Definition: base address of the coincell charger registers + +- qcom,rset-ohms: + Usage: required + Value type: <u32> + Definition: resistance (in ohms) for current-limiting resistor + must be one of: 800, 1200, 1700, 2100 + +- qcom,vset-millivolts: + Usage: required + Value type: <u32> + Definition: voltage (in millivolts) to apply for charging + must be one of: 2500, 3000, 3100, 3200 + +- qcom,charge-enable: + Usage: optional + Value type: <u32> or <none> + Definition: definining this property, with an optional non-zero + value, enables charging + +Examples: + + qcom,coincell@2800 { + compatible = "qcom,pm8941-coincell"; + reg = <0x2800>; + + qcom,rset-ohms = <2100>; + qcom,vset-millivolts = <3000>; + qcom,charge-enable; + };
--
1.8.2.2
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/3 ARM: qcom: Add coincell charger driver
This driver is used to configure the coincell charger found in Qualcomm PMICs.
The driver allows configuring the current-limiting resistor for the charger, as well as the voltage to apply to the coincell (or capacitor) when charging.
--- drivers/misc/Kconfig | 11 ++++ drivers/misc/Makefile | 1 + drivers/misc/qcom-coincell.c | 154 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 166 insertions(+) create mode 100644 drivers/misc/qcom-coincell.c
drivers/misc/Kconfig +11 -0
@@ -271,6 +271,17 @@ config HP_ILO To compile this driver as a module, choose M here: the module will be called hpilo. +config QCOM_COINCELL + tristate "Qualcomm coincell charger support" + depends on OF + select REGMAP + help + This driver supports the coincell block found inside of + Qualcomm PMICs. The coincell charger provides a means to + charge a coincell battery or backup capacitor which is used + to maintain PMIC register and RTC state in the absence of + external power. + config SGI_GRU tristate "SGI GRU driver" depends on X86_UV && SMP
drivers/misc/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-$(CONFIG_LKDTM) += lkdtm.o obj-$(CONFIG_TIFM_CORE) += tifm_core.o obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o obj-$(CONFIG_PHANTOM) += phantom.o +obj-$(CONFIG_QCOM_COINCELL) += qcom-coincell.o obj-$(CONFIG_SENSORS_BH1780) += bh1780gli.o obj-$(CONFIG_SENSORS_BH1770) += bh1770glc.o obj-$(CONFIG_SENSORS_APDS990X) += apds990x.o
drivers/misc/qcom-coincell.c new file +154 -0
154 lines not on this page · raw message
Signature · 1 line
1.8.2.2
PATCH 3/3 ARM: dts: qcom: Add dts changes for qcom coincell charger
In reply to Tim BirdAdd framework for the coincell charger DT block in pm8941 file, and actual values for honami battery in the honami dts file.
--- arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts | 11 +++++++++++ arch/arm/boot/dts/qcom-pm8941.dtsi | 6 ++++++ 2 files changed, 17 insertions(+)
arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts +11 -0
@@ -17,3 +17,14 @@ status = "ok"; }; }; + +&spmi_bus { + pm8941@0 { + qcom,coincell@2800 { + status = "ok"; + qcom,rset-ohms = <2100>; + qcom,vset-millivolts = <3000>; + qcom,charge-enable; + }; + }; +};
arch/arm/boot/dts/qcom-pm8941.dtsi +6 -0
@@ -125,6 +125,12 @@ interrupts = <0x0 0x36 0x0 IRQ_TYPE_EDGE_RISING>; qcom,external-resistor-micro-ohms = <10000>; }; + + qcom,coincell@2800 { + compatible = "qcom,pm8941-coincell"; + reg = <0x2800>; + status = "disabled"; + }; }; usid1: pm8941@1 {
Signature · 1 line
1.8.2.2
Quoted 6 lines · Tim Bird
Rob,
Thanks for the quick feedback. You responded off-list. I don't know if you meant to do this or not. My response is off-list as well, but let me know if I should have responded on-list, or set something differently in my original e-mail.
Didn't mean to do that. Added back now.
Also adding Mark B in case he has any comments with respect to regulators.
Quoted 39 lines · Rob Herring
Quoted 10 lines · Tim Bird
Quoted 9 lines
This binding is used to configure the driver for the coincell charger found in Qualcomm PMICs.
Signed-off-by Tim Bird <tim.bird-/[email protected]>--- .../bindings/power/qcom,coincell-charger.txt | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/qcom,coincell-charger.txtQuoted 15 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt line 6
Quoted 12 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt new file +6
-0@@ -0,0 +1,44 @@ +Qualcomm Coincell Charger: + +The hardware block controls charging for a coincell or capacitor that is +used to provide power backup for certain features of the power management +IC (PMIC) +Would the regulator binding work for this? I ask mainly because that is what FSL mc13892 coincell charger already uses.
I could use the regulator binding, but I think it would imply more functionality than the driver supports. The regulator binding docs list lots of (admittedly optional) attributes that don't really apply.
I looked at the mc13892 binding, and I didn't like it too much, because it doesn't really indicate what the allowed values are for the regulator -- but it's possible on that hardware that it's acting like a normal regulator with a fine-grained range of voltage outputs and other configurable attributes.
Quoted 3 lines
This is really just 2 values and an enable bit and I think the mapping from the regulator attributes to this is not a good fit.
Okay.
Quoted 26 lines
Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt new file +11
-0+- compatible: + Usage: required + Value type: <string> + Definition: must be: "qcom,pm8941-coincell" + +- reg: + Usage: required + Value type: <u32> + Definition: base address of the coincell charger registers + +- qcom,rset-ohms:Quoted 8 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt line 21
Quoted 4 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt new file +4
-0+ Usage: required + Value type: <u32> + Definition: resistance (in ohms) for current-limiting resistor + must be one of: 800, 1200, 1700, 2100Can you define the current limit and then calculate the resistor value to use in the driver? Current is ultimately what the battery is spec'ed to.
It's possible, but not very useful. The resistor is one of 4 values, and specifies exactly what the hardware is doing. Specifying the current limit is imprecise, and would have to be mapped onto the correct resistor value (depending on the voltage) by the driver.
Quoted 4 lines
Besides being imprecise, however, it's not how these things are usually specified. The SoC specification, system configuration and schematics list the resistor value, and the data sheet for the coincell itself usually specifies a recommended voltage and resistor value.
Okay, if that is how things are spec'ed with batteries then I'm okay with it.
Quoted 18 lines
So if we specify the max current then developers setting this would need to translate the numbers to what the dt expects, so that the driver can reverse that math and fit it to one of the supported values.
Quoted 13 lines
Quoted 12 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt new file +11
-0+- qcom,vset-millivolts: + Usage: required + Value type: <u32> + Definition: voltage (in millivolts) to apply for charging + must be one of: 2500, 3000, 3100, 3200 + +- qcom,charge-enable: + Usage: optional + Value type: <u32> or <none> + Definition: definining this property, with an optional non-zero + value, enables charging
Quoted 6 lines
Quoted 2 lines
I'm not sure that this belongs in DT. Don't you want to enable charging when plugged in perhaps or at some voltage threshold?
In practice this is never changed at runtime. It's only set at kernel boot. The main use of this is to override (either on or off) whatever the firmware did.
If your firmware and dtb are separate from your kernel, then ... (well you know where I'm headed :) ).
If we do keep this, I think is should be a disable property with not present being the default and enabling charging. Also, it only needs to be bool (i.e. no value).
Rob
Quoted 25 lines
Quoted 8 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt line 37
Quoted 5 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt new file +4
-0+ +Examples: + + qcom,coincell@2800 {This should be a sub node of the PMIC, right. Please show in the example and refer to the relevant PMIC binding doc.
OK.
Quoted 2 lines
Also, drop the "qcom," from the node name.
OK.
Will do these in the next patch rev.Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt new file +7
-1+ compatible = "qcom,pm8941-coincell"; + reg = <0x2800>; + + qcom,rset-ohms = <2100>; + qcom,vset-millivolts = <3000>; + qcom,charge-enable; + }; --1.8.2.2
Quoted 3 lines
Thanks!
-- Tim
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 111 lines · Rob Herring
Quoted 6 lines · Tim Bird
Rob,
Thanks for the quick feedback. You responded off-list. I don't know if you meant to do this or not. My response is off-list as well, but let me know if I should have responded on-list, or set something differently in my original e-mail.
Didn't mean to do that. Added back now.
Also adding Mark B in case he has any comments with respect to regulators.
Quoted 39 lines · Rob Herring
Quoted 10 lines · Tim Bird
Quoted 9 lines
This binding is used to configure the driver for the coincell charger found in Qualcomm PMICs.
Signed-off-by Tim Bird <[email protected]>--- .../bindings/power/qcom,coincell-charger.txt | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/qcom,coincell-charger.txtQuoted 15 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt line 6
Quoted 12 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt new file +6
-0@@ -0,0 +1,44 @@ +Qualcomm Coincell Charger: + +The hardware block controls charging for a coincell or capacitor that is +used to provide power backup for certain features of the power management +IC (PMIC) +Would the regulator binding work for this? I ask mainly because that is what FSL mc13892 coincell charger already uses.
I could use the regulator binding, but I think it would imply more functionality than the driver supports. The regulator binding docs list lots of (admittedly optional) attributes that don't really apply.
I looked at the mc13892 binding, and I didn't like it too much, because it doesn't really indicate what the allowed values are for the regulator -- but it's possible on that hardware that it's acting like a normal regulator with a fine-grained range of voltage outputs and other configurable attributes.
Quoted 3 lines
This is really just 2 values and an enable bit and I think the mapping from the regulator attributes to this is not a good fit.
Okay.
Quoted 26 lines
Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt new file +11
-0+- compatible: + Usage: required + Value type: <string> + Definition: must be: "qcom,pm8941-coincell" + +- reg: + Usage: required + Value type: <u32> + Definition: base address of the coincell charger registers + +- qcom,rset-ohms:Quoted 8 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt line 21
Quoted 4 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt new file +4
-0+ Usage: required + Value type: <u32> + Definition: resistance (in ohms) for current-limiting resistor + must be one of: 800, 1200, 1700, 2100Can you define the current limit and then calculate the resistor value to use in the driver? Current is ultimately what the battery is spec'ed to.
It's possible, but not very useful. The resistor is one of 4 values, and specifies exactly what the hardware is doing. Specifying the current limit is imprecise, and would have to be mapped onto the correct resistor value (depending on the voltage) by the driver.
Quoted 4 lines
Besides being imprecise, however, it's not how these things are usually specified. The SoC specification, system configuration and schematics list the resistor value, and the data sheet for the coincell itself usually specifies a recommended voltage and resistor value.
Okay, if that is how things are spec'ed with batteries then I'm okay with it.
Quoted 21 lines
So if we specify the max current then developers setting this would need to translate the numbers to what the dt expects, so that the driver can reverse that math and fit it to one of the supported values.
Quoted 15 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt line 33
Quoted 12 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt new file +11
-0+- qcom,vset-millivolts: + Usage: required + Value type: <u32> + Definition: voltage (in millivolts) to apply for charging + must be one of: 2500, 3000, 3100, 3200 + +- qcom,charge-enable: + Usage: optional + Value type: <u32> or <none> + Definition: definining this property, with an optional non-zero + value, enables chargingI'm not sure that this belongs in DT. Don't you want to enable charging when plugged in perhaps or at some voltage threshold?
Quoted 6 lines
Quoted 3 lines
In practice this is never changed at runtime. It's only set at kernel boot. The main use of this is to override (either on or off) whatever the firmware did.
If your firmware and dtb are separate from your kernel, then ... (well you know where I'm headed :) ).
Sorry, I have no idea how the sentence would end, so I think I'm missing where you are headed.
Quoted 3 lines
If we do keep this, I think it should be a disable property with not present being the default and enabling charging. Also, it only needs to be bool (i.e. no value).
Are you suggesting something like this, then?
- qcom,charger-disable:
Usage: optional
Value type: <none>
Definition: defining this property disables charging
The logic would be as follows:
- if the developer wants to just use the firmware settings, then the kernel would just not define this dts node at all, and nothing would change on kernel boot
- if the developers want to change the settings, either turning off the charger, or specifying desired settings, then they define the appropriate attributes.
I'm OK with that.
It would make no sense to define rset and vset values when this is defined. Should I note that somewhere in the binding doc?
Thanks.
-- Tim
Quoted 6 lines · Tim Bird
Quoted 5 lines · Rob Herring
Quoted 4 lines · Tim Bird
Quoted 3 lines · Rob Herring
Quoted 2 lines · Tim Bird
This binding is used to configure the driver for the coincell charger found in Qualcomm PMICs.
[...]
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt line 33
Quoted 5 lines
+- qcom,charge-enable:
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt new file +4
-0+ Usage: optional + Value type: <u32> or <none> + Definition: definining this property, with an optional non-zero + value, enables chargingI'm not sure that this belongs in DT. Don't you want to enable charging when plugged in perhaps or at some voltage threshold?
In practice this is never changed at runtime. It's only set at kernel boot. The main use of this is to override (either on or off) whatever the firmware did.
Quoted 5 lines
Quoted 2 lines
If your firmware and dtb are separate from your kernel, then ... (well you know where I'm headed :) ).
Sorry, I have no idea how the sentence would end, so I think I'm missing where you are headed.
dtbs should be separate from the kernel and part of the firmware. I'm certain you recall those discussions or have sucessfully blocked them from memory. If the dtb is part of the firmware, then changing the dtb to change the kernel's handling of this would not make a lot of sense.
I was going to say if you want to change what firmware did, then you could just do it from userspace. A delay from kernel boot to userspace init would not matter here. However, if you have no other reason for having a userspace interface, that probably isn't worth it and it is fine as is.
Quoted 10 lines
Quoted 4 lines
If we do keep this, I think it should be a disable property with not present being the default and enabling charging. Also, it only needs to be bool (i.e. no value).
Are you suggesting something like this, then?
- qcom,charger-disable:
Usage: optional
Value type: <none>
s/<none>/boolean/
But otherwise, yes this looks fine.
Quoted 6 lines
Definition: defining this property disables charging
The logic would be as follows:
- if the developer wants to just use the firmware settings, then the kernel would just not define this dts node at all, and nothing would change on kernel boot
Well, the kernel doesn't decide dts settings, but yes I agree that removing or disabling the node would disable any kernel control.
Quoted 5 lines
- if the developers want to change the settings, either turning off the charger, or specifying desired settings, then they define the appropriate attributes.
I'm OK with that.
I am too.
Quoted 2 lines
It would make no sense to define rset and vset values when this is defined. Should I note that somewhere in the binding doc?
They are somewhat don't care unless changing them has some side effect. I'll leave it up to you.
Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 26 lines · Rob Herring
Quoted 6 lines · Tim Bird
Quoted 5 lines · Rob Herring
Quoted 4 lines · Tim Bird
Quoted 3 lines · Rob Herring
Quoted 2 lines · Tim Bird
This binding is used to configure the driver for the coincell charger found in Qualcomm PMICs.
[...]
Quoted 16 lines
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
+- qcom,charge-enable:
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt new file +4
-0+ Usage: optional + Value type: <u32> or <none> + Definition: definining this property, with an optional non-zero + value, enables chargingQuoted 6 lines
Quoted 2 lines
I'm not sure that this belongs in DT. Don't you want to enable charging when plugged in perhaps or at some voltage threshold?
In practice this is never changed at runtime. It's only set at kernel boot. The main use of this is to override (either on or off) whatever the firmware did.
If your firmware and dtb are separate from your kernel, then ... (well you know where I'm headed :) ).
Quoted 6 lines
Quoted 2 lines
Sorry, I have no idea how the sentence would end, so I think I'm missing where you are headed.
dtbs should be separate from the kernel and part of the firmware. I'm certain you recall those discussions or have sucessfully blocked them from memory.
Ah yes, those discussions. :-)
Having dtbs come from firmware is not on the horizon yet for projects I'm working on, so I haven't really considered the ramifications.
Quoted 2 lines
If the dtb is part of the firmware, then changing the dtb to change the kernel's handling of this would not make a lot of sense.
Indeed.
Quoted 37 lines
I was going to say if you want to change what firmware did, then you could just do it from userspace. A delay from kernel boot to userspace init would not matter here. However, if you have no other reason for having a userspace interface, that probably isn't worth it and it is fine as is.
Quoted 10 lines
Quoted 4 lines
If we do keep this, I think it should be a disable property with not present being the default and enabling charging. Also, it only needs to be bool (i.e. no value).
Are you suggesting something like this, then?
- qcom,charger-disable:
Usage: optional
Value type: <none>s/<none>/boolean/
But otherwise, yes this looks fine.
Quoted 6 lines
Definition: defining this property disables charging
The logic would be as follows:
- if the developer wants to just use the firmware settings, then the kernel would just not define this dts node at all, and nothing would change on kernel bootWell, the kernel doesn't decide dts settings, but yes I agree that removing or disabling the node would disable any kernel control.
Quoted 5 lines
- if the developers want to change the settings, either turning off the charger, or specifying desired settings, then they define the appropriate attributes.
I'm OK with that.
Quoted 7 lines
I am too.
Quoted 2 lines
It would make no sense to define rset and vset values when this is defined. Should I note that somewhere in the binding doc?
They are somewhat don't care unless changing them has some side effect. I'll leave it up to you.
OK - these are indeed "don't care" in that case.
I probably don't have to explain in the binding doc that adjusting settings for disabled hardware doesn't make sense.
Thanks again for the quick feedback.
-- Tim
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 36 lines · Tim Bird
Quoted 26 lines · Rob Herring
Quoted 6 lines · Tim Bird
Quoted 5 lines · Rob Herring
Quoted 4 lines · Tim Bird
Quoted 3 lines · Rob Herring
Quoted 2 lines · Tim Bird
This binding is used to configure the driver for the coincell charger found in Qualcomm PMICs.
[...]
Quoted 16 lines
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
+- qcom,charge-enable:
(quoted diff) +4
-0+ Usage: optional + Value type: <u32> or <none> + Definition: definining this property, with an optional non-zero + value, enables chargingQuoted 6 lines
Quoted 2 lines
I'm not sure that this belongs in DT. Don't you want to enable charging when plugged in perhaps or at some voltage threshold?
In practice this is never changed at runtime. It's only set at kernel boot. The main use of this is to override (either on or off) whatever the firmware did.
If your firmware and dtb are separate from your kernel, then ... (well you know where I'm headed :) ).
Quoted 6 lines
Quoted 2 lines
Sorry, I have no idea how the sentence would end, so I think I'm missing where you are headed.
dtbs should be separate from the kernel and part of the firmware. I'm certain you recall those discussions or have sucessfully blocked them from memory.
Quoted 6 lines
Ah yes, those discussions. :-)
Having dtbs come from firmware is not on the horizon yet for projects I'm working on, so I haven't really considered the ramifications.
This has nothing to do about how the dtb, kernel and boot is stored on the device; we already store them as 3 separate entities and they can be upgraded independently. Neither one of them is read only and they will never be!
We've already passed the point where we've gotten the pieces into mainline that would make it possible to run all devices on e.g. the 8974 platform from a single zImage. The fact that we store the dtb in adjacent blocks is simply a convenience thing.
Regards,
Bjorn