diff mbox series

[1/5] arm64: dts: qcom: msm8916-samsung-a2015: Add touch key

Message ID 20210604172742.10593-1-stephan@gerhold.net
State Accepted
Commit 61f363a625fcbff93171a271b898fcf37dd367c3
Headers show
Series [1/5] arm64: dts: qcom: msm8916-samsung-a2015: Add touch key | expand

Commit Message

Stephan Gerhold June 4, 2021, 5:27 p.m. UTC
The Samsung Galaxy A3/A5 both have two capacitive touch keys,
connected to an ABOV MCU. It implements the same interface as
implemented by the tm2-touchkey driver and works just fine with
the coreriver,tc360-touchkey compatible. It's probably actually some
Samsung-specific interface that they implement with different MCUs.

Note that for some reason Samsung decided to connect this to GPIOs
where no hardware I2C bus is available, so we need to fall back
to software bit-banging using i2c-gpio.

The vdd/vcc-supply is board-specific and will be added separately
for a3u/a5u.

Co-developed-by: Michael Srba <Michael.Srba@seznam.cz>
Signed-off-by: Michael Srba <Michael.Srba@seznam.cz>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 .../qcom/msm8916-samsung-a2015-common.dtsi    | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)

Comments

Krzysztof Kozlowski June 7, 2021, 8:23 a.m. UTC | #1
On 04/06/2021 19:27, Stephan Gerhold wrote:
> The Samsung Galaxy A3/A5 both have 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.

> 

> Note that for some reason Samsung decided to connect the I2C pins

> to GPIOs where no hardware I2C bus is available, so we need to

> fall back to software bit-banging with i2c-gpio.

> 

> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>

> ---

>  .../qcom/msm8916-samsung-a2015-common.dtsi    | 64 +++++++++++++++++++

>  1 file changed, 64 insertions(+)

> 



Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>



Best regards,
Krzysztof
patchwork-bot+linux-arm-msm@kernel.org June 10, 2021, 2:50 p.m. UTC | #2
Hello:

This series was applied to qcom/linux.git (refs/heads/for-next):

On Fri,  4 Jun 2021 19:27:38 +0200 you wrote:
> The Samsung Galaxy A3/A5 both have two capacitive touch keys,

> connected to an ABOV MCU. It implements the same interface as

> implemented by the tm2-touchkey driver and works just fine with

> the coreriver,tc360-touchkey compatible. It's probably actually some

> Samsung-specific interface that they implement with different MCUs.

> 

> Note that for some reason Samsung decided to connect this to GPIOs

> where no hardware I2C bus is available, so we need to fall back

> to software bit-banging using i2c-gpio.

> 

> [...]


Here is the summary with links:
  - [1/5] arm64: dts: qcom: msm8916-samsung-a2015: Add touch key
    https://git.kernel.org/qcom/c/61f363a625fc
  - [2/5] arm64: dts: qcom: msm8916-samsung-a3u: Add touch key regulators
    https://git.kernel.org/qcom/c/92b5c3975b3b
  - [3/5] arm64: dts: qcom: msm8916-samsung-a5u: Add touch key regulator
    https://git.kernel.org/qcom/c/410040777744
  - [4/5] arm64: dts: qcom: msm8916-samsung-a2015: Add rt5033 battery
    https://git.kernel.org/qcom/c/0c04d16f4123
  - [5/5] arm64: dts: qcom: msm8916-samsung-a2015: Add NFC
    https://git.kernel.org/qcom/c/5e57e5d0d622

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

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 230ba3ce3277..3c77e7ef9eda 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi
@@ -95,6 +95,35 @@  muic: extcon@25 {
 			pinctrl-0 = <&muic_int_default>;
 		};
 	};
+
+	i2c-tkey {
+		compatible = "i2c-gpio";
+		sda-gpios = <&msmgpio 16 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+		scl-gpios = <&msmgpio 17 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&tkey_i2c_default>;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		touchkey: touchkey@20 {
+			/* Note: Actually an ABOV MCU that implements same interface */
+			compatible = "coreriver,tc360-touchkey";
+			reg = <0x20>;
+
+			interrupt-parent = <&msmgpio>;
+			interrupts = <98 IRQ_TYPE_EDGE_FALLING>;
+
+			/* vcc/vdd-supply are board-specific */
+			vddio-supply = <&pm8916_l6>;
+
+			linux,keycodes = <KEY_APPSELECT KEY_BACK>;
+
+			pinctrl-names = "default";
+			pinctrl-0 = <&tkey_default>;
+		};
+	};
 };
 
 &blsp_i2c2 {
@@ -333,6 +362,22 @@  muic_int_default: muic-int-default {
 		bias-disable;
 	};
 
+	tkey_default: tkey-default {
+		pins = "gpio98";
+		function = "gpio";
+
+		drive-strength = <2>;
+		bias-disable;
+	};
+
+	tkey_i2c_default: tkey-i2c-default {
+		pins = "gpio16", "gpio17";
+		function = "gpio";
+
+		drive-strength = <2>;
+		bias-disable;
+	};
+
 	tsp_en_default: tsp-en-default {
 		pins = "gpio73";
 		function = "gpio";