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
9 #include <common.h>
10 #include <dm.h>
11 #include <thermal.h>
12
sandbox_thermal_get_temp(struct udevice * dev,int * temp)13 int sandbox_thermal_get_temp(struct udevice *dev, int *temp)
14 {
15 /* Simply return 100°C */
16 *temp = 100;
17
18 return 0;
19 }
20
21 static const struct dm_thermal_ops sandbox_thermal_ops = {
22 .get_temp = sandbox_thermal_get_temp,
23 };
24
25 static const struct udevice_id sandbox_thermal_ids[] = {
26 { .compatible = "sandbox,thermal" },
27 { }
28 };
29
30 U_BOOT_DRIVER(thermal_sandbox) = {
31 .name = "thermal-sandbox",
32 .id = UCLASS_THERMAL,
33 .of_match = sandbox_thermal_ids,
34 .ops = &sandbox_thermal_ops,
35 .flags = DM_FLAG_PRE_RELOC,
36 };
37