From patchwork Thu May 30 08:55:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13679971 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CB489C25B74 for ; Thu, 30 May 2024 08:56:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sXkq76VrSOO5VsMPLrqoCtfsxMSFeSuyYpNcyKpd06U=; b=zZ/xXbhT4Gi5e/ gZbn+0jPuZdBCq1C52yfphI6y/yI9HelJdjM6zb9vqlB5UNsXKpxU6mb8qCctOUrkPm7rXpfyNCWA cAC/LcikduySOZBeKLK4HEsDAmP2UBq0hNL31gTv5/LPIiQsYHGc7eU9B2QLqtvcOFY8Ht3yA/M7z RyIrvPt53bfqNWHGu39f28jduwXvrf+nF3zcU+ApcDpfHQ80MWvq/Fwic1aF4lfpioAYZ/fz6Sba1 kBA/JZ23buu4lf/8XehOTMhBFdTBKek7WkcPXcpnQPebVNuyM8aPoK3HqU01G16HD5Igo/AJtR5T4 qy3NUL69YJDRrotwueAA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbaT-00000006hd9-2VIX; Thu, 30 May 2024 08:56:41 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbaH-00000006hYR-2UaV for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2024 08:56:30 +0000 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a62db0c8c9cso51036266b.2 for ; Thu, 30 May 2024 01:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717059387; x=1717664187; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2N+Ye3RWAGURspV1/ZdjrT1yzduMmRZpH0IPoATU19E=; b=BdHGjEy/qkJ/f/lHOPwIcAregG5JH2ZHZPy2XQSGeMb2HuWv9jvZFMo4xlBsssD/Zi DGu2WqzJWCSPws6wHWoDnh6ZQYAtXSGDJ5BLWMsbJ522JA+JJfgrAbZei75rOU1nswLW kyLIKsFc7kNUC2KboHeKxlHbtpSSHcbQuSszo0jk2n+muwKKocfkS3jWsgRuGsEHYumu Qh7bvFhi1r4j5JSPVdyFT7BsKsIe5tKV/ZuW7lkbP/nRb5J4uRnVHbiaO1f8Y2lhBP7F cfsYASIec3RYOszqDBQpYiXmg0EJ8mZhrDxF0aBVJ8OwnhpSJmIfK+zdmAY2fg8Y4hBA 3qRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717059387; x=1717664187; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2N+Ye3RWAGURspV1/ZdjrT1yzduMmRZpH0IPoATU19E=; b=AzyGwzn3nOGZ6pr7F0rnqoN5OyH7p7UOj+4HDJHVUtWSU56zUyVnRA2ejNizPLm47D pXagJeCZPHzmwkcfxImh8FdRM+HEi2zuJGzgJQx0zPZswuO3ScEU35GptpzKkiwXpYWG 0YmHzQ3/CTpq/7KajdP5e8wzXEdQQ6g6Iwz/cluNwjEiSKmk6KV573czmFxR+HYSKZv3 jpwv/RF0MD6tKl4trGiQQcCc1a/0LH0FP+1qfg+h699QR8HntuL6au97zSPu2wU2k3kQ 4ZRdPeRpFB258Hjbpr16kMamvaYxfq6XqOz+hmVvtR0Y03lxx6bRxO4Cf6LM/pJlf5/C 6O1g== X-Forwarded-Encrypted: i=1; AJvYcCVWgDlawsdVb/tP7ULiWGBuorzBjfAnLdkrbuGu51c/Qls4XY6xVs6SqsHnlz4rwdXtelIyw2uD1ru6Nm1DKR6kIZEZfDr6oU07eavtUH6A2TyNWrA= X-Gm-Message-State: AOJu0YyYMjlcp5lRA0Tsp0bfjBvKH31WetMa0+CKN6oFJGRkZx48MTkE bJFCt8Ozue4GqWeblxXbJcNSaZ9Ji/sYx/b1JDEXHF42v/8AM9fO X-Google-Smtp-Source: AGHT+IHyS9Qs1kepjHUHXQ9aTRVCxMOeETyLoYnij3nd0Zx182VoZWHIgOSIq7cw0Jq3QCpsyGoctQ== X-Received: by 2002:a17:907:778a:b0:a63:7efd:8ec8 with SMTP id a640c23a62f3a-a65e923ee67mr170948866b.70.1717059387252; Thu, 30 May 2024 01:56:27 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc500a1sm798430166b.125.2024.05.30.01.56.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:56:26 -0700 (PDT) From: Artur Weber Date: Thu, 30 May 2024 10:55:51 +0200 Subject: [PATCH RFC 01/11] dt-bindings: power: supply: max77693: Add fast charge current property MIME-Version: 1.0 Message-Id: <20240530-max77693-charger-extcon-v1-1-dc2a9e5bdf30@gmail.com> References: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> In-Reply-To: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> To: Krzysztof Kozlowski , Chanwoo Choi Cc: Sebastian Reichel , Rob Herring , Conor Dooley , Lee Jones , Krzysztof Kozlowski , Alim Akhtar , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Henrik Grimler , Wolfgang Wiedmeyer , Denis 'GNUtoo' Carikli , Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717059384; l=1078; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=4/v4Yl10Sn2/85JqCalyxo+mnQfcdDcS7xIXZOrC7ic=; b=sKpGCUSVFKBncgtLjB7f/kEoxXGDMoNCSfXcuMN/D1NHxakSVBPwZ+t+uFWNO/Kj7a08w2LHV JP8o7ylKyIWC+u/A+J9LWEntsVmE7li0U3zho1hqAtywGVb74KMqq0J X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_015629_671125_2D193EAC X-CRM114-Status: UNSURE ( 9.34 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add the maxim,fast-charge-current-microamp property, used to specify the current limit to use for fast charge (when plugged into a wall charger). Signed-off-by: Artur Weber --- Documentation/devicetree/bindings/power/supply/maxim,max77693.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max77693.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max77693.yaml index f5fd53debbc8..4f80cc5418f5 100644 --- a/Documentation/devicetree/bindings/power/supply/maxim,max77693.yaml +++ b/Documentation/devicetree/bindings/power/supply/maxim,max77693.yaml @@ -56,6 +56,13 @@ properties: maximum: 3500000 default: 3500000 + maxim,fast-charge-current-microamp: + description: + Current to use for fast charge in uA. + minimum: 60000 + maximum: 2580000 + default: 500000 + maxim,charge-input-threshold-microvolt: description: | Threshold voltage in uV for triggering input voltage regulation loop. From patchwork Thu May 30 08:55:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13679973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C16DDC25B78 for ; Thu, 30 May 2024 08:57:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=53MKPMJei0/vNkwNkUfKtIcBvgu2hkt+toCIinpziL4=; b=DLjinkOXJ1BPDN x2+nyhX/jdyc3Tab0AlZXJnL7gAXs90uW9cCYPE6nJdAVLWlcqPcKs3caqznBlaJX/8SaTqNi9ZBE Kk7f3kt+g4U3g1nojMfSZ8SrENsLKMKAnOAI9cIIKKtzTBChIzKzUMJqEQ8dyPX2aIAeK9noXWe/E QYgeEXgTrhYuu24+l97Jx1hbxy0HRrQ1qXbiAb06ec1IFk3lERezRTnwg0NE3VwY7LJ9W4vl8D5tS M9LlEKTG0SNxh7cC31yfcGIcV4aavG1mcahZBqpOS+/eqMkZdBnXm9fnwo3PzgyEQYw4hOyr197Nq JPC3dYbbqwcItaDeeFoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbb1-00000006hop-28JX; Thu, 30 May 2024 08:57:15 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbaI-00000006hYh-2pGA for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2024 08:56:32 +0000 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a63359aaacaso53619266b.1 for ; Thu, 30 May 2024 01:56:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717059388; x=1717664188; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4u0mVIC+TF9G0asIIdA4dwFhaqzCvDfO1MH0BIe1340=; b=kQaoM/KSLf1qoMl93CDGJNuigeiZ3LShJZkrSoR3DfaGdOmHeFdnfjDO+OmBQSCmJ7 u3HE6MzluDA65lIudAMGZy9ZhQ52CIzoG52WbMufNR28QO/rATtXelJS6LIuyDdy70GS TWtibguNwt9/FOGdlbD0SDexP/Dq69ZaSfjI9ED5wp+aLxC1wjJ2JfecwfpFq5HSP75S LvFRW3WZWHMqFSlP8EcHjbcN3gK+ldIiY42MmuOYlwMlRkdjX9TCQdgTgxtzRHaJ3c5v 7KyTQlfAdKqjJjoQLo7Id9MqucWjJBCJaucy541SQNKzvUPHwIB4VoyqdWGgTeHsiIN9 U+NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717059388; x=1717664188; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4u0mVIC+TF9G0asIIdA4dwFhaqzCvDfO1MH0BIe1340=; b=XB2bUdzqqWLLgTfwwzrBSOhQfhxlOx/7mN655Rzt2GCzWAAGTQzUiuOmFbgiFnJGc+ voz2SQbJE22as3pkbVpoIlLzVk4EeBfPgw84RmseWpF8QtVQCN+a3VTizCA5hymvA0hW hzUKpaIlVConLRpNIWk17Dn+xkxURYSh6sbCqj0Hq2Ata7wi9oFpJxq5PgBHwRxg8EeJ WdumSJrM4yhqGRchuGlISM4UYQD6i2Dp1I90Z3Og6L601wFW6ww/QV9Ie04GGuj7shsb sq2InphXVCmZxSYUhLTSlaUh1mORzCC4rJYTHlrcRYb+EIjNbB6yr3xg91/KTM0a+K0R wsPA== X-Forwarded-Encrypted: i=1; AJvYcCX4ij5VEwbMcM/fMD/IYhtMg1WOQTf0o1kGFfQuq8vdXbGGs+k7DJuuXwIaiVwKW44drRUpDl5/dQS8g07DRLeNxDUVpHJSsl1eO97mSE/AXtfUg0s= X-Gm-Message-State: AOJu0Yx8/1YvzhW/uEbCXNeyU7qZ77vGbpzY1fwvzUnoWCDrSmRv5dZP 72Ac4rXx+HeSkI1Fou+GF758agO1zIqvTS623JEexFwdGfoLt6Lq X-Google-Smtp-Source: AGHT+IEyP2TS9/8Qy85Y+45YpmvtAjOgeIsLUmtMQMYTPbaD2wIPFr75VbxtQQSyD6Y5jnCC90wdSA== X-Received: by 2002:a17:906:1b46:b0:a66:b9a8:74ad with SMTP id a640c23a62f3a-a66b9a87be9mr10297266b.10.1717059388537; Thu, 30 May 2024 01:56:28 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc500a1sm798430166b.125.2024.05.30.01.56.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:56:28 -0700 (PDT) From: Artur Weber Date: Thu, 30 May 2024 10:55:52 +0200 Subject: [PATCH RFC 02/11] dt-bindings: power: supply: max77693: Add maxim,usb-connector property MIME-Version: 1.0 Message-Id: <20240530-max77693-charger-extcon-v1-2-dc2a9e5bdf30@gmail.com> References: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> In-Reply-To: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> To: Krzysztof Kozlowski , Chanwoo Choi Cc: Sebastian Reichel , Rob Herring , Conor Dooley , Lee Jones , Krzysztof Kozlowski , Alim Akhtar , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Henrik Grimler , Wolfgang Wiedmeyer , Denis 'GNUtoo' Carikli , Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717059384; l=1063; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=xgN5sPCevFL3dsnXeVkOmW6b6l95Xb66gcGeR/Rr6O4=; b=9yUpKW0zqhfzMTUuyPlJgp1hjyMIPUsM3qmJQhpwZ9btkMmUIBqVTeVX28r/iJnLYrbkUOH0g scqSoAnh1wjB/Y4IQa9qUWVeaaQLf439Ykk2wto1MP50v5dqmKzcqqc X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_015630_756517_5117CC9E X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allow for specifying a USB connector to use for charger type/OTG cable detection. The way this is done is inspired by the rt5033-charger implementation. Signed-off-by: Artur Weber Reviewed-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/power/supply/maxim,max77693.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max77693.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max77693.yaml index 4f80cc5418f5..e5b29a8aed56 100644 --- a/Documentation/devicetree/bindings/power/supply/maxim,max77693.yaml +++ b/Documentation/devicetree/bindings/power/supply/maxim,max77693.yaml @@ -71,6 +71,12 @@ properties: enum: [4300000, 4700000, 4800000, 4900000] default: 4300000 + maxim,usb-connector: + $ref: /schemas/types.yaml#/definitions/phandle + description: + USB connector to use for charger type/OTG cable detection. Phandle + to a USB connector according to usb-connector.yaml. + required: - compatible From patchwork Thu May 30 08:55:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13679972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB7A5C25B74 for ; Thu, 30 May 2024 08:57:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bPVvNHe1+RG/MYwLkvw0x419qz/IeIMQXgj2tyXySKs=; b=Hh+9C0QRSnN4WT iTyeT5uHOWckBZhF/6SmbCDDekh2BffaHBSamo2FwUcQHqkqp3prUpFey0x2SylrV/mNTPVZdkdQ6 ZRWngoVtpWss36nPi2caERwTkIgQjJgv2WyerwzGYu70KMPPFAVQVM/KNoJfFOUPfUKB8FdwWKFFA inzYmBODTWrrW7nptSKjr4fQagnB0HHhNZicntOxVBDsOgSOuakL4l6ScwVj1T0kcyDVBWVbnEFM+ R/XvSc3Th6ftnEjs0uL9T+JqXTGblNtbULUt36WuDrSgp4i+6T+QTbryMYnbaafRNY0lZyzZQszvk 7ZAXiHvpLVdvgXwdL0jw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbb3-00000006hpy-0sFh; Thu, 30 May 2024 08:57:17 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbaK-00000006hZB-0T6X for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2024 08:56:33 +0000 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-57a1fe63a96so301203a12.0 for ; Thu, 30 May 2024 01:56:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717059390; x=1717664190; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=pH6IEdvPsyMn2z81M00M9CRQyqxS5gUsz993GDmOU5c=; b=Js2nxIVIrX5L20h4ZsHIODrt5NEAtW9+lsITNjeX160bINLhtthLn/LtI/TAYU6VWU wWzXPap7nFpck6vIA/XpNl39KwiUazR+pys2FTnaiEibJGkZ9GitsiXqJuczqkaqQn4T Wf+4QGKfGbK8SqpvMfiRh4xrt3hYUZ7o5x15c8fUAYJ3KbZ+GYidfIpsHnHAxHO23qpc aUTCSBhW+t0U60vP5Rnv3ghlywW58SqRTBqm0G94hr+CZrNc/iYWEFYSDQvfCQ/Ntvd5 8YLhEhfMAeI9Q+x5Qq7sotDMkuHpQqmaWquJ+2bkCV+F5soM3pvF+xeEso3hg1cDKSaV 1K4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717059390; x=1717664190; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pH6IEdvPsyMn2z81M00M9CRQyqxS5gUsz993GDmOU5c=; b=tBcfQKOScgVTvEo7m0NnpetmCorCUtpdZTgydmkH7TbIzDflDDifXtiR+30QrnCULl yDo270B4aAf51go3/7tFap7wNcMFJEmJjnDUitX5j4h4f9cjVq1DndPXZ/fmGCgnT0Ih SiVoJ8pPvCetNC9mqYcPE78t6fYTM0LR9ESuy7mI5vSOGZv9PSXdCRVbEr55XgpL63Rm Mixe+qJKqAwsw/XeFBqunV86W/Bti9deU7H+q5viiY9myw3hK8ul5FT/tVBtdMeSq7Ck 8nqJ1tlLEz/AgM/6kDZ+nHQY0ZfBz43lnnLjSWXm8KUHjYfqPAjPS3lHyVXIIEFcv0XY OrsQ== X-Forwarded-Encrypted: i=1; AJvYcCWAb4+LkB+ub8cculMdcLal7fJMb8K0Nc8/+bppQbkBgChnnq6KtuWMmPnDVkH/vq5ONfnpz+J4pArTDpjox9NF/1Wb6cPVVFwRrXZMgq9esdumtYQ= X-Gm-Message-State: AOJu0Yxmrav11DFF0f405QhskDfUQzBZe+4x34cpd6iXIB93G1GbPOlp Cuo5uba4zGfOcA3NXGD9X99UVVYo87iI4hxnNXjQCpABCyafFTdsdd1BTg== X-Google-Smtp-Source: AGHT+IGnGk2ljLwZ0u8xsY1XXY1Hnt1SDUWhWdbiRrxUqPljltWq596nPnHiBYXJnSz/3lFgR53uBA== X-Received: by 2002:a17:906:3517:b0:a5a:44e:2b87 with SMTP id a640c23a62f3a-a65e8e5c113mr91117566b.21.1717059389889; Thu, 30 May 2024 01:56:29 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc500a1sm798430166b.125.2024.05.30.01.56.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:56:29 -0700 (PDT) From: Artur Weber Date: Thu, 30 May 2024 10:55:53 +0200 Subject: [PATCH RFC 03/11] mfd: max77693: Add defines for charger current control MIME-Version: 1.0 Message-Id: <20240530-max77693-charger-extcon-v1-3-dc2a9e5bdf30@gmail.com> References: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> In-Reply-To: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> To: Krzysztof Kozlowski , Chanwoo Choi Cc: Sebastian Reichel , Rob Herring , Conor Dooley , Lee Jones , Krzysztof Kozlowski , Alim Akhtar , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Henrik Grimler , Wolfgang Wiedmeyer , Denis 'GNUtoo' Carikli , Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717059384; l=1496; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=z92q56T3bzz9gRYE5sI8p34kLQvFNqoO5fMHOAH6pLc=; b=gqZVt0FTts2q85yDzL1R1OZGFpStHpJyMFNtSjLotVPYPTtwzJ9bXD5+s1WXj8u9Dm092xERY 1xicc/PZ5NnAJu1w4t2Pfvq6kpgMbO1ljOYg9eieohJFy/G5VpO+Md3 X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_015632_229317_98105986 X-CRM114-Status: GOOD ( 11.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Wolfgang Wiedmeyer This prepares for an updated regulator and charger driver. The defines are needed to set the maximum input current and the fast charge current. Signed-off-by: Wolfgang Wiedmeyer [GNUtoo@cyberdimension.org: small fix] Signed-off-by: Denis 'GNUtoo' Carikli [Artur: swap hardcoded ILIM values for DEFAULT_FAST_CHARGE_CURRENT] Signed-off-by: Artur Weber --- include/linux/mfd/max77693-private.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h index 54444ff2a5de..4570646e2f33 100644 --- a/include/linux/mfd/max77693-private.h +++ b/include/linux/mfd/max77693-private.h @@ -145,6 +145,8 @@ enum max77693_pmic_reg { #define DEFAULT_THERMAL_REGULATION_TEMP 100 /* microamps */ #define DEFAULT_BATTERY_OVERCURRENT 3500000 +/* microamps */ +#define DEFAULT_FAST_CHARGE_CURRENT 500000 /* microvolts */ #define DEFAULT_CHARGER_INPUT_THRESHOLD_VOLT 4300000 @@ -217,6 +219,10 @@ enum max77693_charger_battery_state { #define CHG_CNFG_01_CHGRSTRT_MASK (0x3 << CHG_CNFG_01_CHGRSTRT_SHIFT) #define CHG_CNFG_01_PQEN_MAKS BIT(CHG_CNFG_01_PQEN_SHIFT) +/* MAX77693_CHG_REG_CHG_CNFG_02 register */ +#define CHG_CNFG_02_CC_SHIFT 0 +#define CHG_CNFG_02_CC_MASK 0x3F + /* MAX77693_CHG_REG_CHG_CNFG_03 register */ #define CHG_CNFG_03_TOITH_SHIFT 0 #define CHG_CNFG_03_TOTIME_SHIFT 3 From patchwork Thu May 30 08:55:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13679974 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A20CC25B74 for ; Thu, 30 May 2024 08:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=I09gLlHaxRSlrc5XZmCBf5GkvRbZhV9xlvoAfJ04VZc=; b=qTP1v5jAa5iOlX UYG09M5mfiUze7JMx+4Oo3H4ZvT3fKLazLDP2+1ZF4h1OFtgeXpFtApWieoicK/D8AOQ4+D8M4A1Y RNAF8qFYhYQDZ1liUCZLBHF2r5Y8jM5bjbXxYS3NN7cnKKZZsGg2aGGvxyrEsRnIbs6kJGyGpgELI awhZRQLISkvFMyO4cTb4uDYo+UhLO4tRSD/AUjwNitoIKq2VKR0PKb4HvI3iAGsd/p1cMDsylBDQJ 7OPRO5eqouWRS+P3ANvGKThlaSIwTNxZkGeR6MRpYKtOOdLFsBoO3bp892zyI7chi2Vy8BaZDdCHp vO+5OkPmgRAAzTbG27AQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbb4-00000006hr1-2283; Thu, 30 May 2024 08:57:18 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbaL-00000006hZb-1pm9 for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2024 08:56:35 +0000 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-57857e0f45cso574257a12.1 for ; Thu, 30 May 2024 01:56:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717059391; x=1717664191; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=qZFoX5IVFjLuki9v4dFBiplrNUJ5RoBfw9AZQOx6kgQ=; b=Rer7TgE0mIfTZud79Fh3sGZmmQgKw6RVKsbpjPuN98kNEfO16rGVQvPhaBlV7aNBP+ ZyfNSFyAevg0UEjAFuaUUmCV3MlQfhs5tgXpa0PbJKQdKJykZa1A3p6W3aTT6P1Sd4Jy rylGHa31JJU/XPhWqT2MSR5OpeurdVAN49d32ApTJTkhyGLzFDNa0OhLp2Ds/6hHeKZr Um6eACBr5WEXmt6w5f7BXmDzU0xhEfBHSefIUeDjlgRMwm3BTRuMvXHPGO0ATc/5MGcl 9l0CVImc/abZkwGyEBgyjjMeTXY938tsw2H4F5SBASCfuiW1RZIxn5WpHo56rQSGzLdF MPAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717059391; x=1717664191; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qZFoX5IVFjLuki9v4dFBiplrNUJ5RoBfw9AZQOx6kgQ=; b=h0rpZXUOODxItS6K3EJle5poXw+0rZXgP4NIxzeBldU2uABEBdPkePHuaYktCeaZJC 7bnWewIcCGanUOf500U9/8PrNHslOy/w7xsMCzSxHS7QzrA8Abag2I7ZfJ6vVF8bFdqs DZPBvHwutluLSyLcXFOR1FJEKigzind2PeD+oQ9LX/i3cDQkbeKBKTS/r/0X4gMm75HW BanJNqNylgL/fuOlIuUh2l2+vb4dmy65nQKfADOwJfuMLdKK9+Sw8iPAnXoXw10CZA+7 ZeR3lamKzDNKyuen0L8Y0V+QdcYiriDdI5C5kWDwsLtOTgCHoC4OeTvDQLw43j5aQgmu 4Ung== X-Forwarded-Encrypted: i=1; AJvYcCWgPyHCq4U7gsrwUrbndHTnDt7iSLm8BMW2mN7PoxzKUvX0L0sMs/MAGx4awHX3dbyMJPKUISB1IBUdUa1trvrk6rtVw2SsYI/ixZ0b7vWkCimBAKc= X-Gm-Message-State: AOJu0Ywzx0+Ni6ciUpX4eOQBg5jrn7Dkva//pzj2WZU0NC+WbbygX3HR IHwKn3YPXFdMSxFluGFYKWUBqivKZfok94/tmPmFTy0WzRn84D9D X-Google-Smtp-Source: AGHT+IE0ZII4vqAKRbQMevN6HtZeVsEyP6AMudu0nYCEDWQluKinx7Ti4QrR8CVjHKxX2kcm6XF30Q== X-Received: by 2002:a17:906:fb0c:b0:a59:ef75:5382 with SMTP id a640c23a62f3a-a65e8f6f478mr88907466b.43.1717059391213; Thu, 30 May 2024 01:56:31 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc500a1sm798430166b.125.2024.05.30.01.56.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:56:30 -0700 (PDT) From: Artur Weber Date: Thu, 30 May 2024 10:55:54 +0200 Subject: [PATCH RFC 04/11] mfd: max77693: Add defines for OTG control MIME-Version: 1.0 Message-Id: <20240530-max77693-charger-extcon-v1-4-dc2a9e5bdf30@gmail.com> References: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> In-Reply-To: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> To: Krzysztof Kozlowski , Chanwoo Choi Cc: Sebastian Reichel , Rob Herring , Conor Dooley , Lee Jones , Krzysztof Kozlowski , Alim Akhtar , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Henrik Grimler , Wolfgang Wiedmeyer , Denis 'GNUtoo' Carikli , Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717059384; l=880; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=fdFCdouFtABSDklI2okYjmv8ltu44PsbFfLaKdFasJM=; b=8aX85TIyQjQICfocT2JKEutODUeUhtAi6tDWjBrIvXV+CLc35vHCgMqCX6obQhvgLowcjr6wS xa0Bz58phthB5z7BfcbkPIzTsiXTRMm/UD8Ml2DTD9NspcfNzLJPJu8 X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_015633_933496_FCBC4C39 X-CRM114-Status: GOOD ( 11.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org These three bits are used to enable OTG control in the charger driver. Add them in preparation for an updated driver. Signed-off-by: Artur Weber --- include/linux/mfd/max77693-private.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h index 4570646e2f33..4448b024255d 100644 --- a/include/linux/mfd/max77693-private.h +++ b/include/linux/mfd/max77693-private.h @@ -209,7 +209,10 @@ enum max77693_charger_battery_state { /* MAX77693 CHG_CNFG_00 register */ #define CHG_CNFG_00_CHG_MASK 0x1 +#define CHG_CNFG_00_OTG_MASK 0x2 #define CHG_CNFG_00_BUCK_MASK 0x4 +#define CHG_CNFG_00_BOOST_MASK 0x8 +#define CHG_CNFG_00_DIS_MUIC_CTRL_MASK 0x20 /* MAX77693_CHG_REG_CHG_CNFG_01 register */ #define CHG_CNFG_01_FCHGTIME_SHIFT 0 From patchwork Thu May 30 08:55:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13679975 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77764C25B74 for ; Thu, 30 May 2024 08:57:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AliJStVi/B+D2fqJ2aIqhr9/1bS/50CErrrTkIrtfso=; b=2fSUKVSlOg/Tg3 ibLYA1I/8q6m/8GHavhnJLBvavUQ52RJZho9PAYw5UDOdbG/dLlpGGSAt3bnuCuW3rdjS53iQiyRG ZNME7hVK7pfqwaFXFGn1TG0aDmO8NiSdC65iV7L1brM7u3eFvugMyLouNXZHMMN/whcCLQFeZqzrf a8KcXr9iXnNSoDlC+vWg9zJKaJt1PWEkQO2LAjR090ZCFfxrjwS8+m4OWbyGXJH/pjvUCaNNTuSi5 Ymxmh1Snfv1WRKb9HXjqKclK0Gx3TS6EuSKpdhJG886rDPxcG7GSCSSZKAMyD67F6F0fu6so5mwXW LwsBimIXcOVvnCbr+kQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbb8-00000006huC-0u4f; Thu, 30 May 2024 08:57:22 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbaM-00000006ha8-2oDI for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2024 08:56:36 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a626776cc50so45018866b.3 for ; Thu, 30 May 2024 01:56:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717059393; x=1717664193; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=LsEhPfZvH2P+EpSo/CYGNbfVPmcN+fNIAQrFOTA/UcQ=; b=mzAMTuFBiW8BFQiYwZOmc4UVYiDdFPWs03GYKwA6d7idleA+MOZwl69QUOr4GBWHvF khOVdysgtyIARlNbEHEUEj87ss/4s4kc22vSq7Pw+BaFYm4E+Z4ED/pdSx7Qjl7z+nei 2tyUfHrKjyaik9h906u4pjDTs7Nz1zE2lo0ElBsiWRnsaGJnX+w507mMx4S84U4K6qSs VwRDhYsKwqZNXvV/1jCNWwHOutqT89mWV9MVOLZ+do2cMBaK5wkodvZwX17BW6fLHpDX X0JNlhOcDiTxnE7ClZzAyeEuRhci4poZ3oE+O8UE2WWryBktxa085OYvLPay+LgAHmcN uCPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717059393; x=1717664193; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LsEhPfZvH2P+EpSo/CYGNbfVPmcN+fNIAQrFOTA/UcQ=; b=Z/A4GibRQDO8LwUkxMezWIMptZgc+JfLkXJo7PGuOGvH9GNjS0yszqJLxkNhmNZBmj P9iUqnWNhyYaR37bd1CibERILjBJ4oISXCAVAIhEW++LWNjaZE8/idUjnOlSQKjdG/FZ 0IlDFr+dZDiRvP3t4n4yPY1Q0ZJklyBDPq6YhUHpqCm0RTSnX1ULw/7SdXdHJrJtvMha qY1fVQgGdov/t2WRtWfUiFWDWjzFCe6EavvgazYfixEJMndmnNjI6A2bfIfM+V5HEEls oZK6ySSnx/z9C0Y4EAk34bHf2wVEQCdQbTBJhCzpGhYMrHzoT6DwEVM4yYIHjWpbav6s pszg== X-Forwarded-Encrypted: i=1; AJvYcCVDOBWH9KFdc+yTiJPsEBNBlpp75A4FzKlC4mrpxNLxalkFhlH5AgwZiucXrzCkyzn7ePbXwJWOIO7FDJ7mmErn5vQ5PZPaJhYgRqNY+JpHyW16ZCM= X-Gm-Message-State: AOJu0YzlVNc+qa+E+AR2P9MJQBwtlNOF3vnRUmXx/UH2omimnOMtpMWV NfleFEwEOU2wEhmzeH1BGUg+H2b7l1CTmZePzVvOxBMH/9e1UmIa X-Google-Smtp-Source: AGHT+IGy1UxJBC3mlOkSAXe0pOgPmMNf33MPiINsk2Yc1DhhEYI1xxBd9KGGHgstBwfP54lhtkFN2g== X-Received: by 2002:a17:906:b49:b0:a65:1322:7a50 with SMTP id a640c23a62f3a-a65e8d3697fmr93332566b.9.1717059392542; Thu, 30 May 2024 01:56:32 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc500a1sm798430166b.125.2024.05.30.01.56.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:56:32 -0700 (PDT) From: Artur Weber Date: Thu, 30 May 2024 10:55:55 +0200 Subject: [PATCH RFC 05/11] power: supply: max77693: Expose INPUT_CURRENT_LIMIT and CURRENT_MAX MIME-Version: 1.0 Message-Id: <20240530-max77693-charger-extcon-v1-5-dc2a9e5bdf30@gmail.com> References: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> In-Reply-To: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> To: Krzysztof Kozlowski , Chanwoo Choi Cc: Sebastian Reichel , Rob Herring , Conor Dooley , Lee Jones , Krzysztof Kozlowski , Alim Akhtar , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Henrik Grimler , Wolfgang Wiedmeyer , Denis 'GNUtoo' Carikli , Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717059384; l=3592; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=8GrD+7N4WIECelsMnMsq1oOIcn8b/3kdBSwFTiT2G4s=; b=ud87G1rB7IwJbUdifMoM61jeuoLZFMLcCeL8B+hk4HIHdhOhuibHT3a/ZGXSAduo063J7b0Ro VAw73uJI42YCzPX5EUaqQxsaOcV1p/fgEQgMkNjYBd6jUQMzRv6wmK2 X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_015634_763540_7A3ADDF0 X-CRM114-Status: GOOD ( 17.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are two charger current limit registers: - Fast charge current limit (which controls current going from the charger to the battery); - CHGIN input current limit (which controls current going into the charger through the cable, and is managed by the CHARGER regulator). Add the necessary functions to retrieve the CHGIN input limit (from CHARGER regulator) and maximum fast charge current values, and expose them as power supply properties. Signed-off-by: Artur Weber --- drivers/power/supply/max77693_charger.c | 52 +++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/drivers/power/supply/max77693_charger.c b/drivers/power/supply/max77693_charger.c index 2001e12c9f7d..894c35b750b3 100644 --- a/drivers/power/supply/max77693_charger.c +++ b/drivers/power/supply/max77693_charger.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -21,6 +22,7 @@ struct max77693_charger { struct device *dev; struct max77693_dev *max77693; struct power_supply *charger; + struct regulator *regu; u32 constant_volt; u32 min_system_volt; @@ -197,12 +199,51 @@ static int max77693_get_online(struct regmap *regmap, int *val) return 0; } +/* + * There are *two* current limit registers: + * - CHGIN limit, which limits the input current from the external charger; + * - Fast charge current limit, which limits the current going to the battery. + */ + +static int max77693_get_input_current_limit(struct max77693_charger *chg, + int *val) +{ + int ret; + + ret = regulator_get_current_limit(chg->regu); + if (ret < 0) + return ret; + + *val = ret; + + return 0; +} + +static int max77693_get_fast_charge_current(struct regmap *regmap, int *val) +{ + unsigned int data; + int ret; + + ret = regmap_read(regmap, MAX77693_CHG_REG_CHG_CNFG_02, &data); + if (ret < 0) + return ret; + + data &= CHG_CNFG_02_CC_MASK; + data >>= CHG_CNFG_02_CC_SHIFT; + + *val = (data * 333 / 10) * 1000; /* 3 steps/0.1A */ + + return 0; +} + static enum power_supply_property max77693_charger_props[] = { POWER_SUPPLY_PROP_STATUS, POWER_SUPPLY_PROP_CHARGE_TYPE, POWER_SUPPLY_PROP_HEALTH, POWER_SUPPLY_PROP_PRESENT, POWER_SUPPLY_PROP_ONLINE, + POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, + POWER_SUPPLY_PROP_CURRENT_MAX, POWER_SUPPLY_PROP_MODEL_NAME, POWER_SUPPLY_PROP_MANUFACTURER, }; @@ -231,6 +272,12 @@ static int max77693_charger_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_ONLINE: ret = max77693_get_online(regmap, &val->intval); break; + case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT: + ret = max77693_get_input_current_limit(chg, &val->intval); + break; + case POWER_SUPPLY_PROP_CURRENT_MAX: + ret = max77693_get_fast_charge_current(regmap, &val->intval); + break; case POWER_SUPPLY_PROP_MODEL_NAME: val->strval = max77693_charger_model; break; @@ -680,6 +727,11 @@ static int max77693_charger_probe(struct platform_device *pdev) chg->dev = &pdev->dev; chg->max77693 = max77693; + chg->regu = devm_regulator_get(chg->dev, "CHARGER"); + if (IS_ERR(chg->regu)) + return dev_err_probe(&pdev->dev, PTR_ERR(chg->regu), + "failed to get charger regulator\n"); + ret = max77693_dt_init(&pdev->dev, chg); if (ret) return ret; From patchwork Thu May 30 08:55:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13679977 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ABBD8C25B74 for ; Thu, 30 May 2024 08:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BQHW2l1bgoQDM4hNierKeUTemMBAGYeajCUUOpF5Z14=; b=C1li7TxymeJ2lD eGZHIiXQ0Ppq/3GTa/8Cp8Un0wOUxP6tcoSQksz9/96DVJwjHYLzZSHJr2+LpiJKyVK5O0rs/U2t9 ZVvwAAE4hhz9daTHZf6HVczUpH/1abvJKhr09gnetLVUeZ1arD+xMPnoJZOwuEUZ8twvI3tI+RQ2q dNXORQ6PvlbRsXrkcNHC/KEAcUEJqX6o7iQ6aF2sxuPwXWlGPgB19U4MCCodx98aLsd4WXFIvMbVE WB4GBIC47v9+Ss90rjabHzn8mHoDiS5HxZP58ktSbp12Z3HXSvPwKzBPcMRNcbfJd0y7mw5CvYWyT VTGagfxG/WhKYuIGkhgw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbb9-00000006hv4-2l2a; Thu, 30 May 2024 08:57:23 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbaO-00000006haU-31gU for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2024 08:56:39 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-52b79447c58so858429e87.1 for ; Thu, 30 May 2024 01:56:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717059394; x=1717664194; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=7RjpzD6bfEzWTvpqtXGEvDLHQS6WjNKNOtNtOUf/g0k=; b=de6jp25nF/+CijsA5k12IoWgwQPQloMN3rtxwpUVQniuxga4KyG95Q8RnZW8EoJTxe NdsNPrYice063pmwrd1A1Elz3NyLQ6KO9YyFye4Uc0htFaqnVQAM6Ip7Pbbg2EXOr+cY eJtaHVU/Pp3kj/Ytqvr2bxF+/LsaSfqQrJ+zrHgirU0y1gANTwPxsi4kWmt51G6e9NHU keXbxJmNKy9TGX7g1vuqSOXCMzBsMoUzQzDdoEDdmnVU+TZMH1MqKXF3ZvswqRe8jDe8 4iIRJe8xO3Vj7sMTO4na17uejY13bSG/0nn7HdTi1GC78blVlOQCVtNrM2EA8+BvWsCF GS8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717059394; x=1717664194; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7RjpzD6bfEzWTvpqtXGEvDLHQS6WjNKNOtNtOUf/g0k=; b=gl37uZac/ULUGy+I3vVWC84B+R7IqJ35/MwAIc1fMEQijO91ppYGqFxhOJ0V5eVnSR LXxHJ+IjlBe2TG64BWoaCL/f4I358kpVh9j1ISbctJPs2uh53rk73a2JL3a+nF0egZmz NRG4AfNjkCDA13Q9h4pAQEW/Uxlrdn5yJzT+KX7pZWtc+sLJ/kv5njbQdySNsGTSePGu OUktUuxyPGa6DgsWEGmgKDFChYMuP6QQ/ADMgGAurNgcRx2DI9mN+wNCAzJQJEGvx22E Mem+g49QPLx/8OJcXtYdgQk2DRCpmTcKmOcEhMoZvsAYiC5bFcaR8dQ+QlUgDg1gdBS4 Qn6w== X-Forwarded-Encrypted: i=1; AJvYcCU3Z/tsrj96s+Poqak8IplGj6py+FkzIudWfGAPKy+ArMK4Pd2L1QYe7SqBWagZD0mf+TrFMtZenJWhqdR5EEBBjW6jkjgqlosMLd1XK2WJOgWKeCg= X-Gm-Message-State: AOJu0YzpdwLBTp/E9i14d3CPSeYSfTvHVaOfeWri4/mnGxAhQuOHO/hW OBHAACY31a09bSUkKmyU29CGmtElkgcJZ8EziODWWu0+yuGTxtAi X-Google-Smtp-Source: AGHT+IHwPpyulXExjGnPKagykwpS32TIBll7xV05JGGq+Yi/BHyTXoe0cwkmsoRZnXimftPoX515uA== X-Received: by 2002:a05:6512:1183:b0:52a:de09:283a with SMTP id 2adb3069b0e04-52b7d43b001mr1194683e87.37.1717059393912; Thu, 30 May 2024 01:56:33 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc500a1sm798430166b.125.2024.05.30.01.56.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:56:33 -0700 (PDT) From: Artur Weber Date: Thu, 30 May 2024 10:55:56 +0200 Subject: [PATCH RFC 06/11] power: supply: max77693: Set charge current limits during init MIME-Version: 1.0 Message-Id: <20240530-max77693-charger-extcon-v1-6-dc2a9e5bdf30@gmail.com> References: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> In-Reply-To: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> To: Krzysztof Kozlowski , Chanwoo Choi Cc: Sebastian Reichel , Rob Herring , Conor Dooley , Lee Jones , Krzysztof Kozlowski , Alim Akhtar , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Henrik Grimler , Wolfgang Wiedmeyer , Denis 'GNUtoo' Carikli , Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717059384; l=3318; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=C8RQpwCwOR+YYCuseUykropyLMG3kS1Is6uGMemnREw=; b=ot9Ju3EGJBen9DJEc/vVfO7LgQgKOaa5PtRG8GPVMQY6vN+iI9zaPuXzBkUtX4sQCTlX+dRwl K0xAp8pivroAnNNGQt/G9m+i0vfmTOy0gZ4h89eqN2J3XET461eIXRg X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_015636_880619_CDAE5E82 X-CRM114-Status: GOOD ( 16.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are two charger current limit registers: - Fast charge current limit (which controls current going from the charger to the battery); - CHGIN input current limit (which controls current going into the charger through the cable, and is managed by the CHARGER regulator). Add functions for setting both of the values, and set them to a safe default value of 500mA at initialization. The default value for the fast charge current limit can be modified by setting the maxim,fast-charge-current-microamp DT property; the CHGIN input current limit will be set up later in the charger detection mechanism. Signed-off-by: Artur Weber --- drivers/power/supply/max77693_charger.c | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/power/supply/max77693_charger.c b/drivers/power/supply/max77693_charger.c index 894c35b750b3..d59b1524b0a4 100644 --- a/drivers/power/supply/max77693_charger.c +++ b/drivers/power/supply/max77693_charger.c @@ -28,6 +28,7 @@ struct max77693_charger { u32 min_system_volt; u32 thermal_regulation_temp; u32 batttery_overcurrent; + u32 fast_charge_current; u32 charge_input_threshold_volt; }; @@ -591,6 +592,35 @@ static int max77693_set_batttery_overcurrent(struct max77693_charger *chg, CHG_CNFG_12_B2SOVRC_MASK, data); } +static int max77693_set_input_current_limit(struct max77693_charger *chg, + unsigned int uamp) +{ + dev_dbg(chg->dev, "CHGIN input current limit: %u\n", uamp); + + return regulator_set_current_limit(chg->regu, (int)uamp, (int)uamp); +} + +static int max77693_set_fast_charge_current(struct max77693_charger *chg, + unsigned int uamp) +{ + unsigned int data; + + data = (uamp / 1000) * 10 / 333; /* 0.1A/3 steps */ + + if (data > CHG_CNFG_02_CC_MASK) { + dev_err(chg->dev, "Wrong value for fast charge current\n"); + return -EINVAL; + } + + data <<= CHG_CNFG_02_CC_SHIFT; + + dev_dbg(chg->dev, "Fast charge current: %u (0x%x)\n", uamp, data); + + return regmap_update_bits(chg->max77693->regmap, + MAX77693_CHG_REG_CHG_CNFG_02, + CHG_CNFG_02_CC_MASK, data); +} + static int max77693_set_charge_input_threshold_volt(struct max77693_charger *chg, unsigned int uvolt) { @@ -668,6 +698,15 @@ static int max77693_reg_init(struct max77693_charger *chg) if (ret) return ret; + ret = max77693_set_fast_charge_current(chg, chg->fast_charge_current); + if (ret) + return ret; + + ret = max77693_set_input_current_limit(chg, + DEFAULT_FAST_CHARGE_CURRENT); + if (ret) + return ret; + return max77693_set_charge_input_threshold_volt(chg, chg->charge_input_threshold_volt); } @@ -703,11 +742,17 @@ static int max77693_dt_init(struct device *dev, struct max77693_charger *chg) chg->charge_input_threshold_volt = DEFAULT_CHARGER_INPUT_THRESHOLD_VOLT; + if (of_property_read_u32(np, "maxim,fast-charge-current-microamp", + &chg->fast_charge_current)) + chg->fast_charge_current = DEFAULT_FAST_CHARGE_CURRENT; + return 0; } #else /* CONFIG_OF */ static int max77693_dt_init(struct device *dev, struct max77693_charger *chg) { + chg->fast_charge_current = DEFAULT_FAST_CHARGE_CURRENT; + return 0; } #endif /* CONFIG_OF */ From patchwork Thu May 30 08:55:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13679976 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 957D3C25B78 for ; Thu, 30 May 2024 08:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7CULSbRSidqMZ+IssNl2TNj1JM6N9QmvDPfnNdqtbS8=; b=QqNxfa56DwSyPC TtFLaUYOZPSoV0xxOcKQ6zjKKQxa9rrBu4byBnakdWPmX6s/iSOrsAc5ymrSjDGOE2N5Vk+c71YZV oZbjsZUQaElnIjgnX7LuRF002yu9840cDXAbVsiYu3gkucFcpr1+BIZgvigOSeF1jZiCDUstqaAsz fsldABDr8QhLJn1irnbuaHIywcrcGF63Hl0dgzZeDP+fa+38Q8WsekcbN36nVK3dnYZCizzhYVgTy S870VFUBFFJC6W2TRMB128YcajWLRAYxMPo3F59u3TDzPorwSXFNyP/h+5JCVtEOzOzHwVWBC769Z ngZ9CMMLcbFwf4+QCJdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbbC-00000006hxX-2T1Z; Thu, 30 May 2024 08:57:26 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbaP-00000006hap-0p6y for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2024 08:56:40 +0000 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5785eab8d5dso635982a12.3 for ; Thu, 30 May 2024 01:56:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717059395; x=1717664195; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Kn2E3HXmiCEzf6NwKWLZ6I/Ayq5D3tGA7P5z5wrdz+Q=; b=CdlIUmlT6HZiGrNERSMSuxpmhguryUNKfZyQG2u7s120cnRS890G3F6roVavMNmFyE uSTljHPbErx/A/UUQAgvSoJVuKwZdpteZoS8M88mzaUJlGMbzXSWPPvSRrYnZ5sCwRQe Ewp8vPY0Xh4fkvyek5JiZS3YduiTHr2q2zJbvD8cGgI50nPouvIt7o/cKmnN63ZvDp2D Yi1emdHDDRssgGz6cav0lqpRbIlWyNVrgx/PYBnZE7JbF4zuvq0NxBFajd4sxgGF3Y8X rbnENLLvfTZeEy+fVQK571lPGxrtgmNld++tKJcGPEWBu2EeZpztHMln6Ij56j2Mrmrq TjJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717059395; x=1717664195; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Kn2E3HXmiCEzf6NwKWLZ6I/Ayq5D3tGA7P5z5wrdz+Q=; b=N1YVjYKb5uJhMjrGm7mJNRr8oyEHDZ+O66CQYugk3F4JO6rJz+xIjPRPEt3Cs8MRd4 PazBd/LACBW/ZU+szF0Rg3pDcoJxWSKON32l8cgDeEq1lCBQjf+0ldtv0DOy346QY3rC JVn3hVRrWrIsxER5SwjXJlHxSGvkqkXAnmEAdQewZEdyFXOh6w5gORS9/wx5Y/MKjU8b CY5r2GvKr2wjmEbiEgmXdvD3ARXUhpivzMTc2q3i/Izb6a4ZF6RjNFbUDw8bHPzYf/mv xS+zT/W3WaJDMqBLuurEvqtaTM3LWzaMVmSiF+TAmIeAFVfIxKwaYBckSZe+7ko08Wl+ o20A== X-Forwarded-Encrypted: i=1; AJvYcCXQCSZPak39yKTzennpNxRqT88WHNHKGIRFfGeIfXDBnFSrYSWwK719TaFfO1IV2GfM1xkLAK0uBxApFP9P0jrJwrX9VvwbXhbDAjRZS7Lzq8aQrwU= X-Gm-Message-State: AOJu0Yz8FlArj66TxytnRqXZi7Knc1oGMsMS86QPNgm+JGZSDQgxUmxE PMthd8L/rc9m7LsB4iY+FALm8v2+Z2zKtlT17tCUe3jEr+TD9IKV X-Google-Smtp-Source: AGHT+IE31vwYfcuJPIGE6LexzX5w+MozSbSYVt+e/+/Z7o3jKatrX2YtbIX2R41eGLdKadHEID+EMg== X-Received: by 2002:a17:906:d92:b0:a59:a64c:9a26 with SMTP id a640c23a62f3a-a65e8e507d8mr84553066b.23.1717059395263; Thu, 30 May 2024 01:56:35 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc500a1sm798430166b.125.2024.05.30.01.56.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:56:34 -0700 (PDT) From: Artur Weber Date: Thu, 30 May 2024 10:55:57 +0200 Subject: [PATCH RFC 07/11] power: supply: max77693: Add USB extcon detection for enabling charging MIME-Version: 1.0 Message-Id: <20240530-max77693-charger-extcon-v1-7-dc2a9e5bdf30@gmail.com> References: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> In-Reply-To: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> To: Krzysztof Kozlowski , Chanwoo Choi Cc: Sebastian Reichel , Rob Herring , Conor Dooley , Lee Jones , Krzysztof Kozlowski , Alim Akhtar , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Henrik Grimler , Wolfgang Wiedmeyer , Denis 'GNUtoo' Carikli , Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717059384; l=6243; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=Z6Uakaaf2pR7w6gR2fxAZJMtvGZtTD0SN8W+EmCqsME=; b=/otuVyG+MYAQnvYq6pnSJfAJ2q8SAm6E1XDwZh46SvFbfocSd7ZsDnbIlnKCkSUoFJXIwbMsP SZVtRrM6cbfBl2IPwVU770VsZIghjYMdO6Rl3TxBTSXkrPox15roc9Y X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_015637_581215_9E27A6F7 X-CRM114-Status: GOOD ( 23.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a device tree property, "maxim,usb-connector", that can be used to specify a USB connector to use to detect whether a charging cable has been plugged in/out, and enable/disable charging accordingly. To accommodate this, also add an internal pointer to the CHARGER regulator, which is used to enable/disable charging and set the input current limit (which will be done in subsequent commits). The extcon listener/worker implementation is inspired by the rt5033_charger driver. Signed-off-by: Artur Weber --- drivers/power/supply/Kconfig | 1 + drivers/power/supply/max77693_charger.c | 125 ++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+) diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig index 3e31375491d5..e4aeff9e7ad1 100644 --- a/drivers/power/supply/Kconfig +++ b/drivers/power/supply/Kconfig @@ -549,6 +549,7 @@ config CHARGER_MAX77650 config CHARGER_MAX77693 tristate "Maxim MAX77693 battery charger driver" depends on MFD_MAX77693 + depends on EXTCON || !EXTCON help Say Y to enable support for the Maxim MAX77693 battery charger. diff --git a/drivers/power/supply/max77693_charger.c b/drivers/power/supply/max77693_charger.c index d59b1524b0a4..c2e8ae367381 100644 --- a/drivers/power/supply/max77693_charger.c +++ b/drivers/power/supply/max77693_charger.c @@ -5,6 +5,8 @@ // Copyright (C) 2014 Samsung Electronics // Krzysztof Kozlowski +#include +#include #include #include #include @@ -30,6 +32,13 @@ struct max77693_charger { u32 batttery_overcurrent; u32 fast_charge_current; u32 charge_input_threshold_volt; + + /* USB cable notifications */ + struct { + struct extcon_dev *edev; + struct notifier_block nb; + struct work_struct work; + } cable; }; static int max77693_get_charger_state(struct regmap *regmap, int *val) @@ -711,16 +720,109 @@ static int max77693_reg_init(struct max77693_charger *chg) chg->charge_input_threshold_volt); } +static int max77693_set_charging(struct max77693_charger *chg, bool enable) +{ + int is_enabled; + int ret = 0; + + is_enabled = regulator_is_enabled(chg->regu); + if (is_enabled < 0) + return is_enabled; + + if (enable && !is_enabled) + ret = regulator_enable(chg->regu); + else if (!enable && is_enabled) + ret = regulator_disable(chg->regu); + + return ret; +} + +static void max77693_charger_extcon_work(struct work_struct *work) +{ + struct max77693_charger *chg = container_of(work, struct max77693_charger, + cable.work); + struct extcon_dev *edev = chg->cable.edev; + int connector, state; + int ret; + + for (connector = EXTCON_USB_HOST; connector <= EXTCON_CHG_USB_PD; + connector++) { + state = extcon_get_state(edev, connector); + if (state == 1) + break; + } + + switch (connector) { + case EXTCON_CHG_USB_SDP: + case EXTCON_CHG_USB_DCP: + case EXTCON_CHG_USB_CDP: + case EXTCON_CHG_USB_ACA: + case EXTCON_CHG_USB_FAST: + case EXTCON_CHG_USB_SLOW: + case EXTCON_CHG_USB_PD: + ret = max77693_set_charging(chg, true); + if (ret) { + dev_err(chg->dev, "failed to enable charging\n"); + break; + } + dev_info(chg->dev, "charging. connector type: %d\n", + connector); + break; + default: + ret = max77693_set_charging(chg, false); + if (ret) { + dev_err(chg->dev, "failed to disable charging\n"); + break; + } + dev_info(chg->dev, "charging. connector type: %d\n", + connector); + break; + } + + power_supply_changed(chg->charger); +} + +static int max77693_charger_extcon_notifier(struct notifier_block *nb, + unsigned long event, void *param) +{ + struct max77693_charger *chg = container_of(nb, struct max77693_charger, + cable.nb); + + schedule_work(&chg->cable.work); + + return NOTIFY_OK; +} + #ifdef CONFIG_OF static int max77693_dt_init(struct device *dev, struct max77693_charger *chg) { struct device_node *np = dev->of_node; + struct device_node *np_conn, *np_edev; if (!np) { dev_err(dev, "no charger OF node\n"); return -EINVAL; } + np_conn = of_parse_phandle(np, "maxim,usb-connector", 0); + np_edev = of_get_parent(np_conn); + + chg->cable.edev = extcon_find_edev_by_node(np_edev); + if (IS_ERR(chg->cable.edev)) { + /* + * In case of deferred extcon probe, defer our probe as well + * until it appears. + */ + if (PTR_ERR(chg->cable.edev) == -EPROBE_DEFER) + return PTR_ERR(chg->cable.edev); + /* + * Otherwise, ignore errors (the charger can run without a + * connector provided). + */ + dev_warn(dev, "no extcon device found in device-tree (%ld)\n", + PTR_ERR(chg->cable.edev)); + } + if (of_property_read_u32(np, "maxim,constant-microvolt", &chg->constant_volt)) chg->constant_volt = DEFAULT_CONSTANT_VOLT; @@ -787,6 +889,26 @@ static int max77693_charger_probe(struct platform_device *pdev) psy_cfg.drv_data = chg; + /* Set up extcon if the USB connector node was found */ + if (!IS_ERR(chg->cable.edev)) { + ret = devm_work_autocancel(&pdev->dev, &chg->cable.work, + max77693_charger_extcon_work); + if (ret) { + dev_err(&pdev->dev, "failed: initialize extcon work\n"); + return ret; + } + + chg->cable.nb.notifier_call = max77693_charger_extcon_notifier; + + ret = devm_extcon_register_notifier_all(&pdev->dev, + chg->cable.edev, + &chg->cable.nb); + if (ret) { + dev_err(&pdev->dev, "failed: register extcon notifier\n"); + return ret; + } + } + ret = device_create_file(&pdev->dev, &dev_attr_fast_charge_timer); if (ret) { dev_err(&pdev->dev, "failed: create fast charge timer sysfs entry\n"); @@ -822,6 +944,9 @@ static int max77693_charger_probe(struct platform_device *pdev) device_remove_file(&pdev->dev, &dev_attr_top_off_threshold_current); device_remove_file(&pdev->dev, &dev_attr_fast_charge_timer); + devm_extcon_unregister_notifier_all(&pdev->dev, chg->cable.edev, + &chg->cable.nb); + return ret; } From patchwork Thu May 30 08:55:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13679979 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD92FC25B74 for ; Thu, 30 May 2024 08:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bai9VDX9qoZaKLOjtWwOD868iU8aov0VZkseKN5lAtQ=; b=zKFTOcgxQvu4iE wMoZ2m3KplEfJtPnplglHzYtUvdW3cxwX+UxB4HebwIZOd1m3/wy7wBzjQi5/lVz9FT/S/GNFrxql y83wAhbHyhlYHycHAxmR2H74yWgWepRwduLwZMVtlefZcUofk8ciGZaC5defGy19IecXCqBqzB0I1 zXJuvOSWeqoH20Zox2UKC27CS28xgHhJrmRGB+1rx/nEydTIUXb4m90kFFY99/IKxcjEpuG0Lop8H DkOUaCPo3gj/CHQQAsPaIKmFZR9+dhkzjlAMBH3KuD/NnNsnwk9b6kjzK/OcdTel21ZoYfTwWMwHX CaGgA+gcKco3OrpjS9WQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbbE-00000006hzD-1ue9; Thu, 30 May 2024 08:57:28 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbaQ-00000006hb9-2r3N for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2024 08:56:41 +0000 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a653972487fso34130166b.1 for ; Thu, 30 May 2024 01:56:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717059397; x=1717664197; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=y515HyBE05tinjYLW0X+UrEG/VkT72f1VOdrq3/W9HM=; b=Gx+rgs8tC9lCk8LT86+RBRPLgz2H5rVFUBow4LNNAFq+h62R1kURKhncdb3v9qNLwY ZfwfRBvwmymohlrmeE/EFhpMiqzwOb2ZWmtVvczvPIwcTkhBamgOYOYFX1EDqottTQYk EiVbcXroFT+cGFnCywYHV8AfwRAoYjmSX+UU0tb12gyGQz3ffX+zv9Q0NryvTKnR5Wli nEjuKoQN2FV31iH6CetNsJq69/xnaoprT1qewPcDqiLO5C7e/yC/x4tcTwlEbLppjOCT 1aWnLkXzqugoQsA3Qokb5cOXnf9I6JqmiaVlAnpHb/qfJqs8XREwADHccrM3KxcfLb/h fQuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717059397; x=1717664197; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y515HyBE05tinjYLW0X+UrEG/VkT72f1VOdrq3/W9HM=; b=o5wx60Mue8TdBDMd047h17UmF7WudU+ru9p/gOm6FyfmPbEpDC0KnJVINtR1P7IjUK 7TauHpSypKO18Uat0NPorbosjbifpS5DQN7x+Bx5lxcoWl1C9UoW/o3vKxiABP4HHCjM r7unDe9OyKWav/pe9AJfdsR84oRJS8xpay9XrxRYcLg9N7FUVIHyrcVjhLpHA9nsfDZ2 UgZV3qxsqna+5pj5g21ZE86LoTrJn3u9JR9B+S/Q8yQXOLrWJjSuEpqAvNsee/h2et6m DzknUTG+8+GH317vJCdVG9titJK0b4SQD6TmXUfMWrjnL1RXinvPUQOjZcVgIYU/Nn9h JJlQ== X-Forwarded-Encrypted: i=1; AJvYcCUwY0Jei7+5YH/STR6NACZSSWjHk+vZX+Wva6UmGMMxg61SllDwxuTq761KHdwOCmq6ZS46iJq396a0rQx19TRfniEuoOBV8KRUGTiucJQjT9UbbWE= X-Gm-Message-State: AOJu0YzoPY4KXtOwgOkN27nyIaksBvpXx+/PBQyhcMKkmAj4Et6PXywQ ZB59hTMQe7dihLctWVTmzm2vhDd7nEOX15iyTw7HLXMg9qmMWAcS X-Google-Smtp-Source: AGHT+IEOoR0GhaKcDjy0VMgU2i9ZuhLM0mYFVsj2XeXlc9nnyB4fJ48jkxmmdzBaeVAKSQ8zfT79vA== X-Received: by 2002:a17:906:bcf1:b0:a62:1ac8:5752 with SMTP id a640c23a62f3a-a65e8e317e8mr84844066b.8.1717059396642; Thu, 30 May 2024 01:56:36 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc500a1sm798430166b.125.2024.05.30.01.56.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:56:36 -0700 (PDT) From: Artur Weber Date: Thu, 30 May 2024 10:55:58 +0200 Subject: [PATCH RFC 08/11] power: supply: max77693: Add support for detecting and enabling OTG MIME-Version: 1.0 Message-Id: <20240530-max77693-charger-extcon-v1-8-dc2a9e5bdf30@gmail.com> References: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> In-Reply-To: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> To: Krzysztof Kozlowski , Chanwoo Choi Cc: Sebastian Reichel , Rob Herring , Conor Dooley , Lee Jones , Krzysztof Kozlowski , Alim Akhtar , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Henrik Grimler , Wolfgang Wiedmeyer , Denis 'GNUtoo' Carikli , Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717059384; l=3575; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=ASIwzdEZQZXRm8Gyc8ivplNNZTHwY1NZ3AUZqjW/FCw=; b=MXc4Bb2/SN4z7AvEEeeSSMbRT9iuCtg3ixSez6kz6cE5oO+N08S58aiJ0Lfic/PE6EWcO4BIc Q+aEXmRvbfFDSMFAdElLbXdf7WM0IdllawF8Jzg0BN+OKcPfhzte9rM X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_015639_579750_D81FC42D X-CRM114-Status: GOOD ( 19.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Building upon the newly added extcon detection support, add detection for USB OTG cables (EXTCON_USB_HOST type), and enable/disable the OTG bits as needed. Signed-off-by: Artur Weber --- Downstream also sets "CHGIN output current limit in OTG mode" to 900mA by writing (1 << 7) to the CHG_CNFG_02 register; while I would try to add this here, I do not know which exact bits control the current limit and how their value affects it (downstream has no docs other than what I just mentioned), so it's impossible for me to know what the mask is. --- drivers/power/supply/max77693_charger.c | 70 +++++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 11 deletions(-) diff --git a/drivers/power/supply/max77693_charger.c b/drivers/power/supply/max77693_charger.c index c2e8ae367381..e548fd420e78 100644 --- a/drivers/power/supply/max77693_charger.c +++ b/drivers/power/supply/max77693_charger.c @@ -737,11 +737,41 @@ static int max77693_set_charging(struct max77693_charger *chg, bool enable) return ret; } +static int max77693_set_otg(struct max77693_charger *chg, bool enable) +{ + struct regmap *regmap = chg->max77693->regmap; + unsigned int data; + bool is_enabled; + int ret; + + ret = regmap_read(regmap, MAX77693_CHG_REG_CHG_CNFG_00, &data); + if (ret) + return ret; + + is_enabled = !!(data & CHG_CNFG_00_OTG_MASK); + + if (enable && !is_enabled) { + /* OTG on, boost on, DIS_MUIC_CTRL on */ + data |= CHG_CNFG_00_OTG_MASK | CHG_CNFG_00_BOOST_MASK \ + | CHG_CNFG_00_DIS_MUIC_CTRL_MASK; + + } else if (!enable && is_enabled) { + /* OTG off, boost off, DIS_MUIC_CTRL off */ + data &= ~(CHG_CNFG_00_OTG_MASK | CHG_CNFG_00_BOOST_MASK \ + | CHG_CNFG_00_DIS_MUIC_CTRL_MASK); + } + + return regmap_write(chg->max77693->regmap, + MAX77693_CHG_REG_CHG_CNFG_00, + data); +} + static void max77693_charger_extcon_work(struct work_struct *work) { struct max77693_charger *chg = container_of(work, struct max77693_charger, cable.work); struct extcon_dev *edev = chg->cable.edev; + bool set_charging, set_otg; int connector, state; int ret; @@ -760,25 +790,43 @@ static void max77693_charger_extcon_work(struct work_struct *work) case EXTCON_CHG_USB_FAST: case EXTCON_CHG_USB_SLOW: case EXTCON_CHG_USB_PD: - ret = max77693_set_charging(chg, true); - if (ret) { - dev_err(chg->dev, "failed to enable charging\n"); - break; - } + set_charging = true; + set_otg = false; + dev_info(chg->dev, "charging. connector type: %d\n", connector); break; + case EXTCON_USB_HOST: + set_charging = false; + set_otg = true; + + dev_info(chg->dev, "USB host. connector type: %d\n", + connector); + break; default: - ret = max77693_set_charging(chg, false); - if (ret) { - dev_err(chg->dev, "failed to disable charging\n"); - break; - } - dev_info(chg->dev, "charging. connector type: %d\n", + set_charging = false; + set_otg = false; + + dev_info(chg->dev, "disconnected. connector type: %d\n", connector); break; } + /* + * The functions below already check if the change is necessary, + * so we don't need to do so here. + */ + ret = max77693_set_charging(chg, set_charging); + if (ret) { + dev_err(chg->dev, "failed to set charging (%d)\n", ret); + goto out; + } + + ret = max77693_set_otg(chg, set_otg); + if (ret) + dev_err(chg->dev, "failed to set OTG (%d)\n", ret); + +out: power_supply_changed(chg->charger); } From patchwork Thu May 30 08:55:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13679978 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77A29C25B78 for ; Thu, 30 May 2024 08:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3P+2MdYXLgL24yJC+Q6vE4E8xge5ppS6umvn4t1wg0M=; b=ZrdRLluFJUl1jS EVS0vp6kJcGthW6W+hXXXRE7/uvEJ0zL9SKQSPtr8xQQFD8Zu+L8EKW54zMwkWZaPwo02/naqarPa KTGDwVwabR/8Ngl6nyNWi53ZeuPMTsbBD0COH35Ap7QNcT32DA6o502TlzBdvm3gacVEZn5j+NkOb xvp9x2KCtEh4nihDrrOOlv808KKnlgxzZ8tYZGzhZLwNrZT+NZwepYniEMS1PMBNCRwPYT2thG5Nk RlkaD1B6IYTH7vLxdlpq2nBIh50axKRlk8K3Kn/cm6ckNg/edbPhv+/yZmjTgl9ZNvzwdRnx0zXPZ Ln0OLv5DEf+rv8NQPNgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbbI-00000006i2N-1qkg; Thu, 30 May 2024 08:57:32 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbaR-00000006hbh-2tI0 for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2024 08:56:41 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-52b7a3c19b0so624731e87.3 for ; Thu, 30 May 2024 01:56:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717059398; x=1717664198; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=8DVL7HMaLdGimcENmoBF+IUgjRnKXHAyyw7ouZ5rrWU=; b=OeDOL9FSpwHBdRkvIsyHQ7RxdQNVAfSGuLpTsCEpnTrl1ji1xGug8iuCv0rpv4rNaY AMr5lgjaD438LIxJnkNYOUzqSjUngfzK5tYSo/q1qu0+WIH0BmRUuGZvF2ENoMsq8cyG WMj2K17DjRHbDSs0JIn+JOqNmJeh/osLgU5r6eoofEI9cgsyLsgWqb2I59LU+qjFE8Uc n+NiSidfzR2jy//syaTICsO6PBH8OmYCPrHaTxpG/mBnc1McLz6Bz7igWK3apeQ7QhrD tzWehjJQIftYKjWdssjQyBK/0hUaCURZ77fQz6c/IYvQqe2s2LzW0WxeuEeDLTx3H8wy vYHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717059398; x=1717664198; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8DVL7HMaLdGimcENmoBF+IUgjRnKXHAyyw7ouZ5rrWU=; b=jH1201fYjBEb2ZlbpNc+F8MrCve4I6HGGuLbtFVIXprl355Xyx/3IlMrg4keKuZZyo wSFfynmv+EJV09nZw6kNrwvLyjfR0orBx8aS28/c2mSEBPK+aC4DlC7MDRgdA3sfNE9Y UMYP9TZE8PS1nXx1mVCGf02I5xeOTEKuXsdR5qDL+zf2ELAlnvQImVl2u/Mzf/Lm2pMv FLCfdlIIguWINTuENAFgGteK3CZ5rYEyDogXRjTNAW63Fv2DKKKFAyDmSrZtmaALefV1 vx0hUEWECnenMr+ZznWjeaRq0S2YfDSJUkt3wKUHJpYQpRcAexgf/YoidlDIpbJKv9F0 z1VA== X-Forwarded-Encrypted: i=1; AJvYcCWvJUMUYC7sJkk2OyopyWGoTKfsGKxex7cD/UyhP6IJCPwz6n61kFjDIwvz+92XDm/kwaDhhOeWQPsTJ00LrCcOLvNQHln675YvNzvCwhQA5oIq9Js= X-Gm-Message-State: AOJu0YxMKA6wxv8XXCfIwGaenODs1gkLGL1kg9dt6KBjU75gUMA+Nv2A pvxIzcQucVoeMCVix3t1XoeAA8k9ySh3doxnRRCb9pc2rb2RNA+O X-Google-Smtp-Source: AGHT+IFTjYlQv7nU3izoblFm7KSETkxELCqItOAh1GiFE325pUNk9/sXgkbtI+fA8666ss/SUq+7Mg== X-Received: by 2002:ac2:48b3:0:b0:52a:9db1:9d7a with SMTP id 2adb3069b0e04-52b7d48e0f0mr947365e87.58.1717059397940; Thu, 30 May 2024 01:56:37 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc500a1sm798430166b.125.2024.05.30.01.56.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:56:37 -0700 (PDT) From: Artur Weber Date: Thu, 30 May 2024 10:55:59 +0200 Subject: [PATCH RFC 09/11] power: supply: max77693: Set up charge/input current according to cable type MIME-Version: 1.0 Message-Id: <20240530-max77693-charger-extcon-v1-9-dc2a9e5bdf30@gmail.com> References: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> In-Reply-To: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> To: Krzysztof Kozlowski , Chanwoo Choi Cc: Sebastian Reichel , Rob Herring , Conor Dooley , Lee Jones , Krzysztof Kozlowski , Alim Akhtar , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Henrik Grimler , Wolfgang Wiedmeyer , Denis 'GNUtoo' Carikli , Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717059384; l=3617; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=bu/D7bMK1QFCZGMzfQmpKpoYUdwQ8o3XZkg5O1eFV1U=; b=dN1Vyib5+v40zVBQAXRIRNpvfeNVaScau4zaQVfODXVKPuwbfQ2kYHfUVagNu2vj924k+RYYV 0064bxnp3XVDKfVveClxYOyfb363quWai75IRNCdcxJ614xDPFpSopX X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_015639_882931_A828F7EB X-CRM114-Status: GOOD ( 17.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This behavior was observed on a downstream kernel - for chargers, the current would be set to a fast charge current value, and it would be bumped down for all other cable types. If we leave only the fast charge current value applied, peripheral mode stops working. If we stick to 500mA, charging becomes too slow. So, set the charge input current limit accordingly to the cable type. Signed-off-by: Artur Weber --- drivers/power/supply/max77693_charger.c | 35 ++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/drivers/power/supply/max77693_charger.c b/drivers/power/supply/max77693_charger.c index e548fd420e78..76e08775f796 100644 --- a/drivers/power/supply/max77693_charger.c +++ b/drivers/power/supply/max77693_charger.c @@ -711,6 +711,10 @@ static int max77693_reg_init(struct max77693_charger *chg) if (ret) return ret; + /* + * Set it to a lower value by default; the DT fast charge current + * property is applied later, in the charger detection mechanism. + */ ret = max77693_set_input_current_limit(chg, DEFAULT_FAST_CHARGE_CURRENT); if (ret) @@ -772,6 +776,7 @@ static void max77693_charger_extcon_work(struct work_struct *work) cable.work); struct extcon_dev *edev = chg->cable.edev; bool set_charging, set_otg; + unsigned int input_current; int connector, state; int ret; @@ -784,19 +789,28 @@ static void max77693_charger_extcon_work(struct work_struct *work) switch (connector) { case EXTCON_CHG_USB_SDP: - case EXTCON_CHG_USB_DCP: case EXTCON_CHG_USB_CDP: + case EXTCON_CHG_USB_SLOW: + input_current = 500000; /* 500 mA */ + set_charging = true; + set_otg = false; + + dev_info(chg->dev, "slow charging. connector type: %d\n", + connector); + break; + case EXTCON_CHG_USB_DCP: case EXTCON_CHG_USB_ACA: case EXTCON_CHG_USB_FAST: - case EXTCON_CHG_USB_SLOW: case EXTCON_CHG_USB_PD: + input_current = chg->fast_charge_current; set_charging = true; set_otg = false; - dev_info(chg->dev, "charging. connector type: %d\n", + dev_info(chg->dev, "fast charging. connector type: %d\n", connector); break; case EXTCON_USB_HOST: + input_current = 500000; /* 500 mA */ set_charging = false; set_otg = true; @@ -804,6 +818,7 @@ static void max77693_charger_extcon_work(struct work_struct *work) connector); break; default: + input_current = 500000; /* 500 mA */ set_charging = false; set_otg = false; @@ -812,10 +827,12 @@ static void max77693_charger_extcon_work(struct work_struct *work) break; } - /* - * The functions below already check if the change is necessary, - * so we don't need to do so here. - */ + ret = max77693_set_input_current_limit(chg, input_current); + if (ret) { + dev_err(chg->dev, "failed to set input current (%d)\n", ret); + goto out; + } + ret = max77693_set_charging(chg, set_charging); if (ret) { dev_err(chg->dev, "failed to set charging (%d)\n", ret); @@ -887,6 +904,10 @@ static int max77693_dt_init(struct device *dev, struct max77693_charger *chg) &chg->batttery_overcurrent)) chg->batttery_overcurrent = DEFAULT_BATTERY_OVERCURRENT; + if (of_property_read_u32(np, "maxim,fast-charge-current-microamp", + &chg->fast_charge_current)) + chg->fast_charge_current = DEFAULT_FAST_CHARGE_CURRENT; + if (of_property_read_u32(np, "maxim,charge-input-threshold-microvolt", &chg->charge_input_threshold_volt)) chg->charge_input_threshold_volt = From patchwork Thu May 30 08:56:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13679980 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5BC92C25B78 for ; Thu, 30 May 2024 08:57:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+BcU/IVFe5B3nHZ/UkDshwNUIRaVBON0YnaFPbOgnQU=; b=WhaJViDRbqbppn LyeyszXVgMaOMIacLHYXzcaLV2Gfxkknl4LZ8z4fOFcIZUlmh0/C9u9t813DGSP6DE795i7+4S2jS 5QNH4Zdd/TR0ODAE5FUEkRCP52ec5YH7ptKc5f39k10b+Sc86UgphZzUz7YTBpd9+3HULGcmJWjVj eRY+ZyAK6OFDvOnXU4bMxZqlp7P54hM2Lop8Bkd3mVKhM/WPm0C+AGSosDxVJpV5ZjHLqQ175f1zz fcr3G/c5J0bwoHkIPm04gK+fn15E01Ueyn5UZxTjjgIYsuIVQXiEnqNa6/hVifOEcXDG7x3SserFa TA4suCzxLiFzTmfFpYEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbbN-00000006i62-1w9z; Thu, 30 May 2024 08:57:37 +0000 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbaT-00000006hcj-1hvs for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2024 08:56:43 +0000 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-a59a352bbd9so101235666b.1 for ; Thu, 30 May 2024 01:56:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717059399; x=1717664199; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=cQNLlC64Z+6NySSM58h4q7W0lLlgYuyQBuL59GO7BQI=; b=dU8+GtBdYhUcGMgj4ZJuUCG+2DOceaQNil6Yjsk7RJt/3wLv63jaY11GMMdAyRAjX0 +MO2pN8xbJfBekaRfT9cmbJdIpwsiH9varoPR2m30Ux5ORavaZjQ6Rjkr7txSdpIAXbj QvMr8tbTgmEa5LBAMzWS0BUdV8RGMTu6lxg9a5bD2eBLYMLLl66y4qOKne+Ty0qnG9sy ZnXRgjJWQoRLxzxGF3xjf4JTLetgBZbkZnMw6wBrFd3XqXyBoVTo/tT6jvEZ7mY/CmX+ BtN8NIMUJojuyWXkxOIH1fq4zZLChgbpOJfnTcF9CBrOKlBnQvjRLZldkYmrmON1+zAu 17LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717059399; x=1717664199; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cQNLlC64Z+6NySSM58h4q7W0lLlgYuyQBuL59GO7BQI=; b=UTQOrqVpkkqN6O6AoVjWGPeGpClJ6qOh8TvntpzfJj5BzWGUCB0zeebkw4FZPetDmq pPRxFwnu3j3xW78emTkHhqafT+G+qaHCxu6oH8mMMinHZ1HCXOtUymKxVjKhbdh+ex/S 4ZDdojMIYD8DGgga0Yp9iVCtzpZNHPQTpnOpBeN2rEC4CmRp+QrCMsOlZVJZ1aa9Hpjd 2ZHae7cEEvFnAcqU2jG+Fpu8ZzLi57DcscprwLkRnMVGLNTvleKQ4CLF5W93Nflx4Xj4 z9qA99wEZtFipS+s5A4VnXSvQ0zybJgCt1lFFkep9dkW+/CVF17LDKzeT2p8f9LaO5b1 NL/w== X-Forwarded-Encrypted: i=1; AJvYcCXVjooQ+B2Gf71niHy9SZZwLKnSjOZ6GapOt9xoE/iDfHym3G699ONtfE882pK4UxANWVEHLCloCOCp6eMUBwkSSmPWkn12DSStikzAbA/v3NSytG0= X-Gm-Message-State: AOJu0Ywr6DXcW1xcnQyNBpYSy0G9ItwJf7fGs1axTqJvCoRwMbXQ9tse wnDlULTB/E8Erd6Ly9NDsH34NXCPPVOezaDp55+lB3WROlVvcGjnfYQqOg== X-Google-Smtp-Source: AGHT+IHkLEVV6E75jVIShiYEHFkNtLk1TaBGd1BSfvKYAYZG6bC/a1gzyQgtYJAgE0LVsGNX5ckQtQ== X-Received: by 2002:a17:906:38d6:b0:a65:f504:6d48 with SMTP id a640c23a62f3a-a65f5046ee0mr91861966b.2.1717059399308; Thu, 30 May 2024 01:56:39 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc500a1sm798430166b.125.2024.05.30.01.56.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:56:38 -0700 (PDT) From: Artur Weber Date: Thu, 30 May 2024 10:56:00 +0200 Subject: [PATCH RFC 10/11] ARM: dts: samsung: exynos4212-tab3: Set fast charge current for MAX77693 MIME-Version: 1.0 Message-Id: <20240530-max77693-charger-extcon-v1-10-dc2a9e5bdf30@gmail.com> References: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> In-Reply-To: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> To: Krzysztof Kozlowski , Chanwoo Choi Cc: Sebastian Reichel , Rob Herring , Conor Dooley , Lee Jones , Krzysztof Kozlowski , Alim Akhtar , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Henrik Grimler , Wolfgang Wiedmeyer , Denis 'GNUtoo' Carikli , Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717059384; l=949; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=EY+BEcJQ9F9LUdm4bF8mu/8KmPSqDEshmLjLao4MQ0E=; b=kXudDF1YC5D4fcIqIOcVLdEvXLvphHXgfFdfuQ7rFNYKEQsklCP8FjoANLctcXa2OAKOOsBNv 3FtW7ZSzAqABBhFnKjKb7TL233hDIPYcuvTh4vcOh2yCRn5LJF9JCOx X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_015641_567620_CE763EA6 X-CRM114-Status: GOOD ( 10.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This value was verified by comparing register dumps of the MAX77693 charger with on mainline with a downstream kernel under Android; the value on downstream was set to 1.8 amps when charging with a proper charger. Signed-off-by: Artur Weber --- arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi b/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi index e5254e32aa8f..b13c135bd944 100644 --- a/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +++ b/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi @@ -158,6 +158,7 @@ charger { maxim,min-system-microvolt = <3600000>; maxim,thermal-regulation-celsius = <100>; maxim,battery-overcurrent-microamp = <3500000>; + maxim,fast-charge-current-microamp = <1800000>; maxim,charge-input-threshold-microvolt = <4300000>; }; }; From patchwork Thu May 30 08:56:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13679981 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 60119C25B74 for ; Thu, 30 May 2024 08:57:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8mOFxRUJ2VZ0BhAO+i6vbk0LTO1Yl0uSZ8+0cgp4CmI=; b=QGt2jlfGBUX9X9 zdRMT8j26x8A0GFQqZdgCvJPghu5hqkfhiQyCcXPeawJ5SLDhok1lToWe6GNUFsAz8v5o7iXDpTr/ HNfXCNEIKo58CfI6Xw0NmB3iCvZfQXYtOHhs/ctmA4gSYbhZV7wN4mIRTOUHzPU4EIA3diG9UpLI9 3N2Tba+W+Wz/EJknYRf02+dz6c0NEvC/N72hKBw4AzyJ+MS1pIl4LL96sjas5DlfvP49C02tDD60y 4Au9/A+TW3LEeEEnixC0yzl95gYfgdy6VurbdowdadPdX0OqTiBnJ9ljNile9AjkevK8KA0jkka5L KDz9eVyLFUJ6+skZArmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbbT-00000006iBz-3TD2; Thu, 30 May 2024 08:57:43 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbaU-00000006hdD-3qNe for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2024 08:56:45 +0000 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a59cc765c29so50269066b.3 for ; Thu, 30 May 2024 01:56:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717059401; x=1717664201; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=a/bTfxUDpLBsxqobZuUMzQ5F6E7SsMJqv3Sv+i++EIs=; b=dcDZYJmvnjD1THbNZn/7C2rfs4uPQqbB10UhJk9h0J1YSqfYBOvWD8atrWh9ds3YI7 OEQ3AD4HQ8MZvz/S2Jg629XUpCD1VaeU3gpf4YXCfRi++if3uj5J/C+99yZx1CEYau0T t2n7EsdibC5SGVAKlyGxn9MXtrP3u09dhdXopflo8koS7VKclWFsb5ypnP+xJvqTxq9t fMxG9/BRLgzou4bAMgMNNXd94XvkCjgmIKe0Q4ZA+09+un7CJlUnxg4hmSd59DxaWsW+ YaIAmJ2WWP5gKsbwVQI2cAfDD9xMOba57jg5J0lwGWs1lUe3BHPAmzb0OXhigatgelzh 7tbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717059401; x=1717664201; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a/bTfxUDpLBsxqobZuUMzQ5F6E7SsMJqv3Sv+i++EIs=; b=DGmDN8wEjnEUdR0xbSL9jeJ4vxVfuKAFdZsmqQn4Na2Bs6PtqSsYJb3dcovSXo9yPM An5BfWI1ij6GLF5YCATLE2VgHOTdn4W3EVSCerpVDj1oHoxtKF1tk+TywlgZFt95DjNQ ZAx+xSEYAZG+BfWwdQ4AK4K8qKaJHN+sIqKogVvC74+Egk+lmzhIlAziylMaaC9iZVZC ofHZLPtWuYjQRWP25wPiQa3Lz97d/8TDkS+Pmkm3OB/a383m//h1auT6nqcWDv50942D 7jX2/cPQ5UbGh2V7r3qg8MMoBVm6BDCueO+KTwGrQu2wWUJWR531ymZ9faD849Nd0hZ1 FmcA== X-Forwarded-Encrypted: i=1; AJvYcCUPxugvR2yD0kuNZ3UiI8rMfsT/3ed8mzCBwLm3FcJrnKTdHMDlwQUmdqbR2JQ9IKa4y6dhZvOfCWp5mC+hTUXbwlgPPc+Jklt/rH9R0m8EPNyPstA= X-Gm-Message-State: AOJu0YwLq4abb0WXGO2GWsX0YrB6HohgkhZJ9ehbYLWXh+ECCIvADJGq iM2n+h9mQoN9HCir7iH05PIbtIDgIYY7MzodC6vTngQWrgiZPw5m X-Google-Smtp-Source: AGHT+IG573BZMS5XVV6j5fgOeiWkxgpjXNFMSLM5231icRj+AWqiNBcvUSNKCU/IRhzaVgsi5S3G1g== X-Received: by 2002:a17:906:4087:b0:a5a:896e:d0b4 with SMTP id a640c23a62f3a-a65e8e5d2e3mr98732566b.26.1717059400816; Thu, 30 May 2024 01:56:40 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc500a1sm798430166b.125.2024.05.30.01.56.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:56:40 -0700 (PDT) From: Artur Weber Date: Thu, 30 May 2024 10:56:01 +0200 Subject: [PATCH RFC 11/11] ARM: dts: samsung: exynos4212-tab3: Add USB connector node MIME-Version: 1.0 Message-Id: <20240530-max77693-charger-extcon-v1-11-dc2a9e5bdf30@gmail.com> References: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> In-Reply-To: <20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com> To: Krzysztof Kozlowski , Chanwoo Choi Cc: Sebastian Reichel , Rob Herring , Conor Dooley , Lee Jones , Krzysztof Kozlowski , Alim Akhtar , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Henrik Grimler , Wolfgang Wiedmeyer , Denis 'GNUtoo' Carikli , Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717059384; l=1216; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=fjOh0MJjj/plDrKA9K0KZ/bX8+GSDBRzqIWJ4jir1Tw=; b=iWckinN8kfDKXZyUp93fjpuNF22RQGJf7qyhBbbG9wnGN5Ei88ykYtNMZdQQU+5qTudvzUHn/ E8JEI13qHidDkix15SP7eOCW4aOpuH5PjY/ei03qHHTzr6K9AX3aMG+ X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_015644_100721_B3DDCF41 X-CRM114-Status: GOOD ( 12.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a subnode to the MAX77693 MFD for the MUIC and connect the USB connector node to the charger to allow for charger type/OTG cable detection. Signed-off-by: Artur Weber --- arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi b/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi index b13c135bd944..2e7f7e8f6c3b 100644 --- a/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +++ b/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi @@ -151,6 +151,17 @@ charger_reg: CHARGER { }; }; + muic { + compatible = "maxim,max77693-muic"; + + usb_conn: connector { + compatible = "samsung,usb-connector-11pin", + "usb-b-connector"; + label = "micro-USB"; + type = "micro"; + }; + }; + charger { compatible = "maxim,max77693-charger"; @@ -160,6 +171,8 @@ charger { maxim,battery-overcurrent-microamp = <3500000>; maxim,fast-charge-current-microamp = <1800000>; maxim,charge-input-threshold-microvolt = <4300000>; + + maxim,usb-connector = <&usb_conn>; }; }; };