mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 12:30:53 +07:00
Merge branches 'pm-avs', 'pm-clk', 'pm-devfreq' and 'pm-sleep'
* pm-avs: PM / AVS: rockchip-io: add io selectors and supplies for rk3399 * pm-clk: PM / clk: Add support for obtaining clocks from device-tree * pm-devfreq: PM / devfreq: Spelling s/frequnecy/frequency/ * pm-sleep: ACPI / PM: Runtime resume devices when waking from hibernate PM / sleep: Clear pm_suspend_global_flags upon hibernate
This commit is contained in:
commit
3513ac743d
@ -35,6 +35,8 @@ Required properties:
|
||||
- "rockchip,rk3288-io-voltage-domain" for rk3288
|
||||
- "rockchip,rk3368-io-voltage-domain" for rk3368
|
||||
- "rockchip,rk3368-pmu-io-voltage-domain" for rk3368 pmu-domains
|
||||
- "rockchip,rk3399-io-voltage-domain" for rk3399
|
||||
- "rockchip,rk3399-pmu-io-voltage-domain" for rk3399 pmu-domains
|
||||
- rockchip,grf: phandle to the syscon managing the "general register files"
|
||||
|
||||
|
||||
@ -79,6 +81,15 @@ Possible supplies for rk3368 pmu-domains:
|
||||
- pmu-supply: The supply connected to PMUIO_VDD.
|
||||
- vop-supply: The supply connected to LCDC_VDD.
|
||||
|
||||
Possible supplies for rk3399:
|
||||
- bt656-supply: The supply connected to APIO2_VDD.
|
||||
- audio-supply: The supply connected to APIO5_VDD.
|
||||
- sdmmc-supply: The supply connected to SDMMC0_VDD.
|
||||
- gpio1830 The supply connected to APIO4_VDD.
|
||||
|
||||
Possible supplies for rk3399 pmu-domains:
|
||||
- pmu1830-supply:The supply connected to PMUIO2_VDD.
|
||||
|
||||
Example:
|
||||
|
||||
io-domains {
|
||||
|
@ -748,6 +748,7 @@ static int acpi_hibernation_enter(void)
|
||||
|
||||
static void acpi_hibernation_leave(void)
|
||||
{
|
||||
pm_set_resume_via_firmware();
|
||||
/*
|
||||
* If ACPI is not enabled by the BIOS and the boot kernel, we need to
|
||||
* enable it here.
|
||||
|
@ -137,6 +137,62 @@ int pm_clk_add_clk(struct device *dev, struct clk *clk)
|
||||
return __pm_clk_add(dev, NULL, clk);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* of_pm_clk_add_clks - Start using device clock(s) for power management.
|
||||
* @dev: Device whose clock(s) is going to be used for power management.
|
||||
*
|
||||
* Add a series of clocks described in the 'clocks' device-tree node for
|
||||
* a device to the list of clocks used for the power management of @dev.
|
||||
* On success, returns the number of clocks added. Returns a negative
|
||||
* error code if there are no clocks in the device node for the device
|
||||
* or if adding a clock fails.
|
||||
*/
|
||||
int of_pm_clk_add_clks(struct device *dev)
|
||||
{
|
||||
struct clk **clks;
|
||||
unsigned int i, count;
|
||||
int ret;
|
||||
|
||||
if (!dev || !dev->of_node)
|
||||
return -EINVAL;
|
||||
|
||||
count = of_count_phandle_with_args(dev->of_node, "clocks",
|
||||
"#clock-cells");
|
||||
if (count == 0)
|
||||
return -ENODEV;
|
||||
|
||||
clks = kcalloc(count, sizeof(*clks), GFP_KERNEL);
|
||||
if (!clks)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
clks[i] = of_clk_get(dev->of_node, i);
|
||||
if (IS_ERR(clks[i])) {
|
||||
ret = PTR_ERR(clks[i]);
|
||||
goto error;
|
||||
}
|
||||
|
||||
ret = pm_clk_add_clk(dev, clks[i]);
|
||||
if (ret) {
|
||||
clk_put(clks[i]);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
kfree(clks);
|
||||
|
||||
return i;
|
||||
|
||||
error:
|
||||
while (i--)
|
||||
pm_clk_remove_clk(dev, clks[i]);
|
||||
|
||||
kfree(clks);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* __pm_clk_remove - Destroy PM clock entry.
|
||||
* @ce: PM clock entry to destroy.
|
||||
@ -197,6 +253,39 @@ void pm_clk_remove(struct device *dev, const char *con_id)
|
||||
__pm_clk_remove(ce);
|
||||
}
|
||||
|
||||
/**
|
||||
* pm_clk_remove_clk - Stop using a device clock for power management.
|
||||
* @dev: Device whose clock should not be used for PM any more.
|
||||
* @clk: Clock pointer
|
||||
*
|
||||
* Remove the clock pointed to by @clk from the list of clocks used for
|
||||
* the power management of @dev.
|
||||
*/
|
||||
void pm_clk_remove_clk(struct device *dev, struct clk *clk)
|
||||
{
|
||||
struct pm_subsys_data *psd = dev_to_psd(dev);
|
||||
struct pm_clock_entry *ce;
|
||||
|
||||
if (!psd || !clk)
|
||||
return;
|
||||
|
||||
spin_lock_irq(&psd->lock);
|
||||
|
||||
list_for_each_entry(ce, &psd->clock_list, node) {
|
||||
if (clk == ce->clk)
|
||||
goto remove;
|
||||
}
|
||||
|
||||
spin_unlock_irq(&psd->lock);
|
||||
return;
|
||||
|
||||
remove:
|
||||
list_del(&ce->node);
|
||||
spin_unlock_irq(&psd->lock);
|
||||
|
||||
__pm_clk_remove(ce);
|
||||
}
|
||||
|
||||
/**
|
||||
* pm_clk_init - Initialize a device's list of power management clocks.
|
||||
* @dev: Device to initialize the list of PM clocks for.
|
||||
|
@ -61,7 +61,7 @@ config DEVFREQ_GOV_USERSPACE
|
||||
Sets the frequency at the user specified one.
|
||||
This governor returns the user configured frequency if there
|
||||
has been an input to /sys/devices/.../power/devfreq_set_freq.
|
||||
Otherwise, the governor does not change the frequnecy
|
||||
Otherwise, the governor does not change the frequency
|
||||
given at the initialization.
|
||||
|
||||
comment "DEVFREQ Drivers"
|
||||
|
58
drivers/power/avs/rockchip-io-domain.c
Normal file → Executable file
58
drivers/power/avs/rockchip-io-domain.c
Normal file → Executable file
@ -47,6 +47,10 @@
|
||||
#define RK3368_SOC_CON15_FLASH0 BIT(14)
|
||||
#define RK3368_SOC_FLASH_SUPPLY_NUM 2
|
||||
|
||||
#define RK3399_PMUGRF_CON0 0x180
|
||||
#define RK3399_PMUGRF_CON0_VSEL BIT(8)
|
||||
#define RK3399_PMUGRF_VSEL_SUPPLY_NUM 9
|
||||
|
||||
struct rockchip_iodomain;
|
||||
|
||||
/**
|
||||
@ -181,6 +185,25 @@ static void rk3368_iodomain_init(struct rockchip_iodomain *iod)
|
||||
dev_warn(iod->dev, "couldn't update flash0 ctrl\n");
|
||||
}
|
||||
|
||||
static void rk3399_pmu_iodomain_init(struct rockchip_iodomain *iod)
|
||||
{
|
||||
int ret;
|
||||
u32 val;
|
||||
|
||||
/* if no pmu io supply we should leave things alone */
|
||||
if (!iod->supplies[RK3399_PMUGRF_VSEL_SUPPLY_NUM].reg)
|
||||
return;
|
||||
|
||||
/*
|
||||
* set pmu io iodomain to also use this framework
|
||||
* instead of a special gpio.
|
||||
*/
|
||||
val = RK3399_PMUGRF_CON0_VSEL | (RK3399_PMUGRF_CON0_VSEL << 16);
|
||||
ret = regmap_write(iod->grf, RK3399_PMUGRF_CON0, val);
|
||||
if (ret < 0)
|
||||
dev_warn(iod->dev, "couldn't update pmu io iodomain ctrl\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* On the rk3188 the io-domains are handled by a shared register with the
|
||||
* lower 8 bits being still being continuing drive-strength settings.
|
||||
@ -252,6 +275,33 @@ static const struct rockchip_iodomain_soc_data soc_data_rk3368_pmu = {
|
||||
},
|
||||
};
|
||||
|
||||
static const struct rockchip_iodomain_soc_data soc_data_rk3399 = {
|
||||
.grf_offset = 0xe640,
|
||||
.supply_names = {
|
||||
"bt656", /* APIO2_VDD */
|
||||
"audio", /* APIO5_VDD */
|
||||
"sdmmc", /* SDMMC0_VDD */
|
||||
"gpio1830", /* APIO4_VDD */
|
||||
},
|
||||
};
|
||||
|
||||
static const struct rockchip_iodomain_soc_data soc_data_rk3399_pmu = {
|
||||
.grf_offset = 0x180,
|
||||
.supply_names = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"pmu1830", /* PMUIO2_VDD */
|
||||
},
|
||||
.init = rk3399_pmu_iodomain_init,
|
||||
};
|
||||
|
||||
static const struct of_device_id rockchip_iodomain_match[] = {
|
||||
{
|
||||
.compatible = "rockchip,rk3188-io-voltage-domain",
|
||||
@ -269,6 +319,14 @@ static const struct of_device_id rockchip_iodomain_match[] = {
|
||||
.compatible = "rockchip,rk3368-pmu-io-voltage-domain",
|
||||
.data = (void *)&soc_data_rk3368_pmu
|
||||
},
|
||||
{
|
||||
.compatible = "rockchip,rk3399-io-voltage-domain",
|
||||
.data = (void *)&soc_data_rk3399
|
||||
},
|
||||
{
|
||||
.compatible = "rockchip,rk3399-pmu-io-voltage-domain",
|
||||
.data = (void *)&soc_data_rk3399_pmu
|
||||
},
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, rockchip_iodomain_match);
|
||||
|
@ -42,7 +42,9 @@ extern int pm_clk_create(struct device *dev);
|
||||
extern void pm_clk_destroy(struct device *dev);
|
||||
extern int pm_clk_add(struct device *dev, const char *con_id);
|
||||
extern int pm_clk_add_clk(struct device *dev, struct clk *clk);
|
||||
extern int of_pm_clk_add_clks(struct device *dev);
|
||||
extern void pm_clk_remove(struct device *dev, const char *con_id);
|
||||
extern void pm_clk_remove_clk(struct device *dev, struct clk *clk);
|
||||
extern int pm_clk_suspend(struct device *dev);
|
||||
extern int pm_clk_resume(struct device *dev);
|
||||
#else
|
||||
@ -69,11 +71,18 @@ static inline int pm_clk_add_clk(struct device *dev, struct clk *clk)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
static inline int of_pm_clk_add_clks(struct device *dev)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
static inline void pm_clk_remove(struct device *dev, const char *con_id)
|
||||
{
|
||||
}
|
||||
#define pm_clk_suspend NULL
|
||||
#define pm_clk_resume NULL
|
||||
static inline void pm_clk_remove_clk(struct device *dev, struct clk *clk)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAVE_CLK
|
||||
|
@ -339,6 +339,7 @@ int hibernation_snapshot(int platform_mode)
|
||||
pm_message_t msg;
|
||||
int error;
|
||||
|
||||
pm_suspend_clear_flags();
|
||||
error = platform_begin(platform_mode);
|
||||
if (error)
|
||||
goto Close;
|
||||
|
Loading…
Reference in New Issue
Block a user