Robert Marko | 9cf8712 | 2022-09-06 13:30:35 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 2 | /* |
| 3 | * Copyright (c) 2022 Sartura Ltd. |
| 4 | * Written by Robert Marko <robert.marko@sartura.hr> |
| 5 | * |
| 6 | * Sandbox driver for the thermal uclass. |
| 7 | */ |
| 8 | |
Robert Marko | 9cf8712 | 2022-09-06 13:30:35 +0200 | [diff] [blame] | 9 | #include <dm.h> |
| 10 | #include <thermal.h> |
| 11 | |
| 12 | int sandbox_thermal_get_temp(struct udevice *dev, int *temp) |
| 13 | { |
Michal Simek | cc046dc | 2024-04-16 08:55:19 +0200 | [diff] [blame] | 14 | /* Simply return 100 deg C */ |
Robert Marko | 9cf8712 | 2022-09-06 13:30:35 +0200 | [diff] [blame] | 15 | *temp = 100; |
| 16 | |
| 17 | return 0; |
| 18 | } |
| 19 | |
| 20 | static const struct dm_thermal_ops sandbox_thermal_ops = { |
| 21 | .get_temp = sandbox_thermal_get_temp, |
| 22 | }; |
| 23 | |
| 24 | static const struct udevice_id sandbox_thermal_ids[] = { |
| 25 | { .compatible = "sandbox,thermal" }, |
| 26 | { } |
| 27 | }; |
| 28 | |
| 29 | U_BOOT_DRIVER(thermal_sandbox) = { |
| 30 | .name = "thermal-sandbox", |
| 31 | .id = UCLASS_THERMAL, |
| 32 | .of_match = sandbox_thermal_ids, |
| 33 | .ops = &sandbox_thermal_ops, |
| 34 | .flags = DM_FLAG_PRE_RELOC, |
| 35 | }; |