Hi Lee,
Thank you for the fast reply.

On 24 March 2014 07:52 Lee Jones wrote,
>> From: Opensource [Steve Twiss] <stwiss.opensou...@diasemi.com>
>>
>> Add the HWMON driver for DA9063
>>
>> Signed-off-by: Opensource [Steve Twiss] <stwiss.opensou...@diasemi.com>
>> ---
>>
>>  drivers/hwmon/Kconfig                |   10 +
>>  drivers/hwmon/Makefile               |    1 +
>>  drivers/hwmon/da9063-hwmon.c         |  456
>++++++++++++++++++++++++++++++++++
>>  include/linux/mfd/da9063/registers.h |   34 +++
>
>I'd prefer to see all values in hex, but this probably a preference
>thing rather than something which would prevent acceptance.
>
>For the MFD header changes:
>  Acked-by: Lee Jones <lee.jo...@linaro.org>
>
Thanks for the Ack.

<snip>
> +#define DA9063_ADC_RES       (1 << (DA9063_ADC_RES_L_BITS + 
> DA9063_ADC_RES_M_BITS))
> +#define DA9063_ADC_MAX       (DA9063_ADC_RES - 1)
>> +#define DA9063_2V5  2500
>> +#define DA9063_5V0  5000
>> +#define DA9063_5V5  5500
>> +#define DA9063_TJUNC_M      -420
>> +#define DA9063_TJUNC_C      -812
>> +#define DA9063_VBBAT_M      2048

I am using these defines as part of the base-10 calculations in the conversion
routines for voltage and temperature.
I guess they do look weird .. and looking at it, I have mixed  division by 1024
as a right shift 10 in the TJUNC calculation.

I will re-format that part and put a comment in the defines to explain.
Thanks.

<snip>
>> +    case DA9063_CHAN_ADCIN1:
>> +    case DA9063_CHAN_ADCIN2:
>> +    case DA9063_CHAN_ADCIN3:
>> +            val = (DA9063_2V5 * val) / DA9063_ADC_MAX;
>> +            break;
>> +    case DA9063_CHAN_VSYS:
>> +            val = ((DA9063_5V5 - DA9063_2V5) * val) / DA9063_ADC_MAX +
>> +                    DA9063_2V5;
>> +            break;
>> +    case DA9063_CHAN_TJUNC:
>> +            val -= hwmon->tjunc_offset;
>> +            val = (DA9063_TJUNC_M * (val + DA9063_TJUNC_C)) >> 10;
>> +            break;
>> +    case DA9063_CHAN_VBBAT:
>> +            val = (DA9063_5V0 * val) / DA9063_ADC_MAX;
>> +            break;

<snip>
>
>--
>Lee Jones
>Linaro STMicroelectronics Landing Team Lead
>Linaro.org │ Open source software for ARM SoCs
>Follow Linaro: Facebook | Twitter | Blog

Regards,
Steve

Reply via email to