From patchwork Sat Jan 23 22:18:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 369458 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp2687550jam; Sat, 23 Jan 2021 14:20:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyqeQuXmeWqc3w49ohcnDLjjm0IuyFtoCsEUmtgmDES46++VgrbbF7PNKwq3GdoworzbDsm X-Received: by 2002:aa7:dd12:: with SMTP id i18mr577523edv.36.1611440436369; Sat, 23 Jan 2021 14:20:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611440436; cv=none; d=google.com; s=arc-20160816; b=JhLFvpj8udHORqFaHPmvN3wm2XIR7zI3oG9TwxRCSkDE+1kL37/dYXUnhZgZWcsFO/ 1IXVTn1Pt7oSvWem7VyR9z9Gf4Tf/+cwSkHxmQNIih4ohWxJLnDOykQ+79u6MhnZA2hy T3gzdu2uWr03N4FA6LBngdq/nO3hZ2uiGRCgVi8AA4fS2Xp5J/LjM7d1CGwQ6DMPl/xp njxSHVHkQjfl4dM4zbbkH0r7tOrw612wDoij+lA+W1MyOQhLNlDM6LinLjutGtbffgne Usbv0x8BdrddLiPc8a5JIJKanoEfTN4OrzR5FJGQA6BGb/5KIf//PO3jK17oVYmZ5u/L WEUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=OuzrSh9DV5NeRS6vSmPIUQn7/gIkMFfQQN91c4hi3rg=; b=JflhZTSTlGyX0KVq4Y2W2aSkeDBRqpO0+mopDnSedi37RvIKH/e3TyNnfobkuMeFkO 5TAmqOKLPq2KfcLjfWSxd5A2PCQ/W+IxEsMnFj1CJ6D+dYJDfAZxAkPTXbF8Dj/4lwtO 8SkLS/IfeTpE+BH24TEyksY/rtlMY6ElC7U5yu5KpndPlNc8+cSey+WfzinBK6JeD7nU j/nG72n3XTTyIv5A94G7DFPgC+DdEDsdr0qMnOLrbcmP4JrzWV618/Y31TWEvEI96wjL /9quxJPGtarJf7nR2j/mDluOPTr/m/Sj/1OzuLqTfup3JLGSwHqKiQ6Nqldyoxsonl0w KZKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lLUpr6J+; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w3si5278360edr.427.2021.01.23.14.20.35; Sat, 23 Jan 2021 14:20:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lLUpr6J+; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725765AbhAWWT6 (ORCPT + 7 others); Sat, 23 Jan 2021 17:19:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725932AbhAWWT5 (ORCPT ); Sat, 23 Jan 2021 17:19:57 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE07AC0613D6 for ; Sat, 23 Jan 2021 14:19:16 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id p21so7485664lfu.11 for ; Sat, 23 Jan 2021 14:19:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OuzrSh9DV5NeRS6vSmPIUQn7/gIkMFfQQN91c4hi3rg=; b=lLUpr6J+cII/f+if1E3XCWeANU8AXjwVDrJjGtGUOrNz4S3bq3z2mUj6OT+xnN0VIg Bhbszf/WWtUTgXKj6Z6QeJrWUP3cNz5veNQ5AKSEMCj/JKpNzrcx6VGsVYedgNsTWcYK nsZtSqQ3ilN0u0UdZUA+8xnZaDJCDXoHItYEq4JKJimN6biU8WylR7wh647Tc/xd/4pR lbm63S5+axFOkKq0VbkGjY2L8K1qRgc5ZTdFqd1MFxGhYOxeGFimuO+NNau+NvKQLzAL IsBDaHRoKI5BttM6taSSQZVRfk6oMqm8Y/akWKy0Wdr+xZ9sSv+P5wFTltM3M14qmlTk jVbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OuzrSh9DV5NeRS6vSmPIUQn7/gIkMFfQQN91c4hi3rg=; b=hkdm125YT/1JelqNw49Kc7YaMmahmmLWBIj+X57/WhLwTan+96q3ZfzKyCDIz9sTiy bz+GEf7U14i9m84ZMdfz+wdzlHWvJz8CZh34+KKMIrves0dRJGaMLC2/8QMFdZN2Bmyk dX+7pR6V+bCIR7vP4NrvLzqEYcCALotXKiqwD4t0wGqN3tInakPrWYDpFVZRuDfHuqqw m13tSTgryEixFGb48jnGxvmiLF0NMmeFIfzv4kQ1TK0V6yYyZsBRrWmDYKYZ5mWj4Ymf LJ71FpcQ+oHcNLFqd1+uS3OIiWF2yaGMoXRNw671BGKwAj9oP35HQiHpIlFZfKWCRJMl YYgA== X-Gm-Message-State: AOAM533CPz3lsgGsLfydO0Y1jQJ+d3fTbXZnvmVrXxl2GKAmCNkguMxZ /4OS4a9OV1nwD1tvMOyJvM9vugtZKQb78px7 X-Received: by 2002:a05:6512:3157:: with SMTP id s23mr221945lfi.275.1611440355283; Sat, 23 Jan 2021 14:19:15 -0800 (PST) Received: from localhost.localdomain (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id x17sm1313956lfg.0.2021.01.23.14.19.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 14:19:14 -0800 (PST) From: Linus Walleij To: Sebastian Reichel , Lee Jones , Marcus Cooper Cc: linux-pm@vger.kernel.org, Linus Walleij Subject: [PATCH 00/10] power: supply: ab8500: refactor and isolate Date: Sat, 23 Jan 2021 23:18:58 +0100 Message-Id: <20210123221908.2993388-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The AB8500 code was merged in 2012 and hasn't seen much love in the years since that, but the code is needed by the PostmarketOS community. commit a1149ae975547142f78e96745a994cb9b0e98fd2 ("ARM: ux500: Disable Power Supply and Battery Management by default") disabled the use of the code in 2013 mentioning that "drivers are more than a little bit broken". Charging is nice. The platform is not unused. Let's begin to fix this. This patch set does a bunch of things to the AB8500 charger code: - Cleans out non-devicetree code as we are now always probing Ux500 and AB8500 from the device tree. - Breaks the ties to the MFD subsystem and pushes the charging-related headers down to power/supply/* these headers were shared in include/linux/mfd in order to support board files, and with device tree that is unnecessary. - Bind all subdrivers using the driver component model which is common in the DRM subsystem, and as a consequence we know the order the subdrivers are initialized and we can cut the code that is just there to satisfy the case where the drivers probe in different order. - Add some minor code that makes the drivers actually work (it was very close). Right now it has dependencies on the MFD tree (this series is based on thefor-mfd-next branch) due to a renaming of the cell macro so the best would be if Lee could merge it, at least partly. I am also fine if we only merge patches 1 thru 4 into MFD this merge window to isolate the charger code into drivers/power so we can continue next merge window with the rest of the code. Linus Walleij (10): power: supply: ab8500: Require device tree power: supply: ab8500: Push data to power supply code power: supply: ab8500: Push algorithm to power supply code power: supply: ab8500: Push data to power supply code power: supply: ab8500: Move to componentized binding power: supply: ab8500: Call battery population once power: supply: ab8500: Avoid NULL pointers power: supply: ab8500: Enable USB and AC power: supply: ab8500: Drop unused member power: supply: ab8500_bmdata: Use standard phandle drivers/mfd/ab8500-core.c | 17 +- drivers/power/supply/Kconfig | 2 +- .../power/supply}/ab8500-bm.h | 298 ++++++++++++- .../power/supply/ab8500-chargalg.h | 6 +- drivers/power/supply/ab8500_bmdata.c | 6 +- drivers/power/supply/ab8500_btemp.c | 162 +++---- drivers/power/supply/ab8500_charger.c | 406 ++++++++++-------- drivers/power/supply/ab8500_fg.c | 154 +++---- drivers/power/supply/abx500_chargalg.c | 129 +++--- drivers/power/supply/pm2301_charger.c | 4 +- include/linux/mfd/abx500.h | 276 ------------ 11 files changed, 720 insertions(+), 740 deletions(-) rename {include/linux/mfd/abx500 => drivers/power/supply}/ab8500-bm.h (58%) rename include/linux/mfd/abx500/ux500_chargalg.h => drivers/power/supply/ab8500-chargalg.h (93%) -- 2.29.2 Acked-by: Sebastian Reichel