]> www.infradead.org Git - linux.git/commitdiff
arm64: dts: qcom: msm8916-samsung-gprimeltecan: Add NFC
authorJoe Mason <buddyjojo06@outlook.com>
Sat, 1 Jun 2024 11:53:57 +0000 (11:53 +0000)
committerBjorn Andersson <andersson@kernel.org>
Thu, 6 Jun 2024 03:02:30 +0000 (22:02 -0500)
The Samsung Galaxy Grand Prime CAN has a Samsung S3FWRN5 NFC chip that
works quite well with the s3fwrn5 driver in the Linux NFC subsystem.

The clock setup for the NFC chip is a bit special (although this
seems to be a common approach used for Qualcomm devices with NFC):

The NFC chip has an output GPIO that is asserted whenever the clock
is needed to function properly. On the A3/A5 this is wired up to
PM8916 GPIO2, which is then configured with a special function
(NFC_CLK_REQ or BB_CLK2_REQ).

Enabling the rpmcc RPM_SMD_BB_CLK2_PIN clock will then instruct
PM8916 to automatically enable the clock whenever the NFC chip
requests it. The advantage is that the clock is only enabled when
needed and we don't need to manage it ourselves from the NFC driver.

Signed-off-by: Joe Mason <buddyjojo06@outlook.com>
[Stephan: Put NFC pinctrl into common dtsi to share it with other variants]
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
[Raymond: Use interrupts-extended. Keep &blsp_i2c6 enabled by default]
Signed-off-by: Raymond Hackley <raymondhackley@protonmail.com>
Link: https://lore.kernel.org/r/20240601115321.25314-2-raymondhackley@protonmail.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
arch/arm64/boot/dts/qcom/msm8916-samsung-fortuna-common.dtsi
arch/arm64/boot/dts/qcom/msm8916-samsung-gprimeltecan.dts

index 4f05cae68b37e03f07379658d6135d4ad955a836..4cc83b64e256147db816a5fd09beaae8015ab61d 100644 (file)
@@ -6,6 +6,7 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
 
 / {
        aliases {
        };
 };
 
+&blsp_i2c6 {
+       status = "okay";
+};
+
 &blsp_uart2 {
        status = "okay";
 };
                bias-disable;
        };
 
+       nfc_default: nfc-default-state {
+               irq-pins {
+                       pins = "gpio21";
+                       function = "gpio";
+                       drive-strength = <2>;
+                       bias-pull-down;
+               };
+
+               nfc-pins {
+                       pins = "gpio20", "gpio49";
+                       function = "gpio";
+                       drive-strength = <2>;
+                       bias-disable;
+               };
+       };
+
+       nfc_i2c_default: nfc-i2c-default-state {
+               pins = "gpio0", "gpio1";
+               function = "gpio";
+               drive-strength = <2>;
+               bias-disable;
+       };
+
        sdc2_cd_default: sdc2-cd-default-state {
                pins = "gpio38";
                function = "gpio";
                bias-disable;
        };
 };
+
+&pm8916_gpios {
+       nfc_clk_req: nfc-clk-req-state {
+               pins = "gpio2";
+               function = "func1";
+               power-source = <PM8916_GPIO_L2>;
+               bias-disable;
+               input-enable;
+       };
+};
index 4dc74e8bf1d827b98d9fa376d7c6d00c295bdebc..7ac86fd3c703d1e247b7e20e197e35d275a5aa78 100644 (file)
        status = "okay";
 };
 
+&blsp_i2c6 {
+       nfc@27 {
+               compatible = "samsung,s3fwrn5-i2c";
+               reg = <0x27>;
+
+               interrupts-extended = <&tlmm 21 IRQ_TYPE_EDGE_RISING>;
+
+               en-gpios = <&tlmm 20 GPIO_ACTIVE_HIGH>;
+               wake-gpios = <&tlmm 49 GPIO_ACTIVE_HIGH>;
+
+               clocks = <&rpmcc RPM_SMD_BB_CLK2_PIN>;
+
+               pinctrl-0 = <&nfc_default>, <&nfc_clk_req>;
+               pinctrl-names = "default";
+       };
+};
+
 &mpss_mem {
        /* Firmware for gprimeltecan needs more space */
        reg = <0x0 0x86800000 0x0 0x5400000>;