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: 13680004 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A1556F31B; Thu, 30 May 2024 08:56:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059390; cv=none; b=j2Uq2CzFqbmgvbmvPzMgrKvSoewa3VSU8y90Cx9d5ot34BosiBFrglQ1S0T/EK0l7dfjZPlpn+GphJVl4up7hjYwviPDM7GhJdCx9EXZapuO9l/sAdmoEdyelBN3Pi4Bf7Ex+Am4Ajpwr0xXUzy8AMa0xUfkPvg7te0RmbBNd8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059390; c=relaxed/simple; bh=4/v4Yl10Sn2/85JqCalyxo+mnQfcdDcS7xIXZOrC7ic=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IVcw0PhZLQIpiTU/otBlcnhMllMTKcaOam538d3mlywEF0MxNF1RZ51bvY7goTdL4bCWUlvZib8Ayf4HqlpP43ZTjNtDO5z7/AtwYkvpiNdW5d0Y7VQIicOUq+hvBPLwKQJaS/4nhgPa63yMk9Z5f/q7J0TZVBsncokrr5I35Vk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hyUzRgI5; arc=none smtp.client-ip=209.85.208.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hyUzRgI5" Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-5785fc9c543so782456a12.1; 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=vger.kernel.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=hyUzRgI5OvGyWvpky2wID8y29b89c+tALi2WvmCRiIpEg78pZLdMjku8OUHbr9jjVN 3JkNYYE1nZwOTclAMX1JRzUhvxQUJdAPzz7HPO38bDaLWk8kuL/3C6YlAf3FD06bLmG1 Cit4zAlB0xsGfuqBo6v3uAB3U5EmjLuzuLsHqFv6Hoo3LiQ9TLlEJMXFawnXrj3hd3+5 QhH2adeyAP4kPTI6umTEw19iBq0Xx3YzjDcwPj138fd9jk+3BQzd5Vp6YRgx7xl4MwY+ Xa5TyLgA6KLntdYFcexamaCE2UliAtG1cE6C+yclR0VWEHPBfB1iu/n+1TWyv9iV0MxY oH+w== 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=GjQHGBgSIiTbaVUP4nOD2LsXCDCenYsShf360h04FM7s/tcJHENn13Uuh0j1cUk6Tk rZYZ8Fg8DMjV1s9ChxnrOQJ/Wr5CVpLkae4n4aakYEVOFdEkZBkhARHc4G3CWLzIfEHe r1ObdSEECeOtwVLKHFo3N5pZUF69nVJC70V5GwAPk09Gf3p6tX38VmIakfu4Cj2Nd0gI yWekzviMKQNjPOEtAHcBgYilM7iFnNa541iUHh0mAwQQXmcjnG83jRm3tQkGU3bYgSMM uoi6fa5vIumRJbalTyVx19StrBt5bd/BS37/qLCGjTuolr5mkkHEbfCyUE1ahwxagtAr Rsqw== X-Forwarded-Encrypted: i=1; AJvYcCUOSXgSlBegWIdMtCyKT9pfVlhJiH2NGjN0VCaC3OiM70adgNxiQMSFGH9XNALYTsGqwzYNvRRyAQp2fi/5DDCPCoihXelp+0UnnLmU510fn66xV9TU5eQoGbkenvV69wS5647wBgQKnE4AgSQpwdq4ukGLZXUIJml7oormoclIsXDVEH6I853V0YHO3fbjLTO8lnMY8BnL7dvxVnfsxfaFPy98+m8= X-Gm-Message-State: AOJu0Ywz+Sxx6OOniUq0I6PX5qhRvVhRl6h5wz+26nMh5yA1DvPtX1fN xZ52E974z0fxlXTVKPuLvK0gBIjFWRYLX/oKvNK97vVaFxQyVaPm 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 Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 13680005 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 387CA15218D; Thu, 30 May 2024 08:56:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059391; cv=none; b=e3lmsk6BXFaE4KtJqbjyZrRF71eYMcX9R/l9oTlc4qbMD0xb3IKrb8n8PbGiZeoR5Khb6YT14Uidras3Bwi9JRlt4M1Uy73kKYdfYFrMLw5KOwtYnt3F90O8tHu4SxSb6MdloD29Hzav9lbWVxHf5NORSilzYil0uRLG76HxSo4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059391; c=relaxed/simple; bh=xgN5sPCevFL3dsnXeVkOmW6b6l95Xb66gcGeR/Rr6O4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ggempJO5EFJ7VbavUzsjtgJOhH+fwqjYUCGVsMK3tKyXFcOGcs9ZAuvtGmqiryeAH1kdEmYEuh4i5KjfutKFBJMyrqHl16N3oxO0tynGU/SSuVzvcUd9HVgQlNMZe2CR2HaEFrjDQlj3XTa81LE5Kwdi8gtb+izye5XppWy9Uho= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RyK9vlvF; arc=none smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RyK9vlvF" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a633ec1cecdso48753966b.2; Thu, 30 May 2024 01:56:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717059388; x=1717664188; darn=vger.kernel.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=RyK9vlvFC3oc9Ue506cRR7Nkbi1gn86JLxK9czoyL7InQVbWwWZ8AZnxzApR7wnVZ/ EfNUyXxk/PnbEQjwLC8zBVcg+4C+CnkmIK01VAoFy4TKZv76m6THMkyqATANFtvnAYah YRmg6hOisapUGseSTKm0pbWOyFSHAt+vchmowk2Es4/MkoBZlzTI417EJNqLEvDAJOcu Edh9im9+7R97lfEA0oKVXhos9IqP6g1F8yGc5UdonX9qikwhDrA/oF68oQUJ8Uy4/WAq pnOMo1TG1fGo6B5EOIR5mq1zqfW9PKxQxb/e3WQyAZN4aiWi7Fk52AQaQYAm0nmaQiq8 iSlQ== 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=Byp9ubXFyi4+n88GlTwK530qrasMa5hqfKfRCTxR3/fcp9VBcsTvXeHLWL1KUeNhg8 QULp4HMOO1OiH7Q/WwHmLT4nmtnEJY5hB4eXolS6wng571Q2gcwT/NcssJ4DC3oc+VOw VZP84sEyyPKshRl1aNYx2D2sJytRDz5WQvg2zDtg/PXrLhPW9SP4YM6rKPhotQkb+his 7bE59sZLbGx7XRJUck3mDfl1tvqXXaAlRMY/ktEZVIHpt1Y9LubXIdol8kHV327CU3v4 siLoz0S/YRhrRLnc/u1LZW2ZxCQlkPQaXBmZZcM5m68dqbnPYKzcIpJMqdx6BdWgk0OQ Dydg== X-Forwarded-Encrypted: i=1; AJvYcCUS1S8uYk4ZhKdlRjHj9jPFFFCrBh/rQf1iKFrHjvEE1wX4O3SKR9/7OfYjJvcZEDzn5FnFmeir7aiCoUo3w2p2C+HmYevFjpNJ5xGC0bX/wCI4IUAqNWRk7rkV41o/dFHVVuwHs274pt8KRDCdrgkdV62dwVTGyAnx5Yop6JzUOq3DvEy6Jyln4dyNtiE0otyYcPXbL5Kd4KnPimzfI14dQ6hYWUM= X-Gm-Message-State: AOJu0YzpPF8EdcUC0bOUIHuI7stt8YqSEfJrkGUUypURoaNsROQgggbe FblTCjC2CV+TL+P+OMrJJUgCU/rdiQsxNx8XF5WuScKl9stxowjE 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 Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 13680006 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9987176AAD; Thu, 30 May 2024 08:56:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059393; cv=none; b=qg4QOEczU8y7gik/x7GJVcnfIn8rbLLFa4n6yo4ylz5Sjk8NedsVG+R6PFoPPhvDTmypshoeK/0DoTUpHr1DxEUrvxuZ/grMb8hb2le5q4V+tsXX4FKHalNHfuevkxTsp3rgTsyF0zCtYlGX4QSdK2u1hgMy2zg4P/wBAD8nVw4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059393; c=relaxed/simple; bh=lvdySO4g1Iq+BvNlPqD2DOaKCv3w2CKbmZOppf2fdkE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Fl1EfwoTS8Gbx2sKY/n/aIMdNHZ67SSmuFoVzcGReuhHVgV9PVhMyGNI+euVUdqZC1K6dEXeD3reAefNUQHlDp+eCwnvIBt/wPUsgrUZe58XrN5Ssq3DkokjZ7qN8XnsH3vZaIYycFuUyGY8wrDIciCLke0R9J5U6G1VOFLIZgM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KGe/RBV7; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KGe/RBV7" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a63036f2daaso54437566b.1; 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=vger.kernel.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=KGe/RBV75ZcFlbq1s2s5SGBvVR5Uu/CYkSncDklpl+6/Kx5No6cQWpibUezKDkNE+m 7F8iJntpjFIwFC0b5RNBr/AJwoZ6ZVIG6ahLLZCPpbtF3T/VpLxfuJOyJvJvZbHXJxue LQncPRLlv5QAPQ4xoYYDBATp9gmFwFrZs6KsMsoABdQ79ShpbAHdSOACyPYT6kigp5oz J0WWT50f0pBZ8JvSjosCbHQ2R6JMqZfxBCoYHe8saT1kxDhMGI5XUTW7CAyow3AEnHYy CHjwfVHbRR3xIHluX0QZnH9cSFAwqknOBy7MWICh2uYLvX6Ot12mhRFg/OPSj4lbWO4T U6Tg== 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=b9+tkW61xLOiEixJQr47OqOHR0M89I94Ghkp9Xvc4iIpfa5KYyHinfBltnq56b1AXf 0aCkB/YgY7u393BHPvWaHMnOwj0GeoRS40EIOYW8AbQq+P3QYBIDFGAHTLCUSeEDB8d6 OMZyWnTWzbP4Yy0svsSP+hSE8ULtqsXRuu2+ADiQMKJ1/w3XlBSaNBNDRqTFgLpVzGag rD8HmZp5SvezYTHq6o0JyWqJKDpd1Qo/PzLVqUbtMQ+G8fvcxcMqnbpuAe3zto9YDfa9 ZmQ04y3J5vw0+5tL5pgq18DnBcWb1yxX7rse9whz0afCqdJH+ZFnoPcRn+2iJbez3a4/ fJMQ== X-Forwarded-Encrypted: i=1; AJvYcCWOKvJ5VrkXN5GmZmHVNZh/SgihEdUkCD9ZL2EsuPDkmGe30qPv1jSDHfc11EIsyS49cULOSj/LF/IvB1wOJecM5MQ0sEP7PzwR89iZRGhInhMRGLMfP94huOVyS2roJMLJ/U/W8ai6yELxw8Xrs/grg8te7jdCuxWAAagOhCxguQx+6XwAmdqnbAk93pNKUa8RReg6hHbclyxa8YLnm37SBzIobvA= X-Gm-Message-State: AOJu0YzoelcD7O7PXY6k5jRL4sV4vM6rYQSrbpUlb8rcMT+LaR9CsWnP 4ea9DFMYSgNtJlH0bz767D3uo6VMkJor8PJ4dTeiCX9gqpUsIi/a 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 Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 13680007 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAF671C2322; Thu, 30 May 2024 08:56:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059394; cv=none; b=hhn6KqV/O/XyHMYVoRDWzcb1C64LG5e8kd5lDCJeUMcHZQ+CU6jobfb1l4ivqCEoiR0sK49v0l2hWc21q5o6voYbc8Go6MmfaSqXEBBcpT605zCIZJgky/kw+I/eWPEKXI+d96YJGKY1J9UaOdmTOCV3gHHXiZGO5BlbVPFmgJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059394; c=relaxed/simple; bh=fdFCdouFtABSDklI2okYjmv8ltu44PsbFfLaKdFasJM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UgRoGYKinW8LGw0BbN1LQlpMKJYWjc45mog5TcFXUP3KcNkBVxyM6rlQ5T39sX6CH//JmCa7A7hFUcmkARFBtiACCje9l8TDSq92+JXVUyUQXtLo6ipriU7Qer/wZ7VVnBkTNC195GukwS+wnNmdHms6GDVBJdjBUAytc/u69zk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GB5Me9G/; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GB5Me9G/" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a626776cc50so45016066b.3; 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=vger.kernel.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=GB5Me9G/4Ss7MqV15eRjzG2fC9dl/4zkNHcwmpVh8ZJxuLMjaqLntPXdrO48GWMypp wwjpBFFQv2Kp28+L2/iQJBsG/EaBP3XaiXzZw71fbGyl5gIG7MNa9ru8QKHAreTpWvrL aADOn7uEGhnC/qYkGUSBNK6Y2jGyKcfq2xEOmJpEjUOGpuCdJ5EpZn12HK/hmlV2H/SR ajQuySW/x27s4WeJlI81Z2mt+Vjb2H1tHh18hlnvLts14K2ADq5pBER1uLK7UMGm643J 1Yr3sC85cgkfT9ce4ODZAzGOK0K1qDotnOnGq18JaJ0x3kayNj/FAYqVb5tdGQObM5c5 uSrg== 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=cevbzjx4k8nYOnK/gX6CPWTngGaJt0mUxXTh5IwRlwXKloKdAsQRmYZrmq4Uu5UhYm 66UTcOaPRj+zGwVgd11txCYSHRSZc8JiNkpjigyr8BzaSXSkWhVjTAwCyoHlgCSc9qWe RfoLO/3SsQqf21gGWpC+maBv+4rJbyTwRJQRkNkG8puqVVWOnckZ32/dGJVoyDVN9rJy YnLxVXNyukYBOLPcyfhajKErWcJ6uBZKnbipDEvRF+Pj7w85SDFbTekAiZSKCV+3I8Pr FAiS6B+VhZ+gZ/il7bkLnJJzwZcuz6uXZZO7Cojds0MjghVrvZBtdVdWEdWq7zWS0MGK ImPA== X-Forwarded-Encrypted: i=1; AJvYcCW2niaHADeINOVjtrmF+GQUmetzSkqD8+KRLKoeCl1FeORVnlt1GM19AwoNrKX3lo06weG6brLoWPanWNnaLat892tLvM5sZfaW4IjF7DB2xlhKXnDx3tKS5WKkbE25r9nVV/2oGOhADjSzMs8jqYIdTz6j+Ig6/VxoB6QHgSQDUIKnh1veRdd3LvjEVS5l71+wud1jJVApOf9AprP7iUaqVIS5+Ks= X-Gm-Message-State: AOJu0YxlBxHotNDXobhMgu/zOAKTBb2iN6LANfmOy/EqoF1W8d+rj75i Tu66UCFy/xxjxAddxVyYPq0WzsXgtfGhlQjWo9SZOpydnnhl4BbN 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 Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 13680008 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C5083DAC1E; Thu, 30 May 2024 08:56:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059396; cv=none; b=A+iq+yKMnhXkGRJIzkP1fWhIh9iQx3CFiumGv6waLvDvMJ5imb1buWmDc1RWVuBBFd9In3cAUtaP2WeBVpR+QSScjNbHqnK21ovMzm9MSFOcpGuIm0bn1/28FX5ta6VhHfhv+pO0BwRpd4/aJ5GbFh+kTGzPBUISzoFfH+iC6oc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059396; c=relaxed/simple; bh=8GrD+7N4WIECelsMnMsq1oOIcn8b/3kdBSwFTiT2G4s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=elTlJ/9iMR7eQTPhmFsgIiLtWl4qImq4rHFylsQASle6J+UxsPiB9y/wSnBDidrSa30MqB4UXIRudlmC7F5TXkrVyMj/vx8l3RNf7bvy8Wp1dnH343Oej48T17J2x72Ooj+zBZiAfJHj9pVGxEq1hYnKfvvRq9LDByXjAwsIyKU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UvaHsGpN; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UvaHsGpN" Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a667e104375so19044966b.1; 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=vger.kernel.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=UvaHsGpNpYN4hTSJE3zUv0WWiyFfbI9JpeoFGD+30R9X/+QaYklGTqZzF750G48hOG otK66K6K4XPmQD7Ftkti/p+omXGkRoyny6YmuPUO0PJi6+NqmHdo5YU6BTQUH7YUTB41 dI+p+9Zrw1O7G9FQQdVS0x2HG/VPC+X+hSG3km5wJIZKNxO7/lnf7ZPuP2NETzGW8RgQ Q04JSECSo/G6kLOuHwOm6llAWGnJkysxluf/QdWYeSCTwbgLTqduZmnZPJw2hg9If7Mi Nt0leYf8LS58onx/FBFdut1rjTlneqCcZBECWQyaiPgRgWntVfRHPh3BcwjJLsvQ6C0S P9WA== 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=KOtp3GVu/FFbsEDPdJwup4lPVZz84r2IuRXw574hnvDDMGGHkWmrqQ6ShYHjI6CcVs 7RMGwgusGuSRBwcnTF/OF4rGgr/RqbWhIGHc54xNCUEzz5xqmt55ZzutXvWfjTpicZjj zAUuWowb4eXoKZ+g4D+Ix2lbkLSJlqgYIbFlGF8qHEAnKs9EOV1uktmJ94NlnsnDVTaf kMvH62hcpCqdMbvYW+qNKWqd38V6tgO5ld5cnMZ+DlwP9yWqJkdOUTiv93/oQOWjNTk8 OkRXKU5ZBvMQOOduh8o3T3cgX2sBe0kCYM5oDW8c5r9pdoc0yFNiizprodO8vb1wNSu3 E1zw== X-Forwarded-Encrypted: i=1; AJvYcCWGOO4woMbybOdkh4xxjBPzfJNZeghKS3xCsTs6ns/4Xj1EnKegPMbMYZl0gYFGTn8T0XjCgkqmgpOfGz5GB23rCCkZxqYM4EjSDKoGrw1/5tfTyLpNgwaltixBPywTyMTPeLi+SyxbQTY569ola60UY2pc4f68F4Gj6ZoR6M1KHb5S+izWoO7Fbw2RVQLmUbynxUq+dklKHLvnPwNtei0JbYxH0x8= X-Gm-Message-State: AOJu0YwVFTnbvfGfS0vazzYoQwVloaUopG7/GX98YrtN579/9N/WlEOu ZuMkBMqomKh2hDRzmVrI0dIJgRmh/jwLZ5oximwKT3wtqUZtzKoz 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 Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 13680009 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CAFB117C7CD; Thu, 30 May 2024 08:56:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059397; cv=none; b=Wyuir1Grk7NbAxz6/Dj203n+yVWYkSjGdoTwQX93dQKWflWk9VYu/uRqGnDRiZjXLzcXv9pyNtE6aEdUGzALTwIAE8v5xiF9ED0w1JtB5Ld73gJIJxZ8/qasPRz99ugiMuSLM8xI2QwE5o6379SO3o3dC1JJZ2S2eGxB9iS8mI8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059397; c=relaxed/simple; bh=C8RQpwCwOR+YYCuseUykropyLMG3kS1Is6uGMemnREw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cBuQl949zfP734vHBJ76HbkIDqgggE2QSC1V6T8TLvlhtqxvPRTTA04WmTkItTMH77uFryzIK+zYzp/EwRP5wpnlizvxt26jaiVgtBpe2VSqVNXKPy9vrXZtmstCMIbj7aQSLUXm/cveL/VuXyxwrz1hegueKwQT91LaYDAtvAo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GpgO9AIO; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GpgO9AIO" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-52b7ebb2668so466264e87.2; 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=vger.kernel.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=GpgO9AIOEBDl9h70EV6beLFPGNbx9IKkS1cGFUs6t2L/4Nf6+VailHqTwIHaMt6nc0 SMmthAEkPBIKhk1x+2gkioIgGXkWh9wJz4seY9RrMIy0uIzk+vSdVOAWBZG2FpWQqz01 BKQLXTLHM44ASTAnTX6vr0OsejpCRROAjRJvrrhrbzR7kFgkYpLPtOfNmIqYuEB6fqJi 96T0Kirip5/EOu8gkPTgceAKbvGc0GMLp0CVFHAZj01SVjpQ32FgtIjAfAZs+Q13Iqe9 xkdx/r/TAe++FSHbK2Zks54fVby3lUYUhMs10XWFucAMTz/13wkUpsCaWZ3ypzDyBW8D 8j8g== 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=hG0MfMWXwCvZebpx2OW/QN1vDV/My6TwCE9B07LtaAji7iVK0JoBur14349bG8tJtx rPQ2zPXQXPLPb2Fy9tZeDf19A19InGkEQ8ZAkXQv4Cf6DOQP1v5yfVc3HDvmedLAJ+LO ADQZp+yUkSks2/mxrMFb//R4US9YRRcTuylMAVlVtGdtgMRenHuPRvi4Us9u98/GYitH FaiqcsaYqPzX8NdVjognSBkYEPRo28u7apv0F6utzz86Tm09wmiRF0v0oGzEy6OEvnAG yJCduQGeuCEEkKZSqZJXBG/PVDnY//zl18ao+7M1tofw6OO1h8McRxgPMaLFaDKfAVls nKxw== X-Forwarded-Encrypted: i=1; AJvYcCVfnGJG0c9ARaD+4syJR4TyHzyaxBmmvADfYvV/Go+ts4EbweUP4CirbMZc2mKznDxQOFzoqBUlt4+/Clh/bNh0A6ERVDrakQqmEkyu5LIFOQzcFREYRbYwwGEfyR59JCglM3Sr/7JtNzeBQCXB8O9i+fCxf9a1bNl0rtOL7VC0J7ce22CDnSY1PPqjfCNOXlZKfNcRcr1M+r4KgY4AhTBEcrV640E= X-Gm-Message-State: AOJu0YwUx8WCy+dRotLcH3iiDjjBmns3ZbROevZxQ6uYzKvKfiekivtC eoH//wsdDAzu76l262thss2Y0mbi5tA5CN9BSFB1H7/m4sz/qp95nI7zyg== 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 Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 13680010 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA4C417D34C; Thu, 30 May 2024 08:56:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059398; cv=none; b=IFXyxAX06CTFHvVrmidv54JzKI+5/mv7/y57KU8mFT308RZTHOiHv7+BWDgGjPnrb5Fm1Vxggbm2fTxMxaobdrRCcqbYq6uXgyp6L2d77T6P45+eTeporId1mkuM5JR0nofxcV9rzXsPr2tSyjRmxzmOlnz248gB13MPZw8TZo0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059398; c=relaxed/simple; bh=Z6Uakaaf2pR7w6gR2fxAZJMtvGZtTD0SN8W+EmCqsME=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fJx9CiFeJ2cqlvvnFWYXGoK0UvxbISugR0z/8rSia4rmqHIy8yGmNrx69LlyP7AKd+l+wB2e6pvYZOebQV5wmIWBo5KCWIrQSX5l6ybTCz1Qv8AJwoQmumgtN42a2PblXtl/RUt1z+2V/WlhfBIMZMzzwXXXa/TRX9z46ml1A9I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UZ/8/Fzl; arc=none smtp.client-ip=209.85.218.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UZ/8/Fzl" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a63359aaacaso53635266b.1; 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=vger.kernel.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=UZ/8/Fzl3E1qptSWeuSLcqabrFXvmOXnd+sSo2v8PRUrx8WuYNX/V2BhckQGMjLvkR DTCGF9pe+j7ODZjOZCmzDZqu5nCN3kPHNYwDz5yBWfuphBZh6joiYZ8Tl5RWgSCsbAvr fn6OthDUl/nRapQDqxSieSGPi/m8YuFWmXjkGTclvrkwQAFpX39vuUxJg7nm2gn9csdN CyrOV/fKfawYvL55IduEUSnFpKu+X5GJcsmc56OeXlObUaqqJu+Q6iS3tNRa0rNZJ7vu ZQWgxFSLOkhZn362r9Goquj4wyOtMcsO8p1AewTkywDNWjSlKoyxJzVDiID78H7H51rk hCKw== 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=TuWCtJd6YOKCguHY4pUpdKOO7QYNNtiw8mE4hAYnJMiP1LS87hHhg/BgJQCp3WNBhr rUHcgTf+q3RdjzKgIsQFXNZp/SiIGAWoD8H9Vnk12B2qr/CZjDLsRVa+foSdq/X60/id qXYiDvNNHuus+4wn9Iw7der90Hlj6m7cmipyZbt7YLVzS5k4Ni52N7qPLgsTID0W4HAw mKyOpB2CW+X3PmQmd8lsZ6jeswmnf7GWlnIC5PLEGdFPolJr3x0z6bVfWAbHNgwJ0nuk 4kSYH5DGbtbV6PC/6mk1mUuCOxFjhP/PzQk8Bxzcjt0cPHDakWFYtEB5gDGu8zj4VMKf 9Quw== X-Forwarded-Encrypted: i=1; AJvYcCWuQ/XDXNFWQtO+422UTurbc5jgmOTvyN6GIVX8/jfthWXIp/HNqQCDk4y2XjwZTPJPwaE23xsLF9yUDbvja6UfjJKxtwQh74rIXAwOFA0E2YwyqmmG3QQOHqLQdgTR0WX1uwp8LWdDD+OazTg8275Vi3emlLHRCcfDfI3U1J8LoYhfXYgR3+8iX44ZxZ3D/QVmqc95Po2/0STyEUCWt9rU247+aR8= X-Gm-Message-State: AOJu0YybU5d6Yd4YfD12kf7/Un5KxEN3bLkIkwgR21dh6hwIWb/W/y73 ZhgyYqwAPfbSkwYlEZyPMJ0Caw9h5Wfz2KKTNIYChmS+z4GIGZAl 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 Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 13680011 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6533C17D375; Thu, 30 May 2024 08:56:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059400; cv=none; b=RYYLHSu4Ss/aF23cOW87iP5fP/svQ7JlRLhh3oL3WU4L9nJvMmAMywEWb7WkhInWREumtoJnimVC/M2rqAUUxSVBV+2zMdPaup5DhoAHjOu5NoVPolNs5vJP9LwKHEE8oRm7NgKodT0k3tcESwjKletj9uxb7TKL0y6167lk+zs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059400; c=relaxed/simple; bh=ASIwzdEZQZXRm8Gyc8ivplNNZTHwY1NZ3AUZqjW/FCw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TTVgWy3HR6muIgITT4E2fTCumWeK/D73vEjxIvHP145cAQTZYdEkWN+cr7FFzXqejz+YJzltQWt3RFXgfd3m8QgppDwNltuSijr5sHLPSmUG7hxgYTGIx9ejOz0slHLMhmXByrWgbl4p7xTGFm6mnrB/Fy+8/thUONPtLuVlWMM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mOVRgl1o; arc=none smtp.client-ip=209.85.218.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mOVRgl1o" Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a6267778b3aso33079766b.3; 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=vger.kernel.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=mOVRgl1olq2CDAl4zvIKpGg+63kOXWkrTFaDOx00QQpT4Y6oj85dXdu/MhXVWh/Wra kt0IXAuA8GgDawuMTXZ2rtQRy5DFwlNlVpwlwH7NyVJ/VLdVs/nzCNrZfk8FOuRoYJln AaEpWPoDWqlIWkwA1cJLvluznoSddr/yn9fBUTpi2h2yl7LENGPJ8n8aFzbzZzOSLsox nVliYdDmO+EPLapQ8EcxVBe80bmhPE+xP1qMUZe51Khk7H//IDXl9PdEW8M2ZYWH4ksv cw3H1LMeepVOwvyeJplSC2BXLUbVAQKCfYRMdhpRJA5MV/77pGDNiWSEPsu2ngFtKmsU rjEQ== 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=dg4pAlH/cjZC1UH+xHySiyOpV34C01CqkcVHJ86yTKvgFFJd4ZQ946OC2Fy9QY3bBH 4QEEdmf5OxiP8Ura73RCnO8CY4OGjU9sp7soHaq2BkhZcQyqYMLruzjSNTIxO0TDB/l6 sqYIft02o2KUp0OtFAY6n2NLd98d3dLeI++otyzUtfVW6gIProReYHVtWZmNcbasvzkR 61tNQmyHKegluckHry2lWZb6yDsaITFLPN8I+1umPzjWxmajX28BXV0qc1KiY06YiNTx G05cp0B0+7tWCdpewH8Q6LOZtxGDPMwSyvCdUwFA2BUp4aqBLzxHkHIAISleiQCMfcKB uu4g== X-Forwarded-Encrypted: i=1; AJvYcCW9Oxfi3SGyL0cuRJ4AM+y9QvU9lyxjXeP7xxHxUCJ+21LSnP0FjwAsIB7XaeNvcPW4GWRaSfBgoJCZjZWXGP7a/H+NYc7WGOo2ftBxnkErr9eg2DXm7jOvmv8eM8RqOPBc9IPBglPOHTqSpXA9ayoTFx95iAFDTAfe+hh7v3TkyDIr5WOvBRopa8NJMKm2MESXMaUOy2/nMmcxIIqtdrgOHI9AAzw= X-Gm-Message-State: AOJu0YzurNM/GQGi03YNXOlTMv4dGWPRASd3Uv4S9to/zlDUOYSB2bkK +65OmIkEzJo7o2KiGcfJXnzL5k2Kdy0hEoFdICKxcIOFnnf+ykVx 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 Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 13680012 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0A8517E454; Thu, 30 May 2024 08:56:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059401; cv=none; b=sNWrrz52KTpPiWwcTYuo5e6kksfKqy6aaLEgUmK9UreOHU7qRdkTA2zsd6CQGQ855NrZITrG40Xc6q++Y3hVea7iXq5HAxgpOrYlr1lN6fLR4OG1g9KeJ9XtHjC8h4iq+xwez7CE80ahykcEJKskiKNhtnxanhQKDWkow7zIRec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059401; c=relaxed/simple; bh=bu/D7bMK1QFCZGMzfQmpKpoYUdwQ8o3XZkg5O1eFV1U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ii8zb4EHbZaCAYt/6LRK5XqVpnAWk0F8oRrdE0WsdQqwQStQroHCR9/w6WAudtSQYk+eZy2EkD1aX6zKrCqWaVovZjsTQNyAEz8rtVpegdLLxdYg2vCvo0sewC8UyXOoSsq+CXWnLrYGyqo98C6HUEWdSnTSqIOuSjRh7TkKvhA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=T0ScUcrA; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T0ScUcrA" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-52962423ed8so763961e87.2; 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=vger.kernel.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=T0ScUcrAdjLsAcffDNfuktlVOyW+sa88C8/SBnu8KbKIHVMyDXhEhU3NGYFSgfHHQ1 mrJeFK21MOk6bcbPvMdxZ1HP/hGt/7iEQkiHv27knzvfGhq/akaOYJ7xWczM2YI5PYhv pHdIX6E02cr/NdsYZOc6bcV0jL+3YACTrmHLjRc0qaxr7xbcA2LvvsIHAG1sGC8TCnZH MIM2ZjUZQffazR8nJPJ9GHeAf/l7duJzYeXP4wQ1Bg+nTVMuBZDQjWxarTRM/kZvme4M RjheyaLwiwuOK5GWawGHgwQcNkhpW6CxUD19L2bjwi5bgSfAMdMpyhKGj43NVdi8rUfR 7oZw== 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=RvKQfsaVAQj/Rw7e/YQf0xco24CpZufd6XDqQZsI1MKyJifq5XcpFXBKKbfo6xL+nn afkzjQZY6UqNTDBM/kiF6OFoIw07AnqTo6VSUqINJmF/+aaTo8BeOAZbG6FkNSlBD7RM VGhIi4/v38M4W4Anjsrim6578cpUFGg1+oBfpq8MsGK5XSCA/ZBZdaqLXtXrH0x2tLok p5sBe69qZlDiYRviYEvFUNL6Uplq9XIrzNPhHzKii4gP66fPvs6+iIXHCipst5iawW2b Ppb7TDKCksfV4C34/1vDw5iWwkZztolmSVC8RkfA4ZYLVhC4/BcuwVigUQ9Q8VUd0Pl6 VXCQ== X-Forwarded-Encrypted: i=1; AJvYcCVkpetSVvMEPTgP9lPFMx12VhqkGdvUqtuie5H6mVVIJlW0OlpBXb1KJv3g4RKq3mmSrkCTuQpBQgyWj6dpY2wPyJj2hSIxUkQZhrfrocJroOk5hXN8jBKXiWQE33ySCFu7FKxk6H3mrNw31wgrdksZDythmsEqw+fEft+JxPXEBzhDYHizBW9iWq+eYIUyj9AdVhH51ObWe+lcHcA3ZKbvLdCrpYw= X-Gm-Message-State: AOJu0Yyc4esmDrhXazrW/sBmOxplc66XlHHQ0p2/KCcuId3oYx6K6iYS RErDY8a2fGKkIS0jnkiHXH/vHxs2FIzrBZKob7G4Qv5fVyDRl6XJ 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 Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 13680013 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25FCE17E448; Thu, 30 May 2024 08:56:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059402; cv=none; b=HHs3hVlG5UJXqeWGQ1Uln0jQiyRdVRARXSYYfEpNfFsLxhEOk/6ETnkbFZko0+gPPIUdhFMznt0qlJK2b81J3qawuw5S+E/G7sUmD2vk2BY4rltfoKN9NyQ+xs7gY3AJyny4n6d6/lHheVnnux9iy3jBDM1SuoWm6onYu3ag3Oc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059402; c=relaxed/simple; bh=EY+BEcJQ9F9LUdm4bF8mu/8KmPSqDEshmLjLao4MQ0E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QrR1CjVXnRKBeD+OpTz+6TcNjwXrcA11CjtNMybPWv3EbhCBSB2Lj3IlacxeqPm/iBjSI/B+Wh/Q84B+zrj7/fKvGP2hXCF6sSvCAvX38kUPQ+EtTFd7iXbPNBuJvV5czNt98pmNDuA5f+JYYFQMUm+wnGKc7petnSXZTCsrMTU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lOpxM5Md; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lOpxM5Md" Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a59a609dd3fso96351666b.0; 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=vger.kernel.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=lOpxM5Md5tkPm6myec87dbl/OHsEv/5OCqpYCBUZQ3zW0BpE6Y1U6wF8EOYtKYHXRT 8V+x/EsJNaZ1Sb69f4DYUhrg2RHxTU/79vsv3mDe3oOqooPCerPpz0VfoRQa+fq6Myfi 3TvVpkH3Pbii81PDl1o1MGyxqPrfdayw1KPdFJ5OpyceKl6Zui/V1G8/MWwMcFtyQbkC 7WbgTn4O3ifNgoeldUGc1UH9X9VWhpCPNVN0k+UmB4QQnVF8eQ7CVND3xGE2YN4eaLSW 3swPrfG5SGtxyuZ80yYCWUrvXkaBCDejEt6WyBcfpjzpmMOEi9KSeKj5orkV5MVF30nL Kp3Q== 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=W65EEPyAv+Me+8hgjUMPjtcc3qgiJOKmmZMYcHJnX8iy884K2L6bA0/6nnj8W5kWW0 R5nnTxIdzrYotX0gTg/P+u7jNFLjtXjUVk0XDg3mVWE6CuzPwiDKnuUzHgvKkr9uNHcs JnlfxgvWRK6KAw8ELWC7Y90iDWegpkR9uqiRiV+02nGfrgOIxJpH7TQwadrDOj1hql3V wM9JtUfD3r6lKwqooWGGOg2mlLRTJtH+l3pwrDvrEQ1fcMdtYxzFP07lO9OqxT77A9W5 ALNp9rJgVLViqRh2NSgyyOqGrv7WyFTlC2Fn4mlQeFIBJNglPE4B0Uwv6FoohzF71qBe VB/g== X-Forwarded-Encrypted: i=1; AJvYcCXg4usadJK2vPLPzwzXv7TK09bbDkzUd5fABUmlHGQUIBp3Ifh/4YGsN3RP+EZq5gXxsQXnQtarsNyCYHHenmBOCnRWdHiA2GR22lp8O8VYDZZHoAYne4QrsJQCaEYp8SxIOFhxUY4JqeCiwBqZ6w4QQQkT66G+l7c2lqTqWXoBq32U2aponPNXSCPEbGvb7giA5uW0WsVQT5r4NN5Kce4Apf3EQWQ= X-Gm-Message-State: AOJu0Yzsis6Rt7iO5hftus+sg6HiQdPG6fsGxvBBXCG+kkEFyM74rGvR YOmv8+0lg9yiXCJE2Wprgaq2F2BVofNq2vWgjv62pGtX5S5KEeFl 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 Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 13680014 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 757D517FAB5; Thu, 30 May 2024 08:56:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059404; cv=none; b=KSl5/Xq4P3Da2VBk12vUOaDIxDvgwGd4CNzP/CxAc+APgmufc6/h7m6mRhtpodCfFcwWUMz+fgTKVIvm0DyyeeM9Y1cyHoO+ssXACxVe+DXGGsFX495Fc3de/1TVRsMJEiKY/iK20tnBUb55METClPVbYFJw/f8e3yInCH8URNs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059404; c=relaxed/simple; bh=fjOh0MJjj/plDrKA9K0KZ/bX8+GSDBRzqIWJ4jir1Tw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cbW7X6aQggG+ROHkpI70RWhOlXjaIIxDUHdAFiv4RGCan/RV3LbQlcq8n+lkuKsFxiS1hg0U/dwsNhFnip3uGemqJBz72z77Ek3QOaqqEck5BgdLkuaQ/zZ3Q3o8SQcT7t9TSa84nxPoMMfTJlU64jUXjb9DZM5XX7LN5nX+V+U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ti6CjaFm; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ti6CjaFm" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a63036f2daaso54458666b.1; 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=vger.kernel.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=Ti6CjaFm6P9+5+gad6CC/QW76oeCB8SNhctDdBZLUTQc8qjyMY99ER2N65HWg1AbBl 4GTNRBqZsmCBvea3jwCiibtXnah7n1QBffUTMerJIt6z8iciw01fxZSVHkyV7lrwjW0c PJ7dybdo/wYwjDMTEtyno+PGmr9UBGyoDH2CXpTrPWxNfvO8ACJGS/EMww1ZY+ZCBqBc IHdpQRQ1r7azRQ2KS3T0YrXCzRW5gpP63fK1lJ3sLWxNHA/NKx+aG+/6XqkKs5krQ7Cd eg7r5RbrPoBqgRmEOrPa8LSsej5AxA1BDXqmME86eAdIAq8ImWkqRN6aTVXboGCVhXLL dadw== 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=Tx9E+tMzbakL85sny14vjRyVUjOdRhJn9sxsu98oGoqqTk8zTNFJ04SmTzVf4hhDI4 /whaVv+Ob0tsxZ7gHJNbT545XquwHHUfwnzrlK1flRaIn1cTPlVVpnmHYzyw7FtcfbRT Nb10d5re8sGpFaxKu1wlEIzBr+vQpN9HdYIJxQGI1an+Ptfn9Q/9qY7xC5YG5zy7iGtk tzAEzO1cehptPcCoBqS32sLjabviCpO+1esFOnz0PPec7BVD+jBMhi1QyOfmjsNxUbwW U+84jGliNFUXKMhMRqfcvKmaYOQPsD5/31q8YA9b6EDxdEt6UllFSWRClmCCuakD8J7I lpkQ== X-Forwarded-Encrypted: i=1; AJvYcCWcCkk+OErXo8CeOpcteLdu+mSWzQ1WATjlUT4dYQ8T3CXDLeLJxtxxm9XDeSJPSlRmt1KeRcrqOyxSTzF2ADDBPJJ+wA9GkJZ/LzXIdeBgHMjN0qzNYCTVCyvpn1D1XVwXlMSOL2Ub0uu5Rhchl/7yHxiKRXCyYMQ3RVBJBBquVGu9+6vuYEbqZPKQ5JcV54xrdFUPZ0AqjOwWoTohywYbQ+sfWoU= X-Gm-Message-State: AOJu0Ywghz9qOiahOIbfgOHWJzfFNoKZKPflSZPy5rbxxSr4ACWJoO1s 3ykbJQXkU4cxAUQjpMXJ0qDrg1QhUMevm2L0QP5GXiVEIHPs1jK7Zttsmw== 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 Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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>; }; }; };