Require Intel for PECI, add empty AMD power module
PECI is an Intel-only mechanism for getting CPU temp. AMD will use SB-TSI to get temps. Add empty power functions for AMD so the project will compile with AMD selected. Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
		
				
					committed by
					
						 Tim Crawford
						Tim Crawford
					
				
			
			
				
	
			
			
			
						parent
						
							2c6977bc6b
						
					
				
				
					commit
					3d8204c3f4
				
			| @@ -7,11 +7,14 @@ | |||||||
| #include <board/gpio.h> | #include <board/gpio.h> | ||||||
| #include <board/kbled.h> | #include <board/kbled.h> | ||||||
| #include <board/lid.h> | #include <board/lid.h> | ||||||
| #include <board/peci.h> |  | ||||||
| #include <board/pwm.h> | #include <board/pwm.h> | ||||||
| #include <common/debug.h> | #include <common/debug.h> | ||||||
| #include <common/macro.h> | #include <common/macro.h> | ||||||
|  |  | ||||||
|  | #if CONFIG_PLATFORM_INTEL | ||||||
|  | #include <board/peci.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #ifndef HAVE_LED_AIRPLANE_N | #ifndef HAVE_LED_AIRPLANE_N | ||||||
| #define HAVE_LED_AIRPLANE_N 1 | #define HAVE_LED_AIRPLANE_N 1 | ||||||
| #endif // HAVE_LED_AIRPLANE_N | #endif // HAVE_LED_AIRPLANE_N | ||||||
| @@ -113,7 +116,9 @@ uint8_t acpi_read(uint8_t addr) { | |||||||
|             } |             } | ||||||
|             break; |             break; | ||||||
|  |  | ||||||
|  | #if CONFIG_PLATFORM_INTEL | ||||||
|         ACPI_8(0x07, peci_temp); |         ACPI_8(0x07, peci_temp); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|         // Handle AC adapter and battery present |         // Handle AC adapter and battery present | ||||||
|         case 0x10: |         case 0x10: | ||||||
|   | |||||||
| @@ -14,7 +14,6 @@ board-common-y += keymap.c | |||||||
| board-common-y += lid.c | board-common-y += lid.c | ||||||
| board-common-y += main.c | board-common-y += main.c | ||||||
| board-common-y += parallel.c | board-common-y += parallel.c | ||||||
| board-common-y += peci.c |  | ||||||
| board-common-y += pmc.c | board-common-y += pmc.c | ||||||
| board-common-y += pnp.c | board-common-y += pnp.c | ||||||
| board-common-y += ps2.c | board-common-y += ps2.c | ||||||
| @@ -42,8 +41,12 @@ CFLAGS+=-DLEVEL=4 | |||||||
| #CFLAGS+=-DI2C_DEBUGGER=0x76 | #CFLAGS+=-DI2C_DEBUGGER=0x76 | ||||||
|  |  | ||||||
| ifeq ($(CONFIG_PLATFORM_INTEL),y) | ifeq ($(CONFIG_PLATFORM_INTEL),y) | ||||||
|  | board-common-y += peci.c | ||||||
| board-common-y += power/intel.c | board-common-y += power/intel.c | ||||||
| CFLAGS += -DCONFIG_PLATFORM_INTEL=1 | CFLAGS += -DCONFIG_PLATFORM_INTEL=1 | ||||||
|  | else ifeq ($(CONFIG_PLATFORM_AMD),y) | ||||||
|  | board-common-y += power/amd.c | ||||||
|  | CFLAGS += -DCONFIG_PLATFORM_AMD=1 | ||||||
| else | else | ||||||
| $(error PLATFORM not specified) | $(error PLATFORM not specified) | ||||||
| endif | endif | ||||||
|   | |||||||
| @@ -2,12 +2,15 @@ | |||||||
|  |  | ||||||
| #include <board/fan.h> | #include <board/fan.h> | ||||||
| #include <board/dgpu.h> | #include <board/dgpu.h> | ||||||
| #include <board/peci.h> |  | ||||||
| #include <board/power.h> | #include <board/power.h> | ||||||
| #include <common/debug.h> | #include <common/debug.h> | ||||||
| #include <common/macro.h> | #include <common/macro.h> | ||||||
| #include <ec/pwm.h> | #include <ec/pwm.h> | ||||||
|  |  | ||||||
|  | #if CONFIG_PLATFORM_INTEL | ||||||
|  | #include <board/peci.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| bool fan_max = false; | bool fan_max = false; | ||||||
|  |  | ||||||
| uint8_t fan1_pwm_actual = 0; | uint8_t fan1_pwm_actual = 0; | ||||||
| @@ -195,11 +198,16 @@ static uint16_t fan_get_tach1_rpm(void) { | |||||||
| } | } | ||||||
|  |  | ||||||
| void fan_event(void) { | void fan_event(void) { | ||||||
|  | #if CONFIG_PLATFORM_INTEL | ||||||
| #if CONFIG_HAVE_DGPU | #if CONFIG_HAVE_DGPU | ||||||
|     int16_t sys_temp = MAX(peci_temp, dgpu_temp); |     int16_t sys_temp = MAX(peci_temp, dgpu_temp); | ||||||
| #else | #else | ||||||
|     int16_t sys_temp = peci_temp; |     int16_t sys_temp = peci_temp; | ||||||
| #endif | #endif | ||||||
|  | #elif CONFIG_PLATFORM_AMD | ||||||
|  |     // TODO: AMD SB-TSI temp | ||||||
|  |     int16_t sys_temp = 50; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|     // Fan update interval is 100ms (main.c). The event changes PWM duty |     // Fan update interval is 100ms (main.c). The event changes PWM duty | ||||||
|     // by 1 every interval to give a smoothing effect. |     // by 1 every interval to give a smoothing effect. | ||||||
|   | |||||||
| @@ -17,7 +17,6 @@ void power_init(void); | |||||||
| void power_on(void); | void power_on(void); | ||||||
| void power_off(void); | void power_off(void); | ||||||
| void power_cpu_reset(void); | void power_cpu_reset(void); | ||||||
|  |  | ||||||
| void power_event(void); | void power_event(void); | ||||||
|  |  | ||||||
| #endif // _BOARD_POWER_H | #endif // _BOARD_POWER_H | ||||||
|   | |||||||
| @@ -18,7 +18,6 @@ | |||||||
| #include <board/kbscan.h> | #include <board/kbscan.h> | ||||||
| #include <board/keymap.h> | #include <board/keymap.h> | ||||||
| #include <board/lid.h> | #include <board/lid.h> | ||||||
| #include <board/peci.h> |  | ||||||
| #include <board/pmc.h> | #include <board/pmc.h> | ||||||
| #include <board/power.h> | #include <board/power.h> | ||||||
| #include <board/ps2.h> | #include <board/ps2.h> | ||||||
| @@ -31,6 +30,10 @@ | |||||||
| #include <common/version.h> | #include <common/version.h> | ||||||
| #include <ec/ec.h> | #include <ec/ec.h> | ||||||
|  |  | ||||||
|  | #if CONFIG_PLATFORM_INTEL | ||||||
|  | #include <board/peci.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #ifdef PARALLEL_DEBUG | #ifdef PARALLEL_DEBUG | ||||||
| #include <board/parallel.h> | #include <board/parallel.h> | ||||||
| #endif // PARALLEL_DEBUG | #endif // PARALLEL_DEBUG | ||||||
| @@ -73,7 +76,9 @@ void init(void) { | |||||||
|         kbscan_init(); |         kbscan_init(); | ||||||
|     } |     } | ||||||
|     keymap_init(); |     keymap_init(); | ||||||
|  | #if CONFIG_PLATFORM_INTEL | ||||||
|     peci_init(); |     peci_init(); | ||||||
|  | #endif | ||||||
|     pmc_init(); |     pmc_init(); | ||||||
|     pwm_init(); |     pwm_init(); | ||||||
|     smbus_init(); |     smbus_init(); | ||||||
| @@ -140,7 +145,9 @@ void main(void) { | |||||||
|             if ((time - last_time_250ms) >= INTERVAL_250MS) { |             if ((time - last_time_250ms) >= INTERVAL_250MS) { | ||||||
|                 last_time_250ms = time; |                 last_time_250ms = time; | ||||||
|  |  | ||||||
|  | #if CONFIG_PLATFORM_INTEL | ||||||
|                 peci_read_temp(); |                 peci_read_temp(); | ||||||
|  | #endif | ||||||
|                 dgpu_read_temp(); |                 dgpu_read_temp(); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								src/board/system76/common/power/amd.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/board/system76/common/power/amd.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | // SPDX-License-Identifier: GPL-3.0-only | ||||||
|  |  | ||||||
|  | #include <board/power.h> | ||||||
|  |  | ||||||
|  | enum PowerState power_state = POWER_STATE_OFF; | ||||||
|  |  | ||||||
|  | void update_power_state(void) {} | ||||||
|  | void power_init(void) {} | ||||||
|  | void power_on(void) {} | ||||||
|  | void power_off(void) {} | ||||||
|  | void power_cpu_reset(void) {} | ||||||
|  | void power_event(void) {} | ||||||
| @@ -1,5 +1,7 @@ | |||||||
| // SPDX-License-Identifier: GPL-3.0-only | // SPDX-License-Identifier: GPL-3.0-only | ||||||
|  |  | ||||||
|  | #include <board/power.h> | ||||||
|  |  | ||||||
| #include <arch/delay.h> | #include <arch/delay.h> | ||||||
| #include <arch/time.h> | #include <arch/time.h> | ||||||
| #include <board/acpi.h> | #include <board/acpi.h> | ||||||
| @@ -12,7 +14,6 @@ | |||||||
| #include <board/kbled.h> | #include <board/kbled.h> | ||||||
| #include <board/lid.h> | #include <board/lid.h> | ||||||
| #include <board/peci.h> | #include <board/peci.h> | ||||||
| #include <board/power.h> |  | ||||||
| #include <board/pmc.h> | #include <board/pmc.h> | ||||||
| #include <board/pnp.h> | #include <board/pnp.h> | ||||||
| #include <board/wireless.h> | #include <board/wireless.h> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user