From patchwork Sat Jan 30 17:29:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timon Baetz X-Patchwork-Id: 373935 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44E37C433DB for ; Sat, 30 Jan 2021 17:30:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1266364E13 for ; Sat, 30 Jan 2021 17:30:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231970AbhA3RaH (ORCPT ); Sat, 30 Jan 2021 12:30:07 -0500 Received: from mail-40133.protonmail.ch ([185.70.40.133]:16572 "EHLO mail-40133.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231903AbhA3RaG (ORCPT ); Sat, 30 Jan 2021 12:30:06 -0500 Date: Sat, 30 Jan 2021 17:29:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1612027764; bh=Jef0sxyvy4V4e51bjeysAtFKH9/BhUi4CG0LIgwACFY=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=scN7H758NYWgDlCXSVPD5gadJ2SYKpQqwWxUa/KnXQBRi+0yokF8UD4Z4jIfLaC2k xewkoOTJigChipX+d0+7qLJ3JTiAr0HHILUUbEiURVt+0N3Pm5tweH8UTCYn+IYTAA mO7T2vMK9l+7cTCSPafgsSg9OZoxsL0dTId14pPk= To: Liam Girdwood , Mark Brown , Krzysztof Kozlowski , Rob Herring , Sebastian Reichel From: Timon Baetz Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, Timon Baetz Reply-To: Timon Baetz Subject: [PATCH 1/3] regulator: dt-bindings: Document charger-supply for max8997 Message-ID: <20210130172747.2022977-2-timon.baetz@protonmail.com> In-Reply-To: <20210130172747.2022977-1-timon.baetz@protonmail.com> References: <20210130172747.2022977-1-timon.baetz@protonmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Add charger-supply optional property to enable charging control. Signed-off-by: Timon Baetz --- .../devicetree/bindings/regulator/max8997-regulator.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/regulator/max8997-regulator.txt b/Documentation/devicetree/bindings/regulator/max8997-regulator.txt index 6fe825b8ac1b..b53c5e2b335f 100644 --- a/Documentation/devicetree/bindings/regulator/max8997-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/max8997-regulator.txt @@ -35,6 +35,7 @@ Optional properties: - interrupts: Interrupt specifiers for two interrupt sources. - First interrupt specifier is for 'irq1' interrupt. - Second interrupt specifier is for 'alert' interrupt. +- charger-supply: regulator node for charging current. - max8997,pmic-buck1-uses-gpio-dvs: 'buck1' can be controlled by gpio dvs. - max8997,pmic-buck2-uses-gpio-dvs: 'buck2' can be controlled by gpio dvs. - max8997,pmic-buck5-uses-gpio-dvs: 'buck5' can be controlled by gpio dvs. From patchwork Sat Jan 30 17:29:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timon Baetz X-Patchwork-Id: 374145 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93EC3C433E6 for ; Sat, 30 Jan 2021 17:30:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6416664E09 for ; Sat, 30 Jan 2021 17:30:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232062AbhA3RaX (ORCPT ); Sat, 30 Jan 2021 12:30:23 -0500 Received: from mail-40133.protonmail.ch ([185.70.40.133]:61042 "EHLO mail-40133.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232054AbhA3RaW (ORCPT ); Sat, 30 Jan 2021 12:30:22 -0500 Date: Sat, 30 Jan 2021 17:29:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1612027780; bh=4eVGT5fGnXBDwcPzfkmp9J/JieDPT6/ded3iof5KfOA=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=wChuA3TIYOvugxz0FnaYnnTCRwfUv25nY692W4mkM1Azx/pv2ZwhaXry8oF1kk5ML RDqFIJfiCGrHOkC5FwOPL9buNO+WqKF/RqbZ2MqFFG78fw2ALi4Uqe1fWQt1VQfeiK G5MIPtbNSwPIBzKqVo3V4sJFK5Vx6YqQ2EKmH1r0= To: Liam Girdwood , Mark Brown , Krzysztof Kozlowski , Rob Herring , Sebastian Reichel From: Timon Baetz Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, Timon Baetz Reply-To: Timon Baetz Subject: [PATCH 2/3] ARM: dts: exynos: Add charger supply for I9100 Message-ID: <20210130172747.2022977-3-timon.baetz@protonmail.com> In-Reply-To: <20210130172747.2022977-1-timon.baetz@protonmail.com> References: <20210130172747.2022977-1-timon.baetz@protonmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org The regulator is used for charging control by max8997_charger driver. Signed-off-by: Timon Baetz --- arch/arm/boot/dts/exynos4210-i9100.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/exynos4210-i9100.dts b/arch/arm/boot/dts/exynos4210-i9100.dts index 304a8ee2364c..dad950daafb4 100644 --- a/arch/arm/boot/dts/exynos4210-i9100.dts +++ b/arch/arm/boot/dts/exynos4210-i9100.dts @@ -384,6 +384,8 @@ pmic@66 { pinctrl-0 = <&max8997_irq>, <&otg_gp>, <&usb_sel>; pinctrl-names = "default"; + charger-supply = <&charger_reg>; + regulators { vadc_reg: LDO1 { regulator-name = "VADC_3.3V_C210"; From patchwork Sat Jan 30 17:30:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timon Baetz X-Patchwork-Id: 373934 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 953C3C433E6 for ; Sat, 30 Jan 2021 17:31:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A9A364DE1 for ; Sat, 30 Jan 2021 17:31:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231397AbhA3RbI (ORCPT ); Sat, 30 Jan 2021 12:31:08 -0500 Received: from mail1.protonmail.ch ([185.70.40.18]:45541 "EHLO mail1.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231565AbhA3RbG (ORCPT ); Sat, 30 Jan 2021 12:31:06 -0500 Date: Sat, 30 Jan 2021 17:30:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1612027817; bh=oQy4RevNDWFClH37MnwytBl8YcA2kgCeFHUG6CufrzE=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=RyCG1sqmI4l0wPx1P5Qgj3Zu5LJqGikvt9h7HNMPTiRdk0Zg91K07J8dwktAtCZMR yQtNtj+aBRVs1md5Kd28/+p11tIJym2pbHhA5BvG2NJyA3qWSpFLLJmJrxVUSZjlwr JVRahuP3RPLPKTs3fsLeIHG/D87jly/ZQbQzbYW0= To: Liam Girdwood , Mark Brown , Krzysztof Kozlowski , Rob Herring , Sebastian Reichel From: Timon Baetz Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, Timon Baetz Reply-To: Timon Baetz Subject: [PATCH 3/3] power: supply: max8997_charger: Switch to new binding Message-ID: <20210130172747.2022977-4-timon.baetz@protonmail.com> In-Reply-To: <20210130172747.2022977-1-timon.baetz@protonmail.com> References: <20210130172747.2022977-1-timon.baetz@protonmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Get regulator from parent device's node and extcon by name. Signed-off-by: Timon Baetz Reviewed-by: Krzysztof Kozlowski --- drivers/power/supply/max8997_charger.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/power/supply/max8997_charger.c b/drivers/power/supply/max8997_charger.c index 321bd6b8ee41..625d8cc4312a 100644 --- a/drivers/power/supply/max8997_charger.c +++ b/drivers/power/supply/max8997_charger.c @@ -168,6 +168,7 @@ static int max8997_battery_probe(struct platform_device *pdev) int ret = 0; struct charger_data *charger; struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent); + struct device_node *np = pdev->dev.of_node; struct i2c_client *i2c = iodev->i2c; struct max8997_platform_data *pdata = iodev->pdata; struct power_supply_config psy_cfg = {}; @@ -237,20 +238,23 @@ static int max8997_battery_probe(struct platform_device *pdev) return PTR_ERR(charger->battery); } + // grab regulator from parent device's node + pdev->dev.of_node = iodev->dev->of_node; charger->reg = devm_regulator_get_optional(&pdev->dev, "charger"); + pdev->dev.of_node = np; if (IS_ERR(charger->reg)) { if (PTR_ERR(charger->reg) == -EPROBE_DEFER) return -EPROBE_DEFER; dev_info(&pdev->dev, "couldn't get charger regulator\n"); } - charger->edev = extcon_get_edev_by_phandle(&pdev->dev, 0); - if (IS_ERR(charger->edev)) { - if (PTR_ERR(charger->edev) == -EPROBE_DEFER) + charger->edev = extcon_get_extcon_dev("max8997-muic"); + if (IS_ERR_OR_NULL(charger->edev)) { + if (!charger->edev) return -EPROBE_DEFER; dev_info(charger->dev, "couldn't get extcon device\n"); } - if (!IS_ERR(charger->reg) && !IS_ERR(charger->edev)) { + if (!IS_ERR(charger->reg) && !IS_ERR_OR_NULL(charger->edev)) { INIT_WORK(&charger->extcon_work, max8997_battery_extcon_evt_worker); ret = devm_add_action(&pdev->dev, max8997_battery_extcon_evt_stop_work, charger); if (ret) {