Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp629562lqb; Wed, 17 Apr 2024 06:46:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW1yH2IBD2vW7hwBw6fXgG9ZoFFK/0tJSWrrg3Wgoif+A6DxEIXO1prDODeyfiibGLrh3OmgfWLqCwuufNsY8jTDspRCWZNWMGgXHIVWg== X-Google-Smtp-Source: AGHT+IHr+W7kOkhudC9dXgpzKLQ5nHQrBR+EuDheqSeowxDbfzLM2ZI3TLfYolEixt13el7HdAGn X-Received: by 2002:a17:902:d48a:b0:1e5:c1a7:1b0e with SMTP id c10-20020a170902d48a00b001e5c1a71b0emr17500854plg.2.1713361583383; Wed, 17 Apr 2024 06:46:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713361583; cv=pass; d=google.com; s=arc-20160816; b=y246FbKvXB3/F2ijjcR8nD7XhY2fpCd3yo0UjHMJdNncFdgdXxxpK6QU29EP0kkG9A U0o7EGacUeVvEkD16YH7OzJQHfStYWdwueQa+O5beWaYYTf+cwjfvwl5scHcNjTrifEA jxd6KW4z6tQZf6wkq4mMOyFiaKHx/cgT2Oxw6Iwd07aoGg3RwiLQh5+f2TAR0eIRW6JG NmtS7C7mgaBUofRwRUMf60Y3/FmpBysTT48gNNrq/gwvaufSgjaxWizk7C/TVgBJxz7u nQtygJ9R7ix5Lte2y8jmZaTWGYZ/21ICu9MDqWPLbDQ4Zo6dBsmZihDwI69s0RoNscsX tcQw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=dkim-signature:cc:to:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from; bh=kSGhSxhNrtUmN9puZvQP3FJBm5BDqc34w0ZbNtdhuUg=; fh=P0x3q3LLDjQWz41+4i1udrQjm9tEDapwjSvh3S7p5lk=; b=ruAmMj1atmhPfFwzDnh3j77485RsM0ZLksClSQnp+M9r9XLS9XTU+2Win6sWmVLL9d AnuU0lPuPCxdCFXR2FjRXV/wbKkbNUc3O/ttYk2MlwW5C1XEMbn6z17HNzXnt/JejQIW B6u/NKuv+wqiSoWNFuOl/tF1rCf+VQHHxvvEZVhL1t0X9YuT+zKTbSjn7fynEqN9BZO8 6vxwV8JSmbOXbO7OEJ/lu8T2fsEyhPW5IApCX+vMxZGAVawiL/DWNBoCxXgEwHiCIahB FPWU7enOyDvpSNwlU2baBOGcQ7iZT3up+HVNCE4NNXs1uH8Y8AmUj/SAJcySQ8FNEvnl uWmA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@herrie.org header.s=transip-a header.b=uGv3Zi8p; arc=pass (i=1 spf=pass spfdomain=herrie.org dkim=pass dkdomain=herrie.org); spf=pass (google.com: domain of linux-kernel+bounces-148617-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148617-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id t8-20020a170902e84800b001e0b89a6dbesi1604835plg.387.2024.04.17.06.46.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 06:46:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148617-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@herrie.org header.s=transip-a header.b=uGv3Zi8p; arc=pass (i=1 spf=pass spfdomain=herrie.org dkim=pass dkdomain=herrie.org); spf=pass (google.com: domain of linux-kernel+bounces-148617-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148617-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 183DF2825BE for ; Wed, 17 Apr 2024 13:46:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B38311411EA; Wed, 17 Apr 2024 13:45:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=herrie.org header.i=@herrie.org header.b="uGv3Zi8p" Received: from outbound10.mail.transip.nl (outbound10.mail.transip.nl [136.144.136.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29BEE13D265; Wed, 17 Apr 2024 13:45:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=136.144.136.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713361507; cv=none; b=A3PKxHcF+tS0WcRNp4jGlkO+VKT4g/OitJO7wXj1gKQ5aO8QaVwWxYXZD0jn2Xnj1qQ5gvReS4F9Y5d/cC379Nn9rSEvhDkFrnR8vFbX1HVU9clWAdxT9n463m0PrR+HC+JXYWYjd1kqmrMoNSWoWSdrvsRODf9kLu/XzMXhMa4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713361507; c=relaxed/simple; bh=t+qjWM6WqKQ78Oz7BhB/nstW8ocY0wkyhoC5eWgtaMk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=lXcuN6oM4lVE8V9g+jKUc01XtZ+iBA0TaUgExyFNyPW3M4GL8sas6Meei347NCdl2aOKUlr3InBSQr+yBrcxX/+kZd9YnsfDKLM2b8iF3Me9eY0a+XGfVy2UgvnU9oDl9asxokKYWGaZ60LNZfGhpxkM/Gg2ECDqsmZvainO1e8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=herrie.org; spf=pass smtp.mailfrom=herrie.org; dkim=pass (2048-bit key) header.d=herrie.org header.i=@herrie.org header.b=uGv3Zi8p; arc=none smtp.client-ip=136.144.136.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=herrie.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=herrie.org Received: from submission13.mail.transip.nl (unknown [10.103.8.164]) by outbound10.mail.transip.nl (Postfix) with ESMTP id 4VKMNB29c6zTPNQV; Wed, 17 Apr 2024 15:35:06 +0200 (CEST) Received: from [127.0.1.1] (110-31-146-85.ftth.glasoperator.nl [85.146.31.110]) by submission13.mail.transip.nl (Postfix) with ESMTPA id 4VKMN93D0Gz1xxC; Wed, 17 Apr 2024 15:35:05 +0200 (CEST) From: Herman van Hazendonk Date: Wed, 17 Apr 2024 15:35:00 +0200 Subject: [PATCH] power: supply: max8903: configure USUS as output Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240417-max8903-v1-1-25d4dbf4ce9b@herrie.org> X-B4-Tracking: v=1; b=H4sIAAPQH2YC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIxMDE0Nz3dzECgtLA2PdxORUS/MU8xRjEwNzJaDqgqLUtMwKsEnRsbW1AEq 3FsBZAAAA To: Sebastian Reichel Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Ben Wolsieffer , Herman van Hazendonk X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1713360905; l=1957; i=github.com@herrie.org; s=20240417; h=from:subject:message-id; bh=t+qjWM6WqKQ78Oz7BhB/nstW8ocY0wkyhoC5eWgtaMk=; b=N3q9sr/Hrp55UApG4eNS6z0LV/G2ehm1oLOnjX2BlNxdz4c0gk8XL2UPEjQNDl0mcVex15LRX +CvR78NFtLhD6TiyCguqf2t3x4ZmLls4ZhwZVv0dyu5jBosGN6EAh7l X-Developer-Key: i=github.com@herrie.org; a=ed25519; pk=YYxdq8fb5O9vhkW3n2dCH044FPZZO5718v/du7fRhFw= X-Scanned-By: ClueGetter at submission13.mail.transip.nl DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=transip-a; d=herrie.org; t=1713360905; h=from:subject:to:cc:date: mime-version:content-type; bh=kSGhSxhNrtUmN9puZvQP3FJBm5BDqc34w0ZbNtdhuUg=; b=uGv3Zi8ppHjBs31fXy9/Wvm+jIJreoshHGttDWIdQvb8CG9mLt7vssuCy1OM4U5ZUBR2VC VMLaD2ubEB/g0fLCWgFH2P095qnNfZvogJjMVbgmmky7bJai3CaxlNjPoDU5DR6802/W1s 3ChkiYiwuQ8/iD6HIYkj4AiF7lrlGAsTlSkDkoXGJx+7jRUbcmzbqLyxXyjnt5FcQjUXNS SFeimzRH3nl+vHITr7zOnLcM8WrYMmGNA5uVrR3VTAKiWsromqkXrQEI85R4uNTJQ9tjk8 3RzO4eAZ+5l4CEJK31n5d2EjUzeMhtT8HuSDZd1OsuB7a5oRIYWDkzt4Ex7rPw== X-Report-Abuse-To: abuse@transip.nl The USUS pin was mistakenly configured as an input, when it should be an output that specifies whether the USB power input is suspended. In addition to fixing the pin mode, this patch also suspends the USB input when a DC charger is connected, which should result in a slight reduction in USB quiescent current. Signed-off-by: Ben Wolsieffer Signed-off-by: Herman van Hazendonk --- drivers/power/supply/max8903_charger.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/max8903_charger.c b/drivers/power/supply/max8903_charger.c index e65d0141f260..15dc3a5239e2 100644 --- a/drivers/power/supply/max8903_charger.c +++ b/drivers/power/supply/max8903_charger.c @@ -102,6 +102,10 @@ static irqreturn_t max8903_dcin(int irq, void *_data) if (data->dcm) gpiod_set_value(data->dcm, ta_in); + /* Set USB-Suspend 1:Suspended 0:Active */ + if (data->usus) + gpiod_set_value(data->usus, ta_in); + /* Charger Enable / Disable */ if (data->cen) { int val; @@ -310,7 +314,15 @@ static int max8903_setup_gpios(struct platform_device *pdev) "failed to get FLT GPIO"); gpiod_set_consumer_name(data->flt, data->psy_desc.name); - data->usus = devm_gpiod_get_optional(dev, "usus", GPIOD_IN); + /* + * Suspend the USB input if the DC charger is connected. + * + * The USUS line should be marked GPIO_ACTIVE_HIGH in the + * device tree. Driving it low will enable the USB charger + * input. + */ + flags = ta_in ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; + data->usus = devm_gpiod_get_optional(dev, "usus", flags); if (IS_ERR(data->usus)) return dev_err_probe(dev, PTR_ERR(data->usus), "failed to get USUS GPIO"); --- base-commit: 96fca68c4fbf77a8185eb10f7557e23352732ea2 change-id: 20240417-max8903-ace97d7d3407 Best regards, -- Herman van Hazendonk