mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
pmdomain core:
- Add support for HW-managed devices pmdomain providers: - amlogic: Add support for the A5 and the A4 power domains - arm: Enable system wakeups for the SCMI PM domain - qcom/clk: Add HW-mode callbacks to allow switching of GDSC mode pmdomain consumers: - qcom/media/venus: Enable support for switching GDSC HW-mode on V6 -----BEGIN PGP SIGNATURE----- iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAmaU8RIXHHVsZi5oYW5z c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjCnrbhAAqWQWOxXxZ9QHYgmE8K+fc96h 9e67dF2WjvBbipGEj63ijCRei9pChyHaIWPLSN/pHusfxTHaLqC2RTRf7Os/4TCm vwaITTvrIBxTHkocHVKDNUaODo/Mdc6WyhY8DUo+SyoZTvzKxy4QsmHDPsicJ6Q6 SxN01JrvNAHlOIRwgEm1BSuiL1qCOwg6vjdq/9I+3TVbFCLD8a9dYB8duWYTkupR HJqCeTQrrkucVi7LtGPwFZD50KnxK5/wMmug2jjHZ1jhS+iDI6WRoPGgyhlDyDNf 269Gveog7ewxK8Ny+h38FAgHwXvf0XuW47Zq4Pth7GdUnJH1n5AYGc0HETaFa0Xo +DnAm6xbWggSiAfzD63LwhRuv44hCE2vq3Ab10DYYcWC863qOis4t31VAyFsNq4m wQejAFPlZMQGUMjJMLRM9jPSYGakasvRjXwcVuv9DjFnku69lzroib8Z2eP6FR/t Q7DHVuq1lXbaVk4T4qV/yqgSjSOhEF5F/w1s+dYGygxfdY9Y5YH9dC8WBGtoqAUl K9w9UsA9qfVLvlLESRzHFF2oJaIdoqsTwcxykdq3WNaW+G2sGDf89rCpPvFvMLsj 43MWaxWs4dxS0okfr/hsGhBiCzIegqNbhxsrVdtn6BM/1qLnax7PjT2AEhP0oWL7 J4jvKcldHF4vNK5Kwlk= =ZIDp -----END PGP SIGNATURE----- Merge tag 'pmdomain-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm Pull pmdomain updates from Ulf Hansson: "pmdomain core: - Add support for HW-managed devices pmdomain providers: - amlogic: Add support for the A5 and the A4 power domains - arm: Enable system wakeups for the SCMI PM domain - qcom/clk: Add HW-mode callbacks to allow switching of GDSC mode pmdomain consumers: - qcom/media/venus: Enable support for switching GDSC HW-mode on V6" * tag 'pmdomain-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm: pmdomain: amlogic: Constify struct meson_secure_pwrc_domain_desc venus: pm_helpers: Use dev_pm_genpd_set_hwmode to switch GDSC mode on V6 clk: qcom: videocc: Use HW_CTRL_TRIGGER for SM8250, SC7280 vcodec GDSC's clk: qcom: gdsc: Add set and get hwmode callbacks to switch GDSC mode PM: domains: Add the domain HW-managed mode to the summary PM: domains: Allow devices attached to genpd to be managed by HW pmdomain: amlogic: Add support for A5 power domains controller dt-bindings: power: add Amlogic A5 power domains pmdomain: amlogic: add missing MODULE_DESCRIPTION() macros pmdomain: arm: scmi_pm_domain: set flag GENPD_FLAG_ACTIVE_WAKEUP pmdomain: renesas: rmobile-sysc: Use for_each_child_of_node_scoped() pmdomain: core: Use genpd_is_irq_safe() helper pmdomain: amlogic: Add support for A4 power domains controller dt-bindings: power: add Amlogic A4 power domains
This commit is contained in:
commit
d46ede3188
@ -20,6 +20,8 @@ properties:
|
||||
enum:
|
||||
- amlogic,meson-a1-pwrc
|
||||
- amlogic,meson-s4-pwrc
|
||||
- amlogic,a4-pwrc
|
||||
- amlogic,a5-pwrc
|
||||
- amlogic,c3-pwrc
|
||||
- amlogic,t7-pwrc
|
||||
|
||||
|
@ -363,6 +363,43 @@ static int gdsc_disable(struct generic_pm_domain *domain)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gdsc_set_hwmode(struct generic_pm_domain *domain, struct device *dev, bool mode)
|
||||
{
|
||||
struct gdsc *sc = domain_to_gdsc(domain);
|
||||
int ret;
|
||||
|
||||
ret = gdsc_hwctrl(sc, mode);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* Wait for the GDSC to go through a power down and
|
||||
* up cycle. If we poll the status register before the
|
||||
* power cycle is finished we might read incorrect values.
|
||||
*/
|
||||
udelay(1);
|
||||
|
||||
/*
|
||||
* When the GDSC is switched to HW mode, HW can disable the GDSC.
|
||||
* When the GDSC is switched back to SW mode, the GDSC will be enabled
|
||||
* again, hence we need to poll for GDSC to complete the power up.
|
||||
*/
|
||||
if (!mode)
|
||||
return gdsc_poll_status(sc, GDSC_ON);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool gdsc_get_hwmode(struct generic_pm_domain *domain, struct device *dev)
|
||||
{
|
||||
struct gdsc *sc = domain_to_gdsc(domain);
|
||||
u32 val;
|
||||
|
||||
regmap_read(sc->regmap, sc->gdscr, &val);
|
||||
|
||||
return !!(val & HW_CONTROL_MASK);
|
||||
}
|
||||
|
||||
static int gdsc_init(struct gdsc *sc)
|
||||
{
|
||||
u32 mask, val;
|
||||
@ -451,6 +488,10 @@ static int gdsc_init(struct gdsc *sc)
|
||||
sc->pd.power_off = gdsc_disable;
|
||||
if (!sc->pd.power_on)
|
||||
sc->pd.power_on = gdsc_enable;
|
||||
if (sc->flags & HW_CTRL_TRIGGER) {
|
||||
sc->pd.set_hwmode_dev = gdsc_set_hwmode;
|
||||
sc->pd.get_hwmode_dev = gdsc_get_hwmode;
|
||||
}
|
||||
|
||||
ret = pm_genpd_init(&sc->pd, NULL, !on);
|
||||
if (ret)
|
||||
|
@ -67,6 +67,7 @@ struct gdsc {
|
||||
#define ALWAYS_ON BIT(6)
|
||||
#define RETAIN_FF_ENABLE BIT(7)
|
||||
#define NO_RET_PERIPH BIT(8)
|
||||
#define HW_CTRL_TRIGGER BIT(9)
|
||||
struct reset_controller_dev *rcdev;
|
||||
unsigned int *resets;
|
||||
unsigned int reset_count;
|
||||
|
@ -236,7 +236,7 @@ static struct gdsc mvs0_gdsc = {
|
||||
.name = "mvs0_gdsc",
|
||||
},
|
||||
.pwrsts = PWRSTS_OFF_ON,
|
||||
.flags = HW_CTRL | RETAIN_FF_ENABLE,
|
||||
.flags = HW_CTRL_TRIGGER | RETAIN_FF_ENABLE,
|
||||
};
|
||||
|
||||
static struct gdsc mvsc_gdsc = {
|
||||
|
@ -293,7 +293,7 @@ static struct gdsc mvs0_gdsc = {
|
||||
.pd = {
|
||||
.name = "mvs0_gdsc",
|
||||
},
|
||||
.flags = HW_CTRL,
|
||||
.flags = HW_CTRL_TRIGGER,
|
||||
.pwrsts = PWRSTS_OFF_ON,
|
||||
};
|
||||
|
||||
@ -302,7 +302,7 @@ static struct gdsc mvs1_gdsc = {
|
||||
.pd = {
|
||||
.name = "mvs1_gdsc",
|
||||
},
|
||||
.flags = HW_CTRL,
|
||||
.flags = HW_CTRL_TRIGGER,
|
||||
.pwrsts = PWRSTS_OFF_ON,
|
||||
};
|
||||
|
||||
|
@ -412,10 +412,9 @@ static int vcodec_control_v4(struct venus_core *core, u32 coreid, bool enable)
|
||||
u32 val;
|
||||
int ret;
|
||||
|
||||
if (IS_V6(core)) {
|
||||
ctrl = core->wrapper_base + WRAPPER_CORE_POWER_CONTROL_V6;
|
||||
stat = core->wrapper_base + WRAPPER_CORE_POWER_STATUS_V6;
|
||||
} else if (coreid == VIDC_CORE_ID_1) {
|
||||
if (IS_V6(core))
|
||||
return dev_pm_genpd_set_hwmode(core->pmdomains->pd_devs[coreid], !enable);
|
||||
else if (coreid == VIDC_CORE_ID_1) {
|
||||
ctrl = core->wrapper_base + WRAPPER_VCODEC0_MMCC_POWER_CONTROL;
|
||||
stat = core->wrapper_base + WRAPPER_VCODEC0_MMCC_POWER_STATUS;
|
||||
} else {
|
||||
@ -451,9 +450,11 @@ static int poweroff_coreid(struct venus_core *core, unsigned int coreid_mask)
|
||||
|
||||
vcodec_clks_disable(core, core->vcodec0_clks);
|
||||
|
||||
ret = vcodec_control_v4(core, VIDC_CORE_ID_1, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!IS_V6(core)) {
|
||||
ret = vcodec_control_v4(core, VIDC_CORE_ID_1, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = pm_runtime_put_sync(core->pmdomains->pd_devs[1]);
|
||||
if (ret < 0)
|
||||
@ -467,9 +468,11 @@ static int poweroff_coreid(struct venus_core *core, unsigned int coreid_mask)
|
||||
|
||||
vcodec_clks_disable(core, core->vcodec1_clks);
|
||||
|
||||
ret = vcodec_control_v4(core, VIDC_CORE_ID_2, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!IS_V6(core)) {
|
||||
ret = vcodec_control_v4(core, VIDC_CORE_ID_2, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = pm_runtime_put_sync(core->pmdomains->pd_devs[2]);
|
||||
if (ret < 0)
|
||||
@ -488,9 +491,11 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = vcodec_control_v4(core, VIDC_CORE_ID_1, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!IS_V6(core)) {
|
||||
ret = vcodec_control_v4(core, VIDC_CORE_ID_1, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = vcodec_clks_enable(core, core->vcodec0_clks);
|
||||
if (ret)
|
||||
@ -506,9 +511,11 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = vcodec_control_v4(core, VIDC_CORE_ID_2, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!IS_V6(core)) {
|
||||
ret = vcodec_control_v4(core, VIDC_CORE_ID_2, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = vcodec_clks_enable(core, core->vcodec1_clks);
|
||||
if (ret)
|
||||
|
@ -648,4 +648,5 @@ static struct platform_driver meson_ee_pwrc_driver = {
|
||||
},
|
||||
};
|
||||
module_platform_driver(meson_ee_pwrc_driver);
|
||||
MODULE_DESCRIPTION("Amlogic Meson Everything-Else Power Domains driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
@ -376,4 +376,5 @@ static struct platform_driver meson_gx_pwrc_vpu_driver = {
|
||||
},
|
||||
};
|
||||
module_platform_driver(meson_gx_pwrc_vpu_driver);
|
||||
MODULE_DESCRIPTION("Amlogic Meson GX Power Domains driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include <dt-bindings/power/amlogic,c3-pwrc.h>
|
||||
#include <dt-bindings/power/meson-s4-power.h>
|
||||
#include <dt-bindings/power/amlogic,t7-pwrc.h>
|
||||
#include <dt-bindings/power/amlogic,a4-pwrc.h>
|
||||
#include <dt-bindings/power/amlogic,a5-pwrc.h>
|
||||
#include <linux/arm-smccc.h>
|
||||
#include <linux/firmware/meson/meson_sm.h>
|
||||
#include <linux/module.h>
|
||||
@ -45,7 +47,7 @@ struct meson_secure_pwrc_domain_desc {
|
||||
|
||||
struct meson_secure_pwrc_domain_data {
|
||||
unsigned int count;
|
||||
struct meson_secure_pwrc_domain_desc *domains;
|
||||
const struct meson_secure_pwrc_domain_desc *domains;
|
||||
};
|
||||
|
||||
static bool pwrc_secure_is_off(struct meson_secure_pwrc_domain *pwrc_domain)
|
||||
@ -109,7 +111,7 @@ static int meson_secure_pwrc_on(struct generic_pm_domain *domain)
|
||||
.parent = __parent, \
|
||||
}
|
||||
|
||||
static struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = {
|
||||
static const struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = {
|
||||
SEC_PD(DSPA, 0),
|
||||
SEC_PD(DSPB, 0),
|
||||
/* UART should keep working in ATF after suspend and before resume */
|
||||
@ -136,7 +138,41 @@ static struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = {
|
||||
SEC_PD(RSA, 0),
|
||||
};
|
||||
|
||||
static struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = {
|
||||
static const struct meson_secure_pwrc_domain_desc a4_pwrc_domains[] = {
|
||||
SEC_PD(A4_AUDIO, 0),
|
||||
SEC_PD(A4_SDIOA, 0),
|
||||
SEC_PD(A4_EMMC, 0),
|
||||
SEC_PD(A4_USB_COMB, 0),
|
||||
SEC_PD(A4_ETH, 0),
|
||||
SEC_PD(A4_VOUT, 0),
|
||||
SEC_PD(A4_AUDIO_PDM, 0),
|
||||
/* DMC is for DDR PHY ana/dig and DMC, and should be always on */
|
||||
SEC_PD(A4_DMC, GENPD_FLAG_ALWAYS_ON),
|
||||
/* WRAP is secure_top, a lot of modules are included, and should be always on */
|
||||
SEC_PD(A4_SYS_WRAP, GENPD_FLAG_ALWAYS_ON),
|
||||
SEC_PD(A4_AO_I2C_S, 0),
|
||||
SEC_PD(A4_AO_UART, 0),
|
||||
/* IR is wake up trigger source, and should be always on */
|
||||
SEC_PD(A4_AO_IR, GENPD_FLAG_ALWAYS_ON),
|
||||
};
|
||||
|
||||
static const struct meson_secure_pwrc_domain_desc a5_pwrc_domains[] = {
|
||||
SEC_PD(A5_NNA, 0),
|
||||
SEC_PD(A5_AUDIO, 0),
|
||||
SEC_PD(A5_SDIOA, 0),
|
||||
SEC_PD(A5_EMMC, 0),
|
||||
SEC_PD(A5_USB_COMB, 0),
|
||||
SEC_PD(A5_ETH, 0),
|
||||
SEC_PD(A5_RSA, 0),
|
||||
SEC_PD(A5_AUDIO_PDM, 0),
|
||||
/* DMC is for DDR PHY ana/dig and DMC, and should be always on */
|
||||
SEC_PD(A5_DMC, GENPD_FLAG_ALWAYS_ON),
|
||||
/* WRAP is secure_top, a lot of modules are included, and should be always on */
|
||||
SEC_PD(A5_SYS_WRAP, GENPD_FLAG_ALWAYS_ON),
|
||||
SEC_PD(A5_DSPA, 0),
|
||||
};
|
||||
|
||||
static const struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = {
|
||||
SEC_PD(C3_NNA, 0),
|
||||
SEC_PD(C3_AUDIO, 0),
|
||||
SEC_PD(C3_SDIOA, 0),
|
||||
@ -153,7 +189,7 @@ static struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = {
|
||||
SEC_PD(C3_VCODEC, 0),
|
||||
};
|
||||
|
||||
static struct meson_secure_pwrc_domain_desc s4_pwrc_domains[] = {
|
||||
static const struct meson_secure_pwrc_domain_desc s4_pwrc_domains[] = {
|
||||
SEC_PD(S4_DOS_HEVC, 0),
|
||||
SEC_PD(S4_DOS_VDEC, 0),
|
||||
SEC_PD(S4_VPU_HDMI, 0),
|
||||
@ -165,7 +201,7 @@ static struct meson_secure_pwrc_domain_desc s4_pwrc_domains[] = {
|
||||
SEC_PD(S4_AUDIO, 0),
|
||||
};
|
||||
|
||||
static struct meson_secure_pwrc_domain_desc t7_pwrc_domains[] = {
|
||||
static const struct meson_secure_pwrc_domain_desc t7_pwrc_domains[] = {
|
||||
SEC_PD(T7_DSPA, 0),
|
||||
SEC_PD(T7_DSPB, 0),
|
||||
TOP_PD(T7_DOS_HCODEC, 0, PWRC_T7_NIC3_ID),
|
||||
@ -311,6 +347,16 @@ static struct meson_secure_pwrc_domain_data meson_secure_a1_pwrc_data = {
|
||||
.count = ARRAY_SIZE(a1_pwrc_domains),
|
||||
};
|
||||
|
||||
static struct meson_secure_pwrc_domain_data amlogic_secure_a4_pwrc_data = {
|
||||
.domains = a4_pwrc_domains,
|
||||
.count = ARRAY_SIZE(a4_pwrc_domains),
|
||||
};
|
||||
|
||||
static struct meson_secure_pwrc_domain_data amlogic_secure_a5_pwrc_data = {
|
||||
.domains = a5_pwrc_domains,
|
||||
.count = ARRAY_SIZE(a5_pwrc_domains),
|
||||
};
|
||||
|
||||
static struct meson_secure_pwrc_domain_data amlogic_secure_c3_pwrc_data = {
|
||||
.domains = c3_pwrc_domains,
|
||||
.count = ARRAY_SIZE(c3_pwrc_domains),
|
||||
@ -331,6 +377,14 @@ static const struct of_device_id meson_secure_pwrc_match_table[] = {
|
||||
.compatible = "amlogic,meson-a1-pwrc",
|
||||
.data = &meson_secure_a1_pwrc_data,
|
||||
},
|
||||
{
|
||||
.compatible = "amlogic,a4-pwrc",
|
||||
.data = &amlogic_secure_a4_pwrc_data,
|
||||
},
|
||||
{
|
||||
.compatible = "amlogic,a5-pwrc",
|
||||
.data = &amlogic_secure_a5_pwrc_data,
|
||||
},
|
||||
{
|
||||
.compatible = "amlogic,c3-pwrc",
|
||||
.data = &amlogic_secure_c3_pwrc_data,
|
||||
@ -355,4 +409,5 @@ static struct platform_driver meson_secure_pwrc_driver = {
|
||||
},
|
||||
};
|
||||
module_platform_driver(meson_secure_pwrc_driver);
|
||||
MODULE_DESCRIPTION("Amlogic Meson Secure Power Domains driver");
|
||||
MODULE_LICENSE("Dual MIT/GPL");
|
||||
|
@ -102,6 +102,7 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev)
|
||||
scmi_pd->genpd.name = scmi_pd->name;
|
||||
scmi_pd->genpd.power_off = scmi_pd_power_off;
|
||||
scmi_pd->genpd.power_on = scmi_pd_power_on;
|
||||
scmi_pd->genpd.flags = GENPD_FLAG_ACTIVE_WAKEUP;
|
||||
|
||||
pm_genpd_init(&scmi_pd->genpd, NULL,
|
||||
state == SCMI_POWER_STATE_GENERIC_OFF);
|
||||
|
@ -588,6 +588,68 @@ void dev_pm_genpd_synced_poweroff(struct device *dev)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dev_pm_genpd_synced_poweroff);
|
||||
|
||||
/**
|
||||
* dev_pm_genpd_set_hwmode() - Set the HW mode for the device and its PM domain.
|
||||
*
|
||||
* @dev: Device for which the HW-mode should be changed.
|
||||
* @enable: Value to set or unset the HW-mode.
|
||||
*
|
||||
* Some PM domains can rely on HW signals to control the power for a device. To
|
||||
* allow a consumer driver to switch the behaviour for its device in runtime,
|
||||
* which may be beneficial from a latency or energy point of view, this function
|
||||
* may be called.
|
||||
*
|
||||
* It is assumed that the users guarantee that the genpd wouldn't be detached
|
||||
* while this routine is getting called.
|
||||
*
|
||||
* Return: Returns 0 on success and negative error values on failures.
|
||||
*/
|
||||
int dev_pm_genpd_set_hwmode(struct device *dev, bool enable)
|
||||
{
|
||||
struct generic_pm_domain *genpd;
|
||||
int ret = 0;
|
||||
|
||||
genpd = dev_to_genpd_safe(dev);
|
||||
if (!genpd)
|
||||
return -ENODEV;
|
||||
|
||||
if (!genpd->set_hwmode_dev)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
genpd_lock(genpd);
|
||||
|
||||
if (dev_gpd_data(dev)->hw_mode == enable)
|
||||
goto out;
|
||||
|
||||
ret = genpd->set_hwmode_dev(genpd, dev, enable);
|
||||
if (!ret)
|
||||
dev_gpd_data(dev)->hw_mode = enable;
|
||||
|
||||
out:
|
||||
genpd_unlock(genpd);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dev_pm_genpd_set_hwmode);
|
||||
|
||||
/**
|
||||
* dev_pm_genpd_get_hwmode() - Get the HW mode setting for the device.
|
||||
*
|
||||
* @dev: Device for which the current HW-mode setting should be fetched.
|
||||
*
|
||||
* This helper function allows consumer drivers to fetch the current HW mode
|
||||
* setting of its the device.
|
||||
*
|
||||
* It is assumed that the users guarantee that the genpd wouldn't be detached
|
||||
* while this routine is getting called.
|
||||
*
|
||||
* Return: Returns the HW mode setting of device from SW cached hw_mode.
|
||||
*/
|
||||
bool dev_pm_genpd_get_hwmode(struct device *dev)
|
||||
{
|
||||
return dev_gpd_data(dev)->hw_mode;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dev_pm_genpd_get_hwmode);
|
||||
|
||||
static int _genpd_power_on(struct generic_pm_domain *genpd, bool timed)
|
||||
{
|
||||
unsigned int state_idx = genpd->state_idx;
|
||||
@ -1687,6 +1749,8 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
|
||||
|
||||
gpd_data->cpu = genpd_get_cpu(genpd, base_dev);
|
||||
|
||||
gpd_data->hw_mode = genpd->get_hwmode_dev ? genpd->get_hwmode_dev(genpd, dev) : false;
|
||||
|
||||
ret = genpd->attach_dev ? genpd->attach_dev(genpd, dev) : 0;
|
||||
if (ret)
|
||||
goto out;
|
||||
@ -2079,7 +2143,7 @@ static void genpd_free_data(struct generic_pm_domain *genpd)
|
||||
|
||||
static void genpd_lock_init(struct generic_pm_domain *genpd)
|
||||
{
|
||||
if (genpd->flags & GENPD_FLAG_IRQ_SAFE) {
|
||||
if (genpd_is_irq_safe(genpd)) {
|
||||
spin_lock_init(&genpd->slock);
|
||||
genpd->lock_ops = &genpd_spin_ops;
|
||||
} else {
|
||||
@ -3120,6 +3184,15 @@ static void rtpm_status_str(struct seq_file *s, struct device *dev)
|
||||
seq_printf(s, "%-25s ", p);
|
||||
}
|
||||
|
||||
static void mode_status_str(struct seq_file *s, struct device *dev)
|
||||
{
|
||||
struct generic_pm_domain_data *gpd_data;
|
||||
|
||||
gpd_data = to_gpd_data(dev->power.subsys_data->domain_data);
|
||||
|
||||
seq_printf(s, "%20s", gpd_data->hw_mode ? "HW" : "SW");
|
||||
}
|
||||
|
||||
static void perf_status_str(struct seq_file *s, struct device *dev)
|
||||
{
|
||||
struct generic_pm_domain_data *gpd_data;
|
||||
@ -3178,6 +3251,7 @@ static int genpd_summary_one(struct seq_file *s,
|
||||
seq_printf(s, "\n %-50s ", kobj_path);
|
||||
rtpm_status_str(s, pm_data->dev);
|
||||
perf_status_str(s, pm_data->dev);
|
||||
mode_status_str(s, pm_data->dev);
|
||||
kfree(kobj_path);
|
||||
}
|
||||
|
||||
@ -3194,8 +3268,8 @@ static int summary_show(struct seq_file *s, void *data)
|
||||
int ret = 0;
|
||||
|
||||
seq_puts(s, "domain status children performance\n");
|
||||
seq_puts(s, " /device runtime status\n");
|
||||
seq_puts(s, "----------------------------------------------------------------------------------------------\n");
|
||||
seq_puts(s, " /device runtime status managed by\n");
|
||||
seq_puts(s, "------------------------------------------------------------------------------------------------------------\n");
|
||||
|
||||
ret = mutex_lock_interruptible(&gpd_list_lock);
|
||||
if (ret)
|
||||
|
@ -268,9 +268,7 @@ static int __init rmobile_add_pm_domains(void __iomem *base,
|
||||
struct device_node *parent,
|
||||
struct generic_pm_domain *genpd_parent)
|
||||
{
|
||||
struct device_node *np;
|
||||
|
||||
for_each_child_of_node(parent, np) {
|
||||
for_each_child_of_node_scoped(parent, np) {
|
||||
struct rmobile_pm_domain *pd;
|
||||
u32 idx = ~0;
|
||||
|
||||
@ -279,10 +277,8 @@ static int __init rmobile_add_pm_domains(void __iomem *base,
|
||||
}
|
||||
|
||||
pd = kzalloc(sizeof(*pd), GFP_KERNEL);
|
||||
if (!pd) {
|
||||
of_node_put(np);
|
||||
if (!pd)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
pd->genpd.name = np->name;
|
||||
pd->base = base;
|
||||
|
21
include/dt-bindings/power/amlogic,a4-pwrc.h
Normal file
21
include/dt-bindings/power/amlogic,a4-pwrc.h
Normal file
@ -0,0 +1,21 @@
|
||||
/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */
|
||||
/*
|
||||
* Copyright (C) 2024 Amlogic, Inc. All rights reserved
|
||||
*/
|
||||
#ifndef _DT_BINDINGS_AMLOGIC_A4_POWER_H
|
||||
#define _DT_BINDINGS_AMLOGIC_A4_POWER_H
|
||||
|
||||
#define PWRC_A4_AUDIO_ID 0
|
||||
#define PWRC_A4_SDIOA_ID 1
|
||||
#define PWRC_A4_EMMC_ID 2
|
||||
#define PWRC_A4_USB_COMB_ID 3
|
||||
#define PWRC_A4_ETH_ID 4
|
||||
#define PWRC_A4_VOUT_ID 5
|
||||
#define PWRC_A4_AUDIO_PDM_ID 6
|
||||
#define PWRC_A4_DMC_ID 7
|
||||
#define PWRC_A4_SYS_WRAP_ID 8
|
||||
#define PWRC_A4_AO_I2C_S_ID 9
|
||||
#define PWRC_A4_AO_UART_ID 10
|
||||
#define PWRC_A4_AO_IR_ID 11
|
||||
|
||||
#endif
|
21
include/dt-bindings/power/amlogic,a5-pwrc.h
Normal file
21
include/dt-bindings/power/amlogic,a5-pwrc.h
Normal file
@ -0,0 +1,21 @@
|
||||
/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */
|
||||
/*
|
||||
* Copyright (C) 2024 Amlogic, Inc. All rights reserved
|
||||
*/
|
||||
|
||||
#ifndef _DT_BINDINGS_AMLOGIC_A5_POWER_H
|
||||
#define _DT_BINDINGS_AMLOGIC_A5_POWER_H
|
||||
|
||||
#define PWRC_A5_NNA_ID 0
|
||||
#define PWRC_A5_AUDIO_ID 1
|
||||
#define PWRC_A5_SDIOA_ID 2
|
||||
#define PWRC_A5_EMMC_ID 3
|
||||
#define PWRC_A5_USB_COMB_ID 4
|
||||
#define PWRC_A5_ETH_ID 5
|
||||
#define PWRC_A5_RSA_ID 6
|
||||
#define PWRC_A5_AUDIO_PDM_ID 7
|
||||
#define PWRC_A5_DMC_ID 8
|
||||
#define PWRC_A5_SYS_WRAP_ID 9
|
||||
#define PWRC_A5_DSPA_ID 10
|
||||
|
||||
#endif
|
@ -175,6 +175,10 @@ struct generic_pm_domain {
|
||||
int (*set_performance_state)(struct generic_pm_domain *genpd,
|
||||
unsigned int state);
|
||||
struct gpd_dev_ops dev_ops;
|
||||
int (*set_hwmode_dev)(struct generic_pm_domain *domain,
|
||||
struct device *dev, bool enable);
|
||||
bool (*get_hwmode_dev)(struct generic_pm_domain *domain,
|
||||
struct device *dev);
|
||||
int (*attach_dev)(struct generic_pm_domain *domain,
|
||||
struct device *dev);
|
||||
void (*detach_dev)(struct generic_pm_domain *domain,
|
||||
@ -237,6 +241,7 @@ struct generic_pm_domain_data {
|
||||
unsigned int performance_state;
|
||||
unsigned int default_pstate;
|
||||
unsigned int rpm_pstate;
|
||||
bool hw_mode;
|
||||
void *data;
|
||||
};
|
||||
|
||||
@ -267,6 +272,8 @@ int dev_pm_genpd_remove_notifier(struct device *dev);
|
||||
void dev_pm_genpd_set_next_wakeup(struct device *dev, ktime_t next);
|
||||
ktime_t dev_pm_genpd_get_next_hrtimer(struct device *dev);
|
||||
void dev_pm_genpd_synced_poweroff(struct device *dev);
|
||||
int dev_pm_genpd_set_hwmode(struct device *dev, bool enable);
|
||||
bool dev_pm_genpd_get_hwmode(struct device *dev);
|
||||
|
||||
extern struct dev_power_governor simple_qos_governor;
|
||||
extern struct dev_power_governor pm_domain_always_on_gov;
|
||||
@ -340,6 +347,16 @@ static inline ktime_t dev_pm_genpd_get_next_hrtimer(struct device *dev)
|
||||
static inline void dev_pm_genpd_synced_poweroff(struct device *dev)
|
||||
{ }
|
||||
|
||||
static inline int dev_pm_genpd_set_hwmode(struct device *dev, bool enable)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline bool dev_pm_genpd_get_hwmode(struct device *dev)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#define simple_qos_governor (*(struct dev_power_governor *)(NULL))
|
||||
#define pm_domain_always_on_gov (*(struct dev_power_governor *)(NULL))
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user