luckfox-pico-sdk/sysdrv/source/uboot/u-boot/drivers/power/domain/sandbox-power-domain.c
luckfox-eng29 8f34c2760d project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between
the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door
for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more
usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp:
Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for
compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem.
sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device
tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately.
sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick
boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades.
sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for
fastboot.

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
2024-10-14 09:47:04 +08:00

105 lines
2.2 KiB
C

/*
* Copyright (c) 2016, NVIDIA CORPORATION.
*
* SPDX-License-Identifier: GPL-2.0
*/
#include <common.h>
#include <dm.h>
#include <power-domain-uclass.h>
#include <asm/io.h>
#include <asm/power-domain.h>
#define SANDBOX_POWER_DOMAINS 3
struct sandbox_power_domain {
bool on[SANDBOX_POWER_DOMAINS];
};
static int sandbox_power_domain_request(struct power_domain *power_domain)
{
debug("%s(power_domain=%p)\n", __func__, power_domain);
if (power_domain->id >= SANDBOX_POWER_DOMAINS)
return -EINVAL;
return 0;
}
static int sandbox_power_domain_free(struct power_domain *power_domain)
{
debug("%s(power_domain=%p)\n", __func__, power_domain);
return 0;
}
static int sandbox_power_domain_on(struct power_domain *power_domain)
{
struct sandbox_power_domain *sbr = dev_get_priv(power_domain->dev);
debug("%s(power_domain=%p)\n", __func__, power_domain);
sbr->on[power_domain->id] = true;
return 0;
}
static int sandbox_power_domain_off(struct power_domain *power_domain)
{
struct sandbox_power_domain *sbr = dev_get_priv(power_domain->dev);
debug("%s(power_domain=%p)\n", __func__, power_domain);
sbr->on[power_domain->id] = false;
return 0;
}
static int sandbox_power_domain_bind(struct udevice *dev)
{
debug("%s(dev=%p)\n", __func__, dev);
return 0;
}
static int sandbox_power_domain_probe(struct udevice *dev)
{
debug("%s(dev=%p)\n", __func__, dev);
return 0;
}
static const struct udevice_id sandbox_power_domain_ids[] = {
{ .compatible = "sandbox,power-domain" },
{ }
};
struct power_domain_ops sandbox_power_domain_ops = {
.request = sandbox_power_domain_request,
.rfree = sandbox_power_domain_free,
.on = sandbox_power_domain_on,
.off = sandbox_power_domain_off,
};
U_BOOT_DRIVER(sandbox_power_domain) = {
.name = "sandbox_power_domain",
.id = UCLASS_POWER_DOMAIN,
.of_match = sandbox_power_domain_ids,
.bind = sandbox_power_domain_bind,
.probe = sandbox_power_domain_probe,
.priv_auto_alloc_size = sizeof(struct sandbox_power_domain),
.ops = &sandbox_power_domain_ops,
};
int sandbox_power_domain_query(struct udevice *dev, unsigned long id)
{
struct sandbox_power_domain *sbr = dev_get_priv(dev);
debug("%s(dev=%p, id=%ld)\n", __func__, dev, id);
if (id >= SANDBOX_POWER_DOMAINS)
return -EINVAL;
return sbr->on[id];
}