blob: 7dc0d108b8ca6df35d363d1d3c153405bcf1e987 [file] [log] [blame]
Robert Marko9cf87122022-09-06 13:30:35 +02001// 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
13int sandbox_thermal_get_temp(struct udevice *dev, int *temp)
14{
Michal Simekcc046dc2024-04-16 08:55:19 +020015 /* Simply return 100 deg C */
Robert Marko9cf87122022-09-06 13:30:35 +020016 *temp = 100;
17
18 return 0;
19}
20
21static const struct dm_thermal_ops sandbox_thermal_ops = {
22 .get_temp = sandbox_thermal_get_temp,
23};
24
25static const struct udevice_id sandbox_thermal_ids[] = {
26 { .compatible = "sandbox,thermal" },
27 { }
28};
29
30U_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};