From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751218AbeCIMWj (ORCPT ); Fri, 9 Mar 2018 07:22:39 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46435 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750898AbeCIMWg (ORCPT ); Fri, 9 Mar 2018 07:22:36 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180309122233euoutp0150c8d91ae38a26221a72ebad9eb258e9~aP-bcSWU41639716397euoutp01_ X-AuditID: cbfec7f2-1c1ff70000011644-b0-5aa27c8842f2 From: Maciej Purski To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Mark Brown , Fabio Estevam , Tony Lindgren , Liam Girdwood , Rob Herring , Mark Rutland , Marek Szyprowski , Doug Anderson , Bartlomiej Zolnierkiewicz , Maciej Purski Subject: [PATCH v6 0/5] Add coupled regulators mechanism Date: Fri, 09 Mar 2018 13:22:02 +0100 Message-id: <1520598128-11768-1-git-send-email-m.purski@samsung.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAAzWRfUgTcRjH++1edg4Xxyn58yWhVRRWphB2oIwM/ziMqKAIF2WXHs5yU++c qVlYsZwzTKalmPgGioz52pqmSDZkkuJgOrEsSynEXgWXw7Qy5+l/n4fv53mBh0CoYTSESNfm cLyWzVDgMtTm+O08YihsUkX1TwXTXdUdGP147jNO1w85MXqs5RVOz02eob1ug4Se6KvF6YYv 0yjdNjQjpZunXBJaPzAkpV+6E0/4M5Y6C2C8yyaUeVrkQpkXNTNSpttcgjNlVjNgPN3hZ6Uq WVwql5Gey/FHlVdl6l+dCVn3d+c91DulReD7LiPwIyB5DK7VORAjkBEU2QrggsGGiYUHwErr HLZtrVS8xsWgBcBGr14qFusA/unskBgBQeBkBLQUJ/saAsk4+OPNIPA5CPkIgRX39K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7p2iWjHxxncFmvxNxrf3rzlAvFH1sdmd/l21l71WxUVTSJi2GT2SPaIfTgqYIs Wxb/jVqDI0t2pKV6mCvwLjzs2sXSrGUrIi+4r7+wbe7uu3k10WdUW1/Xsv0tzle9Z35XiaU4 I9FQi7moOBEAwYRTFSICAAA= X-CMS-MailID: 20180309122231eucas1p1b8e0a85a73b31aa07eac08f809face6e X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180309122231eucas1p1b8e0a85a73b31aa07eac08f809face6e X-RootMTR: 20180309122231eucas1p1b8e0a85a73b31aa07eac08f809face6e 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. 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. The previous version caused locking problems on some boards. The discussion can be found here: https://lkml.org/lkml/2018/3/5/965 Current idea, which should solve the locking issues is making it possible to try to lock a mutex multiple times by a single task just like it is done in clk/clk.c. This should handle all possible coupling-supply combinations except coupling with a supply. I would like to kindly ask Fabio Estevam and Tony Lindgren to test the patch series on their boards. Best regards, Maciej Purski --- Changes in v6: - change locking model - fix build errors on non-of architectures - update bindings Changes in v5: - rebase against current Mark Brown's regulators next 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 (6): regulator: core: Make locks re-entrant 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 | 549 ++++++++++++++++++--- drivers/regulator/internal.h | 28 +- drivers/regulator/of_regulator.c | 151 ++++++ include/linux/regulator/driver.h | 20 + include/linux/regulator/machine.h | 4 + 6 files changed, 677 insertions(+), 80 deletions(-) -- 2.7.4