Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1638453

Re: [PATCH] regulator: max8997/8966: fix charger cv voltage set bug

From Chanwoo Choi <cw00.choi@samsung.com>
Newsgroups linux.kernel
Subject Re: [PATCH] regulator: max8997/8966: fix charger cv voltage set bug
Date 2017-05-10 01:40 +0200
Message-ID <tFmTv-dy-13@gated-at.bofh.it> (permalink)
References <tEJIt-83h-3@gated-at.bofh.it> <tEJIt-83h-5@gated-at.bofh.it> <tEJIt-83h-1@gated-at.bofh.it>
Organization Samsung Electronics

Show all headers | View raw


Hi,

On 2017년 05월 08일 14:45, MyungJoo Ham wrote:
> 
> When min charger-CV is <= 4.0V and max charger-CV is >= 4.0V,
> we can use 4.00V as CV (register value = 0x1).`
> 
> The original code had a typo that wrote ">=" (max_uV >= 4000000),
> which should've been "<", which is not necessary anyway
> as mentioned by Dan Carpenter.
> 
> Reported-By: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
> ---
>  drivers/regulator/max8997-regulator.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/regulator/max8997-regulator.c b/drivers/regulator/max8997-regulator.c
> index efabc0e..559b9ac 100644
> --- a/drivers/regulator/max8997-regulator.c
> +++ b/drivers/regulator/max8997-regulator.c
> @@ -428,12 +428,9 @@ static int max8997_set_voltage_charger_cv(struct regulator_dev *rdev,
>  	if (max_uV < 4000000 || min_uV > 4350000)
>  		return -EINVAL;
>  
> -	if (min_uV <= 4000000) {
> -		if (max_uV >= 4000000)
> -			return -EINVAL;
> -		else
> -			val = 0x1;
> -	} else if (min_uV <= 4200000 && max_uV >= 4200000)
> +	if (min_uV <= 4000000)
> +		val = 0x1;
> +	else if (min_uV <= 4200000 && max_uV >= 4200000)
>  		val = 0x0;
>  	else {
>  		lb = (min_uV - 4000001) / 20000 + 2;
> 

Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] regulator: max8997/8966: fix charger cv voltage set bug MyungJoo Ham <myungjoo.ham@samsung.com> - 2017-05-08 07:50 +0200
  Re: [PATCH] regulator: max8997/8966: fix charger cv voltage set bug Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> - 2017-05-08 11:20 +0200
  Re: [PATCH] regulator: max8997/8966: fix charger cv voltage set bug Chanwoo Choi <cw00.choi@samsung.com> - 2017-05-10 01:40 +0200

csiph-web