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


Groups > linux.kernel > #1370200 > unrolled thread

Re: [PATCH] regulator: pwm: Try to avoid voltage error in duty cycle calculation

Started byLaxman Dewangan <ldewangan@nvidia.com>
First post2016-04-03 13:20 +0200
Last post2016-04-04 18:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] regulator: pwm: Try to avoid voltage error in duty cycle  calculation Laxman Dewangan <ldewangan@nvidia.com> - 2016-04-03 13:20 +0200
    Re: [PATCH] regulator: pwm: Try to avoid voltage error in duty cycle  calculation Mark Brown <broonie@kernel.org> - 2016-04-04 18:30 +0200

#1370200 — Re: [PATCH] regulator: pwm: Try to avoid voltage error in duty cycle calculation

FromLaxman Dewangan <ldewangan@nvidia.com>
Date2016-04-03 13:20 +0200
SubjectRe: [PATCH] regulator: pwm: Try to avoid voltage error in duty cycle calculation
Message-ID<rjOeu-2w5-29@gated-at.bofh.it>
On Saturday 02 April 2016 10:23 PM, Mark Brown wrote:
> * PGP Signed by an unknown key
>
> On Fri, Apr 01, 2016 at 12:02:19PM +0530, Laxman Dewangan wrote:
>> On Friday 01 April 2016 11:55 AM, kbuild test robot wrote:
>>>>> pwm-regulator.c:(.text+0x1728d4): undefined reference to `__umoddi3'
>>>>> pwm-regulator.c:(.text+0x1728fd): undefined reference to `__udivdi3'
>> Seems build error is coming from logic
>> u64 req_period
>> unsigned int diff;
>> unsigned int period
>> unsigned int req_diff
>> req_period = req_diff * period;
>> if (req_period % diff == 0)
>> used u64 to avoid overflow in multiplication.
> Yes, you're doing a 64 bit divide so that's kind of expected...
>

Is there any way to resolve this issue?

Otherwise, need to divide by 100 first for the req_diff to get 10x of mV 
(instead of uV) and then do calculation with unsigned int only. That way 
I can restrict the number to unsigned int.

[toc] | [next] | [standalone]


#1370736

FromMark Brown <broonie@kernel.org>
Date2016-04-04 18:30 +0200
Message-ID<rkfy2-5Pj-1@gated-at.bofh.it>
In reply to#1370200

[Multipart message — attachments visible in raw view] — view raw

On Sun, Apr 03, 2016 at 04:37:18PM +0530, Laxman Dewangan wrote:
> On Saturday 02 April 2016 10:23 PM, Mark Brown wrote:

> >Yes, you're doing a 64 bit divide so that's kind of expected...

> Is there any way to resolve this issue?

You need to reorganize the maths so you're not doing a 64 bit divide
operation or use do_div().

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web