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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E2D66EB64DA for ; Thu, 20 Jul 2023 12:38:16 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A7E12867B7; Thu, 20 Jul 2023 14:38:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YttmLnQr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 83017867C6; Thu, 20 Jul 2023 14:38:13 +0200 (CEST) Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 36755867B0 for ; Thu, 20 Jul 2023 14:38:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=clamor95@gmail.com Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4fba1288bbdso1164888e87.1 for ; Thu, 20 Jul 2023 05:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689856690; x=1690461490; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=lrrz0d5RxzUIsxuaCwltwlvw/gjUD5Ldtj+D9gKLfFw=; b=YttmLnQr6VwkDXoJsQGbyj35USbVqUTmFLWEAGt8yhzIe8nCpymadQsstPxpAfbrsd ZVqOz8r2RAMCt92lQOirLZsGKeHjGy4gbc1vH3puPR/o3rK5Xkt6ypeNPI9KTzUp72fr Yz+/Xltd86YgE0A+E36CmSfcGE4JX/FYXscAtzKb3z13sPbfwAStBThtsnrccqoSukTF 9dAESc6tLU/zdkQQZYF3geKAmRHxW/xXKIwuJo4vqjAkHLYxWf65eDuHwp1yIgsp2A8U Mzfq0JoZEpZ+8GsqKSeZtlbXgtDGoqL77c9tSVv+p0GSEtd1CpUXasY6/iFTrFbeEnvD K2+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689856690; x=1690461490; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lrrz0d5RxzUIsxuaCwltwlvw/gjUD5Ldtj+D9gKLfFw=; b=KrKs334ldBPfwcGBxlBbkFt5ldaL+4IiC0NMwzmyoHJI8NJ9gk0KDg+HVQqhCpoS/B XyQByDSQq+opnCGEVey+BjnQi2Jk85nq15dG3nppWvZcQNsKdinEF41LFR8Sff5H6JYS RygnKdXrg65L7kv+W077/DyqJdL7mL/k0BwOT0GM5wiw0yISV3RGxO3ygNOceorcsI67 Tu5lZfjQxVP3hbM11uaHExiZNTPBhZ+PoV6EWW7vm5LSL356NpntmavWdZ32eOG5+Cfe FLc+IBqv3hpOEdTKgxVgvr9ratSzsmx9qVVlbWHrLXqW0QqYZ/bxNj03KQ9V3DRnwdaX tKzw== X-Gm-Message-State: ABy/qLZem6Nc6je3WG72RVQkiHm1g7wZH6Nz3/tmuQQ59vo/hJ2mRan2 F9m0s5AikJsqW6r7sagmoYw= X-Google-Smtp-Source: APBJJlGaPxZtjACjzezA5zprsZbVZFjzxshZ/WIBA6QPtp2cZuN6MW/mCHypaZiLg5U+patD2sVvpw== X-Received: by 2002:a05:6512:e85:b0:4fb:8f79:631 with SMTP id bi5-20020a0565120e8500b004fb8f790631mr2261103lfb.46.1689856690095; Thu, 20 Jul 2023 05:38:10 -0700 (PDT) Received: from xeon.. ([188.163.112.64]) by smtp.gmail.com with ESMTPSA id m25-20020ac24ad9000000b004fb9c625b4asm184401lfp.210.2023.07.20.05.38.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 05:38:09 -0700 (PDT) From: Svyatoslav Ryhel To: Simon Glass , Philipp Tomsich , Kever Yang , Neil Armstrong , Marek Vasut , Patrick Delaunay , Patrice Chotard , Jagan Teki , Matteo Lisi , Jaehoon Chung , Anatolij Gustschin , Jonas Karlman , Quentin Schulz , Svyatoslav Ryhel , Eugen Hristev Cc: u-boot@lists.denx.de, u-boot-amlogic@groups.io, u-boot@dh-electronics.com, uboot-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 0/7] General regulator and pmic uclass improvements Date: Thu, 20 Jul 2023 15:37:37 +0300 Message-Id: <20230720123744.26854-1-clamor95@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This patchset derives from discussion of TPS65913 bringup and aims to cycle all regulator management inside uclass removing need of any board calls for regulators. My hw setup is Tegra 3 LG Optimus Vu P895 (PMIC is MAX77663) with native spl u-boot build. power: regulator: expand basic reference counter onto all uclass Commit is basically expansion of 4fcba5d ("regulator: implement basic reference counter") onto all regulators. - my testing on hw has shown no issues so far with both pmic regulators and fixed regulators. Counting works as expected, dm test is set in test of regulator_set_enable_if_allowed. power: regulator-uclass: perform regulator setup inside uclass All self-sufficient regulators are set to probe after bind to perform initial setup later in post-probe with pdata from device tree. - self-sufficient regulator is one that is not dependent on any other device (this category does not include pmic regulators for example). I have tested fixed regulators and got correct probing and setup according to device tree. DM test is set by checking regulators data without pre-configuring them manually power: pmic-uclass: probe every child on pmic_post_probe All non self-sufficient regulators must be probed after main device is probed (in this case it is pmic_post_probe). In all other aspects pmic regulators behave same. - tested with MAX77663 ldo and sd regulators, no errors or inconsistencies were tracked, regulator props (boot-on, always-on etc) and consumer calls work as expected. DM test is set by checking regulators data without pre- configuring them manually just after pmic probe. power: regulator-uclass: remove all deprecated API use This is where everything gets tricky. All board dedicated API of regulators has to be removed. System presented above should cover all regulators setup but non the less this should be disscussed with maintainers and tested on affected boards. This commit removes and cleans most of those API traces. --- Changes from v1: - adapted description of regulator_set_enable - remove uc_pdata->enable_count from post_probe - added tests from counter and regulators post_probe --- Svyatoslav Ryhel (7): power: regulator: expand basic reference counter onto all uclass test: dm: regulator: test counter in set_enable_if_allowed test power: regulator-uclass: perform regulator setup inside uclass test: dm: regulator: provide test of auto setup power: pmic-uclass: probe every child on pmic_post_probe test: dm: pmic: provide test of child autosetup power: regulator-uclass: remove all deprecated API use arch/arm/mach-rockchip/board.c | 8 - arch/arm/mach-rockchip/rk3399/rk3399.c | 10 - board/Marvell/octeontx2_cn913x/board.c | 5 - .../amlogic/odroid-go-ultra/odroid-go-ultra.c | 2 - board/dhelectronics/dh_stm32mp1/board.c | 2 - board/engicam/stm32mp1/stm32mp1.c | 3 - board/google/veyron/veyron.c | 6 - board/samsung/common/exynos5-dt.c | 4 - board/samsung/odroid/odroid.c | 10 - board/st/stm32mp1/stm32mp1.c | 9 - drivers/power/pmic/pmic-uclass.c | 10 + drivers/power/regulator/regulator-uclass.c | 253 +++++++----------- drivers/power/regulator/regulator_common.c | 22 -- drivers/power/regulator/regulator_common.h | 21 -- drivers/video/bridge/ps862x.c | 12 +- drivers/video/rockchip/rk_vop.c | 6 +- include/power/regulator.h | 121 +-------- include/power/sandbox_pmic.h | 2 +- test/dm/pmic.c | 34 +++ test/dm/regulator.c | 148 +++------- 20 files changed, 204 insertions(+), 484 deletions(-) -- 2.39.2