Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp721411rwd; Sun, 14 May 2023 05:33:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6+sOBYC7O0wZ2P1cKK21gkmQNy4WZkwy/6R0DQbJdCNYoGqo26CogaaW9pX6RlsnR7Bpd1 X-Received: by 2002:a17:90a:7c45:b0:250:a964:9379 with SMTP id e5-20020a17090a7c4500b00250a9649379mr19464549pjl.9.1684067619089; Sun, 14 May 2023 05:33:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684067619; cv=none; d=google.com; s=arc-20160816; b=DapipjLfBq8pG/QBQednPKSNMM9vdSGfE2UQvLWjZvyb4yzuB43HUVxwrQl+r5sOvd S5VTcRLRXQOHCw66bJx+G0ep80ESeLAcSvTiaXtPKqu0XJ4FI5j1qfzxKBFvReQYqUQM BPCz9YAh7OXcAfDCx2U63VbXYl3B0GEKd2JC1Lwq3aNMllWfLVB5PkqKR2wstHfLZRgl LhrZTR+yBbT0CUXyw1fesNAVyvAXgBjq9Tt1gOQ+lWotkltazPRy5VnkGcL4XiPy869m xwrnsS9eFcU9VFrFPlz9A/3pRG1qQ1P0G08jiO72UPC02wPgvXdZIc+3LH9u2DFvYgTM 3vZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=LIpjzw43yAswmcqXPnpxZYz8CzOXQtvNx0gQj9Flbfw=; b=V0/wtD2Y5Ham5he40+G8qzfHjClmQ7E6Sj8HriNtEYgV1C0Ya0HYWQCYXVHBWu1hOm SruCKFGkgwy5DHIN5umjDOz2CqkIMI2XV5uXBIRYgy4/eEF8XVtRcFbrtbbrLwDiUnhq XllmoRr6hAlkYNxepfvv5BJmkaRy4+FWE8MhQ6tmBoOsZT7iMzTBdJJQ3zJxu4HK1PKk demoiFtMok6MCdbSzgvdkykp9pQDNBoa0FmYIqf/XxLS9ZBt/N13CtNIoT9rDgeWQCal QycLlXLtypGBIHL4oiRzVi9d1Jj6WBfERcmJiv2bMkpE5qd3ZXqClLVVDzhdlz7lXqva ltpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rocketmail.com header.s=s2048 header.b=M6e6pv1m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rocketmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l64-20020a638843000000b005307138a514si9010115pgd.29.2023.05.14.05.33.26; Sun, 14 May 2023 05:33:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rocketmail.com header.s=s2048 header.b=M6e6pv1m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rocketmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230009AbjENMb4 (ORCPT + 99 others); Sun, 14 May 2023 08:31:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233548AbjENMby (ORCPT ); Sun, 14 May 2023 08:31:54 -0400 Received: from sonic302-20.consmr.mail.ir2.yahoo.com (sonic302-20.consmr.mail.ir2.yahoo.com [87.248.110.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5F081720 for ; Sun, 14 May 2023 05:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1684067510; bh=LIpjzw43yAswmcqXPnpxZYz8CzOXQtvNx0gQj9Flbfw=; h=From:To:Cc:Subject:Date:References:From:Subject:Reply-To; b=M6e6pv1mxQUKgT6pRvy+tsRCgoBSGDj+wyYftWbClv2Gc/zpouBDemysvJg6j9iMEkpnGuVz1uxUeHZj+z0TeATlym+ZY7AIoP4PnPqOOYEWTEJGKX/flUD65Wbxxw7ozuFk9Gl/RCGyzBpgL2XHIzz/mvL1DrgFqgOZ0h+eXiNJUf6+UyhECUCS8PuakdGGHgAKCjVTEBnw1rzJKwd/y34VPcTMn3TYMn1zUWhwJdVehSoESX8wNIDz1HSqsrAbcgngQJMYdQOgfqMBxI6Ls5YawGgiR/s90Sdxn02FSzcOBsnjC4w5e6qid18io5ApVRWgeRzveyhSrtVPaHuRiQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1684067510; bh=wSPmtaHvV3XsFmU5AcHElGb/HUuZARKV341mZWdkRJj=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=Rt2FFVD+HEdmNnGBVgWUqu7WlfI4SXktJSZtRohEk+GBG7WJS5iGPIq6bqTyaNkX2oBelYwImCvQqlvuJMtmi33GNCNaOplxUzFrFq1ct1KG85jTczCUq6oIOHaM8bXyMZClM11pMiOM1w3eh5SzUNRei5/1QUAn/6GTd1K7v0oDImXyghzm5gfR09fNdCaMN0ouuVLfreJHj3yHMTqrRNuNBoVJj29Uh+5iTMofbx4pvuAOY7GepIxcIMt6g3phn1uMXX8mrROWLf7zOwsP74f3eGMbZQC4Pz7tUUmEE/M1g9O3fh/QC/11x5Qfx5UqGnNw/MoXJctvdMRox1xgxw== X-YMail-OSG: GU7I6agVM1nSqHH33UBeSuZjY3Cm1zjFlnZVfNYgQCsxalp.0_unYcvuYbLh3nv Lisi6QzDHWNS2Uraafs9wopb29QA7sH54hBYu15yl9ygDBMuy0q.D7_QGRna4Bey1a7h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5zvha34VXvYGMfeOaHk34hnuAnmfTes2eStokqjHyWgLwoMsieQhpUcda1POdSCuwfgERNrJ9 KjCIs3vEEJMfQsXaFYB98ppPV8w-- X-Sonic-MF: X-Sonic-ID: 695d8ed0-38ec-4e9b-96ae-2dedf005ef4c Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.ir2.yahoo.com with HTTP; Sun, 14 May 2023 12:31:50 +0000 Received: by hermes--production-ir2-7867f454fc-kqstn (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 32d47a946aad3f7d203db987b930ba8f; Sun, 14 May 2023 12:31:49 +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 , Linus Walleij , Henrik Grimler , 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 v5 00/10] Add RT5033 charger device driver Date: Sun, 14 May 2023 14:31:20 +0200 Message-Id: <20230514123130.41172-1-jahau@rocketmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit References: <20230514123130.41172-1-jahau.ref@rocketmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. Changes in v5: General - Rebased to torvalds/linux v6.4-rc1 Patch 5 - Removed the GPL2 text, not needed because of the SPDX license header. - In function rt5033_charger_get_property() removed unused declaration "int ret = 0;". - In function *rt5033_charger_dt_init() changed the error reporting from dev_err() to dev_err_probe(). - In function rt5033_charger_probe() replaced "charger->rt5033 = rt5033;" by "charger->regmap = dev_get_regmap(pdev->dev.parent);" because only the regmap is used of the parent mfd device. - Accordingly to the previous point, replaced "charger->rt5033->regmap" by "charger->regmap" throughout the driver file rt5033_charger.c. - In function rt5033_charger_probe() after devm_power_supply_register() changed dev_err() into dev_err_probe(). - Moved struct rt5033_charger and struct rt5033_charger_data from include/linux/mfd/rt5033.h to drivers/power/supply/rt5033_charger.c. - In struct rt5033_charger removed "struct rt5033_dev *rt5033;" and added "struct regmap *regmap;" instead. This is related to the above mentioned point of using "charger->regmap" instead of "charger->rt5033->regmap". - Removed #include , it's not used anymore. Instead added #include and #include . Patch 6 - In function rt5033_charger_probe(), where getting the extcon device, changed phandle string from "connector" to "richtek,usb-connector". Patch 7 (new) - New patch to move the struct rt5033_battery into the battery driver. Patch 8 (former Patch 7) - Changed the function rt5033_battery_get_status() to use power_supply_get_property_from_supplier() instead of first power_supply_get_by_name() and then power_supply_get_property(). - In function rt5033_battery_probe() initated "of_node" by adding the line "psy_cfg.of_node = client->dev.of_node;". - In function rt5033_battery_probe() after power_supply_register() changed dev_err() into dev_err_probe(). - Removed the "Tested-by:" tag of Raymond because the patch changed a lot. Patch 9 (new) - In dt-bindings power/supply/richtek,rt5033-battery.yaml added property "power-supplies". Otherwise dt_binding_check complains about not match regular expression. Patch 10 (former Patch 8) - In file "richtek,rt5033-charger.yaml" fixed typo on "PMIC" in the title. - In the charger file changed the general "connector" property into vendor-specific "richtek,usb-connector". - In the charger file added $ref to phandle for "monitored-battery" and "richtek,usb-connector". - In charger file removed line "maxItems: 1" from property "richtek,usb-connector" because dt_binding_check complained about it. - In the mfd example added the "power-supplies" connection between fuel-gauge and charger. As the example fuel-gauge contains compatible "richtek,rt5033-battery", dt_binding_check was rather picky to implement that node completely. v1: https://lore.kernel.org/linux-pm/cover.1677620677.git.jahau@rocketmail.com/T/#t v2: https://lore.kernel.org/linux-pm/cover.1681646904.git.jahau@rocketmail.com/T/#t v3: https://lore.kernel.org/linux-pm/cover.1682636929.git.jahau@rocketmail.com/T/#t v4: https://lore.kernel.org/linux-pm/20230506155435.3005-1-jahau@rocketmail.com/T/#t The result of the patchset v5 can be seen at: https://github.com/Jakko3/linux/blob/rt5033-charger_v5/drivers/power/supply/rt5033_charger.c Jakob Hauser (9): 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 power: supply: rt5033_charger: Add RT5033 charger device driver power: supply: rt5033_charger: Add cable detection and USB OTG supply power: supply: rt5033_battery: Move struct rt5033_battery to battery driver power: supply: rt5033_battery: Adopt status property from charger dt-bindings: power: supply: rt5033-battery: Add power-supplies as a property dt-bindings: Add rt5033 mfd, regulator and charger Stephan Gerhold (1): mfd: rt5033: Drop rt5033-battery sub-device .../bindings/mfd/richtek,rt5033.yaml | 138 ++++ .../power/supply/richtek,rt5033-battery.yaml | 2 + .../power/supply/richtek,rt5033-charger.yaml | 65 ++ drivers/mfd/rt5033.c | 8 +- drivers/power/supply/Kconfig | 8 + drivers/power/supply/Makefile | 1 + drivers/power/supply/rt5033_battery.c | 38 +- drivers/power/supply/rt5033_charger.c | 744 ++++++++++++++++++ include/linux/mfd/rt5033-private.h | 64 +- include/linux/mfd/rt5033.h | 24 - 10 files changed, 1035 insertions(+), 57 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 drivers/power/supply/rt5033_charger.c -- 2.39.2