Skip to content

Commit

Permalink
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/jdelvare/staging

Pull hwmon updates from Jean Delvare:
 "We have support for the MCP3021, MC13892 and GMT G781, automatic fan
  speed control for LM63/LM64 chips, and a few clean-ups."

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  hwmon: Add MCP3021 ADC driver
  hwmon: (mc13783-adc) Add support for the MC13892 PMIC
  hwmon: (mc13783-adc) Remove space before tab
  hwmon: (lm63) Let the user adjust the lookup table
  hwmon: (lm63) Make fan speed control strategy changeable
  hwmon: (lm63) Reorganize the code
  hwmon: (lm90) Restore original configuration if probe function fails
  hwmon: (lm90) Add support for GMT G781
  hwmon: (lm90) Fix multi-line comments
  hwmon: (w83795) Fix multi-line comments
  hwmon: (w83795) Unconditionally support manual fan speed control
  hwmon: (fam15h_power) Increase output resolution
  hwmon: (fam15h_power) Correct sign extension of running_avg_capture
  • Loading branch information
Linus Torvalds committed Mar 23, 2012
2 parents 0b0c9d3 + 5510e62 commit f37ab0f
Show file tree
Hide file tree
Showing 11 changed files with 826 additions and 379 deletions.
4 changes: 4 additions & 0 deletions Documentation/hwmon/lm90
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ Supported chips:
Addresses scanned: I2C 0x48 through 0x4F
Datasheet: Publicly available at NXP website
http://ics.nxp.com/products/interface/datasheet/sa56004x.pdf
* GMT G781
Prefix: 'g781'
Addresses scanned: I2C 0x4c, 0x4d
Datasheet: Not publicly available from GMT

Author: Jean Delvare <khali@linux-fr.org>

Expand Down
50 changes: 37 additions & 13 deletions Documentation/hwmon/mc13783-adc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ Kernel driver mc13783-adc

Supported chips:
* Freescale Atlas MC13783
Prefix: 'mc13783_adc'
Prefix: 'mc13783'
Datasheet: http://www.freescale.com/files/rf_if/doc/data_sheet/MC13783.pdf?fsrch=1
* Freescale Atlas MC13892
Prefix: 'mc13892'
Datasheet: http://cache.freescale.com/files/analog/doc/data_sheet/MC13892.pdf?fsrch=1&sr=1

Authors:
Sascha Hauer <s.hauer@pengutronix.de>
Expand All @@ -13,28 +16,29 @@ Authors:
Description
-----------

The Freescale MC13783 is a Power Management and Audio Circuit. Among
other things it contains a 10-bit A/D converter. The converter has 16
channels which can be used in different modes.
The A/D converter has a resolution of 2.25mV. Channels 0-4 have
a dedicated meaning with chip internal scaling applied. Channels 5-7
can be used as general purpose inputs or alternatively in a dedicated
mode. Channels 12-15 are occupied by the touchscreen if it's active.
The Freescale MC13783 and MC13892 are Power Management and Audio Circuits.
Among other things they contain a 10-bit A/D converter. The converter has 16
(MC13783) resp. 12 (MC13892) channels which can be used in different modes. The
A/D converter has a resolution of 2.25mV.

Currently the driver only supports channels 2 and 5-15 with no alternative
modes for channels 5-7.
Some channels can be used as General Purpose inputs or in a dedicated mode with
a chip internal scaling applied .

See this table for the meaning of the different channels and their chip
internal scaling:
Currently the driver only supports the Application Supply channel (BP / BPSNS),
the General Purpose inputs and touchscreen.

See the following tables for the meaning of the different channels and their
chip internal scaling:

MC13783:
Channel Signal Input Range Scaling
-------------------------------------------------------------------------------
0 Battery Voltage (BATT) 2.50 - 4.65V -2.40V
1 Battery Current (BATT - BATTISNS) -50 - 50 mV x20
2 Application Supply (BP) 2.50 - 4.65V -2.40V
3 Charger Voltage (CHRGRAW) 0 - 10V / /5
0 - 20V /10
4 Charger Current (CHRGISNSP-CHRGISNSN) -0.25V - 0.25V x4
4 Charger Current (CHRGISNSP-CHRGISNSN) -0.25 - 0.25V x4
5 General Purpose ADIN5 / Battery Pack Thermistor 0 - 2.30V No
6 General Purpose ADIN6 / Backup Voltage (LICELL) 0 - 2.30V / No /
1.50 - 3.50V -1.20V
Expand All @@ -48,3 +52,23 @@ Channel Signal Input Range Scaling
13 General Purpose TSX2 / Touchscreen X-plate 2 0 - 2.30V No
14 General Purpose TSY1 / Touchscreen Y-plate 1 0 - 2.30V No
15 General Purpose TSY2 / Touchscreen Y-plate 2 0 - 2.30V No

MC13892:
Channel Signal Input Range Scaling
-------------------------------------------------------------------------------
0 Battery Voltage (BATT) 0 - 4.8V /2
1 Battery Current (BATT - BATTISNSCC) -60 - 60 mV x20
2 Application Supply (BPSNS) 0 - 4.8V /2
3 Charger Voltage (CHRGRAW) 0 - 12V / /5
0 - 20V /10
4 Charger Current (CHRGISNS-BPSNS) / -0.3 - 0.3V / x4 /
Touchscreen X-plate 1 0 - 2.4V No
5 General Purpose ADIN5 / Battery Pack Thermistor 0 - 2.4V No
6 General Purpose ADIN6 / Backup Voltage (LICELL) 0 - 2.4V / No
Backup Voltage (LICELL) 0 - 3.6V x2/3
7 General Purpose ADIN7 / UID / Die Temperature 0 - 2.4V / No /
0 - 4.8V /2
12 General Purpose TSX1 / Touchscreen X-plate 1 0 - 2.4V No
13 General Purpose TSX2 / Touchscreen X-plate 2 0 - 2.4V No
14 General Purpose TSY1 / Touchscreen Y-plate 1 0 - 2.4V No
15 General Purpose TSY2 / Touchscreen Y-plate 2 0 - 2.4V No
22 changes: 22 additions & 0 deletions Documentation/hwmon/mcp3021
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Kernel driver MCP3021
======================

Supported chips:
* Microchip Technology MCP3021
Prefix: 'mcp3021'
Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/21805a.pdf

Author: Mingkai Hu

Description
-----------

This driver implements support for the Microchip Technology MCP3021 chip.

The Microchip Technology Inc. MCP3021 is a successive approximation A/D
converter (ADC) with 10-bit resolution.
This device provides one single-ended input with very low power consumption.
Communication to the MCP3021 is performed using a 2-wire I2C compatible
interface. Standard (100 kHz) and Fast (400 kHz) I2C modes are available.
The default I2C device address is 0x4d (contact the Microchip factory for
additional address options).
28 changes: 20 additions & 8 deletions drivers/hwmon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,8 @@ config SENSORS_LM90
LM86, LM89 and LM99, Analog Devices ADM1032, ADT7461, and ADT7461A,
Maxim MAX6646, MAX6647, MAX6648, MAX6649, MAX6657, MAX6658, MAX6659,
MAX6680, MAX6681, MAX6692, MAX6695, MAX6696, ON Semiconductor NCT1008,
Winbond/Nuvoton W83L771W/G/AWG/ASG and Philips SA56004 sensor chips.
Winbond/Nuvoton W83L771W/G/AWG/ASG, Philips SA56004, and GMT G781
sensor chips.

This driver can also be built as a module. If so, the module
will be called lm90.
Expand Down Expand Up @@ -812,6 +813,16 @@ config SENSORS_MAX6650
This driver can also be built as a module. If so, the module
will be called max6650.

config SENSORS_MCP3021
tristate "Microchip MCP3021"
depends on I2C && EXPERIMENTAL
help
If you say yes here you get support for the MCP3021 chip
that is a A/D converter (ADC) with 10-bit resolution.

This driver can also be built as a module. If so, the module
will be called mcp3021.

config SENSORS_NTC_THERMISTOR
tristate "NTC thermistor support"
depends on EXPERIMENTAL
Expand Down Expand Up @@ -1229,18 +1240,19 @@ config SENSORS_W83795
depends on I2C && EXPERIMENTAL
help
If you say yes here you get support for the Winbond W83795G and
W83795ADG hardware monitoring chip.
W83795ADG hardware monitoring chip, including manual fan speed
control.

This driver can also be built as a module. If so, the module
will be called w83795.

config SENSORS_W83795_FANCTRL
boolean "Include fan control support (DANGEROUS)"
boolean "Include automatic fan control support (DANGEROUS)"
depends on SENSORS_W83795 && EXPERIMENTAL
default n
help
If you say yes here, support for the both manual and automatic
fan control features will be included in the driver.
If you say yes here, support for automatic fan speed control
will be included in the driver.

This part of the code wasn't carefully reviewed and tested yet,
so enabling this option is strongly discouraged on production
Expand Down Expand Up @@ -1358,10 +1370,10 @@ config SENSORS_APPLESMC
the awesome power of applesmc.

config SENSORS_MC13783_ADC
tristate "Freescale MC13783 ADC"
depends on MFD_MC13783
tristate "Freescale MC13783/MC13892 ADC"
depends on MFD_MC13XXX
help
Support for the A/D converter on MC13783 PMIC.
Support for the A/D converter on MC13783 and MC13892 PMIC.

if ACPI

Expand Down
1 change: 1 addition & 0 deletions drivers/hwmon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ obj-$(CONFIG_SENSORS_MAX6639) += max6639.o
obj-$(CONFIG_SENSORS_MAX6642) += max6642.o
obj-$(CONFIG_SENSORS_MAX6650) += max6650.o
obj-$(CONFIG_SENSORS_MC13783_ADC)+= mc13783-adc.o
obj-$(CONFIG_SENSORS_MCP3021) += mcp3021.o
obj-$(CONFIG_SENSORS_NTC_THERMISTOR) += ntc_thermistor.o
obj-$(CONFIG_SENSORS_PC87360) += pc87360.o
obj-$(CONFIG_SENSORS_PC87427) += pc87427.o
Expand Down
10 changes: 5 additions & 5 deletions drivers/hwmon/fam15h_power.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ static ssize_t show_power(struct device *dev,
pci_bus_read_config_dword(f4->bus, PCI_DEVFN(PCI_SLOT(f4->devfn), 5),
REG_TDP_RUNNING_AVERAGE, &val);
running_avg_capture = (val >> 4) & 0x3fffff;
running_avg_capture = sign_extend32(running_avg_capture, 22);
running_avg_range = val & 0xf;
running_avg_capture = sign_extend32(running_avg_capture, 21);
running_avg_range = (val & 0xf) + 1;

pci_bus_read_config_dword(f4->bus, PCI_DEVFN(PCI_SLOT(f4->devfn), 5),
REG_TDP_LIMIT3, &val);

tdp_limit = val >> 16;
curr_pwr_watts = tdp_limit + data->base_tdp -
(s32)(running_avg_capture >> (running_avg_range + 1));
curr_pwr_watts = (tdp_limit + data->base_tdp) << running_avg_range;
curr_pwr_watts -= running_avg_capture;
curr_pwr_watts *= data->tdp_to_watts;

/*
Expand All @@ -78,7 +78,7 @@ static ssize_t show_power(struct device *dev,
* scaling factor 1/(2^16). For conversion we use
* (10^6)/(2^16) = 15625/(2^10)
*/
curr_pwr_watts = (curr_pwr_watts * 15625) >> 10;
curr_pwr_watts = (curr_pwr_watts * 15625) >> (10 + running_avg_range);
return sprintf(buf, "%u\n", (unsigned int) curr_pwr_watts);
}
static DEVICE_ATTR(power1_input, S_IRUGO, show_power, NULL);
Expand Down
Loading

0 comments on commit f37ab0f

Please sign in to comment.