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