Lines Matching +full:de +full:- +full:asserted

1 // SPDX-License-Identifier: GPL-2.0
19 * TempSensor reset. The RSTN can be de-asserted once the analog core has
21 * 0:reset 1:de-assert
27 * Tpu(min 50us) after PD is de-asserted. RSTN should be held low until the
41 * Temp(C)=DOUT*Y/4094 - K
65 writel(SFCTEMP_PD, sfctemp->regs); in sfctemp_power_up()
68 writel(0, sfctemp->regs); in sfctemp_power_up()
72 /* de-assert reset */ in sfctemp_power_up()
73 writel(SFCTEMP_RSTN, sfctemp->regs); in sfctemp_power_up()
79 writel(SFCTEMP_PD, sfctemp->regs); in sfctemp_power_down()
84 writel(SFCTEMP_RSTN | SFCTEMP_RUN, sfctemp->regs); in sfctemp_run()
90 writel(SFCTEMP_RSTN, sfctemp->regs); in sfctemp_stop()
97 mutex_lock(&sfctemp->lock); in sfctemp_enable()
98 if (sfctemp->enabled) in sfctemp_enable()
101 ret = clk_prepare_enable(sfctemp->clk_bus); in sfctemp_enable()
104 ret = reset_control_deassert(sfctemp->rst_bus); in sfctemp_enable()
108 ret = clk_prepare_enable(sfctemp->clk_sense); in sfctemp_enable()
111 ret = reset_control_deassert(sfctemp->rst_sense); in sfctemp_enable()
117 sfctemp->enabled = true; in sfctemp_enable()
119 mutex_unlock(&sfctemp->lock); in sfctemp_enable()
123 clk_disable_unprepare(sfctemp->clk_sense); in sfctemp_enable()
125 reset_control_assert(sfctemp->rst_bus); in sfctemp_enable()
127 clk_disable_unprepare(sfctemp->clk_bus); in sfctemp_enable()
129 mutex_unlock(&sfctemp->lock); in sfctemp_enable()
135 mutex_lock(&sfctemp->lock); in sfctemp_disable()
136 if (!sfctemp->enabled) in sfctemp_disable()
141 reset_control_assert(sfctemp->rst_sense); in sfctemp_disable()
142 clk_disable_unprepare(sfctemp->clk_sense); in sfctemp_disable()
143 reset_control_assert(sfctemp->rst_bus); in sfctemp_disable()
144 clk_disable_unprepare(sfctemp->clk_bus); in sfctemp_disable()
145 sfctemp->enabled = false; in sfctemp_disable()
147 mutex_unlock(&sfctemp->lock); in sfctemp_disable()
160 mutex_lock(&sfctemp->lock); in sfctemp_convert()
161 if (!sfctemp->enabled) { in sfctemp_convert()
162 ret = -ENODATA; in sfctemp_convert()
167 *val = (long)((readl(sfctemp->regs) & SFCTEMP_DOUT_MSK) >> SFCTEMP_DOUT_POS) in sfctemp_convert()
168 * SFCTEMP_Y1000 / SFCTEMP_Z - SFCTEMP_K1000; in sfctemp_convert()
172 mutex_unlock(&sfctemp->lock); in sfctemp_convert()
203 *val = sfctemp->enabled; in sfctemp_read()
208 return -EINVAL; in sfctemp_read()
211 return -EINVAL; in sfctemp_read()
228 return -EINVAL; in sfctemp_write()
230 return -EINVAL; in sfctemp_write()
233 return -EINVAL; in sfctemp_write()
256 struct device *dev = &pdev->dev; in sfctemp_probe()
263 return -ENOMEM; in sfctemp_probe()
266 mutex_init(&sfctemp->lock); in sfctemp_probe()
268 sfctemp->regs = devm_platform_ioremap_resource(pdev, 0); in sfctemp_probe()
269 if (IS_ERR(sfctemp->regs)) in sfctemp_probe()
270 return PTR_ERR(sfctemp->regs); in sfctemp_probe()
272 sfctemp->clk_sense = devm_clk_get(dev, "sense"); in sfctemp_probe()
273 if (IS_ERR(sfctemp->clk_sense)) in sfctemp_probe()
274 return dev_err_probe(dev, PTR_ERR(sfctemp->clk_sense), in sfctemp_probe()
277 sfctemp->clk_bus = devm_clk_get(dev, "bus"); in sfctemp_probe()
278 if (IS_ERR(sfctemp->clk_bus)) in sfctemp_probe()
279 return dev_err_probe(dev, PTR_ERR(sfctemp->clk_bus), in sfctemp_probe()
282 sfctemp->rst_sense = devm_reset_control_get_exclusive(dev, "sense"); in sfctemp_probe()
283 if (IS_ERR(sfctemp->rst_sense)) in sfctemp_probe()
284 return dev_err_probe(dev, PTR_ERR(sfctemp->rst_sense), in sfctemp_probe()
287 sfctemp->rst_bus = devm_reset_control_get_exclusive(dev, "bus"); in sfctemp_probe()
288 if (IS_ERR(sfctemp->rst_bus)) in sfctemp_probe()
289 return dev_err_probe(dev, PTR_ERR(sfctemp->rst_bus), in sfctemp_probe()
292 ret = reset_control_assert(sfctemp->rst_sense); in sfctemp_probe()
296 ret = reset_control_assert(sfctemp->rst_bus); in sfctemp_probe()
314 { .compatible = "starfive,jh7100-temp" },
315 { .compatible = "starfive,jh7110-temp" },