From patchwork Wed Mar 18 11:47:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 11445091 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C13E492A for ; Wed, 18 Mar 2020 11:47:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9805E2076F for ; Wed, 18 Mar 2020 11:47:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726759AbgCRLrP (ORCPT ); Wed, 18 Mar 2020 07:47:15 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35619 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726586AbgCRLrO (ORCPT ); Wed, 18 Mar 2020 07:47:14 -0400 Received: by mail-lj1-f196.google.com with SMTP id u12so26654823ljo.2; Wed, 18 Mar 2020 04:47:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=Ab62Ifr6mdslEB8rNbBB2lyNK3id75uGbHTExJNuy2w=; b=WG7AWvba1m7Bgi1xcFdbl9adYRZCezs4c7DEgzNGW4Ppp2gDney3qMECnpjEZ9ouxM H44BiKKv1kIO4kfADVzWZi6BduIc0jvKC8b4hicZhkHaLJiY3Fjs8X/c2NyBO6VYzuMs bNAikGIt0AS87EG3EXjKtpxq7KRQJ+BpUaJ+C9fwUfNf3/W5ys711vd3oRnzq/t+oEnm /E14y0WDrXxJMSoFgn2SCrrQPhKB47PfagMsM63ovR6CpZB57ZqSKqHF3+wujuUqaoAy reLYY0rhC5SEdNbKgZp4r8kRy/KC/dT+b43fXhl4vUF5hRbW6Djf7rWc4FWKYRpyEc5F jU6g== X-Gm-Message-State: ANhLgQ2Bgm+5Xag58FsRI6ScpPCrXL6mbfHpff+LaAU5a4y2M4Jql4zR 7sYjBIqs2YQVPpGtX+TX1uM= X-Google-Smtp-Source: ADFU+vsjikg6Y2a5KjS3oadSfQozrw8fRFUY0OAeRSoGQxPf78q4+DaqJVZpkfQhudkt2r3G0F7+Xg== X-Received: by 2002:a2e:240e:: with SMTP id k14mr2152030ljk.228.1584532030161; Wed, 18 Mar 2020 04:47:10 -0700 (PDT) Received: from localhost.localdomain (dc7t7ryyyyyyyyyyyyybt-3.rev.dnainternet.fi. [2001:14ba:16e1:b700::3]) by smtp.gmail.com with ESMTPSA id 8sm17094lfy.21.2020.03.18.04.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 04:47:09 -0700 (PDT) Date: Wed, 18 Mar 2020 13:47:01 +0200 From: Matti Vaittinen To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com Cc: Sebastian Reichel , Rob Herring , Mark Rutland , Greg Kroah-Hartman , "Rafael J. Wysocki" , Liam Girdwood , Mark Brown , Chen-Yu Tsai , Support Opensource , Charles Keepax , Richard Fitzgerald , Bartosz Golaszewski , Andrei Stefanescu , Matthias Brugger , Tony Lindgren , Andy Gross , Bjorn Andersson , Sangbeom Kim , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Matti Vaittinen , linux-pm@vger.kernel.org, patches@opensource.cirrus.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-omap@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Markus Laine , Mikko Mutanen Subject: [PATCH v5 0/9] Support ROHM BD99954 charger IC Message-ID: MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Support ROHM BD99954 Battery Management IC ROHM BD99954 is a Battery Management IC for 1-4 cell Lithium-Ion secondary battery. BD99954 is intended to be used in space-constraint equipment such as Low profile Notebook PC, Tablets and other applications. Series extracts a "linear ranges" helper out of the regulator framework. Linear ranges helper is intended to help converting real-world values to register values when conversion is linear. I suspect this is useful also for power subsystem and possibly for clk. This version of series introduces new battry DT binding entries and adds the parsing in power_supply_get_battery_info(). Changelog v5: generic: - rebased on top of 5.6-rc6. DT-bindings: - Dropped -charger extension from compatible and removed wildcard x. regulators: - squashed the regulator changes in one patch. power-supply KConfig: - fixed indentiation - dropped unnecessary 'default N' from BD99954. Changelog v4: generic: - rebase and drop RFC. DT-bindings: - add I2C node address-cells and size-cells to fix yaml check errors - uncomment multipleOf: bd70528: - add patch which renames driver internal linear_range struct to avoid collision when regulator/driver.h (which gets included from rohm generic header) introduces the linear_range struct. regulators: - rebase to v5.6-rc2 and convert also the two newly introduced drivers to use linear_range struct instead of regulator_linear_range. linear_ranges: - Fix kerneldoc. Changelog RFC-v3: DT-bindings: - fix the BD99954 binding (the *-microvolt Vs. *-microvolts issue is still there. Not sure which one is correct) - renabe tricklecharge-* binding to trickle-charge-* as suggested by Rob. - drop the linear-ranges helper which was written for BD70528 and extract the linear-range code from regulator framework instead. - refactor regulator framework to utilize extracted linear-ranges code. - change the struct regulator_linear_range to linear_range from regulator drivers. - refactor BD70528 to use regulator framework originated linear-ranges code. - change BD99954 to use linear-ranges code from regulator framework Changelog RFC-v2: DT-bindings: - Used the battery parameters described in battery.txt - Added few new parameters to battery.txt - Added ASCII art charging profile chart for BD99954 to explain states and limits. Linear ranges: - Fixed division by zero error from linear-ranges code if step 0 is used. Power-supply core: - Added parsing of new battery parameters. BD99954 driver: - converted to use battery parameters from battery node - Added step 0 ranges for reg values which do not change voltage - added dt-node to psy-config Patch 1: DT binding docs for the new battery parameters Patch 2: BD99954 charger DT binding docs Patch 3: Linear ranges helpers Patch 4: Rename driver internal struct linear_range from bd70528-power Patch 5: Use linear-ranges helpers in regulator framework and convert regulator drivers to use new linear_range struct. Patch 6: Use linear-ranges helpers in bd70528 driver Patch 7: Parsing of new battery parameters Patch 8: ROHM BD99954 charger IC driver Patch 9: Fix Kconfig help text indentiation for other entries as well. --- Matti Vaittinen (9): dt-bindings: battery: add new battery parameters dt_bindings: ROHM BD99954 Charger drivers: base: add linear ranges helpers power: supply: bd70528: rename linear_range to avoid collision regulator: use linear_ranges helper power: supply: bd70528: use linear ranges power: supply: add battery parameters power: supply: Support ROHM bd99954 charger power: supply: Fix Kconfig help text indentiation .../bindings/power/supply/battery.txt | 6 + .../bindings/power/supply/rohm,bd99954.yaml | 155 +++ drivers/base/Kconfig | 3 + drivers/base/Makefile | 1 + drivers/base/linear_ranges.c | 246 ++++ drivers/power/supply/Kconfig | 34 +- drivers/power/supply/Makefile | 1 + drivers/power/supply/bd70528-charger.c | 140 +- drivers/power/supply/bd99954-charger.c | 1171 +++++++++++++++++ drivers/power/supply/power_supply_core.c | 8 + drivers/regulator/88pg86x.c | 4 +- drivers/regulator/88pm800-regulator.c | 4 +- drivers/regulator/Kconfig | 1 + drivers/regulator/act8865-regulator.c | 4 +- drivers/regulator/act8945a-regulator.c | 2 +- drivers/regulator/arizona-ldo1.c | 2 +- drivers/regulator/arizona-micsupp.c | 4 +- drivers/regulator/as3711-regulator.c | 6 +- drivers/regulator/as3722-regulator.c | 4 +- drivers/regulator/axp20x-regulator.c | 16 +- drivers/regulator/bcm590xx-regulator.c | 8 +- drivers/regulator/bd70528-regulator.c | 8 +- drivers/regulator/bd71828-regulator.c | 10 +- drivers/regulator/bd718x7-regulator.c | 26 +- drivers/regulator/da903x.c | 2 +- drivers/regulator/helpers.c | 130 +- drivers/regulator/hi6421-regulator.c | 4 +- drivers/regulator/lochnagar-regulator.c | 4 +- drivers/regulator/lp873x-regulator.c | 4 +- drivers/regulator/lp87565-regulator.c | 2 +- drivers/regulator/lp8788-buck.c | 2 +- drivers/regulator/max77650-regulator.c | 2 +- drivers/regulator/mcp16502.c | 4 +- drivers/regulator/mp8859.c | 2 +- drivers/regulator/mt6323-regulator.c | 6 +- drivers/regulator/mt6358-regulator.c | 8 +- drivers/regulator/mt6380-regulator.c | 6 +- drivers/regulator/mt6397-regulator.c | 6 +- drivers/regulator/palmas-regulator.c | 4 +- drivers/regulator/qcom-rpmh-regulator.c | 2 +- drivers/regulator/qcom_rpm-regulator.c | 14 +- drivers/regulator/qcom_smd-regulator.c | 70 +- drivers/regulator/rk808-regulator.c | 10 +- drivers/regulator/s2mps11.c | 14 +- drivers/regulator/sky81452-regulator.c | 2 +- drivers/regulator/stpmic1_regulator.c | 18 +- drivers/regulator/tps65086-regulator.c | 10 +- drivers/regulator/tps65217-regulator.c | 4 +- drivers/regulator/tps65218-regulator.c | 6 +- drivers/regulator/tps65912-regulator.c | 4 +- drivers/regulator/twl-regulator.c | 4 +- drivers/regulator/twl6030-regulator.c | 2 +- drivers/regulator/wm831x-dcdc.c | 2 +- drivers/regulator/wm831x-ldo.c | 4 +- drivers/regulator/wm8350-regulator.c | 2 +- drivers/regulator/wm8400-regulator.c | 2 +- include/linux/linear_range.h | 48 + include/linux/power/bd99954-charger.h | 1075 +++++++++++++++ include/linux/power_supply.h | 4 + include/linux/regulator/driver.h | 27 +- 60 files changed, 3018 insertions(+), 356 deletions(-) create mode 100644 Documentation/devicetree/bindings/power/supply/rohm,bd99954.yaml create mode 100644 drivers/base/linear_ranges.c create mode 100644 drivers/power/supply/bd99954-charger.c create mode 100644 include/linux/linear_range.h create mode 100644 include/linux/power/bd99954-charger.h base-commit: fb33c6510d55 ("Linux 5.6-rc6")