linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: tony@atomide.com, lgirdwood@gmail.com, broonie@kernel.org,
	sre@kernel.org, pali.rohar@gmail.com, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] regulator: twl: Regulator mode should not depend on regulator enabled state
Date: Sun, 24 Apr 2016 20:01:34 +0300	[thread overview]
Message-ID: <571CFBEE.6050608@gmail.com> (raw)
In-Reply-To: <20160424161155.GD8880@amd>

Hi,

On 24.04.2016 19:11, Pavel Machek wrote:
> On Sat 2016-03-26 10:28:15, Ivaylo Dimitrov wrote:
>> When machine constraints are applied, regulator framework first sets
>> initial mode (if any) and then enables the regulator if needed. The current
>> code in twl4030reg_set_mode always checks if the regulator is enabled
>> before applying the mode. That results in -EACCES error returned for
>> "always-on" regulators which have "initial-mode" set in the board DTS. Fix
>> that by removing the unneeded check.
>
> Should we keep the check for the regulators that are _not_ always-on?
>

I don't think so, as there is no other way to set mode to a regulator 
but through regulator framework and board DTS (for twl4030 that is) - 
and this is done only once during boot, see 
https://lkml.org/lkml/2016/4/17/78 as well. So, no matter if the 
regulator is always-on or not, that check is redundant IMO.

Ivo



>
>> Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
>> ---
>>   drivers/regulator/twl-regulator.c | 8 --------
>>   1 file changed, 8 deletions(-)
>>
>> diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
>> index be8d05e..d8f6ad6 100644
>> --- a/drivers/regulator/twl-regulator.c
>> +++ b/drivers/regulator/twl-regulator.c
>> @@ -371,7 +371,6 @@ static int twl4030reg_set_mode(struct regulator_dev *rdev, unsigned mode)
>>   {
>>   	struct twlreg_info	*info = rdev_get_drvdata(rdev);
>>   	unsigned		message;
>> -	int			status;
>>
>>   	/* We can only set the mode through state machine commands... */
>>   	switch (mode) {
>> @@ -385,13 +384,6 @@ static int twl4030reg_set_mode(struct regulator_dev *rdev, unsigned mode)
>>   		return -EINVAL;
>>   	}
>>
>> -	/* Ensure the resource is associated with some group */
>> -	status = twlreg_grp(rdev);
>> -	if (status < 0)
>> -		return status;
>> -	if (!(status & (P3_GRP_4030 | P2_GRP_4030 | P1_GRP_4030)))
>> -		return -EACCES;
>> -
>>   	return twl4030_send_pb_msg(message);
>>   }
>>
>

      reply	other threads:[~2016-04-24 17:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-26  8:28 [PATCH 0/3] regulator: twl: Fix regulator mode support Ivaylo Dimitrov
2016-03-26  8:28 ` [PATCH 1/3] regulator: twl: Make sure we have access to powerbus before trying to write to it Ivaylo Dimitrov
2016-04-05 22:26   ` Ivaylo Dimitrov
2016-04-06  6:06     ` [PATCH] regulator: twl: Fix a typo in twl4030_send_pb_msg Ivaylo Dimitrov
2016-04-24 16:10   ` [PATCH 1/3] regulator: twl: Make sure we have access to powerbus before trying to write to it Pavel Machek
2016-04-24 17:14     ` Ivaylo Dimitrov
2016-03-26  8:28 ` [PATCH 2/3] regulator: twl: Provide of_map_mode for twl4030 Ivaylo Dimitrov
2016-03-28  9:39   ` Mark Brown
     [not found]     ` <20160328093938.GA2350-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-04-04 18:57       ` [PATCH] " Ivaylo Dimitrov
2016-04-04 22:26         ` Mark Brown
2016-04-05  5:59           ` [PATCH v1] " Ivaylo Dimitrov
2016-04-07 17:57             ` Rob Herring
2016-04-08 15:49               ` Tony Lindgren
     [not found]                 ` <20160408154907.GT16484-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-04-08 16:08                   ` Sebastian Reichel
2016-04-08 16:19                     ` Tony Lindgren
     [not found]                       ` <20160408161923.GW16484-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-04-08 17:54                         ` Tony Lindgren
2016-03-26  8:28 ` [PATCH 3/3] regulator: twl: Regulator mode should not depend on regulator enabled state Ivaylo Dimitrov
2016-04-24 16:11   ` Pavel Machek
2016-04-24 17:01     ` Ivaylo Dimitrov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=571CFBEE.6050608@gmail.com \
    --to=ivo.g.dimitrov.75@gmail.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=sre@kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).