summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
AgeCommit message (Collapse)AuthorFilesLines
2015-06-21hwmon: add driver for Microchip TC74Maciej S. Szmigiero3-0/+188
Add hwmon driver for the Microchip TC74. The TC74 is a single-input 8-bit I2C temperature sensor, with +-2 degrees centigrade accuracy. Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-06-03hwmon: (ntc_thermistor) Improve precision of resistance calculationChris Lesiak1-13/+10
The function get_ohm_of_thermistor has both the measured voltage and the pullup voltage available in microvolts. But it was promptly converting both to millivolts before using them to calculate the thermistor resistance. That conversion unnecessarily hurt the precision of the calculation. For example, take the ncpXXwb473 connected to 5000 mV and pulled down through a 47000 ohm resistor. At 25 C, the resistance of the thermistor is 47000 ohms. The measured voltage will be 2500 mV. If we measure instead 2501 mV, then the calculated resistance will be 46962 ohms -- a difference of 38 ohms. So the precision of the resistance estimate could be increased by 38X by doing the calculations in microvolts. Signed-off-by: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-06-02hwmon: (ntc_thermistor) fix iio raw to microvolts conversionChris Lesiak1-7/+8
The function ntc_adc_iio_read was assuming both a 12 bit ADC and that pullup_uv is the same as the ADC reference voltage. If either assumption is false, then the result is incorrect. Attempt to use iio_convert_raw_to_processed to convert the raw value to microvolts. It will fail for iio channels that don't support support IIO_CHAN_INFO_SCALE; in that case fall back to the assumptions. Signed-off-by: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-31hwmon: (atxp1) Drop auto-detectionGuenter Roeck1-46/+9
Auto-detection for this chip is highly unreliable, and one of its I2C addresses can also be used by EEPROMs, increasing the risk for false positives even more. Drop auto-detection entirely to remove the risk. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-31hwmon: (atxp1) Drop FSF mailing addressGuenter Roeck1-5/+0
The FSF mailing address may change and does not provide any real value. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-31hwmon: Allow compile test of GPIO consumers if !GPIOLIBGeert Uytterhoeven1-2/+2
The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer functionality only, can still be compiled if GPIOLIB is not enabled. Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where appropriate. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Jean Delvare <jdelvare@suse.de> Cc: Guenter Roeck <linux@roeck-us.net> Cc: lm-sensors@lm-sensors.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-31hwmon: (sht15) Constify platform_device_idKrzysztof Kozlowski1-1/+1
The platform_device_id is not modified by the driver and core uses it as const. Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-31hwmon: (max197) Constify platform_device_idKrzysztof Kozlowski1-1/+1
The platform_device_id is not modified by the driver and core uses it as const. Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-31hwmon: (ntc_thermistor) Add support for ncpXXwf104Beomho Seo2-2/+46
This patch adds support for the ntc thermistor NCPXXWF104 series. Cc: Jean Delvare <jdelvare@suse.de> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Beomho Seo <beomho.seo@samsung.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-29hwmon: (nct6683) Add missing sysfs attribute initializationGuenter Roeck1-0/+2
The following error message is seen when loading the nct6683 driver with DEBUG_LOCK_ALLOC enabled. BUG: key ffff88040b2f0030 not in .data! ------------[ cut here ]------------ WARNING: CPU: 0 PID: 186 at kernel/locking/lockdep.c:2988 lockdep_init_map+0x469/0x630() DEBUG_LOCKS_WARN_ON(1) Caused by a missing call to sysfs_attr_init() when initializing sysfs attributes. Reported-by: Alexey Orishko <alexey.orishko@gmail.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Cc: stable@vger.kernel.org # v3.18+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-29hwmon: (nct6775) Add missing sysfs attribute initializationGuenter Roeck1-0/+2
The following error message is seen when loading the nct6775 driver with DEBUG_LOCK_ALLOC enabled. BUG: key ffff88040b2f0030 not in .data! ------------[ cut here ]------------ WARNING: CPU: 0 PID: 186 at kernel/locking/lockdep.c:2988 lockdep_init_map+0x469/0x630() DEBUG_LOCKS_WARN_ON(1) Caused by a missing call to sysfs_attr_init() when initializing sysfs attributes. Reported-by: Alexey Orishko <alexey.orishko@gmail.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Cc: stable@vger.kernel.org # v3.12+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-29hwmon: (tmp401) Do not auto-detect chip on I2C address 0x37Guenter Roeck1-1/+1
I2C address 0x37 may be used by EEPROMs, which can result in false positives. Do not attempt to detect a chip at this address. Reviewed-by: Jean Delvare <jdelvare@suse.de> Cc: stable@vger.kernel.org # v4.0+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-26hwmon: (ntc_thermistor) Ensure iio channel is of type IIO_VOLTAGEChris Lesiak1-0/+9
When configured via device tree, the associated iio device needs to be measuring voltage for the conversion to resistance to be correct. Return -EINVAL if that is not the case. Signed-off-by: Chris Lesiak <chris.lesiak@licor.com> Cc: stable@vger.kernel.org # 3.10+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-17hwmon: (w83795) use find_closest_descending() in pwm_freq_to_reg()Bartosz Golaszewski1-5/+3
Replace the loop iterating over pwm_freq_cksel0 with a call to find_closest_descending(). Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-04-17hwmon: (lm85) use find_closest() in x_TO_REG() functionsBartosz Golaszewski1-18/+8
Replace RANGE_TO_REG() and FREQ_TO_REG() implementations with calls to find_closest(). Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-04-17hwmon: (ina2xx) replace ina226_avg_bits() with find_closest()Bartosz Golaszewski1-14/+3
Use find_closest() to locate the closest average in ina226_avg_tab. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-04-12hwmon: (pwm-fan) Update the duty cycle inorder to control the pwm-fanAnand Moon1-6/+3
pwm_config() must be called with a duty cycle of 0 prior to calling pwm_disable() to ensure that the pwm signal is set to low. Reported-by: Markus Reichl <m.reichl@fivetechno.de> Tested-by: Markus Reichl <m.reichl@fivetechno.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com> Reviewed-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Signed-off-by: Anand Moon <linux.amoon@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-09hwmon: (it87) Use feature macros on sio_dataGuenter Roeck1-2/+5
Feature macros work on sio_data as well, so use them there. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-08hwmon: (ibmpowernv) Fix build error seen for some configurationsGuenter Roeck1-0/+1
Fix drivers/hwmon/ibmpowernv.c: In function 'get_logical_cpu': drivers/hwmon/ibmpowernv.c:121:3: error: implicit declaration of function 'get_hard_smp_processor_id' seen for some configurations, possibly if SMP is not configured. Fixes: 3df2f59f0aae ("hwmon: (ibmpowernv) pretty print labels") Cc: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-08hwmon: (gpio-fan) Move the thermal registration after registration is completeNishanth Menon1-8/+11
Thermal framework may already be ready and cooling policies might already be functional when we are attempting to register gpio fan as a cooling device. This can be reproduced by changing probe order in which registration of various modules are done in a system. In such a case, kernel generates an oops since the data structures are not completely populated with the wrong assumption that thermal framework is not yet ready. Fix this by reordering the thermal framework registration to occur after hwmon registration of the fan is complete. Example kernel oops: [ 149.005828] Unable to handle kernel NULL pointer dereference at virtual address 0000008c [ 149.014369] pgd = ecf48000 [ 149.017204] [0000008c] *pgd=ac065831, *pte=00000000, *ppte=00000000 [ 149.023820] Internal error: Oops: 17 [#1] SMP ARM [ 149.028745] Modules linked in: gpio_fan(+) cpufreq_dt ipv6 evdev leds_gpio led_class omap_wdt phy_omap_usb2 rtc_palmas palmas_pwrbutton tmp102 ti_soc_thermal dwc3_omap thermal_sys extcon rtc_omap rtc_ds1307 hwmon [ 149.048629] CPU: 1 PID: 1183 Comm: modprobe Not tainted 4.0.0-rc7-next-20150407-00002-g7a82da074c99 #3 [ 149.058383] Hardware name: Generic DRA74X (Flattened Device Tree) [ 149.064763] task: edec1240 ti: ec0e0000 task.ti: ec0e0000 [ 149.070421] PC is at dev_driver_string+0x0/0x38 [ 149.075165] LR is at __dev_printk+0x24/0x70 [ 149.079540] pc : [<c03d6cd0>] lr : [<c03d72c4>] psr: 20000013 [ 149.079540] sp : ec0e1c28 ip : edec1240 fp : 00000000 [ 149.091568] r10: edf3eee0 r9 : 00000000 r8 : ffffffff [ 149.097040] r7 : edf3eea0 r6 : 00000034 r5 : 00000010 r4 : ec0e1c44 [ 149.103871] r3 : ec0e1c4c r2 : ec0e1c44 r1 : c079d800 r0 : 00000010 [ 149.110709] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user [ 149.118182] Control: 10c5387d Table: acf4806a DAC: 00000015 [ 149.124198] Process modprobe (pid: 1183, stack limit = 0xec0e0218) [ 149.130673] Stack: (0xec0e1c28 to 0xec0e2000) [ 149.135235] 1c20: 60000013 c05e2ae0 00000000 edf3ec00 ec934a10 c03d73d4 ... [ 149.392230] 1fe0: befe1888 befe1878 00019418 b6ea08f0 80000010 00000003 00000000 00000000 [ 149.400798] [<c03d6cd0>] (dev_driver_string) from [<c03d72c4>] (__dev_printk+0x24/0x70) [ 149.409193] [<c03d72c4>] (__dev_printk) from [<c03d73d4>] (dev_warn+0x34/0x48) [ 149.416767] [<c03d73d4>] (dev_warn) from [<bf0f54fc>] (get_fan_speed_index+0x94/0xa4 [gpio_fan]) [ 149.425980] [<bf0f54fc>] (get_fan_speed_index [gpio_fan]) from [<bf0f5524>] (gpio_fan_get_cur_state+0x18/0x30 [gpio_fan]) [ 149.437476] [<bf0f5524>] (gpio_fan_get_cur_state [gpio_fan]) from [<bf02767c>] (thermal_zone_trip_update+0xe8/0x2a4 [thermal_sys]) [ 149.449794] [<bf02767c>] (thermal_zone_trip_update [thermal_sys]) from [<bf027844>] (step_wise_throttle+0xc/0x74 [thermal_sys]) [ 149.461832] [<bf027844>] (step_wise_throttle [thermal_sys]) from [<bf024ff4>] (handle_thermal_trip+0x5c/0x188 [thermal_sys]) [ 149.473603] [<bf024ff4>] (handle_thermal_trip [thermal_sys]) from [<bf0256c4>] (thermal_zone_device_update+0x94/0x108 [thermal_sys]) [ 149.486104] [<bf0256c4>] (thermal_zone_device_update [thermal_sys]) from [<bf026470>] (__thermal_cooling_device_register+0x2e8/0x374 [thermal_sys]) [ 149.499956] [<bf026470>] (__thermal_cooling_device_register [thermal_sys]) from [<bf0f58e4>] (gpio_fan_probe+0x350/0x4d0 [gpio_fan]) [ 149.512438] [<bf0f58e4>] (gpio_fan_probe [gpio_fan]) from [<c03db8a0>] (platform_drv_probe+0x48/0x98) [ 149.522109] [<c03db8a0>] (platform_drv_probe) from [<c03da30c>] (driver_probe_device+0x1b0/0x26c) [ 149.531399] [<c03da30c>] (driver_probe_device) from [<c03da45c>] (__driver_attach+0x94/0x98) [ 149.540238] [<c03da45c>] (__driver_attach) from [<c03d8bb0>] (bus_for_each_dev+0x54/0x88) [ 149.548814] [<c03d8bb0>] (bus_for_each_dev) from [<c03d9a34>] (bus_add_driver+0xdc/0x1d4) [ 149.557381] [<c03d9a34>] (bus_add_driver) from [<c03dac30>] (driver_register+0x78/0xf4) [ 149.565765] [<c03dac30>] (driver_register) from [<c0009784>] (do_one_initcall+0x80/0x1d8) [ 149.574340] [<c0009784>] (do_one_initcall) from [<c00c2278>] (do_init_module+0x5c/0x1b8) [ 149.582833] [<c00c2278>] (do_init_module) from [<c00c3bbc>] (load_module+0x1720/0x1dcc) [ 149.591212] [<c00c3bbc>] (load_module) from [<c00c43d0>] (SyS_finit_module+0x68/0x6c) [ 149.599418] [<c00c43d0>] (SyS_finit_module) from [<c000f3c0>] (ret_fast_syscall+0x0/0x4c) [ 149.607994] Code: 15830000 e1a00006 e28dd008 e8bd8070 (e590307c) Cc: Eduardo Valentin <edubezval@gmail.com> Fixes: b5cf88e46bad ("(gpio-fan): Add thermal control hooks") Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-08hwmon: (ibmpowernv) pretty print labelsCédric Le Goater1-0/+41
The new OPAL device tree adds a few properties which can be used to add extra information on the sensor label. In the case of a cpu core sensor, the firmware exposes the physical identifier of the core in the "ibm,pir" property. The driver translates this identifier in a linux cpu number and prints out a range corresponding to the hardware threads of the core (as they share the same sensor). The numbering gives a hint on the localization of the core in the system (which socket, which chip). Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-08hwmon: (ibmpowernv) add a label attributeCédric Le Goater1-3/+52
Currently, sensors are only identified by their type and index. The new OPAL device tree can expose extra properties to identify some sensors by their name or location. This patch adds the creation of a new hwmon *_label attribute when such properties are detected. Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-08hwmon: (ibmpowernv) add support for the new device treeCédric Le Goater1-10/+40
The new OPAL device tree for sensors has a different layout and uses new property names, for the type and for the handler used to capture the sensor data. This patch modifies the ibmpowernv driver to support such a tree in a way preserving compatibility with older OPAL firmwares. This is achieved by changing the error path of the routine parsing an OPAL node name. The node is simply considered being from the new device tree layout and fallback values are used. Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-08hwmon: (ibmpowernv) add a helper routine create_hwmon_attrCédric Le Goater1-8/+16
This should shorten a bit the code necessary to create a hmwon attribute. Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-05hwmon: (it87) Add support for 6th fan of IT8620EGuenter Roeck1-15/+33
IT8620E supports up to 6 fan tachometers. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-05hwmon: (it87) Add support for IT8620EGuenter Roeck2-2/+43
IT8620E is mostly compatible to IT7828F. Add generic support for it. IT8620E supports up to 6 fan tachometers and 6 pwm controls. Support for the 6th tachometer and for the additional pwm controls are addded in separate patches. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-05hwmon: (it87) Add support for IT8790EGuenter Roeck2-3/+15
IT8790E is a super-IO chip with three fan tachometers. It is mostly compatible to IT8728F, but only supports three fan tachometers instead of five. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-05hwmon: (it87) Introduce feature flag to reflect internal in7 sensorGuenter Roeck1-11/+16
On some chips, in7 is always an internal voltage sensor. Introduce feature flag to reflect this condition to simplify adding support for new chips. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-05hwmon: (it87) Introduce configuration field for chip suffixGuenter Roeck1-3/+17
ITE chips may have 'E', 'F', or both 'E' and 'F' suffixes. Introduce suffic configuration to the it87_devices structure to simplify adding new chips. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-04-05hwmon: (it87) Fix PWM frequency display for chips with newer PWM controlGuenter Roeck1-9/+25
On chips with newer PWM control, the PWM frequency divider is 256 instead of 128. Since the base PWM frequency remained the same, the actual PWM frequency is half of what it used to be with the older PWM control mechanism. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-30hwmon: (it87) Fix pwm sysfs attribute removalGuenter Roeck1-1/+1
Detection if a pwm channel is supported was wrong on removal, causing the code to try removing non-existing sysfs attributes. That didn't matter much because sysfs attribute removal of non-existing files fails silently, and because the wrong evaluation always returned false, but should nevertheless be fixed. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-20hwmon: (ibmpowernv) do not use the OPAL index for hwmon attribute namesCédric Le Goater1-1/+22
The current OPAL firmware exposes the different sensors of an IBM Power system using node names such as : sensors/amb-temp#1-data sensors/amb-temp#1-thrs cooling-fan#1-data cooling-fan#1-faulted cooling-fan#1-thrs cooling-fan#2-data ... The ibmpowernv driver, when loaded, parses these names to extract the sensor index and the sensor attribute name. Unfortunately, this scheme makes it difficult to add sensors with a different layout (specially of the same type, like temperature) as the sensor index calculated in OPAL is directly used in the hwmon sysfs interface. What this patch does is add a independent hwmon index for each sensor. The increment of the hwmon index (temp, fan, power, etc.) is kept per sensor type in the sensor_group table. The sensor_data table is used to store the association of the hwmon and OPAL indexes, as we need to have the same hwmon index for different attributes of a same sensor. Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-20hwmon: (ibmpowernv) change create_hwmon_attr_name() prototypeCédric Le Goater1-17/+20
It simplifies the creation of the hwmon attributes and will help when support for a new device tree layout is added. The patch also changes the name of the routine to parse_opal_node_name(). Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-20hwmon: (ibmpowernv) add a convert_opal_attr_name() routineCédric Le Goater1-14/+22
It simplifies the create_hwmon_attr_name() routine and it clearly isolates the conversion done between the OPAL node names and hwmon attributes names. Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-20hwmon: (ibmpowernv) add a get_sensor_type() routineCédric Le Goater1-11/+15
It will help in adding different compatible properties, coming from a new device tree layout for example. Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-20hwmon: (ibmpowernv) replace AMBIENT_TEMP by TEMPCédric Le Goater1-3/+3
Ambient is too restrictive as there can be other temperature channels : core, memory, etc. Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-16hwmon: (pwm-fan, vexpress) Constify of_device_id arrayFabian Frederick2-2/+2
of_device_id is always used as const. (See driver.of_match_table and open firmware functions) Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-15hwmon: (nct6775) Enable auxiliary fan monitoring on ASRock Z77 Pro4-MGuenter Roeck1-0/+21
Auxiliary fan monitoring is not enabled on ASRock Z77 Pro4-M with BIOS version 2.00 if booted in UEFI Ultra-FastBoot mode. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-15hwmon: (nct6775) Restore hardware monitoring logical device status on resumeGuenter Roeck1-13/+22
After a suspend/resume cycle it is not guaranteed that the hardware monitoring device is still enabled. Ensure that this is the case after resume. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-15hwmon: (nct6775) Convert to use SIMPLE_DEV_PM_OPSGuenter Roeck1-17/+5
Get rid of #ifdef CONFIG_PM by using SIMPLE_DEV_PM_OPS and declaring suspend and resume functions with __maybe_unused. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-10hwmon: (gpio-fan) Fix build with CONFIG_THERMAL=m and SENSORS_GPIO_FAN=yRandy Dunlap1-0/+1
Fix build error when CONFIG_THERMAL=m and SENSORS_GPIO_FAN=y by preventing that combination. Fixes these build errors: drivers/built-in.o: In function `gpio_fan_remove': gpio-fan.c:(.text+0x21e97e): undefined reference to `thermal_cooling_device_unregister' drivers/built-in.o: In function `gpio_fan_probe': gpio-fan.c:(.text+0x21efbc): undefined reference to `thermal_cooling_device_register' Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Jean Delvare <jdelvare@suse.de> Cc: Guenter Roeck <linux@roeck-us.net> Cc: lm-sensors@lm-sensors.org Cc: Simon Guinot <sguinot@lacie.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09hwmon: (pwm-fan) Fix build when THERMAL=mRandy Dunlap1-0/+1
Fix build errors when CONFIG_THERMAL=m and SENSORS_PWM_FAN=y by restricting SENSORS_PWM_FAN to 'm' when THERMAL=m. drivers/built-in.o: In function `pwm_fan_remove': pwm-fan.c:(.text+0x22ba58): undefined reference to `thermal_cooling_device_unregister' drivers/built-in.o: In function `pwm_fan_probe': pwm-fan.c:(.text+0x22bebb): undefined reference to `thermal_of_cooling_device_register' pwm-fan.c:(.text+0x22bf11): undefined reference to `thermal_cdev_update' Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Kamil Debski <k.debski@samsung.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09hwmon: (pwm-fan) Declare pwm_fan_of_get_cooling_data staticGuenter Roeck1-1/+2
Address the following sparse warnings. drivers/hwmon/pwm-fan.c:176:5: warning: symbol 'pwm_fan_of_get_cooling_data' was not declared. Should it be static? drivers/hwmon/pwm-fan.c:176:5: warning: no previous prototype for 'pwm_fan_of_get_cooling_data' pwm_fan_of_get_cooling_data is only used in the pwm-fan driver and thus should be declared static. Cc: Lukasz Majewski <l.majewski@samsung.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09(gpio-fan): Add thermal control hooksNishanth Menon1-7/+76
Allow gpio-fan to be used as thermal cooling device for platforms that use GPIO maps to control fans. As part of this change, we make the shutdown and remove logic the same as well. Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09hwmon: (pwm-fan) Add support for using PWM FAN as a cooling deviceLukasz Majewski1-1/+88
The PWM FAN device can now be used as a thermal cooling device. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Acked-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09hwmon: (pwm-fan) Read PWM FAN configuration from device treeLukasz Majewski1-1/+49
This patch provides code for reading PWM FAN configuration data via device tree. The pwm-fan can work with full speed when configuration is not provided. However, errors are propagated when wrong DT bindings are found. Additionally the struct pwm_fan_ctx has been extended. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09hwmon: (pwm-fan) Extract __set_pwm() function to only modify PWM duty cycleLukasz Majewski1-12/+21
It was necessary to decouple code handling writing to sysfs from the one responsible for setting PWM of the fan. Due to that, new __set_pwm() method was extracted, which is responsible for only setting new PWM duty cycle. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09hwmon: (gpio-fan) allow to use alarm support alone from DTSimon Guinot1-21/+23
On some boards, such as the LaCie 2Big Network v2 or 2Big NAS (based on Marvell Kirkwood SoCs), an I2C fan controller is used but the alarm signal is wired to a separate GPIO. Unfortunately, the gpio-fan driver can't be used to handle GPIO alarm alone from DT: an error is returned if the "gpios" DT property is missing. This patch allows to use the gpio-fan driver even if the "alarm-gpios" DT property is defined alone. Signed-off-by: Simon Guinot <simon.guinot@sequanux.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-03-09hwmon: (nct7904) Strengthen detect functionGuenter Roeck1-1/+2
The bank register has five unused bits. Verify that those bits are zero to strengthen the detect function. Cc: Vadim V. Vlasov <vvlasov@dev.rtsoft.ru> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <jdelvare@suse.de>
2015-03-09hwmon: Add Nuvoton NCT7904 hwmon driverVadim V. Vlasov3-0/+603
The NCT7904D is a hardware monitor supporting up to 20 voltage sensors, internal temperature sensor, Intel PECI and AMD SB-TSI CPU temperature interface, up to 12 fan tachometer inputs, up to 4 fan control channels with SmartFan. Signed-off-by: Vadim V. Vlasov <vvlasov@dev.rtsoft.ru> [Guenter Roeck: Fixed whitespace errors, dropped redundant comment] Signed-off-by: Guenter Roeck <linux@roeck-us.net>