Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3501430ybl; Sun, 12 Jan 2020 19:55:15 -0800 (PST) X-Google-Smtp-Source: APXvYqwAYIRVxrAjdIurJhh6aIT+tEKCabdxxgcG2gytkooY5A6g8ld98eipr+pKxMDsivx6txdw X-Received: by 2002:aca:2207:: with SMTP id b7mr11517405oic.109.1578887715146; Sun, 12 Jan 2020 19:55:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578887715; cv=none; d=google.com; s=arc-20160816; b=PRWTg+V7QS3ZcR1Q8WB7jJCpvAubGhcm1MDqaPplnUzPRnDMtJSRgThkQ5QQDzdwU1 4ZSjCRaq+LYHHszNFkSzmmbBAEDbRraYA58jOXE3FibScxcj5152hkes/VdMEpNnBwfq UGqabrg0rc/6S8qZN3Jbffn5EgczM7JzNr9xbxgd9kXBh18dYLF5uPjvSIYKewcFAjsT GFtB+Hm5GtghWiLzkLXXpF+1XfNHzH+mIBYCUtL3Z4nYBMnYSmmD8JDVGWdVKq3Rowtj 2iopzDHAj0z2zoVSz/note2QtFko/E4tAND0TM8iCU9N6I2QWOy7ID+48vBnHhZDotE7 5jHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=RHYQj/FernzCJVEio9TnwHcA6uvjDWGqaN7zZ1DFVIc=; b=BrJr9fVbUBI3GuJz5JyNrL9/LC18TJqyNCv3HPHt3rPffXNB4k8RqDjwHDawNxB4NB j6TBV03bC58AAqpKJiO5Pr/xirWn+v1CWSbi73bUeMax10N/d9CHlhs7hDvc3n7kAQVc s94aYGBQp5LQk4I5wAj/CdU6gEm0pHq5eFxZpsJi7h5xev3EHhCGvVwqXtzVjs+ov6vk KPbrVsGpQ5RR1QERach3cDZybYsApUuoPVZTk/1hJWrrkZGNeigqEDoH/2rTLhqUeLng nEqifnroLfQfDmLVzpvyoZXWSGjPamMyybXG+iJ3iwBuNe2h5vGZBOM/q5H9h+2rzeN3 qbeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm1 header.b=FfgUDyjz; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=D7DL0JW6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u18si6477721otg.201.2020.01.12.19.55.03; Sun, 12 Jan 2020 19:55:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm1 header.b=FfgUDyjz; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=D7DL0JW6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387652AbgAMDxp (ORCPT + 99 others); Sun, 12 Jan 2020 22:53:45 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:58049 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387498AbgAMDxN (ORCPT ); Sun, 12 Jan 2020 22:53:13 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id A07A621C7A; Sun, 12 Jan 2020 22:53:12 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sun, 12 Jan 2020 22:53:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=RHYQj/FernzCJ VEio9TnwHcA6uvjDWGqaN7zZ1DFVIc=; b=FfgUDyjzi8fSdgJm28w8tDjs2rOeS ukQnOGsSuoIWRHfVyGN0rpWuw7AoQtVvO5ZskTBhFp4rNgmuitaQYMxpsmpTKnIB nuRQbJwL1kTHXHPoaH1nDR91xBq31sSi5iIlS2RLQWyTG+2jko69g/BF9U1JcE6j TNtKsc5wAdGIF656KnOj39OowbF6OfwQgefjpATDOvQyJclHe5Wlf2n5At1MvSPG 6MMRIbBurqbZtXUsdBkk0519dDqlcTo075nAiIPd5qzRTry6YXd1ife0YJyRb18N mntQNpAZrwc0Q45jUj+CDbQpTcx/wrlvv4zlbA3bqAs3bPZ2zE28DsTmg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=RHYQj/FernzCJVEio9TnwHcA6uvjDWGqaN7zZ1DFVIc=; b=D7DL0JW6 jdOL2jQVH5/t7mreumcfxDvr8syK18bse+gd0NxnGIO8PD0suPPu3+bBThdwdrTt nR2UBUylZoo9ksj60S5OuMaYAATQPwviBK1sZN4W9V09FkMVQLmTFhrWpcsYm3WU AuGVhl993Pja1PrkgzGXMRdVb+Egf78IkBu/XBoMkwfk2sADi+5qhQlBDmBitxG4 f7nffWOVm5qeOJmnMnxicQjTDaA3ckKSx9n5b2emgrA4SrxMoqnYwaKV9ZsTpH8a 6TgJgEAGYKEr779gtlZaWmyRwHPW4SrH+VE8/NEDHV55RVqV8gHPR25VkJey1Nsw DTW6fgICDe0Ifw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvdeiledgieeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucfkph epjedtrddufeehrddugeekrdduhedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehsrghm uhgvlhesshhhohhllhgrnhgurdhorhhgnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from titanium.stl.sholland.net (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id 15BE280063; Sun, 12 Jan 2020 22:53:12 -0500 (EST) From: Samuel Holland To: Chen-Yu Tsai , Sebastian Reichel , Oskari Lemmela Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Samuel Holland Subject: [PATCH v3 2/8] power: supply: axp20x_ac_power: Allow offlining Date: Sun, 12 Jan 2020 21:53:04 -0600 Message-Id: <20200113035310.18950-3-samuel@sholland.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200113035310.18950-1-samuel@sholland.org> References: <20200113035310.18950-1-samuel@sholland.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org AXP803/AXP813 have a flag that enables/disables the AC power supply input. Allow control of this flag via the ONLINE property on those variants. Reviewed-by: Chen-Yu Tsai Signed-off-by: Samuel Holland --- drivers/power/supply/axp20x_ac_power.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/axp20x_ac_power.c b/drivers/power/supply/axp20x_ac_power.c index f74b0556bb6b..3ba38f2f281c 100644 --- a/drivers/power/supply/axp20x_ac_power.c +++ b/drivers/power/supply/axp20x_ac_power.c @@ -24,6 +24,7 @@ #define AXP20X_PWR_STATUS_ACIN_AVAIL BIT(6) #define AXP813_ACIN_PATH_SEL BIT(7) +#define AXP813_ACIN_PATH_SEL_TO_BIT(x) (!!(x) << 7) #define AXP813_VHOLD_MASK GENMASK(5, 3) #define AXP813_VHOLD_UV_TO_BIT(x) ((((x) / 100000) - 40) << 3) @@ -157,6 +158,11 @@ static int axp813_ac_power_set_property(struct power_supply *psy, struct axp20x_ac_power *power = power_supply_get_drvdata(psy); switch (psp) { + case POWER_SUPPLY_PROP_ONLINE: + return regmap_update_bits(power->regmap, AXP813_ACIN_PATH_CTRL, + AXP813_ACIN_PATH_SEL, + AXP813_ACIN_PATH_SEL_TO_BIT(val->intval)); + case POWER_SUPPLY_PROP_VOLTAGE_MIN: if (val->intval < 4000000 || val->intval > 4700000) return -EINVAL; @@ -183,7 +189,8 @@ static int axp813_ac_power_set_property(struct power_supply *psy, static int axp813_ac_power_prop_writeable(struct power_supply *psy, enum power_supply_property psp) { - return psp == POWER_SUPPLY_PROP_VOLTAGE_MIN || + return psp == POWER_SUPPLY_PROP_ONLINE || + psp == POWER_SUPPLY_PROP_VOLTAGE_MIN || psp == POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT; } -- 2.23.0