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
|
# Set touchpad PS2 bus
|
||||||
CFLAGS+=-DPS2_TOUCHPAD=PS2_3
|
CFLAGS+=-DPS2_TOUCHPAD=PS2_3
|
||||||
|
|
||||||
# Set USB-PD I2C bus
|
|
||||||
CFLAGS+=-DI2C_USBPD=I2C_1
|
|
||||||
|
|
||||||
# Set smart charger parameters
|
# Set smart charger parameters
|
||||||
# XXX: PRS1 and PRS2 are in parallel for adapter Rsense?
|
# XXX: PRS1 and PRS2 are in parallel for adapter Rsense?
|
||||||
@ -43,7 +41,9 @@ CFLAGS+=\
|
|||||||
-DCHARGER_INPUT_CURRENT=16920
|
-DCHARGER_INPUT_CURRENT=16920
|
||||||
|
|
||||||
# Set USB-PD parameters
|
# 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
|
# Set CPU power limits in watts
|
||||||
CFLAGS+=\
|
CFLAGS+=\
|
||||||
|
@ -76,8 +76,10 @@ CHARGER?=bq24780s
|
|||||||
board-common-y += charger/$(CHARGER).c
|
board-common-y += charger/$(CHARGER).c
|
||||||
|
|
||||||
# Add USB-PD
|
# Add USB-PD
|
||||||
USBPD?=none
|
ifeq ($(CONFIG_HAVE_USBPD),y)
|
||||||
board-common-y += usbpd/$(USBPD).c
|
CFLAGS += -DCONFIG_HAVE_USBPD=1
|
||||||
|
board-common-$(CONFIG_USBPD_TPS65987) += usbpd/tps65987.c
|
||||||
|
endif
|
||||||
|
|
||||||
# Add keyboard
|
# Add keyboard
|
||||||
ifndef KEYBOARD
|
ifndef KEYBOARD
|
||||||
|
@ -3,9 +3,20 @@
|
|||||||
#ifndef _BOARD_USBPD_H
|
#ifndef _BOARD_USBPD_H
|
||||||
#define _BOARD_USBPD_H
|
#define _BOARD_USBPD_H
|
||||||
|
|
||||||
|
#if CONFIG_HAVE_USBPD
|
||||||
|
|
||||||
void usbpd_init(void);
|
void usbpd_init(void);
|
||||||
void usbpd_event(void);
|
void usbpd_event(void);
|
||||||
void usbpd_disable_charging(void);
|
void usbpd_disable_charging(void);
|
||||||
void usbpd_enable_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
|
#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
|
# Set touchpad PS2 bus
|
||||||
CFLAGS+=-DPS2_TOUCHPAD=PS2_3
|
CFLAGS+=-DPS2_TOUCHPAD=PS2_3
|
||||||
|
|
||||||
# Set USB-PD I2C bus
|
|
||||||
CFLAGS+=-DI2C_USBPD=I2C_1
|
|
||||||
|
|
||||||
# Set smart charger parameters
|
# Set smart charger parameters
|
||||||
# TODO: actually bq24800
|
# TODO: actually bq24800
|
||||||
@ -45,7 +43,9 @@ CFLAGS+=\
|
|||||||
-DCHARGER_INPUT_CURRENT=11500
|
-DCHARGER_INPUT_CURRENT=11500
|
||||||
|
|
||||||
# Set USB-PD parameters
|
# 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
|
# Set CPU power limits in watts
|
||||||
CFLAGS+=\
|
CFLAGS+=\
|
||||||
|
@ -29,8 +29,6 @@ CFLAGS+=-DI2C_SMBUS=I2C_4
|
|||||||
# Set touchpad PS2 bus
|
# Set touchpad PS2 bus
|
||||||
CFLAGS+=-DPS2_TOUCHPAD=PS2_3
|
CFLAGS+=-DPS2_TOUCHPAD=PS2_3
|
||||||
|
|
||||||
# Set USB-PD I2C bus
|
|
||||||
CFLAGS+=-DI2C_USBPD=I2C_1
|
|
||||||
|
|
||||||
# Set smart charger parameters
|
# Set smart charger parameters
|
||||||
# TODO: actually bq24800
|
# TODO: actually bq24800
|
||||||
@ -42,7 +40,9 @@ CFLAGS+=\
|
|||||||
-DCHARGER_INPUT_CURRENT=14000
|
-DCHARGER_INPUT_CURRENT=14000
|
||||||
|
|
||||||
# Set USB-PD parameters
|
# 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
|
# Set CPU power limits in watts
|
||||||
CFLAGS+=\
|
CFLAGS+=\
|
||||||
|
Reference in New Issue
Block a user