aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
Commit message (Collapse)AuthorAge
* hwmon: (nct6683) Add missing sysfs attribute initializationGuenter Roeck2015-05-29
| | | | | | | | | | | | | | | | | | | 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>
* hwmon: (nct6775) Add missing sysfs attribute initializationGuenter Roeck2015-05-29
| | | | | | | | | | | | | | | | | | | 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>
* hwmon: (tmp401) Do not auto-detect chip on I2C address 0x37Guenter Roeck2015-05-29
| | | | | | | | | 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>
* hwmon: (ntc_thermistor) Ensure iio channel is of type IIO_VOLTAGEChris Lesiak2015-05-26
| | | | | | | | | | 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>
* hwmon: (w83795) use find_closest_descending() in pwm_freq_to_reg()Bartosz Golaszewski2015-04-17
| | | | | | | | | | | 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>
* hwmon: (lm85) use find_closest() in x_TO_REG() functionsBartosz Golaszewski2015-04-17
| | | | | | | | | | | 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>
* hwmon: (ina2xx) replace ina226_avg_bits() with find_closest()Bartosz Golaszewski2015-04-17
| | | | | | | | | | 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>
* hwmon: (pwm-fan) Update the duty cycle inorder to control the pwm-fanAnand Moon2015-04-12
| | | | | | | | | | | | 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>
* hwmon: (it87) Use feature macros on sio_dataGuenter Roeck2015-04-09
| | | | | | | 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>
* hwmon: (ibmpowernv) Fix build error seen for some configurationsGuenter Roeck2015-04-09
| | | | | | | | | | | | | 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>
* hwmon: (gpio-fan) Move the thermal registration after registration is completeNishanth Menon2015-04-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* hwmon: (ibmpowernv) pretty print labelsCédric Le Goater2015-04-08
| | | | | | | | | | | | | | | | | 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>
* hwmon: (ibmpowernv) add a label attributeCédric Le Goater2015-04-08
| | | | | | | | | | | 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>
* hwmon: (ibmpowernv) add support for the new device treeCédric Le Goater2015-04-08
| | | | | | | | | | | | | | | | 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>
* hwmon: (ibmpowernv) add a helper routine create_hwmon_attrCédric Le Goater2015-04-08
| | | | | | | 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>
* hwmon: (it87) Add support for 6th fan of IT8620EGuenter Roeck2015-04-05
| | | | | | | IT8620E supports up to 6 fan tachometers. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add support for IT8620EGuenter Roeck2015-04-05
| | | | | | | | | | | 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>
* hwmon: (it87) Add support for IT8790EGuenter Roeck2015-04-05
| | | | | | | | | 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>
* hwmon: (it87) Introduce feature flag to reflect internal in7 sensorGuenter Roeck2015-04-05
| | | | | | | | | 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>
* hwmon: (it87) Introduce configuration field for chip suffixGuenter Roeck2015-04-05
| | | | | | | | | 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>
* hwmon: (it87) Fix PWM frequency display for chips with newer PWM controlGuenter Roeck2015-04-05
| | | | | | | | | | 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>
* hwmon: (it87) Fix pwm sysfs attribute removalGuenter Roeck2015-03-30
| | | | | | | | | | | 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>
* hwmon: (ibmpowernv) do not use the OPAL index for hwmon attribute namesCédric Le Goater2015-03-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* hwmon: (ibmpowernv) change create_hwmon_attr_name() prototypeCédric Le Goater2015-03-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>
* hwmon: (ibmpowernv) add a convert_opal_attr_name() routineCédric Le Goater2015-03-20
| | | | | | | | 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>
* hwmon: (ibmpowernv) add a get_sensor_type() routineCédric Le Goater2015-03-20
| | | | | | | | 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>
* hwmon: (ibmpowernv) replace AMBIENT_TEMP by TEMPCédric Le Goater2015-03-20
| | | | | | | | 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>
* hwmon: (pwm-fan, vexpress) Constify of_device_id arrayFabian Frederick2015-03-16
| | | | | | | | 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>
* hwmon: (nct6775) Enable auxiliary fan monitoring on ASRock Z77 Pro4-MGuenter Roeck2015-03-15
| | | | | | | 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>
* hwmon: (nct6775) Restore hardware monitoring logical device status on resumeGuenter Roeck2015-03-15
| | | | | | | 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>
* hwmon: (nct6775) Convert to use SIMPLE_DEV_PM_OPSGuenter Roeck2015-03-15
| | | | | | | 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>
* hwmon: (gpio-fan) Fix build with CONFIG_THERMAL=m and SENSORS_GPIO_FAN=yRandy Dunlap2015-03-10
| | | | | | | | | | | | | | | | | | | 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>
* hwmon: (pwm-fan) Fix build when THERMAL=mRandy Dunlap2015-03-09
| | | | | | | | | | | | | | | 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>
* hwmon: (pwm-fan) Declare pwm_fan_of_get_cooling_data staticGuenter Roeck2015-03-09
| | | | | | | | | | | | | | | | 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>
* (gpio-fan): Add thermal control hooksNishanth Menon2015-03-09
| | | | | | | | | | | | 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>
* hwmon: (pwm-fan) Add support for using PWM FAN as a cooling deviceLukasz Majewski2015-03-09
| | | | | | | | 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>
* hwmon: (pwm-fan) Read PWM FAN configuration from device treeLukasz Majewski2015-03-09
| | | | | | | | | | | 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>
* hwmon: (pwm-fan) Extract __set_pwm() function to only modify PWM duty cycleLukasz Majewski2015-03-09
| | | | | | | | | | 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>
* hwmon: (gpio-fan) allow to use alarm support alone from DTSimon Guinot2015-03-09
| | | | | | | | | | | | | | 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>
* hwmon: (nct7904) Strengthen detect functionGuenter Roeck2015-03-09
| | | | | | | | | 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>
* hwmon: Add Nuvoton NCT7904 hwmon driverVadim V. Vlasov2015-03-09
| | | | | | | | | | | 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>
* hwmon: (it87) No need to skip fan4 for IT8603Guenter Roeck2015-03-09
| | | | | | | IT8603 only supports three fans, so it is not necessary to skip fan4. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add support for IT8786EThomas Lorblanches2015-03-09
| | | | | | | | | | IT8786E is mostly compatible with IT8771 / IT8772. Parameters determined by testing various combinations. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Thomas Lorblanches <zlika_ese@hotmail.com> [Guenter Roeck: merged from github, addressed review comments] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add feature flag for VID supportGuenter Roeck2015-03-09
| | | | | | | | | Newer chips don't typically support VID inputs or control. Add a feature flag for VID support to simplify adding support for new chips. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add feature flags for fans count and 16-bit fan configurationGuenter Roeck2015-03-09
| | | | | | | | | Fans 4-5 are not supported on all chips and revisions. Also, 16-bit fan counters are always enabled on some chips. Provide feature flags to simplify adding support for new chips. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Don't configure 16 bit fan counters it not necessaryGuenter Roeck2015-03-09
| | | | | | | | On IT8728F, IT8771E, and IT8772E, fans counters are always 16 bit and don't need to be configured for it. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (jc42) Add support for additional IDT temperature sensorsGuenter Roeck2015-03-09
| | | | | | | | | | | | | | | | TS3000GB0 has a new device ID (0x2913). Since IDT's datasheets suggest that the upper 8 bit of the device ID reflect the chip ID and the lower 8 bit reflect the version number, modify the code to accept all chips with ID 0x29xx. Also add support for TS3001 and TSE2004. Some of the datasheets for older chips are no longer available from the IDT web site, so replace explicit links in the documentation with a generic note. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (it87) Add support for IT8781FGuenter Roeck2015-03-09
| | | | | | | | | IT8781F is mostly compatible to IT8782F. Major difference is that it only supports four instead of six UART channels, and therefore does not share the uart6 pins. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (ibmpex) Allow format string checkingRasmus Villemoes2015-03-09
| | | | | | | | | | | | | | The only difference between the three power_sensor_name_templates is whether there is a suffix of "", "_lowest" or "_highest". We might as well pull those into an array and use a literal format string, allowing gcc to do type checking of the arguments to sprintf. Incidentially, the same three suffixes are used in the temp_sensor_name_templates case, so we end up eliminating one static array. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> [Guenter Roeck: Fixed line length over 80 characters] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (coretemp) Allow format checkingRasmus Villemoes2015-03-09
| | | | | | | | | By extracting the only part that differs we can allow static checking of the format string, and possibly save a little .rodata. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> [Guenter Roeck: continuation line alignment] Signed-off-by: Guenter Roeck <linux@roeck-us.net>