From patchwork Thu Jun 22 02:05:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lin, Meng-Bo" X-Patchwork-Id: 695868 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F381EB64DC for ; Thu, 22 Jun 2023 02:05:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230230AbjFVCFh (ORCPT ); Wed, 21 Jun 2023 22:05:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbjFVCFg (ORCPT ); Wed, 21 Jun 2023 22:05:36 -0400 X-Greylist: delayed 77 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 21 Jun 2023 19:05:32 PDT Received: from mail-40140.protonmail.ch (mail-40140.protonmail.ch [185.70.40.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 878191BD8; Wed, 21 Jun 2023 19:05:32 -0700 (PDT) Date: Thu, 22 Jun 2023 02:05:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1687399530; x=1687658730; bh=uIImkaJUqEIc4EnN1u23yWQQQI9ILKskx9wiXhE1ldM=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=C3ClYcTssq1Vu2nWdNc92Khz9hdkZelqa6LM+pU9NukIe8kweBetyyxEedAJ2CUac xCmL/nl53Nsx8D4dWdjUK0xnQPsz1i/DFcUEh8gbHYTNczV+rbzmHt8AZCUTFM2UYF es0BN+CclC1UFc1qDC1QjBeoFfoqx7Lq5Jx15xIdR/XH1znSYaDDjC/x1F0pv0s7Gf e+8GnJu2x8cxDy3SdHCCyjcp4046VrDwVoIuLDu31S9NjEEtBpw3FXTaqEzIQPQBR7 Apa8imih8wsNzUKeaCGqYS70tjIDfpctEGgBAJcik2IzyLHrGbc6YEJppZhYGdDYFW 6jMJQx+a24vFw== To: linux-kernel@vger.kernel.org From: "Lin, Meng-Bo" Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Stephan Gerhold , Nikita Travkin , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht Subject: [PATCH 5/8] arm64: dts: qcom: msm8939-samsung-a7: Add rt5033 battery Message-ID: <20230622020515.65823-1-linmengbo0689@protonmail.com> In-Reply-To: <20230622020344.65745-1-linmengbo0689@protonmail.com> References: <20230622020344.65745-1-linmengbo0689@protonmail.com> Feedback-ID: 40467236:user:proton MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The Samsung Galaxy A7 uses a Richtek RT5033 PMIC as battery fuel gauge, charger, flash LED and for some regulators. For now, only add the fuel gauge/battery device to the device tree, so we can check the remaining battery percentage. The other RT5033 drivers need some more work first before they can be used properly. Signed-off-by: Lin, Meng-Bo --- .../boot/dts/qcom/msm8939-samsung-a7.dts | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/msm8939-samsung-a7.dts b/arch/arm64/boot/dts/qcom/msm8939-samsung-a7.dts index 6a817038a3b9..271dcea6da94 100644 --- a/arch/arm64/boot/dts/qcom/msm8939-samsung-a7.dts +++ b/arch/arm64/boot/dts/qcom/msm8939-samsung-a7.dts @@ -69,6 +69,29 @@ button-home { }; }; + i2c-fg { + compatible = "i2c-gpio"; + sda-gpios = <&tlmm 106 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + scl-gpios = <&tlmm 105 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + + pinctrl-0 = <&fg_i2c_default>; + pinctrl-names = "default"; + + #address-cells = <1>; + #size-cells = <0>; + + battery@35 { + compatible = "richtek,rt5033-battery"; + reg = <0x35>; + + interrupt-parent = <&tlmm>; + interrupts = <121 IRQ_TYPE_EDGE_BOTH>; + + pinctrl-0 = <&fg_alert_default>; + pinctrl-names = "default"; + }; + }; + i2c-sensor { compatible = "i2c-gpio"; sda-gpios = <&tlmm 84 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; @@ -234,6 +257,20 @@ accel_int_default: accel-int-default-state { bias-disable; }; + fg_alert_default: fg-alert-default-state { + pins = "gpio121"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + + fg_i2c_default: fg-i2c-default-state { + pins = "gpio105", "gpio106"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + gpio_hall_sensor_default: gpio-hall-sensor-default-state { pins = "gpio52"; function = "gpio";