From patchwork Mon Jul 15 12:55:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13733493 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 CF057C3DA59 for ; Mon, 15 Jul 2024 12:55:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To: Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date:Subject: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=l4oxwn9faJBZWNYakjxQw34lzbdzSD9MrW7c7EhtXGw=; b=krdlVI61F52cRD 55lNDLOGFbBuhGTh4hmrWbZ8wnVpjM0R/iUo1WKwQM+91s3ROQmhzNK71hUo+ceI1+G+zXfcewSrr CoWjVOZqbwAYzhITUYXA9nkwkbtQS21vCx7hBN+iIFvZ98i2+KZZEu+GGD94IIJIRC9X8QIwyrYs2 JyUgjKX6EcJ844Hb8rL6ajBIDZerqOrcZLu9w0n/OmqtC+hftIjW8PlQx22hnDS1I5mqBY/EJ0Fx6 SCGawL05SqAr2V7pPr/QTaO18kld4lZSNsBlWTh5d726ctYlWIi38ECsoSfwRUvFsGC+mNu/APZqd I0CojF/9EoXUBmH5Fq6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTLEq-000000076Yj-0vfu; Mon, 15 Jul 2024 12:55:32 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTLEW-000000076Qj-0IzV for linux-arm-kernel@lists.infradead.org; Mon, 15 Jul 2024 12:55:13 +0000 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-58d24201934so220679a12.0 for ; Mon, 15 Jul 2024 05:55:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721048110; x=1721652910; darn=lists.infradead.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=l4oxwn9faJBZWNYakjxQw34lzbdzSD9MrW7c7EhtXGw=; b=GxGvgP/3MTNTykMxJpuPTei6F3m+Yo8IA8x8oPbCpkT05n0+r9VW+PsQ8UdbKLxr07 pPkw7HiU51Hp6TlC0QAM1HffB1rBAKhWOk2ERqfZLjRdGPt5nQS0eFAQRgrnhZFYQlJp Yqs3fJ3DUEfrYzxiCVVgeXFeMeX1caGRhBImlmc7g//nMid3Rh01D1Qw0fhER4iO2EtR 5CKWImGUgpVUYgOx7h7z/TbaFvDOkLZWSpvclS/ZaB25Q11G1CFeHq2+ic33TKnueO6U 2WHHli6y8SBIw+Ei8vjpDryi/ewXKj9L2zv6aOUwDGEqjt1U8bQFzIQFDvIjX8RQ2DYe RpRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721048110; x=1721652910; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=l4oxwn9faJBZWNYakjxQw34lzbdzSD9MrW7c7EhtXGw=; b=H5qzGCd6+C2ZH7pV35YaK12d840ulNRV4uollkgfxAeGQeP+2dxrG9zv8pUPSTGJuT qJTIdN4wGZRaOq/e73YoCHQkm+BqZYyEfmFfB9CxYvfmlVbE1jMgnZOUHThr7eyPELO9 vqqY7m7myAuKmLZpOpnRxBguyNRA+yYAEoiWFywPdGz9h7RUFA1VvWMvLz8zwZ00Jg9D 5ruM7jsqMFVM0DJE0Mzsun3aVPykQFHWGkUHdly64ST20Apv/ewvsIoAKKube3hGX81R fc6rXLkz1Polce5LYIuF0KNO1D1IB0GkUr1WSQxeFNf7YVnDEer+PYrlBDKXYp3FojuU mdnA== X-Forwarded-Encrypted: i=1; AJvYcCXwERlf49YLo2EVtfxoSIcc1CU+Pwl8v/WFR16pMyqMkcqB9ghlrp8lRDMb7ShzwV4hioVP6/XSPr0RmmN/Pq8QMrZYk1O/8Bcz28mYL/ksuBdsdjU= X-Gm-Message-State: AOJu0Yz+scz/4JBNx/xnyDB5ASIpDGdDXojcuCZGPEJDGp5J+u8hYqWD THmx75xXGhIUxLbJC1r4XdxPWKKbJOti6VoVYF+7JNAQ8b2vgBQm X-Google-Smtp-Source: AGHT+IFiuhD+U3uimNCwm9sMXN3yk+88hpselw5hq29H3RlOMCChzciDUtnwlTqLtREIV1f6gBzhyw== X-Received: by 2002:a50:d7c9:0:b0:59a:442d:67bd with SMTP id 4fb4d7f45d1cf-59a442d68acmr4790387a12.20.1721048109582; Mon, 15 Jul 2024 05:55:09 -0700 (PDT) Received: from tablet.my.domain (ip-37-248-157-210.multi.internet.cyfrowypolsat.pl. [37.248.157.210]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b26f62165sm3333307a12.87.2024.07.15.05.55.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jul 2024 05:55:09 -0700 (PDT) From: Artur Weber Subject: [PATCH v2 0/9] power: supply: max77693: Toggle charging/OTG based on extcon status Date: Mon, 15 Jul 2024 14:55:02 +0200 Message-Id: <20240715-max77693-charger-extcon-v2-0-0838ffbb18c3@gmail.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIACYclWYC/3WNzQ6CMBCEX4Xs2TWlFRFPvofh0J8FNhFKWtJgC O9uJV49fjOZbzaIFJgi3IsNAiWO7KcM8lSAHfTUE7LLDFLIi6hkhaNe6/raKMx16CkgrYv1EzZ kTG20uylLkNdzoI7Xw/xsMw8cFx/ex1Eqv+nPqcRfZypRoLNSN1QZ1ynx6EfNr7P1I7T7vn8Ak w8nUL4AAAA= 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=openpgp-sha256; l=2480; i=aweber.kernel@gmail.com; h=from:subject:message-id; bh=joW1dUBhJoxnwAipx4tWr4333aQdsreO5ngTla7wYSs=; b=owEBbQKS/ZANAwAKAbO7+KEToFFoAcsmYgBmlRwo9PihOl5L28LE9qP4hgOpnfxfXs8CFPp05 CKvz5ISW/+JAjMEAAEKAB0WIQTmYwAOrB3szWrSiQ2zu/ihE6BRaAUCZpUcKAAKCRCzu/ihE6BR aB0vD/90CLEESM73nmoes655DvnKe9FoKfY0xRcn8DjYELj1oRQsnFmYNzH+Hm4TLWm5wE7Styi FGgmxM/d/ffqC87fdmUpqsmntH5snyajqNAmA7NSPg31xUhoD/MyuEnDc+pm5p4Lngr3iGKPmz1 1RT4MMjLoc1eATadbdTl0bohDfQd5sV1gWsb475Tu7GoevaUzvAs4boj38JKMQtstZ3r5J7Jymm FUgbSioMlcAlF+Hnz6vfgY89jkfwwbbzrtDnp0azbXjm3kS3LBWlttOS9hPHdTe+sLgPs7hfk9a wp6ETUNq0YdSNRUvqJDmJBR014OIxJWOJ/LQfTpr51PSDSa7ALYJAU+lM+CLcX2iaEbxzBqkh0m HvBAhGcYLq+U7tMg1xQbhbQD/MfR0435xZq6I9911JcbyaarK1U+HUnpbqq4i6+OgN2dxHpiPfS w5PowAQzE96/3BfURYLYtzuPTljJrKZzxjIaP9rsezom8vF7Ih4SB90gLUFBrpbq+JrvDIaPpIQ bGFxTcWR2A/5qX3P+WuNsaUfn+lVSbGFCYBY2mbEdJjyDfVYjfscHaMsp9zZRSSOMdOvqna3K6g lFfRsiFhkAZTl4EkZEh+EueB3kMOHgMYSxovU7GgyunqAIc+h1udPKU02Ri5HxMOY9rrqvisyjn 0p9vpp5IDI5eFxw== X-Developer-Key: i=aweber.kernel@gmail.com; a=openpgp; fpr=E663000EAC1DECCD6AD2890DB3BBF8A113A05168 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240715_055512_149599_5F861E1D X-CRM114-Status: GOOD ( 12.17 ) 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 patchset does the following: - Add CURRENT_MAX and INPUT_CURRENT_MAX power supply properties to expose the "fast charge current" (maximum current from charger to battery) and "CHGIN input current limit" (maximum current from external supply to charger). - Add functions for toggling charging and OTG modes. - Add an extcon-based handler that enables charging or OTG depending on the cable type plugged in. The extcon device to use for cable detection can be specified in the device tree, and is entirely optional. The extcon listener implementation is inspired by the rt5033 charger driver (commit 8242336dc8a8 ("power: supply: rt5033_charger: Add cable detection and USB OTG supply")). Signed-off-by: Artur Weber --- See v1 for old description: https://lore.kernel.org/r/20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com --- Changes in v2: - Changed to use monitored-battery for charge current value - Both current limit variables are now set by the CHARGER regulator - Link to v1: https://lore.kernel.org/r/20240530-max77693-charger-extcon-v1-0-dc2a9e5bdf30@gmail.com --- Artur Weber (9): dt-bindings: power: supply: max77693: Add monitored-battery property dt-bindings: power: supply: max77693: Add maxim,usb-connector property regulator: max77693: Set fast charge current in MAX77693 CHARGER regulator power: supply: max77693: Expose CURRENT_MAX property power: supply: max77693: Set charge current limits during init power: supply: max77693: Add USB extcon detection for enabling charging power: supply: max77693: Add support for detecting and enabling OTG ARM: dts: samsung: exynos4212-tab3: Add battery node with charge current value ARM: dts: samsung: exynos4212-tab3: Add USB connector node .../bindings/power/supply/maxim,max77693.yaml | 15 ++ arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi | 19 ++ drivers/power/supply/Kconfig | 1 + drivers/power/supply/max77693_charger.c | 273 ++++++++++++++++++++- drivers/regulator/max77693-regulator.c | 34 ++- include/linux/mfd/max77693-private.h | 11 + 6 files changed, 340 insertions(+), 13 deletions(-) --- base-commit: a38297e3fb012ddfa7ce0321a7e5a8daeb1872b6 change-id: 20240525-max77693-charger-extcon-9ebb7bad83ce Best regards,