arm64: dts: qcom: msm8916/39-samsung-a2015: Add PMIC and charger
Commit Message
The phones listed below have Richtek RT5033 PMIC and charger.
Add them to the device trees.
- Samsung Galaxy A3/A5/A7 2015
- Samsung Galaxy E5/E7
- Samsung Galaxy Grand Max
Signed-off-by: Raymond Hackley <raymondhackley@protonmail.com>
---
.../qcom/msm8916-samsung-a2015-common.dtsi | 59 +++++++++++++++++-
.../boot/dts/qcom/msm8916-samsung-a3u-eur.dts | 6 ++
.../boot/dts/qcom/msm8916-samsung-a5u-eur.dts | 6 ++
.../qcom/msm8916-samsung-e2015-common.dtsi | 6 ++
.../boot/dts/qcom/msm8916-samsung-e5.dts | 6 ++
.../boot/dts/qcom/msm8916-samsung-e7.dts | 7 +++
.../dts/qcom/msm8916-samsung-grandmax.dts | 6 ++
.../boot/dts/qcom/msm8939-samsung-a7.dts | 62 ++++++++++++++++++-
8 files changed, 156 insertions(+), 2 deletions(-)
Comments
On 05/12/2023 10:38, Raymond Hackley wrote:
> The phones listed below have Richtek RT5033 PMIC and charger.
> Add them to the device trees.
>
> - Samsung Galaxy A3/A5/A7 2015
> - Samsung Galaxy E5/E7
> - Samsung Galaxy Grand Max
>
> Signed-off-by: Raymond Hackley <raymondhackley@protonmail.com>
> ---
> .../qcom/msm8916-samsung-a2015-common.dtsi | 59 +++++++++++++++++-
> .../boot/dts/qcom/msm8916-samsung-a3u-eur.dts | 6 ++
> .../boot/dts/qcom/msm8916-samsung-a5u-eur.dts | 6 ++
> .../qcom/msm8916-samsung-e2015-common.dtsi | 6 ++
> .../boot/dts/qcom/msm8916-samsung-e5.dts | 6 ++
> .../boot/dts/qcom/msm8916-samsung-e7.dts | 7 +++
> .../dts/qcom/msm8916-samsung-grandmax.dts | 6 ++
> .../boot/dts/qcom/msm8939-samsung-a7.dts | 62 ++++++++++++++++++-
> 8 files changed, 156 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi b/arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi
> index 2937495940ea..e6355e5e2177 100644
> --- a/arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi
> +++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi
> @@ -28,6 +28,12 @@ tz-apps@85500000 {
> };
> };
>
> + battery: battery {
> + compatible = "simple-battery";
> + precharge-current-microamp = <450000>;
> + precharge-upper-limit-microvolt = <3500000>;
> + };
> +
> clk_pwm: pwm {
> compatible = "clk-pwm";
> #pwm-cells = <2>;
> @@ -128,6 +134,12 @@ muic: extcon@25 {
>
> pinctrl-names = "default";
> pinctrl-0 = <&muic_int_default>;
> +
> + usb_con: connector {
> + compatible = "usb-b-connector";
> + label = "micro-USB";
> + type = "micro";
> + };
It would be nice to break this up into individual patches
One patch for the battery, one patch for the usb-b-connector per device
you are targetting.
More work but better practice to have more granular commits.
> + regulators {
> + rt5033_reg_safe_ldo: SAFE_LDO {
> + regulator-min-microvolt = <4900000>;
> + regulator-max-microvolt = <4900000>;
> + regulator-always-on;
> + };
> +
> + /*
> + * Needed for camera, but not used yet.
> + * Define empty nodes to allow disabling the unused
> + * regulators.
> + */
> + LDO {};
> + BUCK {};
> + };
Aren't the camera regulators off until enabled ?
---
bod
On Tue, Dec 05, 2023 at 12:17:15PM +0100, Bryan O'Donoghue wrote:
> On 05/12/2023 10:38, Raymond Hackley wrote:
> > The phones listed below have Richtek RT5033 PMIC and charger.
> > Add them to the device trees.
> >
> > - Samsung Galaxy A3/A5/A7 2015
> > - Samsung Galaxy E5/E7
> > - Samsung Galaxy Grand Max
> >
> > Signed-off-by: Raymond Hackley <raymondhackley@protonmail.com>
> > [...]
> > + /*
> > + * Needed for camera, but not used yet.
> > + * Define empty nodes to allow disabling the unused
> > + * regulators.
> > + */
> > + LDO {};
> > + BUCK {};
> > + };
>
> Aren't the camera regulators off until enabled ?
>
We don't know for sure what state they are in during boot. If we omit
these nodes the regulator core will ignore these regulators completely
and just leave them in whatever state they are.
I would indeed expect them to be off after reset, but there are also
other situations in which Linux might be booted, such as kexec. That's
why it's usually better to be explicit and avoid relying on boot/reset
states altogether.
Thanks,
Stephan
@@ -28,6 +28,12 @@ tz-apps@85500000 {
};
};
+ battery: battery {
+ compatible = "simple-battery";
+ precharge-current-microamp = <450000>;
+ precharge-upper-limit-microvolt = <3500000>;
+ };
+
clk_pwm: pwm {
compatible = "clk-pwm";
#pwm-cells = <2>;
@@ -128,6 +134,12 @@ muic: extcon@25 {
pinctrl-names = "default";
pinctrl-0 = <&muic_int_default>;
+
+ usb_con: connector {
+ compatible = "usb-b-connector";
+ label = "micro-USB";
+ type = "micro";
+ };
};
};
@@ -239,7 +251,7 @@ magnetometer@12 {
&blsp_i2c4 {
status = "okay";
- battery@35 {
+ fuel-gauge@35 {
compatible = "richtek,rt5033-battery";
reg = <0x35>;
interrupt-parent = <&tlmm>;
@@ -247,6 +259,44 @@ battery@35 {
pinctrl-names = "default";
pinctrl-0 = <&fg_alert_default>;
+
+ power-supplies = <&charger>;
+ };
+};
+
+&blsp_i2c6 {
+ status = "okay";
+
+ pmic@34 {
+ compatible = "richtek,rt5033";
+ reg = <0x34>;
+
+ interrupts-extended = <&tlmm 62 IRQ_TYPE_EDGE_FALLING>;
+
+ pinctrl-0 = <&pmic_int_default>;
+ pinctrl-names = "default";
+
+ regulators {
+ rt5033_reg_safe_ldo: SAFE_LDO {
+ regulator-min-microvolt = <4900000>;
+ regulator-max-microvolt = <4900000>;
+ regulator-always-on;
+ };
+
+ /*
+ * Needed for camera, but not used yet.
+ * Define empty nodes to allow disabling the unused
+ * regulators.
+ */
+ LDO {};
+ BUCK {};
+ };
+
+ charger: charger {
+ compatible = "richtek,rt5033-charger";
+ monitored-battery = <&battery>;
+ richtek,usb-connector = <&usb_con>;
+ };
};
};
@@ -470,6 +520,13 @@ nfc_i2c_default: nfc-i2c-default-state {
bias-disable;
};
+ pmic_int_default: pmic-int-default-state {
+ pins = "gpio62";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-disable;
+ };
+
sdc2_cd_default: sdc2-cd-default-state {
pins = "gpio38";
function = "gpio";
@@ -55,6 +55,12 @@ &accelerometer {
"0", "0", "1";
};
+&battery {
+ charge-term-current-microamp = <150000>;
+ constant-charge-current-max-microamp = <1000000>;
+ constant-charge-voltage-max-microvolt = <4350000>;
+};
+
&blsp_i2c5 {
status = "okay";
@@ -29,6 +29,12 @@ &accelerometer {
"0", "0", "1";
};
+&battery {
+ charge-term-current-microamp = <200000>;
+ constant-charge-current-max-microamp = <1500000>;
+ constant-charge-voltage-max-microvolt = <4350000>;
+};
+
&blsp_i2c5 {
status = "okay";
@@ -23,6 +23,12 @@ muic: extcon@14 {
pinctrl-names = "default";
pinctrl-0 = <&muic_int_default>;
+
+ usb_con: connector {
+ compatible = "usb-b-connector";
+ label = "micro-USB";
+ type = "micro";
+ };
};
};
@@ -23,6 +23,12 @@ / {
chassis-type = "handset";
};
+&battery {
+ charge-term-current-microamp = <200000>;
+ constant-charge-current-max-microamp = <1500000>;
+ constant-charge-voltage-max-microvolt = <4350000>;
+};
+
&blsp_i2c5 {
status = "okay";
@@ -23,6 +23,13 @@ / {
chassis-type = "handset";
};
+&battery {
+ charge-term-current-microamp = <200000>;
+ constant-charge-current-max-microamp = <1500000>;
+ constant-charge-voltage-max-microvolt = <4350000>;
+};
+
+
&pm8916_l17 {
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3000000>;
@@ -41,6 +41,12 @@ led-keyled {
};
};
+&battery {
+ charge-term-current-microamp = <150000>;
+ constant-charge-current-max-microamp = <1000000>;
+ constant-charge-voltage-max-microvolt = <4400000>;
+};
+
®_motor_vdd {
gpio = <&tlmm 72 GPIO_ACTIVE_HIGH>;
};
@@ -33,6 +33,15 @@ tz-apps@85500000 {
};
};
+ battery: battery {
+ compatible = "simple-battery";
+ charge-term-current-microamp = <150000>;
+ constant-charge-current-max-microamp = <1500000>;
+ constant-charge-voltage-max-microvolt = <4300000>;
+ precharge-current-microamp = <450000>;
+ precharge-upper-limit-microvolt = <3500000>;
+ };
+
gpio-hall-sensor {
compatible = "gpio-keys";
@@ -82,7 +91,7 @@ i2c-fg {
#address-cells = <1>;
#size-cells = <0>;
- battery@35 {
+ fuel-gauge@35 {
compatible = "richtek,rt5033-battery";
reg = <0x35>;
@@ -91,6 +100,8 @@ battery@35 {
pinctrl-0 = <&fg_alert_default>;
pinctrl-names = "default";
+
+ power-supplies = <&charger>;
};
};
@@ -286,6 +297,12 @@ muic: extcon@25 {
pinctrl-0 = <&muic_int_default>;
pinctrl-names = "default";
+
+ usb_con: connector {
+ compatible = "usb-b-connector";
+ label = "micro-USB";
+ type = "micro";
+ };
};
};
@@ -319,6 +336,42 @@ touchscreen@24 {
};
};
+&blsp_i2c6 {
+ status = "okay";
+
+ pmic@34 {
+ compatible = "richtek,rt5033";
+ reg = <0x34>;
+
+ interrupts-extended = <&tlmm 62 IRQ_TYPE_EDGE_FALLING>;
+
+ pinctrl-0 = <&pmic_int_default>;
+ pinctrl-names = "default";
+
+ regulators {
+ rt5033_reg_safe_ldo: SAFE_LDO {
+ regulator-min-microvolt = <4900000>;
+ regulator-max-microvolt = <4900000>;
+ regulator-always-on;
+ };
+
+ /*
+ * Needed for camera, but not used yet.
+ * Define empty nodes to allow disabling the unused
+ * regulators.
+ */
+ LDO {};
+ BUCK {};
+ };
+
+ charger: charger {
+ compatible = "richtek,rt5033-charger";
+ monitored-battery = <&battery>;
+ richtek,usb-connector = <&usb_con>;
+ };
+ };
+};
+
&blsp_uart2 {
status = "okay";
};
@@ -504,6 +557,13 @@ nfc_i2c_default: nfc-i2c-default-state {
bias-disable;
};
+ pmic_int_default: pmic-int-default-state {
+ pins = "gpio62";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-disable;
+ };
+
reg_tsp_en_default: reg-tsp-en-default-state {
pins = "gpio73";
function = "gpio";