Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp163314ybg; Mon, 8 Jun 2020 19:39:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8rKAMdH+h9ds2PwIcYG5OO/Ap6wWQY0UHEvIrHZiYMTgk9+bCCQNyIE7nbfd4CPxOIGcY X-Received: by 2002:a05:6402:1153:: with SMTP id g19mr15420668edw.127.1591670397828; Mon, 08 Jun 2020 19:39:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591670397; cv=none; d=google.com; s=arc-20160816; b=g8irA/eEjwwPmmv7iCZNp/ZBu/mcqiVKJUXKYcggGcPElduF/sSB4ZdFvyWeFrzSq8 iYYREDKUmD+OrgGqY4th/XzolPst4RN5ADA1K9QsM4H7ODjSfjijnehRNZGWxwrEMCIP GUh7sqryTt3L4LSEUh9SmooxI4cWCYzyWRb8LGBi2uD4Gn97I/LHBNCUEReIu7W+RkAP M1UXmdgzU58jVa+/YSLHhc7N1ag5rUlN5/iCuRWuyLK1dyMq9J2s3Q2Zar4F3bjvx5Uh HO/2RjtFCdzONvwJLdXnS6+7pNylx0SV6Kv3hte77lcNC9A24ZdsaqYTUH4+vdDdLUX1 dVQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=gIREOCncp+kCLejh9A1JytrjVRseDJ9dDmzpsV7xNws=; b=IwgjItDw8zBHG24q0rA5xlfsM2zZF7No66zpvGZ0pf4QvhUTtowjbz5O2btPO1eyC4 eEkqbrxiOQvquLBmFGbbHseYZor3NXtigv2XaHJn48sH1L4hchJnhZcFUi3ozitj44HU fI3lesyXm6ini/vA9z6JTGZ0TK5zuFHMPWw45wL1yQDbHY75jOncrRkO96snGr2cGh3T tp7wwChK3J1WGhlI59plWYEnuXcWdkECRQwfuw7bIPXQZATDfvk4DCJx/89ff9HXj2aM GmaCtHqQ4TkOHVPWyixDgXeJpfoDJXVMbXYlF2ZKm2NesVYNMVie+QiA/CPEsf15W/79 vnlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=I9F+MzX3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y20si10078838ejf.393.2020.06.08.19.39.35; Mon, 08 Jun 2020 19:39:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@google.com header.s=20161025 header.b=I9F+MzX3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726943AbgFIChp (ORCPT + 99 others); Mon, 8 Jun 2020 22:37:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726909AbgFICho (ORCPT ); Mon, 8 Jun 2020 22:37:44 -0400 Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 136D8C03E97C for ; Mon, 8 Jun 2020 19:37:43 -0700 (PDT) Received: by mail-ot1-x342.google.com with SMTP id g5so15414626otg.6 for ; Mon, 08 Jun 2020 19:37:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gIREOCncp+kCLejh9A1JytrjVRseDJ9dDmzpsV7xNws=; b=I9F+MzX3keiz7H+vq67DtBb3j76mL76MQZ+r9HgbdfDur2wVNf7HxaK0JjLFewpHIl JEhC5yhS5eeZK9YbS3L3jGKgKUclvO6bqli/E4ozAVwZVdJgis0MsPi2Hgadsfexdkyc GQTSjl2rMRA+2wxu7vGskuJxaXnulBsJwF/CHu4/mdeUno+caXYvieZFZA1/QyVtcSTt ba+bxnnpUhC9mBSo7ZJyb9pprv1xeGOatgMlVbhKrztR3z14T4p1ND3KzH1BDo0e0g2K M1AheK59avMkAVhIcd1aAvO6N3Spb+jYpTbN1OYYTIMGLhhtvRmDgj209cPg9F7OO+9B IZZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gIREOCncp+kCLejh9A1JytrjVRseDJ9dDmzpsV7xNws=; b=UNdKJviOqAMNZC3GdkM9kJf09n2jLXoI164Nn4opDKjhd4tBSfjFxB+siyuCqlXQeW ZLRfbUJIr+Zvf5UZVCBw3MQBvd7YTop+DKY5ybN0qtDNKY7Kxu3cXlT3S6ZaUc9cBOSW mwixSgcCkuGuCd9qNjUMzmVJUz1GnLUPc5/yARbZg680XAnPaLZoacaP9DIZmO1hlSq/ tvYw6oizT3kvqHaEGAK480jF3vV7nNcNYjD5bXU542rKyPDhbzBX7z3DkBRX5CeTMW8G PO2+RcpKS5mBkx9hxRmMeUDWnYuT5IVO33y+AEzZXsFryUMqzM+N1dSs3hYto3+tAaLd KX3g== X-Gm-Message-State: AOAM5327wMVmvS1wyM2XtfXf+GECWSHHC4dLOutuQEoK+tI7urJUPiPW E6oiVZp/k87Ru8mR3qleHTvjwHWUOByCgpVmgriLWQ== X-Received: by 2002:a9d:6048:: with SMTP id v8mr14796461otj.231.1591670262910; Mon, 08 Jun 2020 19:37:42 -0700 (PDT) MIME-Version: 1.0 References: <20200605063724.9030-1-m.szyprowski@samsung.com> <20200605102018.GA5413@sirena.org.uk> <2f0e021d-387a-4693-882d-aba66e20dd2b@samsung.com> <20200605155903.GI5413@sirena.org.uk> In-Reply-To: <20200605155903.GI5413@sirena.org.uk> From: Saravana Kannan Date: Mon, 8 Jun 2020 19:37:07 -0700 Message-ID: Subject: Re: [PATCH] regulator: do not balance 'boot-on' coupled regulators without constraints To: Mark Brown Cc: Marek Szyprowski , LKML , Linux PM , Dmitry Osipenko , Liam Girdwood , Lucas Stach , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Viresh Kumar , peron.clem@gmail.com, Nishanth Menon , Stephen Boyd , Vincent Guittot , Rafael Wysocki , Linux Samsung SOC , Chanwoo Choi , Greg Kroah-Hartman , Android Kernel Team Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 5, 2020 at 8:59 AM Mark Brown wrote: > > On Fri, Jun 05, 2020 at 03:37:32PM +0200, Marek Szyprowski wrote: > > On 05.06.2020 12:20, Mark Brown wrote: > > > > No, this is not what boot-on means at all. It is there for cases where > > > we can't read the enable status from the hardware. Trying to infer > > > *anything* about the runtime behaviour from it being present or absent > > > is very badly broken. > > > Okay, what about the 'always-on' property? I don't think that we need > > another property for annotating this behavior, as in my opinion this is > > No, that's just as disconnected from the need - we may as well do it > based on the regulator name being an odd number of characters. > > > just an implementation issue on the Linux kernel and regulator > > framework. Alternatively I can drop the property check, but then it > > won't be possible to have a regulator without a consumer, which follows > > the other one (although we still don't have a real use case for it). > > > If you don't like this idea at all, I will try to move this logic to the > > custom coupler again, although it would mean some code copying. > > I think that's better TBH. > > > > Saravana (CCed) was working on some patches which tried to deal with > > > some stuff around this for enables using the sync_state() callback. > > > Unfortunately there's quite a few problems with the current approach > > > (the biggest one from my point of view being that it's implemented so > > > that it requires every single consumer of every device on the PMIC to > > > come up but there's others at more of an implementation level). > > > I'm not sure if we really need such complex solution for this... > > So I think that the specific approach there is overly heavyweight and > restrictive but I do see the general use case here for something per > regulator providing we can avoid breaking anything that does actually > need to change the regulator state (eg, raising the voltage for > cpufreq). The changes I propose won't prevent anything from asking for more power/energy (will always allow turning on stuff, increasing voltage, increasing current, etc). It'll only prevent reducing power lower than what was provided when the bootloader left stuff on. This shouldn't break most boards -- because any other consumer could be setting similar limits and things don't break then. But even if that's a concern, we can still default to a timeout behavior and then give folks the choice of disabling the timeout if they know all their devices will probe. Btw, the patch series I sent fixes a lot of subtle use cases even with the timeout enabled. For example, in one hardware platform, a LDO is shared between camera, display, UFS and USB. The camera driver would probe first, enable the regulator, poll its HW and then disable the regulator. This causes the regulator to be disabled before display, UFS, and USB could probe and this caused hardware faults for those. > Previously to the past week I'd only really heard about it > causing problems in the context of displays left on by the bootloader > glitching during boot but this is a concrete Ah, finally! I have examples of pretty much the same issue in some downstream kernels -- the CPU and memory shares rails with other hardware blocks and things fail if this isn't taken care of. Glad that someone else found an example for me in the upstream kernel. > use case and we already > have the infrastructure to track dependencies at the device model level > if we use it well. I'll send out a v3 series in a couple of days to address Mark's earlier comments and also add the voltage support to address Marek's case. We can take it from there. -Saravana