Re: [PATCH 06/15] twl4030_charger: split uA calculation into a function.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue 2015-02-24 15:33:51, NeilBrown wrote:
> We will need this calculation in other places, so
> create functions to map between register value and uA value.
> 
> Signed-off-by: NeilBrown <neilb@xxxxxxx>

Acked-by: Pavel Machek <pavel@xxxxxx>

> +static int regval2ua(int regval, bool cgain)
> +{
> +	if (cgain)
> +		return (regval * 16618 - 8500 * 1000) / 5;
> +	else
> +		return (regval * 16618 - 8500 * 1000) / 10;
> +}

   int res = (regval * 16618 - 8500 * 1000);
   if (cgain)
      return res / 5;
   return res / 10;

?
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux