From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751156AbeAVOaZ (ORCPT ); Mon, 22 Jan 2018 09:30:25 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:48085 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751070AbeAVOaX (ORCPT ); Mon, 22 Jan 2018 09:30:23 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180122143020euoutp01ebd5bc98cdea19be84e685f972c700bd~MKD3px3572739227392euoutp01C X-AuditID: cbfec7f4-f790c6d0000075d3-fc-5a65f57b72de From: Maciej Purski To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Mark Brown , Liam Girdwood , Rob Herring , Mark Rutland , Marek Szyprowski , Doug Anderson , Bartlomiej Zolnierkiewicz , Maciej Purski Subject: [PATCH v4 0/7] Add coupled regulators mechanism Date: Mon, 22 Jan 2018 15:30:05 +0100 Message-id: <1516631412-17542-1-git-send-email-m.purski@samsung.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsWy7djP87rVX1OjDHou6llsnLGe1WLqwyds FvOPnGO1OLvsIJvFtysdTBaXd81hs1jw8haLxdojd9ktll6/yGTRuvcIuwOXx5p5axg9Zjdc ZPHYOesuu8emVZ1sHn1bVjF6fN4kF8AWxWWTkpqTWZZapG+XwJUx5fFzloLZUhUXNrSzNzBe FOli5OSQEDCRuP7rNhuELSZx4d56IJuLQ0hgKaPE6yc72CGcz4wSV2/2sMB0XFtyiRkisYxR Yvb2PlYI5z+jxOq+9UxdjBwcbAJaEmva40EaRARsJN7eOMAIUsMscJxJ4vrUjUwgCWEBC4kf W58ygtgsAqoSV58sB7uDV8BF4tvaFYwQ2+Qkbp7rBNsmITCDTWL1qdWsEAkXicbVh9khbGGJ V8e3QNkyEp0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j/Kajpg9SN22QO7M1aCCy0Muv9ZGlkK ND05WZRkpKY2XeR3ZMXRf8/3CE7VKj5lyr//yodTc22WSyzTEjhwRSPvVsT0qm4lluKMREMt 5qLiRADZ1nY+IgIAAA== X-CMS-MailID: 20180122143019eucas1p213b852c98cde3fb8a77b96ab0d372ee6 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180122143019eucas1p213b852c98cde3fb8a77b96ab0d372ee6 X-RootMTR: 20180122143019eucas1p213b852c98cde3fb8a77b96ab0d372ee6 References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, this patchset adds a new mechanism to the framework - regulators' coupling. On Odroid XU3/4 and other Exynos5422 based boards there is a case, that different devices on the board are supplied by different regulators with non-fixed voltages. If one of these devices temporarily requires higher voltage, there might occur a situation that the spread between devices' voltages is so high, that there is a risk of changing 'high' and 'low' states on the interconnection between devices powered by those regulators. Algorithmicaly the problem was solved by: Inderpal Singh Doug Anderson The discussion on that subject can be found here: https://lkml.org/lkml/2014/4/29/28 Therefore this patchset is an attempt to apply the idea to regulators core as concluded in the discussion by Mark Brown and Doug Anderson. This feature is required to enable support for generic CPUfreq and devfreq drivers for the mentioned boards. Note on the locking model: When balancing voltage of a group of coupled regulators, we lock all of them for the whole operation. When voltage of an individual regulator is about to change, its suppliers are additionally locked. The current assumption is that an uncoupled regulator is a special case of a coupled one, so they should share a common voltage setting path. Best regards, Maciej Purski --- Changes in v4: - make paths for coupled and uncoupled regulators common - coupling descriptors are now always present in regulator_dev - fail to probe if data inconsistency is detected - retry to resolve coupling regultors in late init call - rebase on top of linux-next 20180119 - fix commit messages - split patches to make the patchset easier to review Changes in v3: - move dts parsing code to of_regulator.c, in order to the so, add a new commit in which of_regulator_find_by_node() is moved to of_regulator.c as well - improve error messages - move max_spread variable to constraints - perform resolving of coupled regulators under a list mutex - remove useless locking functions - some minor refactorization - improve commit messages Changes in RFC v2: - allow coupling n regulators (in fact up to constant value, now set to 10) - change algorithm to be more readable - introduce better locking - add more comments - split first patch into two - update commit messages - change sequence of the patches Maciej Purski (7): regulator: core: Move of_find_regulator_by_node() to of_regulator.c regulator: core: Refactor regulator_list_voltage() regulator: bindings: Add properties for coupled regulators regulator: core: Parse coupled regulators properties regulator: core: Resolve coupled regulators regulator: core: Add voltage balancing mechanism regulator: core: Change voltage setting path .../devicetree/bindings/regulator/regulator.txt | 5 + drivers/regulator/core.c | 416 ++++++++++++++++++--- drivers/regulator/internal.h | 15 + drivers/regulator/of_regulator.c | 163 ++++++++ include/linux/regulator/driver.h | 18 + include/linux/regulator/machine.h | 4 + 6 files changed, 575 insertions(+), 46 deletions(-) -- 2.7.4