From patchwork Thu Oct 4 19:34:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Oskari_Lemmel=C3=A4?= X-Patchwork-Id: 10626545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1D0AB174A for ; Thu, 4 Oct 2018 19:37:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06D962963A for ; Thu, 4 Oct 2018 19:37:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC4A42963E; Thu, 4 Oct 2018 19:37:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6F8632963B for ; Thu, 4 Oct 2018 19:37:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=iuLECIndfSefwEtCeZXD6pM5b9iDiz8R8JGxlkzdl84=; b=qP0Rwcrja3aBQselcZSJyND6d7 q4Kym106M0DElv3mO/iTssudg6vU99EcW4LHzt2lHfo7boQjjxAOqz96KJteOa+dY3xm7Oiz1EEiL XYzX6M0TBI7SWHqTGl1v8rv8tqGXbyIda/98tAbcut58CCAZygtvb3zgcYJhtf5rgm8GrBPS57hFZ ooq4pNRHYeJJtAw4RnxqGBxDf4qwUiZfmapMSrm5v/Lu5OJsFvJ2gWj8sUTNAXvH8p++4wttQ1Mdv BYNPSEYI8bWXtZe5yj6Dd5vg7RRE3Tx/zi9sz0o7t7r3pjySQdtz5HUwSXzg3wJSKuuNERbD7Ggo9 CJX8NrZg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g89Qh-0006Iv-Am; Thu, 04 Oct 2018 19:36:59 +0000 Received: from mail1.kuutio.org ([92.222.216.83]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g89Ol-00046L-Vj for linux-arm-kernel@lists.infradead.org; Thu, 04 Oct 2018 19:35:03 +0000 Received: from localhost (localhost [127.0.0.1]) by mail1.kuutio.org (Postfix) with ESMTP id 204101FBEE; Thu, 4 Oct 2018 21:34:43 +0200 (CEST) Authentication-Results: mail1.kuutio.org (amavisd-new); dkim=pass (4096-bit key) reason="pass (just generated, assumed good)" header.d=lemmela.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lemmela.net; h= references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received; s=dkim; t=1538681682; x= 1541273683; bh=aui2goVtbIMuvSKHLmP97Y1M6t8ncr2/0qbHdtYYsxU=; b=b JZ/t93aC4E9vh9QKMsgVQcKPz2QYqMqnyfh9BbjW9tdhhVfOBAY4gzQdMLU4evh6 K2cCdvBnmGG8Z7g/bFdOcWClaAlZRib2ykC5EzbfqeeptI2rbuHTdW2HuuoWzhe9 LraiwI9B6rEII+0dUy2dFkQoCykq7+fwGN9AwUKVEOlS4ofAPwhvhJiU6LspfOR+ t9MUdD9h/ENY3g8YAF0IjYWj1NVapOYUUyL4QoTWxPqYR00JZ8YawuFJtnnOBuq2 gIwg6wpivWeHd9JbjyeD3RNhTuKAbipjAN8UQ9ECEIHFOGnemKIsL0qXqAEgfT5k gpG6dbOEkyQ0Lch/eBqJlJftNEHD1gnHZrINi6AYQ7QGQerd6S5KLWTSgy7OxXpp kdLxAmdNnZdYOW3GrUklvFyXJz2VDJTAUdgiaVQXduEvwJlKu7/pLQ29glaXIKgW ICwhbcLM9LmkpBFIV+VnWKp5YJm5oA16vR4bwdM4DqAurQWilfQMIFt3/PP2qL4y ITljYbkX/UpNCwiLKIxs5fj1h3XjGypmw2c7cZ4HUW64TrKtGCva2GZQyKEiMElu z5fMoDCcFinAp5GXoo0oIn5A6lODG3y4lJoz+oENkx9iddZk2bCEyqAWyrCZEPBP h8cw99zHh0/w9jZ23l2hmKHNOqoDITPzfPCM13UR98= X-Virus-Scanned: amavisd-new at kuutio.org Received: from mail1.kuutio.org ([127.0.0.1]) by localhost (mail1.kuutio.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id y3vb2HUn1Ozs; Thu, 4 Oct 2018 21:34:42 +0200 (CEST) Received: from build.kuutio.org (unknown [IPv6:2001:998:13:e4::69]) by mail1.kuutio.org (Postfix) with ESMTPSA id 989431FBA4; Thu, 4 Oct 2018 21:34:41 +0200 (CEST) From: Oskari Lemmela To: Maxime Ripard , Sebastian Reichel , Jonathan Cameron , Chen-Yu Tsai , Mark Rutland , Rob Herring , Linus Walleij Subject: [PATCH 1/4] dt-bindings: add compatibles for AXP803 AC and battery power supplies Date: Thu, 4 Oct 2018 22:34:07 +0300 Message-Id: <20181004193410.7265-2-oskari@lemmela.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181004193410.7265-1-oskari@lemmela.net> References: <20181004193410.7265-1-oskari@lemmela.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181004_123500_332943_CA268BB7 X-CRM114-Status: GOOD ( 13.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Lars-Peter Clausen , linux-gpio@vger.kernel.org, linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Quentin Schulz , Oskari Lemmela , Peter Meerwald-Stadler , Hartmut Knaack , Lee Jones , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP AXP803 PMIC is register compatible with AXP813. AXP803/AXP813 are capable to limit input current and supply voltage. Signed-off-by: Oskari Lemmela --- Documentation/devicetree/bindings/gpio/gpio-axp209.txt | 3 ++- Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt | 3 ++- .../devicetree/bindings/power/supply/axp20x_ac_power.txt | 4 ++++ .../devicetree/bindings/power/supply/axp20x_battery.txt | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/gpio/gpio-axp209.txt b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt index fc42b2caa06d..da3c0efb5e76 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-axp209.txt +++ b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt @@ -11,6 +11,7 @@ This driver employs the per-pin muxing pattern. Required properties: - compatible: Should be one of: - "x-powers,axp209-gpio" + - "x-powers,axp803-gpio" - "x-powers,axp813-gpio" - #gpio-cells: Should be two. The first cell is the pin number and the second is the GPIO flags. @@ -67,7 +68,7 @@ GPIO0 | gpio_in, gpio_out, ldo, adc GPIO1 | gpio_in, gpio_out, ldo, adc GPIO2 | gpio_in, gpio_out -axp813 +axp8x3 ------ GPIO | Functions ------------------------ diff --git a/Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt b/Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt index 7a6313913923..247616099171 100644 --- a/Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt +++ b/Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt @@ -4,6 +4,7 @@ Required properties: - compatible: should be one of: - "x-powers,axp209-adc", - "x-powers,axp221-adc", + - "x-powers,axp803-adc", - "x-powers,axp813-adc", - #io-channel-cells: should be 1, @@ -39,7 +40,7 @@ AXP22x 2 | batt_chrg_i 3 | batt_dischrg_i -AXP813 +AXP8x3 ------ 0 | pmic_temp 1 | gpio0_v diff --git a/Documentation/devicetree/bindings/power/supply/axp20x_ac_power.txt b/Documentation/devicetree/bindings/power/supply/axp20x_ac_power.txt index 826e8a879121..97276a71e961 100644 --- a/Documentation/devicetree/bindings/power/supply/axp20x_ac_power.txt +++ b/Documentation/devicetree/bindings/power/supply/axp20x_ac_power.txt @@ -4,6 +4,8 @@ Required Properties: - compatible: One of: "x-powers,axp202-ac-power-supply" "x-powers,axp221-ac-power-supply" + "x-powers,axp803-ac-power-supply" + "x-powers,axp813-ac-power-supply" This node is a subnode of the axp20x PMIC. @@ -13,6 +15,8 @@ reading ADC channels from the AXP20X ADC. The AXP22X is only able to tell if an AC power supply is present and usable. +The AXP8X3 is able to limit current and supply voltage + Example: &axp209 { diff --git a/Documentation/devicetree/bindings/power/supply/axp20x_battery.txt b/Documentation/devicetree/bindings/power/supply/axp20x_battery.txt index 41916f69902c..780ebd7e3b84 100644 --- a/Documentation/devicetree/bindings/power/supply/axp20x_battery.txt +++ b/Documentation/devicetree/bindings/power/supply/axp20x_battery.txt @@ -4,6 +4,7 @@ Required Properties: - compatible, one of: "x-powers,axp209-battery-power-supply" "x-powers,axp221-battery-power-supply" + "x-powers,axp803-battery-power-supply" "x-powers,axp813-battery-power-supply" This node is a subnode of its respective PMIC DT node. From patchwork Thu Oct 4 19:34:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Oskari_Lemmel=C3=A4?= X-Patchwork-Id: 10626541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0762A174A for ; Thu, 4 Oct 2018 19:35:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9B5329546 for ; Thu, 4 Oct 2018 19:35:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDB1E29638; Thu, 4 Oct 2018 19:35:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 778F029546 for ; Thu, 4 Oct 2018 19:35:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ElZ/nhKy5EqI7OHs8rpcPtcn359OkGNbxGxdpSx09SY=; b=GvJnt+G/o523Hr47rb3yU2Ub61 3FBhTGf1il0zKG7hLFsP7Ayz0esfQ8xff9ywco3Ybi3AwYoWPiAjatZaMzwnzovYEr5PwWoqh2Ytl qw52ZNMHWDvRzt6POWDJ7V2q8HgeCUbx09hULHw40O7j/smahQHv3UlH9d+Wr/kXwwpfV+FCCce6T X0bEG4JVzQ9wObYNsMjqciFCkgQ7Ly4qEIGI5PuZgw4RrhWj6IhEASmrt9UGt5Y87i0oUS9HB6X3g Dl8Ba1J6lhGdv0YvR/jehf7voaGxATIojwx1aNN5vFa4tylfcIHMpkwf0wrePtCQyy7jVriz3yShs /2+Qgg5g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g89PS-0005gH-I3; Thu, 04 Oct 2018 19:35:42 +0000 Received: from mail1.kuutio.org ([92.222.216.83]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g89Oj-00046M-TS for linux-arm-kernel@lists.infradead.org; Thu, 04 Oct 2018 19:35:00 +0000 Received: from localhost (localhost [127.0.0.1]) by mail1.kuutio.org (Postfix) with ESMTP id C6B3E1FBA4; Thu, 4 Oct 2018 21:34:43 +0200 (CEST) Authentication-Results: mail1.kuutio.org (amavisd-new); dkim=pass (4096-bit key) reason="pass (just generated, assumed good)" header.d=lemmela.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lemmela.net; h= references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received; s=dkim; t=1538681683; x= 1541273684; bh=KKVyyBS4oW4DfmHiU/gqRxlOHearp/uEX7HgGQY69JU=; b=s 0faqtGJ4xcflRg0rkHPkg3nk8NDHGGnjVuoeHOnHl6aJLCPfv2ExZ6T4Ak4/cVUE cSsOP3XCVTQxqv2C9pxjcrWk1GkBUhq3PE+gND3q1xh1QDjW22Ospg7XY5laF3+F T1+sPhY9mdkjwHJRSwPGvv5u8Rah+nGYUvHLC0LA9FT409gD6tx9mcypIcoitSG/ VvLMRPxp4ryzVKP3gcHxxH/Q6bzIrzb2INn/d25BTSgLEtNrXDEEL8OrYx+P0wYK KU3CWT++yvj5dXYvdmaPbxnCgIWSels4axL57MFfa0bH28gqkM0GKRl30KLD4Ec0 wk7MXQY5miEK3AaQ6/scGKlcnurJAKAqVOwrK3zZdpY+fIrfcq8tdTBe5znDI0+S SnWDkmvsSAjuLB6A7XAa3OVele31YRa/Vx8GaxiBQadxqNASyfafHf+5JA4WcxAD jc0iismFAATSHySWuePKg4Wfr9ycoLOErbRkC5B2d9RCkY49Ailg8BJtqAmNYfY5 ooMTTqzAshfqT7qa66KmBe0aS09C4C/H5wKf4Itvbpx1TYNUioAnXzRopkHTq7uy PYg8eIB//Kv2q/7tfzrVmOxPTaQfSCYtjtDPtJvBrPPCNnZAjUzLxn5yXvAPtx6x mVJKn6hsiaDk3CP8rBlNR9R+RAIRkxJQCmvBxITGqM= X-Virus-Scanned: amavisd-new at kuutio.org Received: from mail1.kuutio.org ([127.0.0.1]) by localhost (mail1.kuutio.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id B_W0kFCemLKR; Thu, 4 Oct 2018 21:34:43 +0200 (CEST) Received: from build.kuutio.org (unknown [IPv6:2001:998:13:e4::69]) by mail1.kuutio.org (Postfix) with ESMTPSA id 6B4531F99C; Thu, 4 Oct 2018 21:34:42 +0200 (CEST) From: Oskari Lemmela To: Maxime Ripard , Sebastian Reichel , Jonathan Cameron , Chen-Yu Tsai , Mark Rutland , Rob Herring , Linus Walleij Subject: [PATCH 2/4] ARM: dtsi: axp81x: add AC power supply subnode Date: Thu, 4 Oct 2018 22:34:08 +0300 Message-Id: <20181004193410.7265-3-oskari@lemmela.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181004193410.7265-1-oskari@lemmela.net> References: <20181004193410.7265-1-oskari@lemmela.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181004_123458_643467_C2EA1A1B X-CRM114-Status: UNSURE ( 9.14 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Lars-Peter Clausen , linux-gpio@vger.kernel.org, linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Quentin Schulz , Oskari Lemmela , Peter Meerwald-Stadler , Hartmut Knaack , Lee Jones , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add AC power supply subnode for AXP81X PMIC. Signed-off-by: Oskari Lemmela --- arch/arm/boot/dts/axp81x.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/axp81x.dtsi b/arch/arm/boot/dts/axp81x.dtsi index 043c717dcef1..67c17151b584 100644 --- a/arch/arm/boot/dts/axp81x.dtsi +++ b/arch/arm/boot/dts/axp81x.dtsi @@ -69,6 +69,11 @@ }; }; + ac_power_supply: ac-power-supply { + compatible = "x-powers,axp813-ac-power-supply"; + status = "disabled"; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp813-battery-power-supply"; status = "disabled"; From patchwork Thu Oct 4 19:34:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Oskari_Lemmel=C3=A4?= X-Patchwork-Id: 10626539 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C529A174A for ; Thu, 4 Oct 2018 19:35:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3B7A29502 for ; Thu, 4 Oct 2018 19:35:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A678B29633; Thu, 4 Oct 2018 19:35:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B976029502 for ; Thu, 4 Oct 2018 19:35:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=EMZjqTQSAIiEN28+lcxLmTS/XlOJwKj28/UhFdKcVL8=; b=hqU+uC+VaEI34fzkZl9drDklEB wugWo/NiYtcX5ZI1pa1aSU2r7LSISUaBjzCFYp3ghseDSVmA//F9tRvgY2I6KzbfoK3a5IJVhU84F o5fkQO59b8U/hrhdCKegBcv2ayFP34ZcPz5EFG9v8ZpOx+K1nEYtB5/QeG+ehLS9nEWo12cQChdJG T6xq96FRutMOtBxdc6Jio+mwccSeJ6CuFog+2PmOyZ96aAEDxZGmiB3xxbEZKCxepIoBD5Rvm1anB hc+SICaRWO8+J02A38KPw/t9msaQ2hLctydoaLqMXfYPZhvJ8GycavNVPWvdefQQIQBwlFNa/v35w mVAIPCBA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g89Oq-0004At-FF; Thu, 04 Oct 2018 19:35:04 +0000 Received: from mail1.kuutio.org ([92.222.216.83]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g89Oj-00046N-S2 for linux-arm-kernel@lists.infradead.org; Thu, 04 Oct 2018 19:35:00 +0000 Received: from localhost (localhost [127.0.0.1]) by mail1.kuutio.org (Postfix) with ESMTP id C093720657; Thu, 4 Oct 2018 21:34:44 +0200 (CEST) Authentication-Results: mail1.kuutio.org (amavisd-new); dkim=pass (4096-bit key) reason="pass (just generated, assumed good)" header.d=lemmela.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lemmela.net; h= references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received; s=dkim; t=1538681683; x= 1541273684; bh=/PFfFkGU2tveO+f1uD/iVS5pMKTkgRs5f1tx974Fqsg=; b=W s5OQI5dIBTo6sicaSx6tQN/hV30Uz+kGjyvobhMh7q193ONXVJllGxIU7JRC4Jt8 txtAzRkRSet4YNyyn8nlaLsp0oMELYlayT77PnBSNwuVEdl96uUbb8XXQ4jp+ZpU PurWiMy9h1RbvLhDGHlHHSe5Pzsr9yuMNVKvQAo69OXe5BJRxutO6M6j3UkhyGZ2 dObasgJov4VCv+pGZ6BoVS97VeBO9XNgQODGdAUEkk6JKoX9FBI8zVW/0BPp4EWw gduNlK6CZNSNeyuSYexOXDqbHGOCQtWBcBaq5gB1QmhGenr90K1oqavhN5n4k5Tt Dg6cFgw9KYZOEHxQFfgPlc4F19HFT4IO4EVfxeX/qxJfG40GSHGCm7CFiJoqdpbR ChXAHfYT4W5wSYfREhehX/fCMBCIvSUd4xLGxVDJle5727MZRnLV8XvRqtnKUXBP gp+yOStBK0quCz8XXruaDKKv0HDWNYqjUeOFa6IWh1EncWf5evxR40ddqwFdRMg8 ssYX/uVaJ0bJ0ZCOhfbg48Qx8zc/GbpVa++Hz13F9ZNQZfEiTLCSVS4JR3/0vMiK TRI+yXkEK3L7YUCSOINSKx8z9/PKbV/syGm2LiCMyEdnuog+ecXsZK67AqgQw9OC ZH8aH2485EfmdldDvQ4Z0qf5LGp/ljICdlzUjpmDmM= X-Virus-Scanned: amavisd-new at kuutio.org Received: from mail1.kuutio.org ([127.0.0.1]) by localhost (mail1.kuutio.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id LgYUfUWXGgUJ; Thu, 4 Oct 2018 21:34:43 +0200 (CEST) Received: from build.kuutio.org (unknown [IPv6:2001:998:13:e4::69]) by mail1.kuutio.org (Postfix) with ESMTPSA id 39E041FBED; Thu, 4 Oct 2018 21:34:43 +0200 (CEST) From: Oskari Lemmela To: Maxime Ripard , Sebastian Reichel , Jonathan Cameron , Chen-Yu Tsai , Mark Rutland , Rob Herring , Linus Walleij Subject: [PATCH 3/4] arm64: allwinner: a64: add battery and AC power supply support Date: Thu, 4 Oct 2018 22:34:09 +0300 Message-Id: <20181004193410.7265-4-oskari@lemmela.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181004193410.7265-1-oskari@lemmela.net> References: <20181004193410.7265-1-oskari@lemmela.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181004_123458_647298_AA5BAD8A X-CRM114-Status: GOOD ( 10.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Lars-Peter Clausen , linux-gpio@vger.kernel.org, linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Quentin Schulz , Oskari Lemmela , Peter Meerwald-Stadler , Hartmut Knaack , Lee Jones , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add AXP803 DT nodes for AC and battery power supplies. Enable AC and battery power supplies for sopine-baseboard. Signed-off-by: Oskari Lemmela --- arch/arm64/boot/dts/allwinner/axp803.dtsi | 31 +++++++++++++++++++ .../allwinner/sun50i-a64-sopine-baseboard.dts | 8 +++++ 2 files changed, 39 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/axp803.dtsi b/arch/arm64/boot/dts/allwinner/axp803.dtsi index e5eae8bafc42..d23e5d1e9310 100644 --- a/arch/arm64/boot/dts/allwinner/axp803.dtsi +++ b/arch/arm64/boot/dts/allwinner/axp803.dtsi @@ -49,6 +49,37 @@ interrupt-controller; #interrupt-cells = <1>; + axp_adc: adc { + compatible = "x-powers,axp803-adc"; + #io-channel-cells = <1>; + }; + + axp_gpio: gpio { + compatible = "x-powers,axp803-gpio"; + gpio-controller; + #gpio-cells = <2>; + + gpio0_ldo: gpio0-ldo { + pins = "GPIO0"; + function = "ldo"; + }; + + gpio1_ldo: gpio1-ldo { + pins = "GPIO1"; + function = "ldo"; + }; + }; + + ac_power_supply: ac-power-supply { + compatible = "x-powers,axp803-ac-power-supply"; + status = "disabled"; + }; + + battery_power_supply: battery-power-supply { + compatible = "x-powers,axp803-battery-power-supply"; + status = "disabled"; + }; + regulators { /* Default work frequency for buck regulators */ x-powers,dcdc-freq = <3000>; diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts index c21f2331add6..335cf2263d19 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts @@ -69,6 +69,14 @@ }; }; +&ac_power_supply { + status = "okay"; +}; + +&battery_power_supply { + status = "okay"; +}; + &ehci0 { status = "okay"; }; From patchwork Thu Oct 4 19:34:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Oskari_Lemmel=C3=A4?= X-Patchwork-Id: 10626547 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 79C9D15A6 for ; Thu, 4 Oct 2018 19:37:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67124294C1 for ; Thu, 4 Oct 2018 19:37:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A6E72963B; Thu, 4 Oct 2018 19:37:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 880C1294C1 for ; Thu, 4 Oct 2018 19:37:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=keg+NLKtRp66U0hG6i6KQxIciYSX6swzCjZA3fGowq4=; b=hzSBZqDxEL4yzE5/6HVjF/Z2U7 5NHqrR8B08za4nh0F97vjxHKd/o3CDejbRR/2aN9nwdYvT+S3oeQeiciV7P+iEUEe265/hvy3WHkC SD+tm0erNe47/HGZFb3UdEIkgsiEw5pjbRvbEytRVsseupE6QnEi7TuvbRVTSCebzaG/C08+p2F5v 26F+nEjrEo0gmscgfl3vMK9uu8FWbZO1w4A2fxINTSHAn0Ovv2WPiu81hk7SxoKAI83PpnxVhEZQ7 Ni3xRbt2JpcIjj8tTF4WbYMQ9seS7lgRcs37OlMbBQ6Dr3zxyH33FnwQDq0M7Chr55nk8mFa09c1S 8JgWNSCA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g89RJ-0006aR-Fs; Thu, 04 Oct 2018 19:37:37 +0000 Received: from mail1.kuutio.org ([2001:41d0:401:3100::431a]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g89Ok-00046P-MI for linux-arm-kernel@lists.infradead.org; Thu, 04 Oct 2018 19:35:04 +0000 Received: from localhost (localhost [127.0.0.1]) by mail1.kuutio.org (Postfix) with ESMTP id 0734B1F99C; Thu, 4 Oct 2018 21:34:46 +0200 (CEST) Authentication-Results: mail1.kuutio.org (amavisd-new); dkim=pass (4096-bit key) reason="pass (just generated, assumed good)" header.d=lemmela.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lemmela.net; h= references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received; s=dkim; t=1538681684; x= 1541273685; bh=nH9jCOZMiAQffXTRDY0K3dj/dvc9nqOMIuTRGT/kQII=; b=n wDVyYnnghr9vuNsXK1c5b5qHjuRF3JxK6NVVaKTyYTVZ/Z3YIll9u9Y72HOLSATx MGC1o6Ng07odZuUGa+FoW6ijqAGEt3CvaceaXyJA8d3Fe7TjCdwdJVmDvrl9a6Kx ZfWR4Vuo1U+7c/KdLzZ6nJeudYLg+afNF6LqX+zt1q1rdU+V0hwQbWs0Nz7DoXH4 zyUxQdA4Lz+HIyKQuxkw+KURN/b7+sOUeilqEzTqMIepGhuCgLM3xcwsKkyugRaC eDnCqEggV1osDkjgL4ykSQkmW9iT1nV14l23WlaJBUcpVhDaT2vGIwV6p27seXK+ 6IDbmH/aSiiO3oLe1VE2w+t+ycno4ui6dz516OvdwSX1xFx8Pz7XvFJ7EkROf7v6 6SXhemnXqR88U2CUKFKQpgbXfXa4ZK7+l0ayKyNacU6IFjIfM2MweekcRuP1AaIu U84l6X13363NQno0p4TNjXmPS+z7/QzgIvc6CNkqDOtsMeGi8dF1KBp5Nvw4lK8s M7J0yrc2PRTRA1dMygwn3Q0pfZUz5eEJzsUT4KmHlOnPol+x3y8k6Z32lpJlOkZm ngiLL0lrqHWzTea6SQO9V0Agb1FEPy15jQ+0HYXsKMWKGgWhVy3hqoYZKT61cfQb 3L/plzddvr1aDA1sTz0zeKYX/mUwyoN0BnqppB8Bog= X-Virus-Scanned: amavisd-new at kuutio.org Received: from mail1.kuutio.org ([127.0.0.1]) by localhost (mail1.kuutio.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id BwkJ3V_T2fzg; Thu, 4 Oct 2018 21:34:44 +0200 (CEST) Received: from build.kuutio.org (unknown [IPv6:2001:998:13:e4::69]) by mail1.kuutio.org (Postfix) with ESMTPSA id 0EC8A1FBF3; Thu, 4 Oct 2018 21:34:44 +0200 (CEST) From: Oskari Lemmela To: Maxime Ripard , Sebastian Reichel , Jonathan Cameron , Chen-Yu Tsai , Mark Rutland , Rob Herring , Linus Walleij Subject: [PATCH 4/4] power: supply: add AXP803/AXP813 AC and battery power supply support Date: Thu, 4 Oct 2018 22:34:10 +0300 Message-Id: <20181004193410.7265-5-oskari@lemmela.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181004193410.7265-1-oskari@lemmela.net> References: <20181004193410.7265-1-oskari@lemmela.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181004_123459_042331_CC29D475 X-CRM114-Status: GOOD ( 15.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Lars-Peter Clausen , linux-gpio@vger.kernel.org, linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Quentin Schulz , Oskari Lemmela , Peter Meerwald-Stadler , Hartmut Knaack , Lee Jones , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP AXP803 PMIC is register compatible with AXP813. Added support for AXP803/AXP813 AC power supply. AXP8x3 is capable to limit input current and minimum input voltage. Both of these register values are writeable. Signed-off-by: Oskari Lemmela --- drivers/iio/adc/axp20x_adc.c | 1 + drivers/mfd/axp20x.c | 22 ++- drivers/pinctrl/pinctrl-axp209.c | 1 + drivers/power/supply/axp20x_ac_power.c | 194 +++++++++++++++++++++++++ drivers/power/supply/axp20x_battery.c | 3 + include/linux/mfd/axp20x.h | 1 + 6 files changed, 221 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c index 5be789269353..f919a16a8533 100644 --- a/drivers/iio/adc/axp20x_adc.c +++ b/drivers/iio/adc/axp20x_adc.c @@ -641,6 +641,7 @@ static const struct axp_data axp813_data = { static const struct of_device_id axp20x_adc_of_match[] = { { .compatible = "x-powers,axp209-adc", .data = (void *)&axp20x_data, }, { .compatible = "x-powers,axp221-adc", .data = (void *)&axp22x_data, }, + { .compatible = "x-powers,axp803-adc", .data = (void *)&axp813_data, }, { .compatible = "x-powers,axp813-adc", .data = (void *)&axp813_data, }, { /* sentinel */ } }; diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index 0be511dd93d0..c540f17549d5 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c @@ -731,8 +731,23 @@ static const struct mfd_cell axp803_cells[] = { .name = "axp221-pek", .num_resources = ARRAY_SIZE(axp803_pek_resources), .resources = axp803_pek_resources, + }, { + .name = "axp20x-regulator" + }, { + .name = "axp20x-gpio", + .of_compatible = "x-powers,axp803-gpio", + }, { + .name = "axp813-adc", + .of_compatible = "x-powers,axp803-adc", + }, { + .name = "axp20x-battery-power-supply", + .of_compatible = "x-powers,axp803-battery-power-supply", + }, { + .name = "axp20x-ac-power-supply", + .of_compatible = "x-powers,axp803-ac-power-supply", + .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources), + .resources = axp20x_ac_power_supply_resources, }, - { .name = "axp20x-regulator" }, }; static const struct mfd_cell axp806_self_working_cells[] = { @@ -778,6 +793,11 @@ static const struct mfd_cell axp813_cells[] = { }, { .name = "axp20x-battery-power-supply", .of_compatible = "x-powers,axp813-battery-power-supply", + }, { + .name = "axp20x-ac-power-supply", + .of_compatible = "x-powers,axp813-ac-power-supply", + .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources), + .resources = axp20x_ac_power_supply_resources, }, }; diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c index afd0b533c40a..21859579e0a2 100644 --- a/drivers/pinctrl/pinctrl-axp209.c +++ b/drivers/pinctrl/pinctrl-axp209.c @@ -387,6 +387,7 @@ static int axp20x_build_funcs_groups(struct platform_device *pdev) static const struct of_device_id axp20x_pctl_match[] = { { .compatible = "x-powers,axp209-gpio", .data = &axp20x_data, }, + { .compatible = "x-powers,axp803-gpio", .data = &axp813_data, }, { .compatible = "x-powers,axp813-gpio", .data = &axp813_data, }, { } }; diff --git a/drivers/power/supply/axp20x_ac_power.c b/drivers/power/supply/axp20x_ac_power.c index 0771f951b11f..3247efb81cd1 100644 --- a/drivers/power/supply/axp20x_ac_power.c +++ b/drivers/power/supply/axp20x_ac_power.c @@ -27,6 +27,23 @@ #define AXP20X_PWR_STATUS_ACIN_PRESENT BIT(7) #define AXP20X_PWR_STATUS_ACIN_AVAIL BIT(6) +#define AXP8X3_PWR_ACIN_VHOLD GENMASK(5, 3) +#define AXP8X3_PWR_ACIN_VHOLD_4_0V (0 << 3) +#define AXP8X3_PWR_ACIN_VHOLD_4_1V (1 << 3) +#define AXP8X3_PWR_ACIN_VHOLD_4_2V (2 << 3) +#define AXP8X3_PWR_ACIN_VHOLD_4_3V (3 << 3) +#define AXP8X3_PWR_ACIN_VHOLD_4_4V (4 << 3) +#define AXP8X3_PWR_ACIN_VHOLD_4_5V (5 << 3) +#define AXP8X3_PWR_ACIN_VHOLD_4_6V (6 << 3) +#define AXP8X3_PWR_ACIN_VHOLD_4_7V (7 << 3) +#define AXP8X3_PWR_ACIN_CURR_LIMIT GENMASK(2, 0) +#define AXP8X3_PWR_ACIN_CURR_1_5A 0 +#define AXP8X3_PWR_ACIN_CURR_2_0A 1 +#define AXP8X3_PWR_ACIN_CURR_2_5A 2 +#define AXP8X3_PWR_ACIN_CURR_3_0A 3 +#define AXP8X3_PWR_ACIN_CURR_3_5A 4 +#define AXP8X3_PWR_ACIN_CURR_4_0A 5 + #define DRVNAME "axp20x-ac-power-supply" struct axp20x_ac_power { @@ -102,6 +119,72 @@ static int axp20x_ac_power_get_property(struct power_supply *psy, return 0; + case POWER_SUPPLY_PROP_VOLTAGE_MIN: + ret = regmap_read(power->regmap, AXP803_ACIN_PATH_CTRL, ®); + if (ret) + return ret; + + switch (reg & AXP8X3_PWR_ACIN_VHOLD) { + case AXP8X3_PWR_ACIN_VHOLD_4_0V: + val->intval = 4000000; + break; + case AXP8X3_PWR_ACIN_VHOLD_4_1V: + val->intval = 4100000; + break; + case AXP8X3_PWR_ACIN_VHOLD_4_2V: + val->intval = 4200000; + break; + case AXP8X3_PWR_ACIN_VHOLD_4_3V: + val->intval = 4300000; + break; + case AXP8X3_PWR_ACIN_VHOLD_4_4V: + val->intval = 4400000; + break; + case AXP8X3_PWR_ACIN_VHOLD_4_5V: + val->intval = 4500000; + break; + case AXP8X3_PWR_ACIN_VHOLD_4_6V: + val->intval = 4600000; + break; + case AXP8X3_PWR_ACIN_VHOLD_4_7V: + val->intval = 4700000; + break; + default: + return -EINVAL; + } + + return 0; + + case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT: + ret = regmap_read(power->regmap, AXP803_ACIN_PATH_CTRL, ®); + if (ret) + return ret; + + switch (reg & AXP8X3_PWR_ACIN_CURR_LIMIT) { + case AXP8X3_PWR_ACIN_CURR_1_5A: + val->intval = 1500000; + break; + case AXP8X3_PWR_ACIN_CURR_2_0A: + val->intval = 2000000; + break; + case AXP8X3_PWR_ACIN_CURR_2_5A: + val->intval = 2500000; + break; + case AXP8X3_PWR_ACIN_CURR_3_0A: + val->intval = 3000000; + break; + case AXP8X3_PWR_ACIN_CURR_3_5A: + val->intval = 3500000; + break; + case AXP8X3_PWR_ACIN_CURR_4_0A: + val->intval = 4000000; + break; + default: + return -EINVAL; + } + + return 0; + default: return -EINVAL; } @@ -109,6 +192,88 @@ static int axp20x_ac_power_get_property(struct power_supply *psy, return -EINVAL; } +static int axp20x_ac_power_set_property(struct power_supply *psy, + enum power_supply_property psp, + const union power_supply_propval *val) +{ + struct axp20x_ac_power *power = power_supply_get_drvdata(psy); + int setval; + + switch (psp) { + case POWER_SUPPLY_PROP_VOLTAGE_MIN: + switch (val->intval) { + case 4000000: + setval = AXP8X3_PWR_ACIN_VHOLD_4_0V; + break; + case 4100000: + setval = AXP8X3_PWR_ACIN_VHOLD_4_1V; + break; + case 4200000: + setval = AXP8X3_PWR_ACIN_VHOLD_4_2V; + break; + case 4300000: + setval = AXP8X3_PWR_ACIN_VHOLD_4_3V; + break; + case 4400000: + setval = AXP8X3_PWR_ACIN_VHOLD_4_4V; + break; + case 4500000: + setval = AXP8X3_PWR_ACIN_VHOLD_4_5V; + break; + case 4600000: + setval = AXP8X3_PWR_ACIN_VHOLD_4_6V; + break; + case 4700000: + setval = AXP8X3_PWR_ACIN_VHOLD_4_7V; + break; + + default: + return -EINVAL; + } + return regmap_update_bits(power->regmap, AXP803_ACIN_PATH_CTRL, + AXP8X3_PWR_ACIN_VHOLD, setval); + + case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT: + + switch (val->intval) { + case 1500000: + setval = AXP8X3_PWR_ACIN_CURR_1_5A; + break; + case 2000000: + setval = AXP8X3_PWR_ACIN_CURR_2_0A; + break; + case 2500000: + setval = AXP8X3_PWR_ACIN_CURR_2_5A; + break; + case 3000000: + setval = AXP8X3_PWR_ACIN_CURR_3_0A; + break; + case 3500000: + setval = AXP8X3_PWR_ACIN_CURR_3_5A; + break; + case 4000000: + setval = AXP8X3_PWR_ACIN_CURR_4_0A; + break; + default: + return -EINVAL; + } + return regmap_update_bits(power->regmap, AXP803_ACIN_PATH_CTRL, + AXP8X3_PWR_ACIN_CURR_LIMIT, setval); + + default: + return -EINVAL; + } + + return -EINVAL; +} + +static int axp20x_ac_power_prop_writeable(struct power_supply *psy, + enum power_supply_property psp) +{ + return psp == POWER_SUPPLY_PROP_VOLTAGE_MIN || + psp == POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT; +} + static enum power_supply_property axp20x_ac_power_properties[] = { POWER_SUPPLY_PROP_HEALTH, POWER_SUPPLY_PROP_PRESENT, @@ -123,6 +288,14 @@ static enum power_supply_property axp22x_ac_power_properties[] = { POWER_SUPPLY_PROP_ONLINE, }; +static enum power_supply_property axp8x3_ac_power_properties[] = { + POWER_SUPPLY_PROP_HEALTH, + POWER_SUPPLY_PROP_PRESENT, + POWER_SUPPLY_PROP_ONLINE, + POWER_SUPPLY_PROP_VOLTAGE_MIN, + POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, +}; + static const struct power_supply_desc axp20x_ac_power_desc = { .name = "axp20x-ac", .type = POWER_SUPPLY_TYPE_MAINS, @@ -139,6 +312,16 @@ static const struct power_supply_desc axp22x_ac_power_desc = { .get_property = axp20x_ac_power_get_property, }; +static const struct power_supply_desc axp8x3_ac_power_desc = { + .name = "axp8x3-ac", + .type = POWER_SUPPLY_TYPE_MAINS, + .properties = axp8x3_ac_power_properties, + .num_properties = ARRAY_SIZE(axp8x3_ac_power_properties), + .property_is_writeable = axp20x_ac_power_prop_writeable, + .get_property = axp20x_ac_power_get_property, + .set_property = axp20x_ac_power_set_property, +}; + struct axp_data { const struct power_supply_desc *power_desc; bool acin_adc; @@ -154,6 +337,11 @@ static const struct axp_data axp22x_data = { .acin_adc = false, }; +static const struct axp_data axp8x3_data = { + .power_desc = &axp8x3_ac_power_desc, + .acin_adc = false, +}; + static int axp20x_ac_power_probe(struct platform_device *pdev) { struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); @@ -234,6 +422,12 @@ static const struct of_device_id axp20x_ac_power_match[] = { }, { .compatible = "x-powers,axp221-ac-power-supply", .data = &axp22x_data, + }, { + .compatible = "x-powers,axp803-ac-power-supply", + .data = &axp8x3_data, + }, { + .compatible = "x-powers,axp813-ac-power-supply", + .data = &axp8x3_data, }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, axp20x_ac_power_match); diff --git a/drivers/power/supply/axp20x_battery.c b/drivers/power/supply/axp20x_battery.c index e84b6e4da14a..932027f4a993 100644 --- a/drivers/power/supply/axp20x_battery.c +++ b/drivers/power/supply/axp20x_battery.c @@ -537,6 +537,9 @@ static const struct of_device_id axp20x_battery_ps_id[] = { }, { .compatible = "x-powers,axp221-battery-power-supply", .data = (void *)&axp221_data, + }, { + .compatible = "x-powers,axp803-battery-power-supply", + .data = (void *)&axp813_data, }, { .compatible = "x-powers,axp813-battery-power-supply", .data = (void *)&axp813_data, diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h index 517e60eecbcb..23d58e243d01 100644 --- a/include/linux/mfd/axp20x.h +++ b/include/linux/mfd/axp20x.h @@ -266,6 +266,7 @@ enum axp20x_variants { #define AXP288_RT_BATT_V_H 0xa0 #define AXP288_RT_BATT_V_L 0xa1 +#define AXP803_ACIN_PATH_CTRL 0x3a #define AXP813_ADC_RATE 0x85 /* Fuel Gauge */