Commit Graph

11 Commits

Author SHA1 Message Date
Boris Brezillon 2289711c9d hwmon: pwm-fan: Use pwm_get_args() where appropriate
The PWM framework has clarified the concept of reference PWM config (the
platform dependent config retrieved from the DT or the PWM lookup table)
and real PWM state.

Use pwm_get_args() when the PWM user wants to retrieve this reference
config and not the current state.

This is part of the rework allowing the PWM framework to support
hardware readout and expose real PWM state even when the PWM has just
been requested (before the user calls pwm_config/enable/disable()).

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2016-05-17 14:45:00 +02:00
Luis de Bethencourt f491e70ccf hwmon: (pwm-fan) Fix module autoload for OF platform driver
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-09-20 17:50:19 -07:00
Anand Moon f354169e0f hwmon: (pwm-fan) Update the duty cycle inorder to control the pwm-fan
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-12 15:59:11 -07:00
Fabian Frederick d720acace4 hwmon: (pwm-fan, vexpress) Constify of_device_id array
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-16 13:00:32 -07:00
Guenter Roeck de52b049d6 hwmon: (pwm-fan) Declare pwm_fan_of_get_cooling_data static
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 09:59:36 -07:00
Lukasz Majewski b6bddec019 hwmon: (pwm-fan) Add support for using PWM FAN as a cooling device
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-09 09:59:36 -07:00
Lukasz Majewski 2e5219c771 hwmon: (pwm-fan) Read PWM FAN configuration from device tree
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-09 09:59:36 -07:00
Lukasz Majewski cb85ca332f hwmon: (pwm-fan) Extract __set_pwm() function to only modify PWM duty cycle
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-09 09:59:36 -07:00
Kamil Debski 48b9d5b4f4 hwmon: (pwm-fan) Fix suspend/resume behavior
The state of a PWM output is not clearly defined after resume. Some PWM
drivers do not restore the duty cycle upon resume, thus it is necessary to
manually restore the correct value.

Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-11-11 10:39:45 -08:00
Axel Lin 4e8e75f6a4 hwmon: (pwm-fan) Remove duplicate dev_set_drvdata call
The dev_set_drvdata() call is equivalent to the platform_set_drvdata() call in
next line.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-08-04 07:01:40 -07:00
Kamil Debski d82d57767c hwmon: Add pwm-fan driver
The pwm-fan driver enables control of fans connected to PWM lines.
This driver uses the PWM framework, so it is compatible with all
PWM devices that provide drivers through the PWM framework.

Signed-off-by: Kamil Debski <k.debski@samsung.com>
Reviewed-by: Varka Bhadram <varkabhadram@gmail.com>
Reviewed-by: Tobias Klauser <tklauser@distanz.ch>
[Guenter Roeck: Last argument to devm_of_pwm_get is pointer, use NULL]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-08-04 07:01:38 -07:00