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 A0B79C0015E for ; Sun, 16 Jul 2023 13:04:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 750D486290; Sun, 16 Jul 2023 15:04:12 +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="U6OnwHjq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4DE1B862AE; Sun, 16 Jul 2023 15:04:11 +0200 (CEST) Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) (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 02C5F8628F for ; Sun, 16 Jul 2023 15:04:09 +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-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3fbc6ab5ff5so31692875e9.1 for ; Sun, 16 Jul 2023 06:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689512648; x=1692104648; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=XK5hR/y+kyXwvjNlzg52dIu6WKHo2QhK15ouyBMF4MQ=; b=U6OnwHjq1irQFG88FG1mUQ+ikX+MVPApFtERwSFvjon9xrByGzRsDZ4RHqDjmO06k6 yHn1VL3U0nVZYwjOFxtrCKZ0ceDl/F+9pCp0w4Y2lseISowPU1V3ZsolmTDef4EEFf/l I+vljaUlqGRTBaVMtibaz+dk1s4/B521p6wn8GrRhuLAMlgzjLDv0iS0B0UnVpexs1Ty Y8LXjVnVSyfFnvVKxUhcdSU1uFAzqArFYTESf1bmKm/+oHGwq3x2kmNQMfLX5UE3QAIT gHb9Bi4OzqHk0stzdRK0s5OEP5/3Et3DH0pCso+XC+hccWWElEOommXkoItgfQqVY7NI wvrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689512648; x=1692104648; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=XK5hR/y+kyXwvjNlzg52dIu6WKHo2QhK15ouyBMF4MQ=; b=QA2ECMB33x3mQg8c5rm6qfLfUEDCEzS39uBGuRIVDBkJSCvX7Dk4+QYKWuoRFg2B3q BgCpekqNuwtmHSIUb58zTxlcIylRJolPRUAYuHqJA4l40dz0bfRKbQAxyFyI4iJ3aeJ8 2QUKupNnd5ttNJxaZrYmOXMEZsKIjtAdRS/GXQLjILvjH0v1995xI/KHNU+/BOcJZeP8 BT7XRJz45IODIXBOqWU16qL5ZNzO35FJg1TjWv6L5LO0Y3C6kcfBNRk3LH0RSGmIrhk+ DEAs24ox9VeEvTzJRUGyiQ4ZwyXDblUL5ySdelJB9vw5VkwYbob68gI3zqBgKF0/oLU3 dB+Q== X-Gm-Message-State: ABy/qLaNYuRxTu+deoq/alC6j46knBq4amux+LJigdnoxcfpJ1nBw8EK xBdvkwQDMvMM28g3duBT5A8= X-Google-Smtp-Source: APBJJlGqB/AhsyJklUckbvNzNwFfbfNKO1XSfZJpVgWF4CgqiCPbfI+maiNvB+R+vfSrUNFiYp9GDg== X-Received: by 2002:a7b:cc87:0:b0:3fb:b6f3:e528 with SMTP id p7-20020a7bcc87000000b003fbb6f3e528mr7416864wma.25.1689512648124; Sun, 16 Jul 2023 06:04:08 -0700 (PDT) Received: from [127.0.0.1] ([46.211.161.50]) by smtp.gmail.com with ESMTPSA id 5-20020a05600c028500b003fbcdba1a52sm5637756wmk.3.2023.07.16.06.04.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 16 Jul 2023 06:04:06 -0700 (PDT) Date: Sun, 16 Jul 2023 16:03:59 +0300 From: Svyatoslav Ryhel To: Jonas Karlman , Jaehoon Chung , Simon Glass , Patrick Delaunay CC: u-boot@lists.denx.de Subject: Re: [PATCH v2 0/2] power: pmic: add TPS65913 support User-Agent: K-9 Mail for Android In-Reply-To: <3c61cae7-3289-0b9d-2978-75a81dcc4ac5@kwiboo.se> References: <20230715183431.5318-1-clamor95@gmail.com> <038FC205-10C0-40B7-A72C-05830AD9B7D1@gmail.com> <3c61cae7-3289-0b9d-2978-75a81dcc4ac5@kwiboo.se> Message-ID: <21076140-B346-43DB-855D-2C82724B5EEE@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 16 =D0=BB=D0=B8=D0=BF=D0=BD=D1=8F 2023 =D1=80=2E 11:07:15 GMT+03:00, Jonas= Karlman =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=B2(-= =D0=BB=D0=B0): >On 2023-07-16 05:57, Svyatoslav Ryhel wrote: >>=20 >>=20 >> 16 =D0=BB=D0=B8=D0=BF=D0=BD=D1=8F 2023 =D1=80=2E 02:37:39 GMT+03:00, Jo= nas Karlman =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=B2(= -=D0=BB=D0=B0): >>> On 2023-07-15 20:34, Svyatoslav Ryhel wrote: >>>> Existing PALMAS PMIC driver is fully compatible with TI TPS65913 >>>> PMIC found in many Tegra 4 devices, like Tegra Note 7 and ASUS >>>> TF701T=2E Add TPS65913 dts compatible with TPS659038 data=2E >>>> >>>> Issue with regulators is more general then I though initially=2E >>>> It touches all pmic regulators=2E >>>> >>>> Currently device tree entries of regulators are completely >>>> ignored and regulators are probed only if they are called >>>> by the device which uses it=2E This results into two issues: >>>> regulators which must run under boot-on or always-on mode >>>> are ignored and not enabled; dts props like voltage are >>>> not applied to the regulator so the regulator may be enabled >>>> with random actual voltage, which may have unexpected >>>> consequences=2E >>> >>> This sounds like something a call to regulators_enable_boot_on like is >>> done on other platforms/boards could solve? >>=20 >> Yes, regulators_enable_boot_on can solve this if called from the board,= but why should every device call this from the board if this should be don= e automatically? What should do devices without board? Isn't u-boot moving = towards all in device tree setup? > >Main diff is that regulators_enable_boot_on covers all regulators, >including fixed/gpio/pwm regulators, not just regulators that are >children of a pmic=2E Meaning platforms/boards would still need to someho= w >autoset non-pmic regulators=2E This is a good point=2E Non pmic regulators are not probed/set=2E >Maybe regulators_enable_boot_on could be called from the default >power_init_board or similar, when a Kconfig is enabled, to cover more >platforms/boards=2E Since u-boot is moving towards device trees this should be undesireable ap= proach=2E What is possible is to set all non pmic regulators to probe on po= st bind and on post probe call regulator_autoset=2E >Regards, >Jonas > >>=20 >> Best regards, >> Svyatoslav R=2E >>=20 >>> Regards, >>> Jonas >>> >>>> >>>> Second patch changes this behavior=2E Post-probe function is >>>> introduced which performs probing of each pmics child and if >>>> it is a regulator, regulator_autoset function is called, which >>>> handles always-on and boot-on regulators, but if none of those >>>> props are set, the regulator is disabled=2E >>>> >>>> Later disabled regulators can be re-enabled by devices which >>>> use them without issues=2E >>>> >>>> I have tested this change on multiple devices with different >>>> PMICs (LG P895, max77663; TF300T with TPS65911; HTC One X with >>>> TPS80031; Tegratab with TPS65913)=2E Without this patch they behave >>>> as described in the third paragraph=2E With patch behavior is correct= =2E >>>> >>>> --- >>>> Changes from v1: >>>> - implemented general fix of regulator behavior, which include: >>>> - introduction of post-probe into pmic-uclass driver >>>> - probing all pmic childs in post-probe >>>> - check if device is regulator > autoset if regulator is >>>> boot-on or always-on else disable regulator >>>> ---=20 >>>> >>>> Svyatoslav Ryhel (2): >>>> power: pmic: support TI TPS65913 PMIC >>>> power: pmic: fix regulators behaviour >>>> >>>> drivers/power/pmic/palmas=2Ec | 1 + >>>> drivers/power/pmic/pmic-uclass=2Ec | 18 ++++++++++++++++++ >>>> 2 files changed, 19 insertions(+) >>>> >>> >