Change the parameters of the LPM API for further extension.
Change-Id: Id8897c256c2118d00c6b9f3e7424ebc6100f02eb
Signed-off-by: Liju-Clr Chen <liju-clr.chen@mediatek.com>
/* If subsys clk/mtcmos is on, add block-resource-off flag */
if (rm->update != NULL) {
- res = rm->update(rm->consts, stateid, priv);
+ res = rm->update(rm->consts, plat_mt_rm.count, stateid, priv);
if (res != 0) {
return res;
}
(!(mmio_read_32(SPM_PWR_STATUS) & mask) && \
!(mmio_read_32(SPM_PWR_STATUS_2ND) & mask))
-int mt_spm_cond_update(struct mt_resource_constraint **con, int stateid, void *priv)
+int mt_spm_cond_update(struct mt_resource_constraint **con, unsigned int num,
+ int stateid, void *priv)
{
static const struct {
uintptr_t en_reg;
{ PLL_APLL5, PLL_BIT_APLL5 },
};
- int i, res;
+ int res;
+ unsigned int i;
struct mt_resource_constraint *const *_con;
/* read all cg state */
- for (i = 0; i < PLAT_SPM_COND_MAX; i++) {
+ for (i = 0U; i < PLAT_SPM_COND_MAX; i++) {
spm_cond_t.table_cg[i] = 0U;
/* check mtcmos, if off set idle_value and clk to 0 disable */
}
spm_cond_t.table_pll = 0U;
- for (i = 0; i < ARRAY_SIZE(plls); i++) {
+ for (i = 0U; i < ARRAY_SIZE(plls); i++) {
if ((mmio_read_32(plls[i].en_reg) & BIT(9)) != 0U) {
spm_cond_t.table_pll |= plls[i].pll_b;
}
}
spm_cond_t.priv = priv;
- for (_con = con; *_con != NULL ; _con++) {
+ for (i = 0U, _con = con; (*_con != NULL) && (i < num); _con++, i++) {
if ((*_con)->update == NULL) {
continue;
}
unsigned int mt_spm_dump_all_pll(const struct mt_spm_cond_tables *src,
const struct mt_spm_cond_tables *dest,
struct mt_spm_cond_tables *res);
-int mt_spm_cond_update(struct mt_resource_constraint **con, int stateid, void *priv);
+int mt_spm_cond_update(struct mt_resource_constraint **con, unsigned int num,
+ int stateid, void *priv);
#endif
};
struct mt_resource_manager {
- int (*update)(struct mt_resource_constraint **con,
+ int (*update)(struct mt_resource_constraint **con, unsigned int num,
int stateid, void *priv);
struct mt_resource_constraint **consts;
};
/*
- * Copyright (c) 2022, MediaTek Inc. All rights reserved.
+ * Copyright (c) 2022-2023, MediaTek Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
(((mmio_read_32(SPM_PWR_STATUS) & mask) == 0U) && \
((mmio_read_32(SPM_PWR_STATUS_2ND) & mask) == 0U))
-int mt_spm_cond_update(struct mt_resource_constraint **con, int stateid, void *priv)
+int mt_spm_cond_update(struct mt_resource_constraint **con, unsigned int num,
+ int stateid, void *priv)
{
int res;
uint32_t i;
/*
- * Copyright (c) 2022, MediaTek Inc. All rights reserved.
+ * Copyright (c) 2022-2023, MediaTek Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
const struct mt_spm_cond_tables *dest,
struct mt_spm_cond_tables *res);
-extern int mt_spm_cond_update(struct mt_resource_constraint **con,
+extern int mt_spm_cond_update(struct mt_resource_constraint **con, unsigned int num,
int stateid, void *priv);
#endif /* MT_SPM_CONDIT_H */
/*
- * Copyright (c) 2020, MediaTek Inc. All rights reserved.
+ * Copyright (c) 2020-2023, MediaTek Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
(((mmio_read_32(SPM_PWR_STATUS) & mask) == 0U) && \
((mmio_read_32(SPM_PWR_STATUS_2ND) & mask) == 0U))
-int mt_spm_cond_update(struct mt_resource_constraint **con,
+int mt_spm_cond_update(struct mt_resource_constraint **con, unsigned int num,
int stateid, void *priv)
{
int res;
/*
- * Copyright (c) 2020, MediaTek Inc. All rights reserved.
+ * Copyright (c) 2020-2023, MediaTek Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
const struct mt_spm_cond_tables *src,
const struct mt_spm_cond_tables *dest,
struct mt_spm_cond_tables *res);
-extern int mt_spm_cond_update(struct mt_resource_constraint **con,
+extern int mt_spm_cond_update(struct mt_resource_constraint **con, unsigned int num,
int stateid, void *priv);
#endif /* MT_SPM_CONDIT_H */
/*
- * Copyright (c) 2021, MediaTek Inc. All rights reserved.
+ * Copyright (c) 2021-2023, MediaTek Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
(((mmio_read_32(SPM_PWR_STATUS) & mask) == 0U) && \
((mmio_read_32(SPM_PWR_STATUS_2ND) & mask) == 0U))
-int mt_spm_cond_update(struct mt_resource_constraint **con,
+int mt_spm_cond_update(struct mt_resource_constraint **con, unsigned int num,
int stateid, void *priv)
{
int res;
/*
- * Copyright (c) 2021, MediaTek Inc. All rights reserved.
+ * Copyright (c) 2021-2023, MediaTek Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
const struct mt_spm_cond_tables *src,
const struct mt_spm_cond_tables *dest,
struct mt_spm_cond_tables *res);
-extern int mt_spm_cond_update(struct mt_resource_constraint **con,
+extern int mt_spm_cond_update(struct mt_resource_constraint **con, unsigned int num,
int stateid, void *priv);
#endif /* MT_SPM_CONDIT_H */