Message ID | 20240130203714.3020464-1-aren@peacevolution.org |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-45275-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1483328dyb; Tue, 30 Jan 2024 12:38:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IFrRNei+UnvW0uV1hZ0/1AlPaGXnOynK5Yaq+YHFeOWcGa/FrQ4tja2/knOaQhm2lxHnQEd X-Received: by 2002:a05:6e02:92b:b0:363:7d74:a780 with SMTP id o11-20020a056e02092b00b003637d74a780mr241755ilt.23.1706647133965; Tue, 30 Jan 2024 12:38:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706647133; cv=pass; d=google.com; s=arc-20160816; b=zhh9QHZbXPBWw0deALkkKfVKX9SlfXRp24lS32px+aF+JmERl2XwDJpsxJ8MaFl4QS 9GnrvY5NUccFfHSCpOBLGw4SMQ4rn1XTpxTYSmXqxHiTg24CAjFwDGDYzCyTMsn2UQpp iAgrmXbCUTx/uqm6gSFMxB/voNjhqYa54IhxXGl6Z5Vc+g8u7YFfvAPbg99M5gbVw6Ew HUpg0P2Fz4x1obgHNECJ+GcHZyr8qyD0xb/JqjzEx0peu8OI6XWbZbwoU2NOL7yqj/gZ Ltjt8s5eq9iCPpnoTDOgwm9+RI5ljyZiIDdS3q0GPNXfTADXlpHBMGsI7gxqwR+EaCPC WV/g== 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=CnBNCViJHvy4cEKLBSR8JFJniQcbGnFyzpaAFuYyqxw=; fh=CS8UjFWQd4C89aVAWtaFYgKrfPFQKsOq4yc2cb5p77k=; b=iL/J4dAOOPryCCvB3lUVQlyH8ZH+1uq12tbiVj/CXj+8+CLQsJdvKI8+qrsJ2LqRho pIIoMTDj22rzH690sWQffeMrCbfo/b+CtRnL9LUYdCTLijLP06MuILCxKcWBuYAx8w8o 4kDXL5BU8oA7N10ElZihLfJTJc3tTpKs4ixl5b9oXnOyIjjg+7y4VUPNWlbMaO4Uzl3z PnKFgkitz4whSuEk0az378oA/Tj+otrmHQqjuoOuDbHPXDiOzJ8aP0hMJADcOHygEkCB 45/E52m8DXTfLXtbb9vpsAxDlUMT9gPXBax46kVDBW32TE4qeJ8Nm1DtNiwo/uX87k/H AqPw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@peacevolution.org header.s=dkim header.b=FCdLf2bF; arc=pass (i=1 spf=pass spfdomain=peacevolution.org dkim=pass dkdomain=peacevolution.org dmarc=pass fromdomain=peacevolution.org); spf=pass (google.com: domain of linux-kernel+bounces-45275-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45275-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=peacevolution.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bo11-20020a056a02038b00b005d14ca08256si8326347pgb.819.2024.01.30.12.38.53 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 12:38:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45275-ouuuleilei=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=@peacevolution.org header.s=dkim header.b=FCdLf2bF; arc=pass (i=1 spf=pass spfdomain=peacevolution.org dkim=pass dkdomain=peacevolution.org dmarc=pass fromdomain=peacevolution.org); spf=pass (google.com: domain of linux-kernel+bounces-45275-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45275-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=peacevolution.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 979BE28651D for <ouuuleilei@gmail.com>; Tue, 30 Jan 2024 20:37:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F6E271B4B; Tue, 30 Jan 2024 20:37:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=peacevolution.org header.i=@peacevolution.org header.b="FCdLf2bF" Received: from a.peacevolution.org (a.peacevolution.org [206.189.193.133]) (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 6879D79DDB; Tue, 30 Jan 2024 20:37:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=206.189.193.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706647063; cv=none; b=B5VjpBf0dW5tEexYPXSxFM+MNqIDFsB5rrClLep/CCHZa4bi5aZn38RXEjAZZqasFOdqbZZq9Ny2FwJgXEkXzf0lqqFmuKRD9OJGPlU3vkRRs1izQ6Bi/EaFwV1tEenBpvUxL+j6eeDFbp6SW5xapo1REugMmmWYNVxxrD99Uio= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706647063; c=relaxed/simple; bh=42VdHmLmZuT5O6V8Q0K2GarSQjq3zsRvTNhsMQjm5BI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=DRUvygh1qP6mycdWKFluM6ewOzUkhhDOUfJpMh2BaDK1By7xHO0aExO5nFLfaLPzEfUpt3KPtmSzNUTbrLsn2HA/2N6kHvoRXj/lytOm/R0GIcNoEVX7IPNH6bdOsUyhnmXe3jc4OVJFBsAH1RGzfQPdtdSr9evcWVdpM6nuem0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=peacevolution.org; spf=pass smtp.mailfrom=peacevolution.org; dkim=pass (1024-bit key) header.d=peacevolution.org header.i=@peacevolution.org header.b=FCdLf2bF; arc=none smtp.client-ip=206.189.193.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=peacevolution.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peacevolution.org Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by a.peacevolution.org (Postfix) with ESMTPA id 6F80046B74; Tue, 30 Jan 2024 20:37:32 +0000 (UTC) From: Aren Moynihan <aren@peacevolution.org> To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ond=C5=99ej_Jirman?= <megi@xff.cz>, Hans de Goede <j.w.r.degoede@gmail.com>, Aidan MacDonald <aidanmacdonald.0x0@gmail.com>, Aren Moynihan <aren@peacevolution.org>, Chen-Yu Tsai <wens@csie.org>, Quentin Schulz <quentin.schulz@bootlin.com>, Sebastian Reichel <sre@kernel.org> Subject: [PATCH v2 0/5] power: supply: axp20x_usb_power: cleanup input current limit handling Date: Tue, 30 Jan 2024 15:27:56 -0500 Message-ID: <20240130203714.3020464-1-aren@peacevolution.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spamd-Bar: / Authentication-Results: auth=pass smtp.auth=aren@peacevolution.org smtp.mailfrom=aren@peacevolution.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peacevolution.org; s=dkim; t=1706647053; h=from:subject:date:message-id:to:cc:mime-version:content-type:content-transfer-encoding; bh=CnBNCViJHvy4cEKLBSR8JFJniQcbGnFyzpaAFuYyqxw=; b=FCdLf2bFSk3L24ys482teOv4NVoVkgp4hXsRIVyC5BUHZ8cG2nFh55b0ScOuKuZFTJvYvl xx6gGB7eSX+NQ5R92XAVdibbCIxBAoA0yk8f07JvMTRtTxxohiNwkeW3E7ZqJ7zYOYUDvX uXb6y4TWC3K6SHhtEurSClxGvtrPkZo= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789549225227222023 X-GMAIL-MSGID: 1789549225227222023 |
Series |
power: supply: axp20x_usb_power: cleanup input current limit handling
|
|
Message
Aren
Jan. 30, 2024, 8:27 p.m. UTC
Proper handling of the input current limit will be necessary to implement usb power delivery on the Pine64 PinePhone. The PinePhone has a separate chip (anx7688) that handles usb power delivery (among other things), so we will need a way to apply the current limit which that negotiates. The new logic to get/set the input current limit, and get the usb type is originally based on code Ondřej Jirman wrote[1], but I have significantly refactored it. While working on this, I also discovered that the axp803 pmic sets a current limit of 3A on the usb port without any negotiation if it doesn't detect a battery. v1 of this patch can be found at: https://lore.kernel.org/lkml/20240121014057.1042466-1-aren@peacevolution.org/ 1: https://xff.cz/git/linux/commit/?h=axp-6.7&id=3dcd33dfd1ae58db159427365dcb6d0d2b12f06d Changes in v2: - Values less than the lowest supported limit are rounded up instead of returning -EINVAL when setting the input current limit. - Rename existing current_max logic to input_current_limit. This also makes it possible to reuse some of that logic. - Split current limit register and bc race condition fixes into different commits. Aren Moynihan (5): power: supply: axp20x_usb_power: replace current_max with input_current_limit power: supply: axp20x_usb_power: use correct register for input current limit power: supply: axp20x_usb_power: fix race condition with usb bc power: supply: axp20x_usb_power: enable usb_type reporting power: supply: axp20x_usb_power: set input current limit in probe drivers/power/supply/axp20x_usb_power.c | 160 +++++++++++++++++++++--- 1 file changed, 144 insertions(+), 16 deletions(-)