Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751654AbcKHN3e (ORCPT ); Tue, 8 Nov 2016 08:29:34 -0500 Received: from mail-qt0-f181.google.com ([209.85.216.181]:36257 "EHLO mail-qt0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751099AbcKHN3c (ORCPT ); Tue, 8 Nov 2016 08:29:32 -0500 MIME-Version: 1.0 In-Reply-To: <5821A6D3.7010000@nvidia.com> References: <1478077742-25437-1-git-send-email-ldewangan@nvidia.com> <1478077742-25437-3-git-send-email-ldewangan@nvidia.com> <58201401.8050805@nvidia.com> <5821A6D3.7010000@nvidia.com> From: Linus Walleij Date: Tue, 8 Nov 2016 14:29:01 +0100 Message-ID: Subject: Re: [PATCH 2/2] pinctrl: tegra: Add driver to configure voltage and power of io pads To: Laxman Dewangan Cc: "thierry.reding@gmail.com" , Stephen Warren , Rob Herring , Mark Rutland , Jon Hunter , Masahiro Yamada , "linux-gpio@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-tegra@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2000 Lines: 48 On Tue, Nov 8, 2016 at 11:20 AM, Laxman Dewangan wrote: > On Tuesday 08 November 2016 03:45 PM, Linus Walleij wrote: >> If you can *actually* change the volatage, it needs to be modeled >> as a (fixed voltage?) regulator, not as a custom property for the pin >> control attributes. I guess you definiately need the regulator framework >> to accumulate and infer the different consumer requirements anyway >> in that case. > > The PMIC voltage output is changed via regulator calls. > Here, we need to have two configruations for given voltage level of > interface: > * One at IO voltage from PMIC via regulator call to change votlage of IO > rail. > * Second, configure the IO pad register to tell the IO voltage level so that > it can configured internally for that level. I understand! (I think.) But then the two things (A) changing the regulator voltage and (B) changing the pin setting need to happen at the same time do they not? Now you're just hardcoding something into these device tree properties and hoping that the regulators will somehow be set up in accordance to what you set up for the pads in the device tree, correct? To me it seems like the pins/pads should all have an <&phandle> to the regulator controlling its voltage output, in the device tree. In the Linux kernel, the driver has to regulator_[bulk_]get() this for each pin, check the voltage with regulator_get_voltage() and set up this according to the supplied voltage. The driver then ideally should subscribe to regulator voltage notifier events to change the setting if the voltage changes. I guess. But atleast the first step seems inevitable: get the voltage from a regulator. Else there is no dependency between the regulator and its consumer. So what your pins need is a regulator phandle, not a magic value to be poked into a register, hoping things will match up. I understand that this is a simple quick-and-dirty solution but it is not the right solution. Yours, Linus Walleij