In case the ops is not implemented, return 0 in the core right away.
This is better than having multiple copies of functions which just
return 0 in each power domain driver. Drop all those empty functions.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Simon Glass <sjg@chromium.org>
return 0;
}
-static int apple_reset_request(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
-static int apple_reset_free(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
static int apple_reset_assert(struct reset_ctl *reset_ctl)
{
struct apple_pmgr_priv *priv = dev_get_priv(reset_ctl->dev->parent);
struct reset_ops apple_reset_ops = {
.of_xlate = apple_reset_of_xlate,
- .request = apple_reset_request,
- .rfree = apple_reset_free,
.rst_assert = apple_reset_assert,
.rst_deassert = apple_reset_deassert,
};
.ops = &apple_reset_ops,
};
-static int apple_pmgr_request(struct power_domain *power_domain)
-{
- return 0;
-}
-
-static int apple_pmgr_rfree(struct power_domain *power_domain)
-{
- return 0;
-}
-
static int apple_pmgr_ps_set(struct power_domain *power_domain, u32 pstate)
{
struct apple_pmgr_priv *priv = dev_get_priv(power_domain->dev);
return apple_pmgr_ps_set(power_domain, APPLE_PMGR_PS_ACTIVE);
}
-static int apple_pmgr_off(struct power_domain *power_domain)
-{
- return 0;
-}
-
static int apple_pmgr_of_xlate(struct power_domain *power_domain,
struct ofnode_phandle_args *args)
{
}
struct power_domain_ops apple_pmgr_ops = {
- .request = apple_pmgr_request,
- .rfree = apple_pmgr_rfree,
.on = apple_pmgr_on,
- .off = apple_pmgr_off,
.of_xlate = apple_pmgr_of_xlate,
};
return 0;
}
-static int bcm6328_power_domain_free(struct power_domain *power_domain)
-{
- return 0;
-}
-
static int bcm6328_power_domain_on(struct power_domain *power_domain)
{
struct bcm6328_power_domain *priv = dev_get_priv(power_domain->dev);
};
struct power_domain_ops bcm6328_power_domain_ops = {
- .rfree = bcm6328_power_domain_free,
.off = bcm6328_power_domain_off,
.on = bcm6328_power_domain_on,
.request = bcm6328_power_domain_request,
return 0;
}
-static int imx8_power_domain_request(struct power_domain *power_domain)
-{
- debug("%s(power_domain=%p)\n", __func__, power_domain);
-
- return 0;
-}
-
-static int imx8_power_domain_free(struct power_domain *power_domain)
-{
- debug("%s(power_domain=%p)\n", __func__, power_domain);
-
- return 0;
-}
-
static int imx8_power_domain_on(struct power_domain *power_domain)
{
struct udevice *dev = power_domain->dev;
};
struct power_domain_ops imx8_power_domain_ops = {
- .request = imx8_power_domain_request,
- .rfree = imx8_power_domain_free,
.on = imx8_power_domain_on,
.off = imx8_power_domain_off,
.of_xlate = imx8_power_domain_of_xlate,
#include <asm/arch/power-domain.h>
#include <asm/arch/sci/sci.h>
-static int imx8_power_domain_request(struct power_domain *power_domain)
-{
- debug("%s(power_domain=%p)\n", __func__, power_domain);
-
- return 0;
-}
-
-static int imx8_power_domain_free(struct power_domain *power_domain)
-{
- debug("%s(power_domain=%p)\n", __func__, power_domain);
-
- return 0;
-}
-
static int imx8_power_domain_on(struct power_domain *power_domain)
{
u32 resource_id = power_domain->id;
return 0;
}
-static int imx8_power_domain_probe(struct udevice *dev)
-{
- debug("%s(dev=%s)\n", __func__, dev->name);
-
- return 0;
-}
-
static const struct udevice_id imx8_power_domain_ids[] = {
{ .compatible = "fsl,imx8qxp-scu-pd" },
{ .compatible = "fsl,scu-pd" },
};
struct power_domain_ops imx8_power_domain_ops_v2 = {
- .request = imx8_power_domain_request,
- .rfree = imx8_power_domain_free,
.on = imx8_power_domain_on,
.off = imx8_power_domain_off,
};
.name = "imx8_power_domain_v2",
.id = UCLASS_POWER_DOMAIN,
.of_match = imx8_power_domain_ids,
- .probe = imx8_power_domain_probe,
.ops = &imx8_power_domain_ops_v2,
};
DECLARE_GLOBAL_DATA_PTR;
-static int imx8m_power_domain_request(struct power_domain *power_domain)
-{
- return 0;
-}
-
-static int imx8m_power_domain_free(struct power_domain *power_domain)
-{
- return 0;
-}
-
static int imx8m_power_domain_on(struct power_domain *power_domain)
{
struct udevice *dev = power_domain->dev;
return 0;
}
-static int imx8m_power_domain_probe(struct udevice *dev)
-{
- return 0;
-}
-
static int imx8m_power_domain_of_to_plat(struct udevice *dev)
{
struct imx8m_power_domain_plat *pdata = dev_get_plat(dev);
};
struct power_domain_ops imx8m_power_domain_ops = {
- .request = imx8m_power_domain_request,
- .rfree = imx8m_power_domain_free,
.on = imx8m_power_domain_on,
.off = imx8m_power_domain_off,
.of_xlate = imx8m_power_domain_of_xlate,
.id = UCLASS_POWER_DOMAIN,
.of_match = imx8m_power_domain_ids,
.bind = imx8m_power_domain_bind,
- .probe = imx8m_power_domain_probe,
.of_to_plat = imx8m_power_domain_of_to_plat,
.plat_auto = sizeof(struct imx8m_power_domain_plat),
.ops = &imx8m_power_domain_ops,
return (reg & pwrc_domain->top_pd->sleep_mask);
}
-static int meson_ee_pwrc_request(struct power_domain *power_domain)
-{
- return 0;
-}
-
-static int meson_ee_pwrc_free(struct power_domain *power_domain)
-{
- return 0;
-}
-
static int meson_ee_pwrc_off(struct power_domain *power_domain)
{
struct meson_ee_pwrc_priv *priv = dev_get_priv(power_domain->dev);
}
struct power_domain_ops meson_ee_pwrc_ops = {
- .rfree = meson_ee_pwrc_free,
.off = meson_ee_pwrc_off,
.on = meson_ee_pwrc_on,
- .request = meson_ee_pwrc_request,
.of_xlate = meson_ee_pwrc_of_xlate,
};
struct clk_bulk clks;
};
-static int meson_pwrc_vpu_request(struct power_domain *power_domain)
-{
- return 0;
-}
-
-static int meson_pwrc_vpu_free(struct power_domain *power_domain)
-{
- return 0;
-}
-
static int meson_gx_pwrc_vpu_on(struct power_domain *power_domain)
{
struct meson_gx_pwrc_vpu_priv *priv = dev_get_priv(power_domain->dev);
}
struct power_domain_ops meson_gx_pwrc_vpu_ops = {
- .rfree = meson_pwrc_vpu_free,
.off = meson_pwrc_vpu_off,
.on = meson_pwrc_vpu_on,
- .request = meson_pwrc_vpu_request,
.of_xlate = meson_pwrc_vpu_of_xlate,
};
return 0;
}
-static int scpsys_power_free(struct power_domain *power_domain)
-{
- return 0;
-}
-
static int mtk_power_domain_hook(struct udevice *dev)
{
struct scp_domain *scpd = dev_get_priv(dev);
};
struct power_domain_ops mtk_power_domain_ops = {
- .rfree = scpsys_power_free,
.off = scpsys_power_off,
.on = scpsys_power_on,
.request = scpsys_power_request,
return ret;
}
- ret = ops->request(power_domain);
+ ret = ops->request ? ops->request(power_domain) : 0;
if (ret) {
debug("ops->request() failed: %d\n", ret);
return ret;
debug("%s(power_domain=%p)\n", __func__, power_domain);
- return ops->rfree(power_domain);
+ return ops->rfree ? ops->rfree(power_domain) : 0;
}
int power_domain_on(struct power_domain *power_domain)
debug("%s(power_domain=%p)\n", __func__, power_domain);
- return ops->on(power_domain);
+ return ops->on ? ops->on(power_domain) : 0;
}
int power_domain_off(struct power_domain *power_domain)
debug("%s(power_domain=%p)\n", __func__, power_domain);
- return ops->off(power_domain);
+ return ops->off ? ops->off(power_domain) : 0;
}
#if CONFIG_IS_ENABLED(OF_REAL)
#define UPDATE BIT(0)
#define ON BIT(1)
-static int tegra186_power_domain_request(struct power_domain *power_domain)
-{
- debug("%s(power_domain=%p) (dev=%p, id=%lu)\n", __func__,
- power_domain, power_domain->dev, power_domain->id);
-
- return 0;
-}
-
-static int tegra186_power_domain_free(struct power_domain *power_domain)
-{
- debug("%s(power_domain=%p) (dev=%p, id=%lu)\n", __func__,
- power_domain, power_domain->dev, power_domain->id);
-
- return 0;
-}
-
static int tegra186_power_domain_common(struct power_domain *power_domain,
bool on)
{
}
struct power_domain_ops tegra186_power_domain_ops = {
- .request = tegra186_power_domain_request,
- .rfree = tegra186_power_domain_free,
.on = tegra186_power_domain_on,
.off = tegra186_power_domain_off,
};
-static int tegra186_power_domain_probe(struct udevice *dev)
-{
- debug("%s(dev=%p)\n", __func__, dev);
-
- return 0;
-}
-
U_BOOT_DRIVER(tegra186_power_domain) = {
.name = "tegra186_power_domain",
.id = UCLASS_POWER_DOMAIN,
- .probe = tegra186_power_domain_probe,
.ops = &tegra186_power_domain_ops,
};
return 0;
}
-
-static int ti_power_domain_request(struct power_domain *pd)
-{
- return 0;
-}
-
-static int ti_power_domain_free(struct power_domain *pd)
-{
- return 0;
-}
-
static const struct udevice_id ti_power_domain_of_match[] = {
{ .compatible = "ti,sci-pm-domain" },
{ /* sentinel */ }
.on = ti_power_domain_on,
.off = ti_power_domain_off,
.of_xlate = ti_power_domain_of_xlate,
- .request = ti_power_domain_request,
- .rfree = ti_power_domain_free,
};
U_BOOT_DRIVER(ti_pm_domains) = {
return 0;
}
-static int ti_sci_power_domain_request(struct power_domain *pd)
-{
- debug("%s(pd=%p)\n", __func__, pd);
- return 0;
-}
-
-static int ti_sci_power_domain_free(struct power_domain *pd)
-{
- debug("%s(pd=%p)\n", __func__, pd);
- return 0;
-}
-
static int ti_sci_power_domain_on(struct power_domain *pd)
{
struct ti_sci_power_domain_data *data = dev_get_priv(pd->dev);
};
static struct power_domain_ops ti_sci_power_domain_ops = {
- .request = ti_sci_power_domain_request,
- .rfree = ti_sci_power_domain_free,
.on = ti_sci_power_domain_on,
.off = ti_sci_power_domain_off,
.of_xlate = ti_sci_power_domain_of_xlate,