Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1509274lqp; Mon, 15 Apr 2024 08:25:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWuwM5jRXkT34NHqZ230B9r5w64FHbBGGPpq71Am3YGbaVj9wRmgT/K+DdxSIAwdHk77oaxPGfQ3YIgixiW1fvUhR+Tvdj7jOr8mdSn+A== X-Google-Smtp-Source: AGHT+IHlks9iJU0mR6AKDMUBc21h4UGxOk0RdBiwL6Tuhm6HgS9TldPYFh0WLwBS1I40L5p4ERiJ X-Received: by 2002:a05:6a00:b4a:b0:6e8:3d5b:f3b1 with SMTP id p10-20020a056a000b4a00b006e83d5bf3b1mr9234282pfo.22.1713194738035; Mon, 15 Apr 2024 08:25:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713194738; cv=pass; d=google.com; s=arc-20160816; b=kp7retnRAcre50ni9qmpAyVQdiK2O5LG69oDvCzV8q/AscsXLmibsz+/+Lp7WuvV0X 38YnmA7KtzAGShboaV4I2OhM4lTxULQLygyR568FBh7kda4/d7AjPmZMFiv2TrL6poYj CXH7Gj+wqzbGdDANKJEw3RW1l2hAAW9MLgsP8N9c8GQiPwTM/QpiApFaEQFPAs7XWcIx uXENmVk0m3YB4BYVhEv+sC4TjSENxOUFm3FxiEFHJYdMxhBSxb9/mnUdS0zWpf5YYSlz Xta5CiHl9I5ejrdnRklF2hB28/wQoOKYb2io/N/vD3MqZrVDr8G/6gyFlk6Wi0lTMHMy UcgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=dkim-signature:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from; bh=1MGoLH5b+KzBc3k0I/E6VKO47//qQEYgqkirtXpEYX8=; fh=j+mfc1J07KkZegqzrGCQZFDxaxopgWmgEdClkwBOe6M=; b=KQ+KdeRne09e1VW4iFTw5AofmOBCBLlFR5+j3N3gExdmP4/xPlvHaxGiNEK1I2X2yP tyPRSJyQBNoq+FZHCsaUWbI4MgUvNK85+/nncMZQ/Xj7VI6hXe7VMd4PxLnbOX5VjOFZ iY5a0AFCmCeiE6iz1mktXs39T2X3wVJFqVQHwmX9TOGr4VdwZa+PVP5v2bjt+9tTFGNO /Ckw9jKHckTyOezg8YiwXjQIjEUUAql3353nIE9irELQ/OuelmixT/nkOi8Gj6rUmRwY Xd6IN9wfmPSn1I3g2ydS8LRb0k8Xeqhw93/LeptRMItLPztxjE9rGI1/iCmCtKDTtEyK +Esg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@herrie.org header.s=transip-a header.b=ZGStnL2w; arc=pass (i=1 spf=pass spfdomain=herrie.org dkim=pass dkdomain=herrie.org); spf=pass (google.com: domain of linux-kernel+bounces-145449-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145449-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id gm23-20020a056a00641700b006e546bd270dsi8036523pfb.364.2024.04.15.08.25.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 08:25:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145449-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@herrie.org header.s=transip-a header.b=ZGStnL2w; arc=pass (i=1 spf=pass spfdomain=herrie.org dkim=pass dkdomain=herrie.org); spf=pass (google.com: domain of linux-kernel+bounces-145449-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145449-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 A7CCE280DFC for ; Mon, 15 Apr 2024 15:25:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7CBAE78C73; Mon, 15 Apr 2024 15:25:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=herrie.org header.i=@herrie.org header.b="ZGStnL2w" Received: from outbound0.mail.transip.nl (outbound0.mail.transip.nl [149.210.149.69]) (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 2E80042047; Mon, 15 Apr 2024 15:25:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=149.210.149.69 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713194730; cv=none; b=ps025EluOXExbUInAaaXqjopH/j8QmyxzL7+VxNLh4Qp97iUuAaPFeFpA+W0HWuVJmb6RRV6L+D/rgEVcBT6vmdALZhH7DPx2W7K8VGuoDC/QyfIa7Ks1htKfavvI0+kJI5VgIueZLjPfWemW4mvjRXHZJuTXEzWV+CEgXNH5Og= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713194730; c=relaxed/simple; bh=HhAOHciiKTqEWbCIi1HnWqOda20cBLCp/JpI2EcL/Vc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=oiw6Nf7qvZx4Mj6IOTaMAKoTdzF2cZVfLyk0HULF2Ft5oNPpFyDO8rhEoRiSyTo7Cv+JQujIHv9yGr3J1mp6TsSyJbsyA1u52oVVVANehuW2eI2lSR4IpMUu6tjns6WnGITyMpBSdwUsieMu1NCWelJADvTX8AihWWIQnV5mT0M= 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=ZGStnL2w; arc=none smtp.client-ip=149.210.149.69 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 submission12.mail.transip.nl (unknown [10.103.8.163]) by outbound0.mail.transip.nl (Postfix) with ESMTP id 4VJ9lQ2zntzxNrr; Mon, 15 Apr 2024 17:17:38 +0200 (CEST) Received: from herrie-desktop.. (110-31-146-85.ftth.glasoperator.nl [85.146.31.110]) by submission12.mail.transip.nl (Postfix) with ESMTPA id 4VJ9lP2DHnz1BFcM; Mon, 15 Apr 2024 17:17:37 +0200 (CEST) From: Herman van Hazendonk To: sre@kernel.org Cc: benwolsieffer@gmail.com, chris.chapuis@gmail.com, Herman van Hazendonk , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] power: supply: max8903: configure USUS as output Date: Mon, 15 Apr 2024 17:17:33 +0200 Message-Id: <20240415151733.1986047-1-github.com@herrie.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: ClueGetter at submission12.mail.transip.nl DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=transip-a; d=herrie.org; t=1713194257; h=from:subject:to:cc:date: mime-version; bh=1MGoLH5b+KzBc3k0I/E6VKO47//qQEYgqkirtXpEYX8=; b=ZGStnL2wflzGE8xbCYgByDjGk2hqQ2LdV6CYsU8URz2rC7mzTYqLalZgdnPgz7h+Ks902J X28kY/o7Ny44KwEQPgo2KywlKa9rHjn1f6To1y+zAQutk2Ru/qicdX6JB3CscvHz/ahM1w HaeLA0M4Q0FbvB3rIgbrEiVFb3NwkhC+xot6bqCfZx4YScVOOlmrPwKzz8A5p76WyOZ59g uLByw/zu9B+dqS8OrLL3uLWtgeWNkQfR/8w3juODgzioZoSJQJJQvf+2ms+C63qvEzkBLh RmmpfCgkKm9gAIWetAVk3RSymwjdKFL+0LwAtkb2fWf2xi4y22Zsx4J0m8WY+A== 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: Herman van Hazendonk --- drivers/power/supply/max8903_charger.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/max8903_charger.c b/drivers/power/supply/max8903_charger.c index e65d0141f260..dd1cf77b101d 100644 --- a/drivers/power/supply/max8903_charger.c +++ b/drivers/power/supply/max8903_charger.c @@ -102,6 +102,11 @@ 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 +315,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");