Conditionally compile USB-PD support
Boards may not have USB-PD. Remove the need for a "none" option by only adding USB-PD sources when enabled. The resulting binary for boards with USB-PD enabled (addw3, bonw15, serw13) are identical. The binary for boards without USB-PD now have the empty calls optimized out. Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
committed by
Tim Crawford
parent
fc3bad29a2
commit
1e4667f1d3
@ -29,8 +29,6 @@ CFLAGS+=-DI2C_SMBUS=I2C_4
|
||||
# Set touchpad PS2 bus
|
||||
CFLAGS+=-DPS2_TOUCHPAD=PS2_3
|
||||
|
||||
# Set USB-PD I2C bus
|
||||
CFLAGS+=-DI2C_USBPD=I2C_1
|
||||
|
||||
# Set smart charger parameters
|
||||
# XXX: PRS1 and PRS2 are in parallel for adapter Rsense?
|
||||
@ -43,7 +41,9 @@ CFLAGS+=\
|
||||
-DCHARGER_INPUT_CURRENT=16920
|
||||
|
||||
# Set USB-PD parameters
|
||||
USBPD=tps65987
|
||||
CONFIG_HAVE_USBPD = y
|
||||
CONFIG_USBPD_TPS65987 = y
|
||||
CFLAGS += -DI2C_USBPD=I2C_1
|
||||
|
||||
# Set CPU power limits in watts
|
||||
CFLAGS+=\
|
||||
|
@ -76,8 +76,10 @@ CHARGER?=bq24780s
|
||||
board-common-y += charger/$(CHARGER).c
|
||||
|
||||
# Add USB-PD
|
||||
USBPD?=none
|
||||
board-common-y += usbpd/$(USBPD).c
|
||||
ifeq ($(CONFIG_HAVE_USBPD),y)
|
||||
CFLAGS += -DCONFIG_HAVE_USBPD=1
|
||||
board-common-$(CONFIG_USBPD_TPS65987) += usbpd/tps65987.c
|
||||
endif
|
||||
|
||||
# Add keyboard
|
||||
ifndef KEYBOARD
|
||||
|
@ -3,9 +3,20 @@
|
||||
#ifndef _BOARD_USBPD_H
|
||||
#define _BOARD_USBPD_H
|
||||
|
||||
#if CONFIG_HAVE_USBPD
|
||||
|
||||
void usbpd_init(void);
|
||||
void usbpd_event(void);
|
||||
void usbpd_disable_charging(void);
|
||||
void usbpd_enable_charging(void);
|
||||
|
||||
#else
|
||||
|
||||
static inline void usbpd_init(void) {}
|
||||
static inline void usbpd_event(void) {}
|
||||
static inline void usbpd_disable_charging(void) {}
|
||||
static inline void usbpd_enable_charging(void) {}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _BOARD_USBPD_H
|
||||
|
@ -1,11 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include <board/usbpd.h>
|
||||
|
||||
void usbpd_init(void) {}
|
||||
|
||||
void usbpd_event(void) {}
|
||||
|
||||
void usbpd_disable_charging(void) {}
|
||||
|
||||
void usbpd_enable_charging(void) {}
|
@ -31,8 +31,6 @@ CFLAGS+=-DI2C_SMBUS=I2C_4
|
||||
# Set touchpad PS2 bus
|
||||
CFLAGS+=-DPS2_TOUCHPAD=PS2_3
|
||||
|
||||
# Set USB-PD I2C bus
|
||||
CFLAGS+=-DI2C_USBPD=I2C_1
|
||||
|
||||
# Set smart charger parameters
|
||||
# TODO: actually bq24800
|
||||
@ -45,7 +43,9 @@ CFLAGS+=\
|
||||
-DCHARGER_INPUT_CURRENT=11500
|
||||
|
||||
# Set USB-PD parameters
|
||||
USBPD=tps65987
|
||||
CONFIG_HAVE_USBPD = y
|
||||
CONFIG_USBPD_TPS65987 = y
|
||||
CFLAGS += -DI2C_USBPD=I2C_1
|
||||
|
||||
# Set CPU power limits in watts
|
||||
CFLAGS+=\
|
||||
|
@ -29,8 +29,6 @@ CFLAGS+=-DI2C_SMBUS=I2C_4
|
||||
# Set touchpad PS2 bus
|
||||
CFLAGS+=-DPS2_TOUCHPAD=PS2_3
|
||||
|
||||
# Set USB-PD I2C bus
|
||||
CFLAGS+=-DI2C_USBPD=I2C_1
|
||||
|
||||
# Set smart charger parameters
|
||||
# TODO: actually bq24800
|
||||
@ -42,7 +40,9 @@ CFLAGS+=\
|
||||
-DCHARGER_INPUT_CURRENT=14000
|
||||
|
||||
# Set USB-PD parameters
|
||||
USBPD=tps65987
|
||||
CONFIG_HAVE_USBPD = y
|
||||
CONFIG_USBPD_TPS65987 = y
|
||||
CFLAGS += -DI2C_USBPD=I2C_1
|
||||
|
||||
# Set CPU power limits in watts
|
||||
CFLAGS+=\
|
||||
|
Reference in New Issue
Block a user