2023-07-16 22:23:28

by Markuss Broks

[permalink] [raw]
Subject: [PATCH 0/7] Add various peripheral support for K3G

This series adds support for some peripherals installed on
Samsung Galaxy S5 (SM-G900H). This includes the WiFi card,
GPIO keys, fuel gauge, touchkeys, notification LED and display.
Also documents the peripherals for which we currently lack drivers.

Markuss Broks (7):
ARM: dts: exynos: k3g: Add WiFi card support
ARM: dts: exynos: Add GPIO keys support for k3g
ARM: dts: exynos: k3g: Add fuel gauge support
ARM: dts: exynos: k3g: Add touchkeys support
ARM: dts: exynos: k3g: Add notification LED support
ARM: dts: exynos: k3g: Document the devices which are not supported
ARM: dts: exynos: k3g: Add display support

arch/arm/boot/dts/exynos5422-samsung-k3g.dts | 256 +++++++++++++++++++
1 file changed, 256 insertions(+)

--
2.41.0



2023-07-16 22:23:28

by Markuss Broks

[permalink] [raw]
Subject: [PATCH 5/7] ARM: dts: exynos: k3g: Add notification LED support

This device has a Texas Instruments LP5562 LED controller
which controls the LEDs which are used as notification lights.
It has three colors which can be combined, supports pulse mode
and other various features.

Signed-off-by: Markuss Broks <[email protected]>
---
arch/arm/boot/dts/exynos5422-samsung-k3g.dts | 47 ++++++++++++++++++++
1 file changed, 47 insertions(+)

diff --git a/arch/arm/boot/dts/exynos5422-samsung-k3g.dts b/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
index b3576a745054..813dbf0438de 100644
--- a/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
+++ b/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
@@ -10,6 +10,7 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/leds/common.h>
#include "exynos5800.dtsi"
#include "exynos5422-cpus.dtsi"

@@ -131,6 +132,52 @@ touchkey@20 {
};
};

+ i2c-led {
+ compatible = "i2c-gpio";
+
+ sda-gpios = <&gpy3 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+ scl-gpios = <&gpy3 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+ i2c-gpio,delay-us = <2>;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ lp5562@30 {
+ compatible = "ti,lp5562";
+ reg = <0x30>;
+
+ clock-mode = /bits/ 8 <2>;
+ label = "notification-leds";
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ led@0 {
+ reg = <0>;
+ chan-name = "notification-red";
+ color = <LED_COLOR_ID_RED>;
+ led-cur = /bits/ 8 <0x40>;
+ max-cur = /bits/ 8 <0x40>;
+ };
+
+ led@1 {
+ reg = <1>;
+ chan-name = "notification-green";
+ color = <LED_COLOR_ID_GREEN>;
+ led-cur = /bits/ 8 <0x40>;
+ max-cur = /bits/ 8 <0x40>;
+ };
+
+ led@2 {
+ reg = <2>;
+ chan-name = "notification-blue";
+ color = <LED_COLOR_ID_BLUE>;
+ led-cur = /bits/ 8 <0x40>;
+ max-cur = /bits/ 8 <0x40>;
+ };
+ };
+ };
+
tsp_vdd: regulator-tsp-vdd-en {
compatible = "regulator-fixed";
regulator-name = "tsp_vdd_en";
--
2.41.0


2023-07-16 22:24:05

by Markuss Broks

[permalink] [raw]
Subject: [PATCH 2/7] ARM: dts: exynos: Add GPIO keys support for k3g

Add the four physical buttons support, volume buttons have
external pull-up resistors.

Signed-off-by: Markuss Broks <[email protected]>
---
arch/arm/boot/dts/exynos5422-samsung-k3g.dts | 60 ++++++++++++++++++++
1 file changed, 60 insertions(+)

diff --git a/arch/arm/boot/dts/exynos5422-samsung-k3g.dts b/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
index 1a11a6993ba7..c3e006dc34ea 100644
--- a/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
+++ b/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
@@ -8,6 +8,7 @@
/dts-v1/;
#include <dt-bindings/clock/samsung,s2mps11.h>
#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include "exynos5800.dtsi"
#include "exynos5422-cpus.dtsi"
@@ -21,6 +22,45 @@ / {

aliases {
mmc0 = &mmc_0;
+ mmc1 = &mmc_1;
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&power_gpio &volume_up_gpio &volume_down_gpio &home_gpio>;
+
+ key-volume-up {
+ label = "Volume Up";
+ gpios = <&gpx0 2 GPIO_ACTIVE_LOW>;
+ linux,input-type = <1>;
+ linux,code = <KEY_VOLUMEUP>;
+ debounce-interval = <15>;
+ };
+
+ key-volume-down {
+ label = "Volume Down";
+ gpios = <&gpx0 3 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_VOLUMEDOWN>;
+ debounce-interval = <15>;
+ };
+
+ key-home {
+ label = "Home";
+ gpios = <&gpx0 5 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_HOMEPAGE>;
+ wakeup-source;
+ debounce-interval = <15>;
+ };
+
+ key-power {
+ label = "Power";
+ gpios = <&gpx2 2 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_POWER>;
+ wakeup-source;
+ debounce-interval = <15>;
+ };
};

memory@20000000 {
@@ -641,6 +681,21 @@ &mmc_1 {
};

&pinctrl_0 {
+ volume_up_gpio: volume-up-pins {
+ samsung,pins = "gpx0-2";
+ samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>; /* External pull up */
+ };
+
+ volume_down_gpio: volume-down-pins {
+ samsung,pins = "gpx0-3";
+ samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>; /* External pull up */
+ };
+
+ home_gpio: home-key-pins {
+ samsung,pins = "gpx0-5";
+ samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
+ };
+
s2mps11_irq: s2mps11-irq-pins {
samsung,pins = "gpx0-7";
samsung,pin-function = <EXYNOS_PIN_FUNC_F>;
@@ -653,6 +708,11 @@ touch_irq: touch-irq-pins {
samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>;
};

+ power_gpio: power-key-pins {
+ samsung,pins = "gpx2-2";
+ samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
+ };
+
wlan_reset: wlan-reset {
samsung,pins = "gpy7-7";
samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
--
2.41.0


2023-07-16 22:30:02

by Markuss Broks

[permalink] [raw]
Subject: [PATCH 1/7] ARM: dts: exynos: k3g: Add WiFi card support

This device has Broadcom BCM4354 WiFi card installed,
which uses SDIO interface.

Signed-off-by: Markuss Broks <[email protected]>
---
arch/arm/boot/dts/exynos5422-samsung-k3g.dts | 29 ++++++++++++++++++++
1 file changed, 29 insertions(+)

diff --git a/arch/arm/boot/dts/exynos5422-samsung-k3g.dts b/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
index c35261a338ff..1a11a6993ba7 100644
--- a/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
+++ b/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
@@ -48,6 +48,13 @@ tsp_vdd: regulator-tsp-vdd-en {
gpio = <&gpy3 5 GPIO_ACTIVE_HIGH>;
enable-active-high;
};
+
+ wlan_pwrseq: wlan-pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ reset-gpios = <&gpy7 7 GPIO_ACTIVE_LOW>; /* WIFI_EN */
+ clocks = <&s2mps11_osc S2MPS11_CLK_BT>; /* Used not only for Bluetooth */
+ clock-names = "ext_clock";
+ };
};

&cpu0 {
@@ -616,6 +623,23 @@ &mmc_0 {
bus-width = <8>;
};

+/* WiFi SDIO module */
+&mmc_1 {
+ status = "okay";
+ cap-sdio-irq;
+ cap-sd-highspeed;
+ non-removable;
+ samsung,dw-mshc-ciu-div = <1>;
+ samsung,dw-mshc-sdr-timing = <0 1>;
+ samsung,dw-mshc-ddr-timing = <0 2>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&sd1_clk>, <&sd1_cmd>, <&sd1_int>, <&sd1_bus1>,
+ <&sd1_bus4>, <&wlan_reset>;
+ bus-width = <4>;
+ vqmmc-supply = <&ldo3_reg>;
+ mmc-pwrseq = <&wlan_pwrseq>;
+};
+
&pinctrl_0 {
s2mps11_irq: s2mps11-irq-pins {
samsung,pins = "gpx0-7";
@@ -628,6 +652,11 @@ touch_irq: touch-irq-pins {
samsung,pins = "gpx1-6";
samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>;
};
+
+ wlan_reset: wlan-reset {
+ samsung,pins = "gpy7-7";
+ samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
+ };
};

&rtc {
--
2.41.0


2023-07-16 22:31:12

by Markuss Broks

[permalink] [raw]
Subject: [PATCH 4/7] ARM: dts: exynos: k3g: Add touchkeys support

This device has touch keys that are compatible with those
installed on Samsung TM2 dev board.

Signed-off-by: Markuss Broks <[email protected]>
---
arch/arm/boot/dts/exynos5422-samsung-k3g.dts | 32 ++++++++++++++++++++
1 file changed, 32 insertions(+)

diff --git a/arch/arm/boot/dts/exynos5422-samsung-k3g.dts b/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
index 582faedd6aab..b3576a745054 100644
--- a/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
+++ b/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
@@ -104,6 +104,33 @@ battery@36 {
};
};

+ i2c-touchkey {
+ compatible = "i2c-gpio";
+
+ sda-gpios = <&gpd1 4 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+ scl-gpios = <&gpd1 5 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+ i2c-gpio,delay-us = <2>;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ touchkey@20 {
+ compatible = "cypress,tm2-touchkey";
+ reg = <0x20>;
+
+ interrupt-parent = <&gpy7>;
+ interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&touchkey_irq>;
+
+ vcc-supply = <&ldo38_reg>;
+ vdd-supply = <&ldo30_reg>;
+
+ linux,keycodes = <KEY_APPSELECT KEY_BACK>;
+ };
+ };
+
tsp_vdd: regulator-tsp-vdd-en {
compatible = "regulator-fixed";
regulator-name = "tsp_vdd_en";
@@ -742,6 +769,11 @@ power_gpio: power-key-pins {
samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
};

+ touchkey_irq: touchkey-irq-pins {
+ samsung,pins = "gpy7-1";
+ samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>;
+ };
+
wlan_reset: wlan-reset {
samsung,pins = "gpy7-7";
samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
--
2.41.0


2023-07-16 22:31:21

by Markuss Broks

[permalink] [raw]
Subject: [PATCH 2/7] ARM: dts: exynos: k3g: Add GPIO keys support

Add the four physical buttons support, volume buttons have
external pull-up resistors.

Signed-off-by: Markuss Broks <[email protected]>
---
arch/arm/boot/dts/exynos5422-samsung-k3g.dts | 60 ++++++++++++++++++++
1 file changed, 60 insertions(+)

diff --git a/arch/arm/boot/dts/exynos5422-samsung-k3g.dts b/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
index 1a11a6993ba7..c3e006dc34ea 100644
--- a/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
+++ b/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
@@ -8,6 +8,7 @@
/dts-v1/;
#include <dt-bindings/clock/samsung,s2mps11.h>
#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include "exynos5800.dtsi"
#include "exynos5422-cpus.dtsi"
@@ -21,6 +22,45 @@ / {

aliases {
mmc0 = &mmc_0;
+ mmc1 = &mmc_1;
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&power_gpio &volume_up_gpio &volume_down_gpio &home_gpio>;
+
+ key-volume-up {
+ label = "Volume Up";
+ gpios = <&gpx0 2 GPIO_ACTIVE_LOW>;
+ linux,input-type = <1>;
+ linux,code = <KEY_VOLUMEUP>;
+ debounce-interval = <15>;
+ };
+
+ key-volume-down {
+ label = "Volume Down";
+ gpios = <&gpx0 3 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_VOLUMEDOWN>;
+ debounce-interval = <15>;
+ };
+
+ key-home {
+ label = "Home";
+ gpios = <&gpx0 5 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_HOMEPAGE>;
+ wakeup-source;
+ debounce-interval = <15>;
+ };
+
+ key-power {
+ label = "Power";
+ gpios = <&gpx2 2 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_POWER>;
+ wakeup-source;
+ debounce-interval = <15>;
+ };
};

memory@20000000 {
@@ -641,6 +681,21 @@ &mmc_1 {
};

&pinctrl_0 {
+ volume_up_gpio: volume-up-pins {
+ samsung,pins = "gpx0-2";
+ samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>; /* External pull up */
+ };
+
+ volume_down_gpio: volume-down-pins {
+ samsung,pins = "gpx0-3";
+ samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>; /* External pull up */
+ };
+
+ home_gpio: home-key-pins {
+ samsung,pins = "gpx0-5";
+ samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
+ };
+
s2mps11_irq: s2mps11-irq-pins {
samsung,pins = "gpx0-7";
samsung,pin-function = <EXYNOS_PIN_FUNC_F>;
@@ -653,6 +708,11 @@ touch_irq: touch-irq-pins {
samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>;
};

+ power_gpio: power-key-pins {
+ samsung,pins = "gpx2-2";
+ samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
+ };
+
wlan_reset: wlan-reset {
samsung,pins = "gpy7-7";
samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
--
2.41.0


2023-07-19 09:08:18

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 0/7] Add various peripheral support for K3G

On 17/07/2023 00:05, Markuss Broks wrote:
> This series adds support for some peripherals installed on
> Samsung Galaxy S5 (SM-G900H). This includes the WiFi card,
> GPIO keys, fuel gauge, touchkeys, notification LED and display.
> Also documents the peripherals for which we currently lack drivers.
>
> Markuss Broks (7):
> ARM: dts: exynos: k3g: Add WiFi card support
> ARM: dts: exynos: Add GPIO keys support for k3g
> ARM: dts: exynos: k3g: Add fuel gauge support
> ARM: dts: exynos: k3g: Add touchkeys support
> ARM: dts: exynos: k3g: Add notification LED support
> ARM: dts: exynos: k3g: Document the devices which are not supported
> ARM: dts: exynos: k3g: Add display support
>
> arch/arm/boot/dts/exynos5422-samsung-k3g.dts | 256 +++++++++++++++++++

I don't think you based your tree on anything recent. Looks like
something 1 month old or even older. Please always, always base your
patches on maintainer's tree or recent linux-next.

Best regards,
Krzysztof


2023-07-19 09:21:55

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 2/7] ARM: dts: exynos: k3g: Add GPIO keys support

On 17/07/2023 00:05, Markuss Broks wrote:
> Add the four physical buttons support, volume buttons have
> external pull-up resistors.
>
> Signed-off-by: Markuss Broks <[email protected]>
> ---
> arch/arm/boot/dts/exynos5422-samsung-k3g.dts | 60 ++++++++++++++++++++
> 1 file changed, 60 insertions(+)
>

Is it a duplicate? You know it cannot be then applied?

Best regards,
Krzysztof


2023-07-19 09:26:37

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 1/7] ARM: dts: exynos: k3g: Add WiFi card support

On 17/07/2023 00:05, Markuss Broks wrote:
> This device has Broadcom BCM4354 WiFi card installed,
> which uses SDIO interface.
>
> Signed-off-by: Markuss Broks <[email protected]>
> ---


> &pinctrl_0 {
> s2mps11_irq: s2mps11-irq-pins {
> samsung,pins = "gpx0-7";
> @@ -628,6 +652,11 @@ touch_irq: touch-irq-pins {
> samsung,pins = "gpx1-6";
> samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>;
> };
> +
> + wlan_reset: wlan-reset {

It does not look like you tested the DTS against bindings. Please run
`make dtbs_check` (see
Documentation/devicetree/bindings/writing-schema.rst or
https://www.linaro.org/blog/tips-and-tricks-for-validating-devicetree-sources-with-the-devicetree-schema/
for instructions).

This is a requirement since few months (half a year?).

Best regards,
Krzysztof


2023-07-19 09:45:32

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 5/7] ARM: dts: exynos: k3g: Add notification LED support

On 17/07/2023 00:05, Markuss Broks wrote:
> This device has a Texas Instruments LP5562 LED controller
> which controls the LEDs which are used as notification lights.
> It has three colors which can be combined, supports pulse mode
> and other various features.
>
> Signed-off-by: Markuss Broks <[email protected]>
> ---
> arch/arm/boot/dts/exynos5422-samsung-k3g.dts | 47 ++++++++++++++++++++
> 1 file changed, 47 insertions(+)
>
> diff --git a/arch/arm/boot/dts/exynos5422-samsung-k3g.dts b/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
> index b3576a745054..813dbf0438de 100644
> --- a/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
> +++ b/arch/arm/boot/dts/exynos5422-samsung-k3g.dts
> @@ -10,6 +10,7 @@
> #include <dt-bindings/gpio/gpio.h>
> #include <dt-bindings/input/input.h>
> #include <dt-bindings/interrupt-controller/irq.h>
> +#include <dt-bindings/leds/common.h>
> #include "exynos5800.dtsi"
> #include "exynos5422-cpus.dtsi"
>
> @@ -131,6 +132,52 @@ touchkey@20 {
> };
> };
>
> + i2c-led {
> + compatible = "i2c-gpio";
> +
> + sda-gpios = <&gpy3 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
> + scl-gpios = <&gpy3 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
> + i2c-gpio,delay-us = <2>;
> +
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + lp5562@30 {

Node names should be generic. See also an explanation and list of
examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

Most likely this is led-controller



Best regards,
Krzysztof