thermal: add sandbox driver

Provide a simple sandbox driver for the thermal uclass.
It simply registers and returns 100 degrees C if requested.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Robert Marko 2022-09-06 13:30:35 +02:00 committed by Tom Rini
parent 0995e81e10
commit 1fad2cb852
9 changed files with 55 additions and 0 deletions

View File

@ -443,6 +443,10 @@
sandbox_tee { sandbox_tee {
compatible = "sandbox,tee"; compatible = "sandbox,tee";
}; };
thermal {
compatible = "sandbox,thermal";
};
}; };
&cros_ec { &cros_ec {

View File

@ -1694,6 +1694,10 @@
compatible = "sandbox,regmap_test"; compatible = "sandbox,regmap_test";
}; };
}; };
thermal {
compatible = "sandbox,thermal";
};
}; };
#include "sandbox_pmic.dtsi" #include "sandbox_pmic.dtsi"

View File

@ -79,6 +79,7 @@ CONFIG_CMD_PCI=y
CONFIG_CMD_READ=y CONFIG_CMD_READ=y
CONFIG_CMD_REMOTEPROC=y CONFIG_CMD_REMOTEPROC=y
CONFIG_CMD_SPI=y CONFIG_CMD_SPI=y
CONFIG_CMD_TEMPERATURE=y
CONFIG_CMD_USB=y CONFIG_CMD_USB=y
CONFIG_CMD_AXI=y CONFIG_CMD_AXI=y
CONFIG_CMD_SETEXPR_FMT=y CONFIG_CMD_SETEXPR_FMT=y
@ -281,6 +282,7 @@ CONFIG_SYSINFO=y
CONFIG_SYSINFO_SANDBOX=y CONFIG_SYSINFO_SANDBOX=y
CONFIG_SYSINFO_GPIO=y CONFIG_SYSINFO_GPIO=y
CONFIG_SYSRESET=y CONFIG_SYSRESET=y
CONFIG_DM_THERMAL=y
CONFIG_TIMER=y CONFIG_TIMER=y
CONFIG_TIMER_EARLY=y CONFIG_TIMER_EARLY=y
CONFIG_SANDBOX_TIMER=y CONFIG_SANDBOX_TIMER=y

View File

@ -45,6 +45,7 @@ CONFIG_CMD_OSD=y
CONFIG_CMD_PCI=y CONFIG_CMD_PCI=y
CONFIG_CMD_REMOTEPROC=y CONFIG_CMD_REMOTEPROC=y
CONFIG_CMD_SPI=y CONFIG_CMD_SPI=y
CONFIG_CMD_TEMPERATURE=y
CONFIG_CMD_USB=y CONFIG_CMD_USB=y
CONFIG_BOOTP_DNS2=y CONFIG_BOOTP_DNS2=y
CONFIG_CMD_TFTPPUT=y CONFIG_CMD_TFTPPUT=y
@ -186,6 +187,7 @@ CONFIG_SYSINFO=y
CONFIG_SYSINFO_SANDBOX=y CONFIG_SYSINFO_SANDBOX=y
CONFIG_SYSINFO_GPIO=y CONFIG_SYSINFO_GPIO=y
CONFIG_SYSRESET=y CONFIG_SYSRESET=y
CONFIG_DM_THERMAL=y
CONFIG_TIMER=y CONFIG_TIMER=y
CONFIG_TIMER_EARLY=y CONFIG_TIMER_EARLY=y
CONFIG_SANDBOX_TIMER=y CONFIG_SANDBOX_TIMER=y

View File

@ -62,6 +62,7 @@ CONFIG_CMD_OSD=y
CONFIG_CMD_PCI=y CONFIG_CMD_PCI=y
CONFIG_CMD_REMOTEPROC=y CONFIG_CMD_REMOTEPROC=y
CONFIG_CMD_SPI=y CONFIG_CMD_SPI=y
CONFIG_CMD_TEMPERATURE=y
CONFIG_CMD_USB=y CONFIG_CMD_USB=y
CONFIG_BOOTP_DNS2=y CONFIG_BOOTP_DNS2=y
CONFIG_CMD_TFTPPUT=y CONFIG_CMD_TFTPPUT=y
@ -213,6 +214,7 @@ CONFIG_SYSINFO_SANDBOX=y
CONFIG_SYSINFO_GPIO=y CONFIG_SYSINFO_GPIO=y
CONFIG_SYSRESET=y CONFIG_SYSRESET=y
CONFIG_SPL_SYSRESET=y CONFIG_SPL_SYSRESET=y
CONFIG_DM_THERMAL=y
CONFIG_TIMER=y CONFIG_TIMER=y
CONFIG_TIMER_EARLY=y CONFIG_TIMER_EARLY=y
CONFIG_SANDBOX_TIMER=y CONFIG_SANDBOX_TIMER=y

View File

@ -62,6 +62,7 @@ CONFIG_CMD_OSD=y
CONFIG_CMD_PCI=y CONFIG_CMD_PCI=y
CONFIG_CMD_REMOTEPROC=y CONFIG_CMD_REMOTEPROC=y
CONFIG_CMD_SPI=y CONFIG_CMD_SPI=y
CONFIG_CMD_TEMPERATURE=y
CONFIG_CMD_USB=y CONFIG_CMD_USB=y
CONFIG_BOOTP_DNS2=y CONFIG_BOOTP_DNS2=y
CONFIG_CMD_TFTPPUT=y CONFIG_CMD_TFTPPUT=y
@ -216,6 +217,7 @@ CONFIG_SYSINFO_SANDBOX=y
CONFIG_SYSINFO_GPIO=y CONFIG_SYSINFO_GPIO=y
CONFIG_SYSRESET=y CONFIG_SYSRESET=y
CONFIG_SPL_SYSRESET=y CONFIG_SPL_SYSRESET=y
CONFIG_DM_THERMAL=y
CONFIG_TIMER=y CONFIG_TIMER=y
CONFIG_TIMER_EARLY=y CONFIG_TIMER_EARLY=y
CONFIG_SANDBOX_TIMER=y CONFIG_SANDBOX_TIMER=y

View File

@ -74,6 +74,7 @@ CONFIG_CMD_OSD=y
CONFIG_CMD_PCI=y CONFIG_CMD_PCI=y
CONFIG_CMD_REMOTEPROC=y CONFIG_CMD_REMOTEPROC=y
CONFIG_CMD_SPI=y CONFIG_CMD_SPI=y
CONFIG_CMD_TEMPERATURE=y
CONFIG_CMD_USB=y CONFIG_CMD_USB=y
CONFIG_BOOTP_DNS2=y CONFIG_BOOTP_DNS2=y
CONFIG_CMD_TFTPPUT=y CONFIG_CMD_TFTPPUT=y
@ -223,6 +224,7 @@ CONFIG_SYSINFO_GPIO=y
CONFIG_SYSRESET=y CONFIG_SYSRESET=y
CONFIG_SPL_SYSRESET=y CONFIG_SPL_SYSRESET=y
CONFIG_TPL_SYSRESET=y CONFIG_TPL_SYSRESET=y
CONFIG_DM_THERMAL=y
CONFIG_TIMER=y CONFIG_TIMER=y
CONFIG_TIMER_EARLY=y CONFIG_TIMER_EARLY=y
CONFIG_SANDBOX_TIMER=y CONFIG_SANDBOX_TIMER=y

View File

@ -4,6 +4,7 @@
# Author: Nitin Garg <nitin.garg@freescale.com> # Author: Nitin Garg <nitin.garg@freescale.com>
obj-$(CONFIG_DM_THERMAL) += thermal-uclass.o obj-$(CONFIG_DM_THERMAL) += thermal-uclass.o
obj-$(CONFIG_SANDBOX) += thermal_sandbox.o
obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o
obj-$(CONFIG_IMX_SCU_THERMAL) += imx_scu_thermal.o obj-$(CONFIG_IMX_SCU_THERMAL) += imx_scu_thermal.o
obj-$(CONFIG_TI_DRA7_THERMAL) += ti-bandgap.o obj-$(CONFIG_TI_DRA7_THERMAL) += ti-bandgap.o

View File

@ -0,0 +1,36 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2022 Sartura Ltd.
* Written by Robert Marko <robert.marko@sartura.hr>
*
* Sandbox driver for the thermal uclass.
*/
#include <common.h>
#include <dm.h>
#include <thermal.h>
int sandbox_thermal_get_temp(struct udevice *dev, int *temp)
{
/* Simply return 100°C */
*temp = 100;
return 0;
}
static const struct dm_thermal_ops sandbox_thermal_ops = {
.get_temp = sandbox_thermal_get_temp,
};
static const struct udevice_id sandbox_thermal_ids[] = {
{ .compatible = "sandbox,thermal" },
{ }
};
U_BOOT_DRIVER(thermal_sandbox) = {
.name = "thermal-sandbox",
.id = UCLASS_THERMAL,
.of_match = sandbox_thermal_ids,
.ops = &sandbox_thermal_ops,
.flags = DM_FLAG_PRE_RELOC,
};