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 <dm.h>
10 #include <thermal.h>
11
sandbox_thermal_get_temp(struct udevice * dev,int * temp)12 int sandbox_thermal_get_temp(struct udevice *dev, int *temp)
13 {
14 /* Simply return 100 deg C */
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 };
36