hwmon: twl4030: Hwmon Driver for TWL4030 MADC
Subsystems (2)
PATCH v2 2/2 hwmon: twl4030: Hwmon Driver for TWL4030 MADC
This driver exposes the sysfs nodes of the TWL4030 MADC module. All the voltage channel values are expressed in terms of mV. Channel 13 and channel 14 are reserved. There are channels which represent temperature and current the output is represented by celcius and mA respectively.
---
V2:
Changed the names of the sysfs attributes compliant to current, voltage and temperature attributes.
V1:
http://www.mail-archive.com/[email protected]/msg44542.html
Documentation/hwmon/twl4030-madc-hwmon | 45 +++++++++ drivers/hwmon/Kconfig | 10 ++ drivers/hwmon/Makefile | 1 + drivers/hwmon/twl4030-madc-hwmon.c | 153 ++++++++++++++++++++++++++++++++ 4 files changed, 209 insertions(+), 0 deletions(-) create mode 100644 Documentation/hwmon/twl4030-madc-hwmon create mode 100644 drivers/hwmon/twl4030-madc-hwmon.c
Documentation/hwmon/twl4030-madc-hwmon new file +45 -0
@@ -0,0 +1,45 @@ +Kernel driver twl4030-madc +========================= + +Supported chips: + * Texas Instruments TWL4030 + Prefix: 'twl4030-madc' + + +Authors: + J Keerthy <[email protected]> + +Description +----------- + +The Texas Instruments TWL4030 is a Power Management and Audio Circuit. Among +other things it contains a 10-bit A/D converter MADC. The converter has 16 +channels which can be used in different modes. + + +See this table for the meaning of the different channels + +Channel Signal +------------------------------------------ +0 Battery type(BTYPE) +1 BCI: Battery temperature (BTEMP) +2 GP analog input +3 GP analog input +4 GP analog input +5 GP analog input +6 GP analog input +7 GP analog input +8 BCI: VBUS voltage(VBUS) +9 Backup Battery voltage (VBKP) +10 BCI: Battery charger current (ICHG) +11 BCI: Battery charger voltage (VCHG) +12 BCI: Main battery voltage (VBAT) +13 Reserved +14 Reserved +15 VRUSB Supply/Speaker left/Speaker right polarization level + + +The Sysfs nodes will represent the voltage in the units of mV, +the temperature channel shows the converted temperature in +degree celcius. The Battery charging current channel represents +battery charging current in mA.
drivers/hwmon/Kconfig +10 -0
@@ -940,6 +940,16 @@ config SENSORS_TMP421 This driver can also be built as a module. If so, the module will be called tmp421. +config SENSORS_TWL4030_MADC + tristate "Texas Instruments TWL4030 MADC Hwmon" + depends on TWL4030_MADC + help + If you say yes here you get hwmon support for triton + TWL4030-MADC. + + This driver can also be built as a module. If so it will be called + twl4030-madc-hwmon. + config SENSORS_VIA_CPUTEMP tristate "VIA CPU temperature sensor" depends on X86
drivers/hwmon/Makefile +1 -0
@@ -102,6 +102,7 @@ obj-$(CONFIG_SENSORS_THMC50) += thmc50.o obj-$(CONFIG_SENSORS_TMP102) += tmp102.o obj-$(CONFIG_SENSORS_TMP401) += tmp401.o obj-$(CONFIG_SENSORS_TMP421) += tmp421.o +obj-$(CONFIG_SENSORS_TWL4030_MADC)+= twl4030-madc-hwmon.o obj-$(CONFIG_SENSORS_VIA_CPUTEMP)+= via-cputemp.o obj-$(CONFIG_SENSORS_VIA686A) += via686a.o obj-$(CONFIG_SENSORS_VT1211) += vt1211.o
drivers/hwmon/twl4030-madc-hwmon.c new file +153 -0
153 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Hi Keerthy,
Quoted 5 lines · Keerthy
This driver exposes the sysfs nodes of the TWL4030 MADC module. All the voltage channel values are expressed in terms of mV. Channel 13 and channel 14 are reserved. There are channels which represent temperature and current the output is represented by celcius and mA respectively.
It would make sense for me to carry both patches through the MFD tree, but I'd like to get Guenter's ACK before pushing it upstream.
Cheers,
Samuel.
Signature · 7 lines
Intel Open Source Technology Centre http://oss.intel.com/ _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 11 lines · Samuel Ortiz
Hi Keerthy,
Quoted 5 lines · Keerthy
This driver exposes the sysfs nodes of the TWL4030 MADC module. All the voltage channel values are expressed in terms of mV. Channel 13 and channel 14 are reserved. There are channels which represent temperature and current the output is represented by celcius and mA respectively.
It would make sense for me to carry both patches through the MFD tree, but I'd like to get Guenter's ACK before pushing it upstream.
Main problem I have with the hwmon part is the sensor index value and how it maps to adc channels. Specifically, channels 13 and 14 are listed as reserved, yet index value 13 is used without further explanation as bit map value passed on to twl4030_madc_conversion() to obtain the value for channel 15. Either this is wrong, or it asks for a detailed explanation. I didn't have time to track down which one it is. And even if it isn't wrong, it doesn't seem to be the right thing to do since it adds a lot of confusion.
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 20 lines · Guenter Roeck
Quoted 11 lines · Samuel Ortiz
Hi Keerthy,
Quoted 5 lines · Keerthy
This driver exposes the sysfs nodes of the TWL4030 MADC module. All the voltage channel values are expressed in terms of mV. Channel 13 and channel 14 are reserved. There are channels which represent temperature and current the output is represented by celcius and mA respectively.
It would make sense for me to carry both patches through the MFD tree, but I'd like to get Guenter's ACK before pushing it upstream.
Main problem I have with the hwmon part is the sensor index value and how it maps to adc channels. Specifically, channels 13 and 14 are listed as reserved, yet index value 13 is used without further explanation as bit map value passed on to
twl4030_madc_conversion()to obtain the value for channel 15. Either this is wrong, or it asks for a detailed explanation. I didn't have time to track down which one it is. And even if it isn't wrong, it doesn't seem to be the right thing to do since it adds a lot of confusion.
Quoted 2 lines
Guenter
Guenter,
It should be 15. I will repost with the changed value. Sorry for the confusion.
Regards,
Keerthy
Signature · 2 lines
Regards and Thanks, Keerthy