soc: mediatek: mtk-svs: Reduce memory footprint of struct svs_bank

Many 32-bit members of this struct can be size reduced to either 16-bit
or even 8-bit, for a total saving of ~61 bytes per bank. Keeping in mind
that one SoC declares at least two banks, this brings a minimum of ~122
bytes saving (depending on compiler optimization).

Link: https://lore.kernel.org/r/20231121125044.78642-6-angelogioacchino.delregno@collabora.comSigned-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
parent 07933fe2
...@@ -456,13 +456,13 @@ struct svs_bank { ...@@ -456,13 +456,13 @@ struct svs_bank {
char *buck_name; char *buck_name;
char *tzone_name; char *tzone_name;
enum svsb_phase phase; enum svsb_phase phase;
s32 volt_od; short int volt_od;
u32 reg_data[SVSB_PHASE_MAX][SVS_REG_MAX]; u32 reg_data[SVSB_PHASE_MAX][SVS_REG_MAX];
u32 pm_runtime_enabled_count; u32 pm_runtime_enabled_count;
u32 mode_support; u8 mode_support;
u32 freq_base; u32 freq_base;
u32 turn_freq_base; u32 turn_freq_base;
u32 vboot; u8 vboot;
u32 opp_dfreq[MAX_OPP_ENTRIES]; u32 opp_dfreq[MAX_OPP_ENTRIES];
u32 opp_dvolt[MAX_OPP_ENTRIES]; u32 opp_dvolt[MAX_OPP_ENTRIES];
u32 freq_pct[MAX_OPP_ENTRIES]; u32 freq_pct[MAX_OPP_ENTRIES];
...@@ -470,36 +470,36 @@ struct svs_bank { ...@@ -470,36 +470,36 @@ struct svs_bank {
u32 volt_step; u32 volt_step;
u32 volt_base; u32 volt_base;
u32 volt_flags; u32 volt_flags;
u32 vmax; u8 vmax;
u32 vmin; u8 vmin;
u32 age_config; u32 age_config;
u32 age_voffset_in; u16 age_voffset_in;
u32 dc_config; u32 dc_config;
u32 dc_voffset_in; u16 dc_voffset_in;
u32 dvt_fixed; u8 dvt_fixed;
u32 vco; u8 vco;
u32 chk_shift; u8 chk_shift;
u32 core_sel; u32 core_sel;
u32 opp_count; u8 opp_count;
u32 int_st; u32 int_st;
u32 sw_id; u8 sw_id;
u32 cpu_id; u8 cpu_id;
u32 ctl0; u32 ctl0;
u32 temp; u32 temp;
u32 tzone_htemp; u32 tzone_htemp;
u32 tzone_htemp_voffset; u16 tzone_htemp_voffset;
u32 tzone_ltemp; u32 tzone_ltemp;
u32 tzone_ltemp_voffset; u16 tzone_ltemp_voffset;
u32 bts; u16 bts;
u32 mts; u16 mts;
u32 bdes; u16 bdes;
u32 mdes; u16 mdes;
u32 mtdes; u8 mtdes;
u32 dcbdet; u8 dcbdet;
u32 dcmdet; u8 dcmdet;
u32 turn_pt; u32 turn_pt;
u32 vbin_turn_pt; u32 vbin_turn_pt;
u32 type; u8 type;
}; };
static u32 percent(u32 numerator, u32 denominator) static u32 percent(u32 numerator, u32 denominator)
...@@ -1267,6 +1267,7 @@ static inline void svs_error_isr_handler(struct svs_platform *svsp) ...@@ -1267,6 +1267,7 @@ static inline void svs_error_isr_handler(struct svs_platform *svsp)
static inline void svs_init01_isr_handler(struct svs_platform *svsp) static inline void svs_init01_isr_handler(struct svs_platform *svsp)
{ {
struct svs_bank *svsb = svsp->pbank; struct svs_bank *svsb = svsp->pbank;
u32 val;
dev_info(svsb->dev, "%s: VDN74~30:0x%08x~0x%08x, DC:0x%08x\n", dev_info(svsb->dev, "%s: VDN74~30:0x%08x~0x%08x, DC:0x%08x\n",
__func__, svs_readl_relaxed(svsp, VDESIGN74), __func__, svs_readl_relaxed(svsp, VDESIGN74),
...@@ -1276,8 +1277,8 @@ static inline void svs_init01_isr_handler(struct svs_platform *svsp) ...@@ -1276,8 +1277,8 @@ static inline void svs_init01_isr_handler(struct svs_platform *svsp)
svs_save_bank_register_data(svsp, SVSB_PHASE_INIT01); svs_save_bank_register_data(svsp, SVSB_PHASE_INIT01);
svsb->phase = SVSB_PHASE_INIT01; svsb->phase = SVSB_PHASE_INIT01;
svsb->dc_voffset_in = ~(svs_readl_relaxed(svsp, DCVALUES) & val = ~(svs_readl_relaxed(svsp, DCVALUES) & GENMASK(15, 0)) + 1;
GENMASK(15, 0)) + 1; svsb->dc_voffset_in = val & GENMASK(15, 0);
if (svsb->volt_flags & SVSB_INIT01_VOLT_IGNORE || if (svsb->volt_flags & SVSB_INIT01_VOLT_IGNORE ||
(svsb->dc_voffset_in & SVSB_DC_SIGNED_BIT && (svsb->dc_voffset_in & SVSB_DC_SIGNED_BIT &&
svsb->volt_flags & SVSB_INIT01_VOLT_INC_ONLY)) svsb->volt_flags & SVSB_INIT01_VOLT_INC_ONLY))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment