diff options
author | Caesar Wang <wxt@rock-chips.com> | 2016-12-12 06:05:35 -0500 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2016-12-13 23:32:08 -0500 |
commit | 18591add41ec9558ce0e32ef88626c18cc70c686 (patch) | |
tree | 52ee4a9ad20ad134b128d7e7d88850f7361a6d60 /drivers/thermal | |
parent | cadf29dc2a8bcaae83e6e4c3229965de747c8601 (diff) |
thermal: rockchip: handle set_trips without the trip points
In some cases, some sensors didn't need the trip points, the
set_trips will pass {-INT_MAX, INT_MAX} to trigger tsadc alarm in the end,
ignore this case and disable the high temperature interrupt.
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/rockchip_thermal.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index cacc12b44ca1..cbbf0ce2302c 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c | |||
@@ -674,7 +674,21 @@ static int rk_tsadcv2_get_temp(const struct chip_tsadc_table *table, | |||
674 | static int rk_tsadcv2_alarm_temp(const struct chip_tsadc_table *table, | 674 | static int rk_tsadcv2_alarm_temp(const struct chip_tsadc_table *table, |
675 | int chn, void __iomem *regs, int temp) | 675 | int chn, void __iomem *regs, int temp) |
676 | { | 676 | { |
677 | u32 alarm_value, int_en; | 677 | u32 alarm_value; |
678 | u32 int_en, int_clr; | ||
679 | |||
680 | /* | ||
681 | * In some cases, some sensors didn't need the trip points, the | ||
682 | * set_trips will pass {-INT_MAX, INT_MAX} to trigger tsadc alarm | ||
683 | * in the end, ignore this case and disable the high temperature | ||
684 | * interrupt. | ||
685 | */ | ||
686 | if (temp == INT_MAX) { | ||
687 | int_clr = readl_relaxed(regs + TSADCV2_INT_EN); | ||
688 | int_clr &= ~TSADCV2_INT_SRC_EN(chn); | ||
689 | writel_relaxed(int_clr, regs + TSADCV2_INT_EN); | ||
690 | return 0; | ||
691 | } | ||
678 | 692 | ||
679 | /* Make sure the value is valid */ | 693 | /* Make sure the value is valid */ |
680 | alarm_value = rk_tsadcv2_temp_to_code(table, temp); | 694 | alarm_value = rk_tsadcv2_temp_to_code(table, temp); |