lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 24 Mar 2014 08:12:02 +0000
From:	"Opensource [Steve Twiss]" <stwiss.opensource@...semi.com>
To:	Lee Jones <lee.jones@...aro.org>
CC:	Guenter Roeck <linux@...ck-us.net>,
	Jean Delvare <jdelvare@...e.de>,
	"David Dajun Chen" <david.chen@...semi.com>,
	LINUX-DOC <linux-doc@...r.kernel.org>,
	LINUX-KERNEL <linux-kernel@...r.kernel.org>,
	LM-SENSORS <lm-sensors@...sensors.org>,
	Mark Brown <broonie@...aro.org>,
	Philipp Zabel <p.zabel@...gutronix.de>,
	Rob Landley <rob@...dley.net>,
	Samuel Ortiz <sameo@...ux.intel.com>
Subject: RE: [RFC V1 1/3] hwmon: da9063: HWMON driver

Hi Lee,
Thank you for the fast reply.

On 24 March 2014 07:52 Lee Jones wrote,
>> From: Opensource [Steve Twiss] <stwiss.opensource@...semi.com>
>>
>> Add the HWMON driver for DA9063
>>
>> Signed-off-by: Opensource [Steve Twiss] <stwiss.opensource@...semi.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.jones@...aro.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ