| // SPDX-License-Identifier: GPL-2.0+ |
| * TI LM74 temperature sensor driver |
| * Copyright (C) 2024 CS GROUP France |
| static int ti_lm74_get_temp(struct udevice *dev, int *temp) |
| ret = dm_spi_claim_bus(dev); |
| ret = dm_spi_xfer(dev, 16, NULL, buf, SPI_XFER_BEGIN | SPI_XFER_END); |
| raw = ((buf[0] << 8) + buf[1]) >> 3; |
| *temp = (((int)raw * 125) + 1000) / 2000; |
| static struct dm_thermal_ops ti_lm74_ops = { |
| .get_temp = ti_lm74_get_temp, |
| static const struct udevice_id of_ti_lm74_match[] = { |
| U_BOOT_DRIVER(ti_bandgap_thermal) = { |
| .name = "ti_lm74_thermal", |
| .of_match = of_ti_lm74_match, |