public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb•auug.org.au>
To: Thierry Reding <thierry.reding@gmail•com>,
	Mark Brown <broonie@kernel•org>,
	Liam Girdwood <lgirdwood@gmail•com>
Cc: linux-next@vger•kernel.org, linux-kernel@vger•kernel.org,
	Boris Brezillon <boris.brezillon@free-electrons•com>,
	Laxman Dewangan <ldewangan@nvidia•com>
Subject: linux-next: manual merge of the pwm tree with the regulator tree
Date: Tue, 3 May 2016 18:25:09 +1000	[thread overview]
Message-ID: <20160503182509.42658c4f@canb.auug.org.au> (raw)

Hi Thierry,

Today's linux-next merge of the pwm tree got a conflict in:

  drivers/regulator/pwm-regulator.c

between commit:

  fd786fb0276a ("regulator: pwm: Try to avoid voltage error in duty cycle calculation")

from the regulator tree and commit:

  f137b90ba6cd ("regulator: pwm: Use pwm_get_args() where appropriate")

from the pwm tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/regulator/pwm-regulator.c
index 8e928f23279b,ffdb895ace0a..000000000000
--- a/drivers/regulator/pwm-regulator.c
+++ b/drivers/regulator/pwm-regulator.c
@@@ -63,14 -63,14 +63,14 @@@ static int pwm_regulator_set_voltage_se
  	int dutycycle;
  	int ret;
  
- 	pwm_reg_period = pwm_get_period(drvdata->pwm);
+ 	pwm_get_args(drvdata->pwm, &pargs);
  
- 	dutycycle = (pwm_reg_period *
+ 	dutycycle = (pargs.period *
  		    drvdata->duty_cycle_table[selector].dutycycle) / 100;
  
- 	ret = pwm_config(drvdata->pwm, dutycycle, pwm_reg_period);
+ 	ret = pwm_config(drvdata->pwm, dutycycle, pargs.period);
  	if (ret) {
 -		dev_err(&rdev->dev, "Failed to configure PWM\n");
 +		dev_err(&rdev->dev, "Failed to configure PWM: %d\n", ret);
  		return ret;
  	}
  
@@@ -126,35 -138,17 +126,36 @@@ static int pwm_regulator_set_voltage(st
  {
  	struct pwm_regulator_data *drvdata = rdev_get_drvdata(rdev);
  	unsigned int ramp_delay = rdev->constraints->ramp_delay;
- 	unsigned int period = pwm_get_period(drvdata->pwm);
+ 	struct pwm_args pargs;
 -	int duty_cycle;
 +	unsigned int req_diff = min_uV - rdev->constraints->min_uV;
 +	unsigned int diff;
 +	unsigned int duty_pulse;
 +	u64 req_period;
 +	u32 rem;
  	int ret;
  
+ 	pwm_get_args(drvdata->pwm, &pargs);
 -	duty_cycle = pwm_voltage_to_duty_cycle_percentage(rdev, min_uV);
 +	diff = rdev->constraints->max_uV - rdev->constraints->min_uV;
 +
 +	/* First try to find out if we get the iduty cycle time which is
 +	 * factor of PWM period time. If (request_diff_to_min * pwm_period)
 +	 * is perfect divided by voltage_range_diff then it is possible to
 +	 * get duty cycle time which is factor of PWM period. This will help
 +	 * to get output voltage nearer to requested value as there is no
 +	 * calculation loss.
 +	 */
- 	req_period = req_diff * period;
++	req_period = req_diff * pargs.period;
 +	div_u64_rem(req_period, diff, &rem);
 +	if (!rem) {
 +		do_div(req_period, diff);
 +		duty_pulse = (unsigned int)req_period;
 +	} else {
- 		duty_pulse = (period / 100) * ((req_diff * 100) / diff);
++		duty_pulse = (pargs.period / 100) * ((req_diff * 100) / diff);
 +	}
  
- 	ret = pwm_config(drvdata->pwm, duty_pulse, period);
 -	ret = pwm_config(drvdata->pwm, (pargs.period / 100) * duty_cycle,
 -			 pargs.period);
++	ret = pwm_config(drvdata->pwm, duty_pulse, pargs.period);
  	if (ret) {
 -		dev_err(&rdev->dev, "Failed to configure PWM\n");
 +		dev_err(&rdev->dev, "Failed to configure PWM: %d\n", ret);
  		return ret;
  	}
  
@@@ -284,11 -279,16 +285,17 @@@ static int pwm_regulator_probe(struct p
  
  	drvdata->pwm = devm_pwm_get(&pdev->dev, NULL);
  	if (IS_ERR(drvdata->pwm)) {
 -		dev_err(&pdev->dev, "Failed to get PWM\n");
 -		return PTR_ERR(drvdata->pwm);
 +		ret = PTR_ERR(drvdata->pwm);
 +		dev_err(&pdev->dev, "Failed to get PWM: %d\n", ret);
 +		return ret;
  	}
  
+ 	/*
+ 	 * FIXME: pwm_apply_args() should be removed when switching to the
+ 	 * atomic PWM API.
+ 	 */
+ 	pwm_apply_args(drvdata->pwm);
+ 
  	regulator = devm_regulator_register(&pdev->dev,
  					    &drvdata->desc, &config);
  	if (IS_ERR(regulator)) {

             reply	other threads:[~2016-05-03  8:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-03  8:25 Stephen Rothwell [this message]
2016-05-03 11:03 ` linux-next: manual merge of the pwm tree with the regulator tree Mark Brown
2016-05-03 12:18   ` Thierry Reding
  -- strict thread matches above, loose matches on Subject: below --
2016-07-11  6:56 Stephen Rothwell
2016-07-11 16:47 ` Doug Anderson
2016-07-11 21:30   ` Thierry Reding
2016-07-11 21:39     ` Thierry Reding
2016-07-25  8:29       ` Thierry Reding
2016-07-25 13:29         ` Doug Anderson
2016-07-25 14:26           ` Thierry Reding

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=20160503182509.42658c4f@canb.auug.org.au \
    --to=sfr@canb$(echo .)auug.org.au \
    --cc=boris.brezillon@free-electrons$(echo .)com \
    --cc=broonie@kernel$(echo .)org \
    --cc=ldewangan@nvidia$(echo .)com \
    --cc=lgirdwood@gmail$(echo .)com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=thierry.reding@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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