Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditionally compile USB-PD support #429

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/board/system76/bonw15/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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+=\
Expand Down
6 changes: 4 additions & 2 deletions src/board/system76/common/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions src/board/system76/common/include/board/usbpd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 0 additions & 11 deletions src/board/system76/common/usbpd/none.c

This file was deleted.

6 changes: 3 additions & 3 deletions src/board/system76/oryp11/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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+=\
Expand Down
6 changes: 3 additions & 3 deletions src/board/system76/serw13/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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+=\
Expand Down