From patchwork Sun Apr 16 12:44:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Hauser X-Patchwork-Id: 673682 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85F82C77B73 for ; Sun, 16 Apr 2023 12:45:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230331AbjDPMpG (ORCPT ); Sun, 16 Apr 2023 08:45:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230259AbjDPMpF (ORCPT ); Sun, 16 Apr 2023 08:45:05 -0400 Received: from sonic312-25.consmr.mail.ir2.yahoo.com (sonic312-25.consmr.mail.ir2.yahoo.com [77.238.178.96]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2D091982 for ; Sun, 16 Apr 2023 05:45:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1681649101; bh=uou61x2ek9dko20lP5SzF9mUIOr+ld/ukFrixmFYXwc=; h=From:To:Cc:Subject:Date:References:From:Subject:Reply-To; b=VSNpPxljZjt8Xhvg+fJsok28NhXosMufJuLM4tg+7MkSgiOID8m8JbZW5m6tznUGTQADE4tNQBHPcLvlD/UZiUGMdVx1JX8pkcGNq2Wmrw0lOmxMWbg+brIyaIuC9/yVIJy9JpTzUWFHhNGZckYe3Uuzb1oK4K9uZ3/53Bz09SkwBDgf01o1TrKHwJLw7RQ1N+mmW/WpT59v0sxrUkWPz4BCqhsIIX+vDn1gUx74kZ/CX1EeiM01M5DojbNQDIba4sXwNINUDbDdhnA9/uRf8azC5+I67tyg+KXNbvsVoXHBXu3lya25kqpZrbFghaBjOeC15TYtwxDvuLWgff8MPA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1681649101; bh=8bXtnsa4gHFMcw6cKslKNTqWkA3e94z3e8oszgsXcoR=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=JLV4i4we0LVmD0L2zyp0hsV8nXkfT1vWD0/SZiVqKvgSna3GPWaJk21W8cLeLAdIP3t3YOoNj49SBO+vk76WAyZ0n/D+a0UTiH56dGr1VBfG0ysIAc/gYptJdsHih3MaZOn6LX2AHCncTo2FIHfs85zwinrQviXRWN1RFSmig8GR+jpHsK3cDJdy23kuRxTgqyi864CoDcNXE/mIlciWPPyGwQc85n+XERWNZzbcHiD+3gNB1sR+oUgs720EmIg8yA3MbT/Ka1XVShiaf+wdsb/oH9xL8v2/geuDojmJScDj30kHETXKSOwD8wwK70HeiS78E5fAoZvW5TVY8TWQHg== X-YMail-OSG: cY_F.pAVM1lkJJRbdfSaA9PYF8zl2uaKqyjT2uNRhTw7wABLBki0gpiyUQk8RY9 CZgqKx4QVJJn_cSJXhi.Qs4YKoknPTf2c0ubq8W1MA1WGYJFYJ2cJ6A.QcBTDRZDIiCbyiPWjsDC pxNZ5twrHwukdCJRWqf9jpEtDqJFxEvqOUyYPdikXveQHSYLaGS1tPce7aN0k36OWsuOPvtxnqi4 bCccxDeD4RDTfF_spvKcT.hZxOGeXF5gzU.BGkGBFpwfVR4bKknx1Qv2ktMltijCZhs3jV0wV6fc yXJLlboFrpYIPQhTwXRg4g37HDzRuTOpzq_UhlGC8jrU.Rc8jR3aCnEMuC2KO7MIpLNTKKnCuF1p VIWdS9aSMzMnfKjiba8JN7R2iCL5b8E2IsrG1p8YkU.r00EB9mBFG.YdwTOGBhEACL7PHebsHsHq 15cUWUAfjm3CcEJyJ4nsYJS8uIr0vfGAp0lvRKy6hKSpMo0e6SdybIVvYS9PlynSVeSJGdJ77q9x cPPFBKL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RdwE6k0HWT5z8t7CxDbZrAh5XKE2R8vSvtwbni27sWqxo5usYu.28zJBCXs7ik2d rPpyX8hWE.Ij8.IiP6aJFxk0nrOPt4WdQJHlms9Htz1OReGjtl.zCjgCYgCVVYrFFj.U4pF7Hw5S 5TIsgEdLMckMh__iApCikgs5KmWcGYVGV.tBopUaDLqxNcxdTMZAjzGxbZbPqH8.5WxLtd4AhFyN eep7d7kPRMQNbINCh0EluifcOuLkzMWTU7tieTKlivOpJjE4.hw8kdf.XtJWjmK2td60Atsxa_Qh UvLZsfUzgr36WfmCiWeR42sBgBtznbdakojKrFxtIyejj2No.RvjNFFLL76dEy.vEEwZuZiu6jmq XqRE6o82jBgV1Q7UEas7o9F6ON7aJETvj8MaK.BCwGEG1UPzo7gJW7DGo7MbKw5hzwIZVyKrvj33 0AV5qmffZML4tNVg9WsSFQ73ftasz71IuXfFUoqXzvHrlO2rFSinDqFUTKPl3yPmcMlHHP3xMDhp Pus_ZrcIxwbpmMGU3FOrSEPpp2.vqxCOCrxbNiUJ17mBzz79C5KKlSWNjQk0gQ3_x.dxW0fVCFeN Vhv60nNMxVpV1qVUau9RdzAJV5Cpd7s0KJoF35JOXVidmnkDBhfyzqSso4tKZfhh6Qx99MWTGGeV sfcu6HewmJRGXEO04rC4SBnN6CTQ7HwrKDaZYCMK1WlXFWiHHtulqQV1pHHRF5uOv7fkA8LTbWw0 TV4m29g0lrnbBZ3BeeNPxkAVw_xMM6_O8PncZUS4.dV1D_F2n X-Sonic-MF: X-Sonic-ID: cd681a32-e0af-4c73-810c-2372c6f94cf3 Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ir2.yahoo.com with HTTP; Sun, 16 Apr 2023 12:45:01 +0000 Received: by hermes--production-ir2-74cd8fc864-4bl68 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 8a53f7a8722383f9609d619e4fab1862; Sun, 16 Apr 2023 12:44:59 +0000 (UTC) From: Jakob Hauser To: Sebastian Reichel , Lee Jones , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski Cc: Beomho Seo , Chanwoo Choi , Stephan Gerhold , Raymond Hackley , Pavel Machek , Axel Lin , ChiYuan Huang , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Jakob Hauser Subject: [PATCH v2 0/9] Add RT5033 charger device driver Date: Sun, 16 Apr 2023 14:44:27 +0200 Message-Id: X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 References: Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patchset adds the charger driver "rt5033-charger". It is part of the multifunction device rt5033. The patchset is based on an older version by Beomho Seo of March 2015. For more information on the history and setup of the patchset see the cover sheet of version v1, there is a link further down below the changelog. In patch 9 I didn't change the extcon phandle, I haven't received any answer on this. Changes in v2: - Rebased to linux-next (20230413), as suggested by Lee. - The v1 patch 3 "mfd: rt5033: Fix comments and style in includes" vanished as it got applied already. - Dropped the v1 patch 8 "power: supply: rt5033_charger: Make use of high impedance mode". The high impedance mode is kind of a sleep mode for power saving. It turned out that it might complicate a future implementation of an rt5033 flash LED driver. Therefore drop it for now. The high impedance mode could be added at a later date as a power saving improvement. - Patch 2: Changed variable name "data" back to original "dev_id". - New patch 5: Changed name of regulators to lowercase, as suggested by Rob. - Patch 6: In function "rt5033_charger_dt_init" replaced the devicetree units "uamp" to "microamp" and "uvolt" to "microvolt". However, I didn't change the unit names of the driver-internal variables in order to keep the variable names short. Let me know if you think they should be changed too. - Patch 9: Removed '|' after all "description" blocks in all three files. - Patch 9: In the example of "mfd/richtek,rt5033.yaml" changed "i2c@0" to "i2c". - Patch 9: In the example of "mfd/richtek,rt5033.yaml" removed the last part on the battery fuelgauge. It has its own I2C line and is therefore not a subsidiary of the rt5033 MFD driver. - Patch 9: Replaced units "uamp" by "microamp" and "uvolt" by "microvolt" in the example of "mfd/richtek,rt5033.yaml" and the file "power/supply/richtek,rt5033-charger.yaml". - Patch 9: Changed name of regulators to lowercase in "regulator/richtek,rt5033-regulator.yaml" and in the example of "mfd/richtek,rt5033.yaml" (related to patch 5). - Patch 9: Removed example from "regulator/richtek,rt5033-regulator.yaml". It is already part of the example in "mfd/richtek,rt5033.yaml". v1: https://lore.kernel.org/linux-pm/cover.1677620677.git.jahau@rocketmail.com/T/#t The result of the patchset v2 can be seen at: https://github.com/Jakko3/linux/blob/rt5033-charger_v2/drivers/power/supply/rt5033_charger.c Jakob Hauser (8): mfd: rt5033: Fix chip revision readout mfd: rt5033: Fix STAT_MASK, HZ_MASK and AICR defines mfd: rt5033: Apply preparatory changes before adding rt5033-charger driver regulator: rt5033: Change regulator names to lowercase power: supply: rt5033_charger: Add RT5033 charger device driver power: supply: rt5033_charger: Add cable detection and USB OTG supply power: supply: rt5033_battery: Adopt status property from charger dt-bindings: Add documentation for rt5033 mfd, regulator and charger Stephan Gerhold (1): mfd: rt5033: Drop rt5033-battery sub-device .../bindings/mfd/richtek,rt5033.yaml | 90 +++ .../power/supply/richtek,rt5033-charger.yaml | 76 ++ .../regulator/richtek,rt5033-regulator.yaml | 24 + drivers/mfd/rt5033.c | 8 +- drivers/power/supply/Kconfig | 8 + drivers/power/supply/Makefile | 1 + drivers/power/supply/rt5033_battery.c | 24 + drivers/power/supply/rt5033_charger.c | 724 ++++++++++++++++++ drivers/regulator/rt5033-regulator.c | 12 +- include/linux/mfd/rt5033-private.h | 64 +- include/linux/mfd/rt5033.h | 10 +- 11 files changed, 1008 insertions(+), 33 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/richtek,rt5033.yaml create mode 100644 Documentation/devicetree/bindings/power/supply/richtek,rt5033-charger.yaml create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt5033-regulator.yaml create mode 100644 drivers/power/supply/rt5033_charger.c