mb/starlabs/common: Move power profile enum to common code

This isn't a functional change, just reduces duplicated code.

Change-Id: I00b08a71d85be73fbadc25df685f7f9e04cc76c0
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89762
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
This commit is contained in:
Sean Rhodes 2025-10-27 08:18:21 +00:00
commit 87475ef37f
25 changed files with 43 additions and 76 deletions

View file

@ -5,15 +5,6 @@
#include <soc/gpio.h>
enum cmos_power_profile {
PP_POWER_SAVER = 0,
PP_BALANCED = 1,
PP_PERFORMANCE = 2,
};
#define NUM_POWER_PROFILES 3
enum cmos_power_profile get_power_profile(enum cmos_power_profile fallback);
/*
* The next set of functions return the gpio table and fill in the number of
* entries for each table.

View file

@ -5,12 +5,6 @@
#include <option.h>
#include <variants.h>
enum cmos_power_profile get_power_profile(enum cmos_power_profile fallback)
{
const unsigned int power_profile = get_uint_option("power_profile", fallback);
return power_profile < NUM_POWER_PROFILES ? power_profile : fallback;
}
static void init_mainboard(void *chip_info)
{
const struct pad_config *pads;

View file

@ -8,6 +8,7 @@
#include <static.h>
#include <types.h>
#include <variants.h>
#include <common/powercap.h>
#define TJ_MAX 105
#define TCC(temp) (TJ_MAX - temp)

View file

@ -2,6 +2,7 @@
subdirs-$(CONFIG_VENDOR_STARLABS) += cfr
subdirs-$(CONFIG_VENDOR_STARLABS) += hda
subdirs-$(CONFIG_VENDOR_STARLABS) += powercap
subdirs-$(CONFIG_VENDOR_STARLABS) += pin_mux
subdirs-$(CONFIG_VENDOR_STARLABS) += smbios

View file

@ -4,7 +4,7 @@
#define _STARLABS_CMN_CFR_H_
#include <drivers/option/cfr_frontend.h>
#include <variants.h>
#include <common/powercap.h>
void cfr_card_reader_update(const struct sm_object *obj, struct sm_object *new_obj);

View file

@ -0,0 +1,15 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _STARLABS_CMN_POWERCAP_H_
#define _STARLABS_CMN_POWERCAP_H_
enum cmos_power_profile {
PP_POWER_SAVER = 0,
PP_BALANCED = 1,
PP_PERFORMANCE = 2,
};
#define NUM_POWER_PROFILES 3
enum cmos_power_profile get_power_profile(enum cmos_power_profile fallback);
#endif

View file

@ -0,0 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
ramstage-y += powercap.c
CPPFLAGS_common += -I$(src)/mainboard/starlabs/common/powercap

View file

@ -0,0 +1,10 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <option.h>
#include <common/powercap.h>
enum cmos_power_profile get_power_profile(enum cmos_power_profile fallback)
{
const unsigned int power_profile = get_uint_option("power_profile", fallback);
return power_profile < NUM_POWER_PROFILES ? power_profile : fallback;
}

View file

@ -7,15 +7,10 @@
#include <static.h>
#include <types.h>
#include <variants.h>
#include <common/powercap.h>
#include "soc/intel/apollolake/chip.h"
enum cmos_power_profile get_power_profile(enum cmos_power_profile fallback)
{
const unsigned int power_profile = get_uint_option("power_profile", fallback);
return power_profile < NUM_POWER_PROFILES ? power_profile : fallback;
}
void devtree_update(void)
{
config_t *cfg = config_of_soc();

View file

@ -5,15 +5,6 @@
#include <gpio.h>
enum cmos_power_profile {
PP_POWER_SAVER = 0,
PP_BALANCED = 1,
PP_PERFORMANCE = 2,
};
#define NUM_POWER_PROFILES 3
enum cmos_power_profile get_power_profile(enum cmos_power_profile fallback);
/*
* The next set of functions return the gpio table and fill in the number of
* entries for each table.

View file

@ -5,15 +5,6 @@
#include <gpio.h>
enum cmos_power_profile {
PP_POWER_SAVER = 0,
PP_BALANCED = 1,
PP_PERFORMANCE = 2,
};
#define NUM_POWER_PROFILES 3
enum cmos_power_profile get_power_profile(enum cmos_power_profile fallback);
/*
* The next set of functions return the gpio table and fill in the number of
* entries for each table.

View file

@ -6,12 +6,6 @@
#include <option.h>
#include <variants.h>
enum cmos_power_profile get_power_profile(enum cmos_power_profile fallback)
{
const unsigned int power_profile = get_uint_option("power_profile", fallback);
return power_profile < NUM_POWER_PROFILES ? power_profile : fallback;
}
static void init_mainboard(void *chip_info)
{
const struct pad_config *pads;

View file

@ -8,6 +8,7 @@
#include <static.h>
#include <types.h>
#include <variants.h>
#include <common/powercap.h>
#define TJ_MAX 110
#define TCC(temp) (TJ_MAX - temp)

View file

@ -8,6 +8,7 @@
#include <static.h>
#include <types.h>
#include <variants.h>
#include <common/powercap.h>
#define TJ_MAX 105
#define TCC(temp) (TJ_MAX - temp)

View file

@ -8,6 +8,7 @@
#include <static.h>
#include <types.h>
#include <variants.h>
#include <common/powercap.h>
#define TJ_MAX 100
#define TCC(temp) (TJ_MAX - temp)

View file

@ -8,6 +8,7 @@
#include <static.h>
#include <types.h>
#include <variants.h>
#include <common/powercap.h>
#define TJ_MAX 100
#define TCC(temp) (TJ_MAX - temp)

View file

@ -8,6 +8,7 @@
#include <static.h>
#include <types.h>
#include <variants.h>
#include <common/powercap.h>
#define TJ_MAX 110
#define TCC(temp) (TJ_MAX - temp)

View file

@ -8,6 +8,7 @@
#include <static.h>
#include <types.h>
#include <variants.h>
#include <common/powercap.h>
#define TJ_MAX 110
#define TCC(temp) (TJ_MAX - temp)

View file

@ -8,6 +8,7 @@
#include <static.h>
#include <types.h>
#include <variants.h>
#include <common/powercap.h>
#define TJ_MAX 100
#define TCC(temp) (TJ_MAX - temp)

View file

@ -5,15 +5,6 @@
#include <soc/gpio.h>
enum cmos_power_profile {
PP_POWER_SAVER = 0,
PP_BALANCED = 1,
PP_PERFORMANCE = 2,
};
#define NUM_POWER_PROFILES 3
enum cmos_power_profile get_power_profile(enum cmos_power_profile fallback);
/*
* The next set of functions return the gpio table and fill in the number of
* entries for each table.

View file

@ -6,12 +6,6 @@
#include <option.h>
#include <variants.h>
enum cmos_power_profile get_power_profile(enum cmos_power_profile fallback)
{
const unsigned int power_profile = get_uint_option("power_profile", fallback);
return power_profile < NUM_POWER_PROFILES ? power_profile : fallback;
}
static void init_mainboard(void *chip_info)
{
const struct pad_config *pads;

View file

@ -8,6 +8,7 @@
#include <static.h>
#include <types.h>
#include <variants.h>
#include <common/powercap.h>
#define TJ_MAX 110
#define TCC(temp) (TJ_MAX - temp)

View file

@ -5,15 +5,6 @@
#include <soc/gpio.h>
enum cmos_power_profile {
PP_POWER_SAVER = 0,
PP_BALANCED = 1,
PP_PERFORMANCE = 2,
};
#define NUM_POWER_PROFILES 3
enum cmos_power_profile get_power_profile(enum cmos_power_profile fallback);
/*
* The next set of functions return the gpio table and fill in the number of
* entries for each table.

View file

@ -6,12 +6,6 @@
#include <option.h>
#include <variants.h>
enum cmos_power_profile get_power_profile(enum cmos_power_profile fallback)
{
const unsigned int power_profile = get_uint_option("power_profile", fallback);
return power_profile < NUM_POWER_PROFILES ? power_profile : fallback;
}
static void init_mainboard(void *chip_info)
{
const struct pad_config *pads;

View file

@ -8,6 +8,7 @@
#include <static.h>
#include <types.h>
#include <variants.h>
#include <common/powercap.h>
#define TJ_MAX 105
#define TCC(temp) (TJ_MAX - temp)