summaryrefslogtreecommitdiff
path: root/drivers/hwmon/axi-fan-control.c
AgeCommit message (Collapse)AuthorFilesLines
2023-10-25hwmon: (axi-fan-control) Fix possible NULL pointer dereferenceDragos Bogdan1-13/+16
axi_fan_control_irq_handler(), dependent on the private axi_fan_control_data structure, might be called before the hwmon device is registered. That will cause an "Unable to handle kernel NULL pointer dereference" error. Fixes: 8412b410fa5e ("hwmon: Support ADI Fan Control IP") Signed-off-by: Dragos Bogdan <dragos.bogdan@analog.com> Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20231025132100.649499-1-nuno.sa@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19hwmon: axi-fan: constify pointers to hwmon_channel_infoKrzysztof Kozlowski1-1/+1
Statically allocated array of pointed to hwmon_channel_info can be made const for safety. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-09-26hwmon: Make use of devm_clk_get_enabled()Uwe Kleine-König1-14/+1
Several drivers manually register a devm handler to disable their clk. Convert them to devm_clk_get_enabled(). Acked-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-03-08hwmon: (axi-fan-control) Use hwmon_notify_eventNuno Sá1-1/+2
Instead of directly accessing kobj directly from the driver, use the hwmon notify API. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20220308135408.440744-1-nuno.sa@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-08-18hwmon: (axi-fan-control) Support temperature vs pwm pointsNuno Sá1-1/+73
The HW has some predefined points where it will associate a PWM value. However some users might want to better set these points to their usecases. This patch exposes these points as pwm auto_points: * pwm1_auto_point1_temp_hyst: temperature threshold below which PWM should be 0%; * pwm1_auto_point1_temp: temperature threshold above which PWM should be 25%; * pwm1_auto_point2_temp_hyst: temperature threshold below which PWM should be 25%; * pwm1_auto_point2_temp: temperature threshold above which PWM should be 50%; * pwm1_auto_point3_temp_hyst: temperature threshold below which PWM should be 50%; * pwm1_auto_point3_temp: temperature threshold above which PWM should be 75%; * pwm1_auto_point4_temp_hyst: temperature threshold below which PWM should be 75%; * pwm1_auto_point4_temp: temperature threshold above which PWM should be 100%; Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20210811114853.159298-4-nuno.sa@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-08-18hwmon: (axi-fan-control) Handle irqs in natural orderNuno Sá1-15/+15
The core will now start out of reset at boot as soon as clocking is available. Hence, by the time we unmask the interrupts we already might have some of them set. Thus, it's important to handle them in the natural order the core generates them. Otherwise, we could process 'ADI_IRQ_SRC_PWM_CHANGED' before 'ADI_IRQ_SRC_TEMP_INCREASE' and erroneously set 'update_tacho_params' to true. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20210811114853.159298-3-nuno.sa@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-08-18hwmon: (axi-fan-control) Make sure the clock is enabledNuno Sá1-0/+13
The core will only work if it's clock is enabled. This patch is a minor enhancement to make sure that's the case. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20210811114853.159298-2-nuno.sa@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-08-05hwmon: (axi-fan-control) remove duplicate macrosAlexandru Ardelean1-4/+0
These macros are also present in the "include/linux/fpga/adi-axi-common.h" file which is included in this driver. This patch removes them from the AXI Fan Control driver. No sense in having them in 2 places. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20200803054311.98174-1-alexandru.ardelean@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-03-09hwmon: Support ADI Fan Control IPNuno Sá1-0/+469
The purpose of this IP Core is to control the fan used for the cooling of a Xilinx Zynq Ultrascale+ MPSoC without the need of any external temperature sensors. To achieve this, the IP core uses the PL SYSMONE4 primitive to obtain the PL temperature and, based on those readings, it then outputs a PWM signal to control the fan rotation accordingly. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20191009102806.262241-1-nuno.sa@analog.com [groeck: adi,pulses-per-revolution -> pulses-per-revolution; dropped unused 'res' from probe function] Signed-off-by: Guenter Roeck <linux@roeck-us.net>