Skip to content

Commit

Permalink
Merge tag 'hwmon-for-linus-v3.18' of git://git.kernel.org/pub/scm/lin…
Browse files Browse the repository at this point in the history
…ux/kernel/git/groeck/linux-staging

Pull hwmon updates from Guenter Roeck:
 - new driver for menf21bmc.
 - convert k10temp, smsc47b397, da9052, da9055 to new hwmon API.
 - register ntc_thermistor driver with thermal subsystem.
 - add support for F15h M60h to k10temp driver.
 - add driver for MEN14F021P00 BMC HWMON driver; this required a merge
   with tag mfd-hwmon-leds-watchdog-v3.18

* tag 'hwmon-for-linus-v3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (ab8500) Call kernel_power_off instead of pm_power_off
  hwmon: (menf21bmc) Introduce MEN14F021P00 BMC HWMON driver
  leds: leds-menf21bmc: Introduce MEN 14F021P00 BMC LED driver
  watchdog: menf21bmc_wdt: Introduce MEN 14F021P00 BMC Watchdog driver
  mfd: menf21bmc: Introduce MEN 14F021P00 BMC MFD Core driver
  hwmon: (ntc_thermistor) Add ntc thermistor to thermal subsystem as a sensor.
  hwmon: (smsc47b397) Convert to devm_hwmon_device_register_with_groups
  MAINTAINERS: add entry for the PWM fan driver
  hwmon: (k10temp) Convert to devm_hwmon_device_register_with_groups
  hwmon: (k10temp) Add support for F15h M60h
  hwmon: (da9052) Convert to devm_hwmon_device_register_with_groups
  hwmon: (da9055) Convert to devm_hwmon_device_register_with_groups
  hwmon: (ads1015) Use of_property_read_u32 at appropriate places
  • Loading branch information
torvalds committed Oct 10, 2014
2 parents 93834c6 + 3afb57f commit 40c4326
Show file tree
Hide file tree
Showing 23 changed files with 949 additions and 228 deletions.
3 changes: 3 additions & 0 deletions Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Requires node properties:
- "io-channels" Channel node of ADC to be used for
conversion.

Optional node properties:
- "#thermal-sensor-cells" Used to expose itself to thermal fw.

Read more about iio bindings at
Documentation/devicetree/bindings/iio/iio-bindings.txt

Expand Down
2 changes: 1 addition & 1 deletion Documentation/hwmon/k10temp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Supported chips:
Socket S1G2: Athlon (X2), Sempron (X2), Turion X2 (Ultra)
* AMD Family 12h processors: "Llano" (E2/A4/A6/A8-Series)
* AMD Family 14h processors: "Brazos" (C/E/G/Z-Series)
* AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity", "Kaveri"
* AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity", "Kaveri", "Carrizo"
* AMD Family 16h processors: "Kabini", "Mullins"

Prefix: 'k10temp'
Expand Down
50 changes: 50 additions & 0 deletions Documentation/hwmon/menf21bmc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Kernel driver menf21bmc_hwmon
=============================

Supported chips:
* MEN 14F021P00
Prefix: 'menf21bmc_hwmon'
Adresses scanned: -

Author: Andreas Werner <andreas.werner@men.de>

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

The menf21bmc is a Board Management Controller (BMC) which provides an I2C
interface to the host to access the features implemented in the BMC.

This driver gives access to the voltage monitoring feature of the main
voltages of the board.
The voltage sensors are connected to the ADC inputs of the BMC which is
a PIC16F917 Mikrocontroller.

Usage Notes
-----------

This driver is part of the MFD driver named "menf21bmc" and does
not auto-detect devices.
You will have to instantiate the MFD driver explicitly.
Please see Documentation/i2c/instantiating-devices for
details.

Sysfs entries
-------------

The following attributes are supported. All attributes are read only
The Limits are read once by the driver.

in0_input +3.3V input voltage
in1_input +5.0V input voltage
in2_input +12.0V input voltage
in3_input +5V Standby input voltage
in4_input VBAT (on board battery)

in[0-4]_min Minimum voltage limit
in[0-4]_max Maximum voltage limit

in0_label "MON_3_3V"
in1_label "MON_5V"
in2_label "MON_12V"
in3_label "5V_STANDBY"
in4_label "VBAT"
8 changes: 8 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -7364,6 +7364,14 @@ T: git git://linuxtv.org/media_tree.git
S: Maintained
F: drivers/media/usb/pwc/*

PWM FAN DRIVER
M: Kamil Debski <k.debski@samsung.com>
L: lm-sensors@lm-sensors.org
S: Supported
F: Documentation/devicetree/bindings/hwmon/pwm-fan.txt
F: Documentation/hwmon/pwm-fan
F: drivers/hwmon/pwm-fan.c

PWM SUBSYSTEM
M: Thierry Reding <thierry.reding@gmail.com>
L: linux-pwm@vger.kernel.org
Expand Down
15 changes: 13 additions & 2 deletions drivers/hwmon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ config SENSORS_K10TEMP
If you say yes here you get support for the temperature
sensor(s) inside your CPU. Supported are later revisions of
the AMD Family 10h and all revisions of the AMD Family 11h,
12h (Llano), 14h (Brazos), 15h (Bulldozer/Trinity/Kaveri) and
16h (Kabini/Mullins) microarchitectures.
12h (Llano), 14h (Brazos), 15h (Bulldozer/Trinity/Kaveri/Carrizo)
and 16h (Kabini/Mullins) microarchitectures.

This driver can also be built as a module. If so, the module
will be called k10temp.
Expand Down Expand Up @@ -839,6 +839,16 @@ config SENSORS_MCP3021
This driver can also be built as a module. If so, the module
will be called mcp3021.

config SENSORS_MENF21BMC_HWMON
tristate "MEN 14F021P00 BMC Hardware Monitoring"
depends on MFD_MENF21BMC
help
Say Y here to include support for the MEN 14F021P00 BMC
hardware monitoring.

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

config SENSORS_ADCXX
tristate "National Semiconductor ADCxxxSxxx"
depends on SPI_MASTER
Expand Down Expand Up @@ -1077,6 +1087,7 @@ config SENSORS_PC87427
config SENSORS_NTC_THERMISTOR
tristate "NTC thermistor support from Murata"
depends on !OF || IIO=n || IIO
depends on THERMAL || !THERMAL_OF
help
This driver supports NTC thermistors sensor reading and its
interpretation. The driver can also monitor the temperature and
Expand Down
1 change: 1 addition & 0 deletions drivers/hwmon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ obj-$(CONFIG_SENSORS_MAX6650) += max6650.o
obj-$(CONFIG_SENSORS_MAX6697) += max6697.o
obj-$(CONFIG_SENSORS_MC13783_ADC)+= mc13783-adc.o
obj-$(CONFIG_SENSORS_MCP3021) += mcp3021.o
obj-$(CONFIG_SENSORS_MENF21BMC_HWMON) += menf21bmc_hwmon.o
obj-$(CONFIG_SENSORS_NCT6683) += nct6683.o
obj-$(CONFIG_SENSORS_NCT6775) += nct6775.o
obj-$(CONFIG_SENSORS_NTC_THERMISTOR) += ntc_thermistor.o
Expand Down
5 changes: 3 additions & 2 deletions drivers/hwmon/ab8500.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* When the AB8500 thermal warning temperature is reached (threshold cannot
* be changed by SW), an interrupt is set, and if no further action is taken
* within a certain time frame, pm_power off will be called.
* within a certain time frame, kernel_power_off will be called.
*
* When AB8500 thermal shutdown temperature is reached a hardware shutdown of
* the AB8500 will occur.
Expand All @@ -21,6 +21,7 @@
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/power/ab8500.h>
#include <linux/reboot.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include "abx500.h"
Expand Down Expand Up @@ -106,7 +107,7 @@ static void ab8500_thermal_power_off(struct work_struct *work)

dev_warn(&abx500_data->pdev->dev, "Power off due to critical temp\n");

pm_power_off();
kernel_power_off();
}

static ssize_t ab8500_show_name(struct device *dev,
Expand Down
21 changes: 8 additions & 13 deletions drivers/hwmon/ads1015.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,41 +184,36 @@ static int ads1015_get_channels_config_of(struct i2c_client *client)
return -EINVAL;

for_each_child_of_node(client->dev.of_node, node) {
const __be32 *property;
int len;
u32 pval;
unsigned int channel;
unsigned int pga = ADS1015_DEFAULT_PGA;
unsigned int data_rate = ADS1015_DEFAULT_DATA_RATE;

property = of_get_property(node, "reg", &len);
if (!property || len != sizeof(int)) {
if (of_property_read_u32(node, "reg", &pval)) {
dev_err(&client->dev, "invalid reg on %s\n",
node->full_name);
continue;
}

channel = be32_to_cpup(property);
channel = pval;
if (channel >= ADS1015_CHANNELS) {
dev_err(&client->dev,
"invalid channel index %d on %s\n",
channel, node->full_name);
continue;
}

property = of_get_property(node, "ti,gain", &len);
if (property && len == sizeof(int)) {
pga = be32_to_cpup(property);
if (!of_property_read_u32(node, "ti,gain", &pval)) {
pga = pval;
if (pga > 6) {
dev_err(&client->dev,
"invalid gain on %s\n",
dev_err(&client->dev, "invalid gain on %s\n",
node->full_name);
return -EINVAL;
}
}

property = of_get_property(node, "ti,datarate", &len);
if (property && len == sizeof(int)) {
data_rate = be32_to_cpup(property);
if (!of_property_read_u32(node, "ti,datarate", &pval)) {
data_rate = pval;
if (data_rate > 7) {
dev_err(&client->dev,
"invalid data_rate on %s\n",
Expand Down
54 changes: 9 additions & 45 deletions drivers/hwmon/da9052-hwmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

struct da9052_hwmon {
struct da9052 *da9052;
struct device *class_device;
struct mutex hwmon_lock;
};

Expand Down Expand Up @@ -190,13 +189,6 @@ static ssize_t da9052_read_vbbat(struct device *dev,
return sprintf(buf, "%d\n", vbbat_reg_to_mv(ret));
}

static ssize_t da9052_hwmon_show_name(struct device *dev,
struct device_attribute *devattr,
char *buf)
{
return sprintf(buf, "da9052\n");
}

static ssize_t show_label(struct device *dev,
struct device_attribute *devattr, char *buf)
{
Expand Down Expand Up @@ -243,10 +235,7 @@ static SENSOR_DEVICE_ATTR(temp8_input, S_IRUGO, da9052_read_tjunc, NULL,
static SENSOR_DEVICE_ATTR(temp8_label, S_IRUGO, show_label, NULL,
DA9052_ADC_TJUNC);

static DEVICE_ATTR(name, S_IRUGO, da9052_hwmon_show_name, NULL);

static struct attribute *da9052_attr[] = {
&dev_attr_name.attr,
static struct attribute *da9052_attrs[] = {
&sensor_dev_attr_in0_input.dev_attr.attr,
&sensor_dev_attr_in0_label.dev_attr.attr,
&sensor_dev_attr_in3_input.dev_attr.attr,
Expand All @@ -268,54 +257,29 @@ static struct attribute *da9052_attr[] = {
NULL
};

static const struct attribute_group da9052_attr_group = {.attrs = da9052_attr};
ATTRIBUTE_GROUPS(da9052);

static int da9052_hwmon_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct da9052_hwmon *hwmon;
int ret;
struct device *hwmon_dev;

hwmon = devm_kzalloc(&pdev->dev, sizeof(struct da9052_hwmon),
GFP_KERNEL);
hwmon = devm_kzalloc(dev, sizeof(struct da9052_hwmon), GFP_KERNEL);
if (!hwmon)
return -ENOMEM;

mutex_init(&hwmon->hwmon_lock);
hwmon->da9052 = dev_get_drvdata(pdev->dev.parent);

platform_set_drvdata(pdev, hwmon);

ret = sysfs_create_group(&pdev->dev.kobj, &da9052_attr_group);
if (ret)
goto err_mem;

hwmon->class_device = hwmon_device_register(&pdev->dev);
if (IS_ERR(hwmon->class_device)) {
ret = PTR_ERR(hwmon->class_device);
goto err_sysfs;
}

return 0;

err_sysfs:
sysfs_remove_group(&pdev->dev.kobj, &da9052_attr_group);
err_mem:
return ret;
}

static int da9052_hwmon_remove(struct platform_device *pdev)
{
struct da9052_hwmon *hwmon = platform_get_drvdata(pdev);

hwmon_device_unregister(hwmon->class_device);
sysfs_remove_group(&pdev->dev.kobj, &da9052_attr_group);

return 0;
hwmon_dev = devm_hwmon_device_register_with_groups(dev, "da9052",
hwmon,
da9052_groups);
return PTR_ERR_OR_ZERO(hwmon_dev);
}

static struct platform_driver da9052_hwmon_driver = {
.probe = da9052_hwmon_probe,
.remove = da9052_hwmon_remove,
.driver = {
.name = "da9052-hwmon",
.owner = THIS_MODULE,
Expand Down
Loading

0 comments on commit 40c4326

Please sign in to comment.