Lines Matching +full:loongson +full:- +full:1 +full:c

1 // SPDX-License-Identifier: GPL-2.0+
3 * Author: zhanghongchen <zhanghongchen@loongson.cn>
4 * Yinbo Zhu <zhuyinbo@loongson.cn>
5 * Copyright (C) 2022-2023 Loongson Technology Corporation Limited
28 #define LOONGSON2_THSENS_INT_HIGH BIT(1)
35 * method of the Loongson-2K2000
54 int reg_off = data->chip_data->thermal_sensor_sel * 2; in loongson2_set_ctrl_regs()
59 writew(reg_ctrl, data->ctrl_reg + ctrl_reg + reg_off); in loongson2_set_ctrl_regs()
66 loongson2_set_ctrl_regs(data, clamp(-40, low, high), true, enable); in loongson2_thermal_set()
79 val = readl(data->ctrl_reg + LOONGSON2_THSENS_OUT_REG); in loongson2_2k1000_get_temp()
80 *temp = ((val & LOONGSON2_THSENS_OUT_MASK) - HECTO) * KILO; in loongson2_2k1000_get_temp()
90 val = readl(data->temp_reg); in loongson2_2k2000_get_temp()
91 *temp = ((val & 0xffff) * 820 / 0x4000 - 311) * KILO; in loongson2_2k2000_get_temp()
101 writeb(LOONGSON2_THSENS_INT_EN, data->ctrl_reg + LOONGSON2_THSENS_STATUS_REG); in loongson2_thermal_irq_thread()
122 struct device *dev = &pdev->dev; in loongson2_thermal_probe()
129 return -ENOMEM; in loongson2_thermal_probe()
131 data->chip_data = device_get_match_data(dev); in loongson2_thermal_probe()
133 data->ctrl_reg = devm_platform_ioremap_resource(pdev, 0); in loongson2_thermal_probe()
134 if (IS_ERR(data->ctrl_reg)) in loongson2_thermal_probe()
135 return PTR_ERR(data->ctrl_reg); in loongson2_thermal_probe()
137 /* The temperature output register is separate for Loongson-2K2000 */ in loongson2_thermal_probe()
138 if (data->chip_data->flags & LS2K2000_THSENS_OUT_FLAG) { in loongson2_thermal_probe()
139 data->temp_reg = devm_platform_ioremap_resource(pdev, 1); in loongson2_thermal_probe()
140 if (IS_ERR(data->temp_reg)) in loongson2_thermal_probe()
141 return PTR_ERR(data->temp_reg); in loongson2_thermal_probe()
150 writeb(LOONGSON2_THSENS_INT_EN, data->ctrl_reg + LOONGSON2_THSENS_STATUS_REG); in loongson2_thermal_probe()
161 if (PTR_ERR(tzd) != -ENODEV) in loongson2_thermal_probe()
189 .compatible = "loongson,ls2k1000-thermal",
193 .compatible = "loongson,ls2k2000-thermal",
210 MODULE_AUTHOR("Loongson Technology Corporation Limited");