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

Mtl dgpu #62

Merged
merged 29 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4610fd5
ec/ite/adc.c: add comment explaining ADC range
mkopec Jul 29, 2024
5ef0b51
board/novacustom/v560tnx: add board
mkopec Jul 29, 2024
5a3f0c3
Rework fan PWM index handling
mkopec Jul 30, 2024
c794247
v5x0tnx/gpio.h: remove nonexistent SINK_CTRL_2
mkopec Jul 30, 2024
4809f93
novacustom/v560tnx/board.mk: fill in power params
mkopec Jul 30, 2024
6acd6bb
Add V540TNx
mkopec Aug 14, 2024
7fc6764
keyboard/15in_102/keymap/micmute.c: add keymap
mkopec Aug 19, 2024
2c847bd
novacustom/v56*: set correct keymap
mkopec Aug 19, 2024
f6176b5
board/novacustom/v5.0tnx/gpio.c: fix incorrect ME_WE pin direction
mkopec Sep 10, 2024
4b2917c
board/novacustom/v5.0tnx/board.c: add board ID defs
mkopec Sep 12, 2024
1c048a7
board/novacustom/v5*: set GPA1 pin to alt fn
mkopec Sep 12, 2024
52d3419
common/usbpd/tps65987.c: add basic event handling
mkopec Sep 26, 2024
fddd3a6
novacustom/v5.0tnx: port more GPIO config from clevo fw
mkopec Sep 27, 2024
af53259
v560tnx: update GPIO config as per Clevo FW version .11
mkopec Oct 9, 2024
3804902
tps65987: handle events only when platform is on
mkopec Oct 9, 2024
7cb1739
common/main.c: increase fan polling interval
mkopec Oct 15, 2024
bee2160
board/ncm/v5.0tnx: update global config registers per Clevo FW
mkopec Oct 15, 2024
3c9e2f5
Reduce charger safety margin to 7%
mkopec Oct 15, 2024
26bb44c
novacustom/v5.0tnx: bump power charger input power, define AC adapter…
mkopec Oct 15, 2024
70d2dac
common/include/board/battery.h: get AC adapter voltage from cflags
mkopec Oct 15, 2024
cf7b0fc
pwm: actually use the correct DCR registers for each fan
mkopec Oct 17, 2024
14afa0e
power: apply safety margin on USB-PD only
mkopec Oct 18, 2024
e376892
common: Add Nvidia D-notifier support
mkopec Oct 18, 2024
86c0037
novacustom/v5.0tnx: enable D-notifier
mkopec Oct 18, 2024
5a61983
board/ncm/v5.0tnx: tweak D-notifier thresholds
mkopec Oct 25, 2024
f097df1
common/usbpd/tps65987.c: restore previous safety margins
mkopec Oct 25, 2024
6ad853d
common/acpi.c: report power supply wattage
mkopec Oct 25, 2024
3920d55
common/power.c: make applying PsysPL configurable
mkopec Oct 25, 2024
7fedef6
board/ncm/v5.0tnx: disable PsysPL
mkopec Oct 25, 2024
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
81 changes: 81 additions & 0 deletions src/board/novacustom/v540tnx/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// SPDX-License-Identifier: GPL-3.0-only

#include <board/board.h>
#include <board/battery.h>
#include <board/gpio.h>
#include <board/espi.h>
#include <common/debug.h>
#include <ec/adc.h>
#include <ec/ec.h>

void board_init(void) {
espi_init();
battery_charger_disable();

// Allow backlight to be turned on
gpio_set(&BKL_EN, true);
// Enable camera
gpio_set(&CCD_EN, true);

adc_init();
}

uint8_t board_id(void) {
static bool cached = false;
static uint8_t board_id = 0;

if (cached)
return board_id;

int16_t id = adc_read_channel(7);
if (id < 0) {
ERROR("Board ID error %ld, defaulting to V54 GN20P\n", id);
board_id = 0;
goto exit;
}

if (id < 250) {
INFO("Board ID: V54 GN20P\n");
board_id = 0;
goto exit;
}

if (id < 800) {
INFO("Board ID: V56 GN20P\n");
board_id = 1;
goto exit;
}

if (id < 1800) {
INFO("Board ID: V54 GN21-X4/X2\n");
board_id = 2;
goto exit;
}

if (id < 2400) {
INFO("Board ID: V54 GN21-X6\n");
board_id = 3;
goto exit;
}

if (id < 2800) {
INFO("Board ID: V56 GN21-X4/X2\n");
board_id = 4;
goto exit;
}

INFO("Board ID: V56 GN21-X6\n");
board_id = 5;

exit:
cached = true;
return board_id;
}

void board_event(void) {
espi_event();

board_id();

ec_read_post_codes();
}
70 changes: 70 additions & 0 deletions src/board/novacustom/v540tnx/board.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# SPDX-License-Identifier: GPL-3.0-only

board-y += board.c
board-y += gpio.c

EC = ite
CONFIG_EC_ITE_IT5570E = y

# Enable eSPI
CONFIG_BUS_ESPI = y

# Use S0ix
CFLAGS+=-DUSE_S0IX=1

# Include keyboard
KEYBOARD = 14in_83
KEYMAP=combo_iso_ansi_micmute

# Set keyboard LED mechanism
KBLED=white_dac
CFLAGS+=-DKBLED_DAC=2

# Set discrete GPU I2C bus
CFLAGS+=-DI2C_DGPU=I2C_1

# Set battery I2C bus
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
CHARGER = oz26786
CFLAGS += \
-DCHARGER_ADAPTER_RSENSE=5 \
-DCHARGER_BATTERY_RSENSE=10 \
-DCHARGER_CHARGE_CURRENT=1536 \
-DCHARGER_CHARGE_VOLTAGE=17600 \
-DCHARGER_INPUT_CURRENT=9000

# Set CPU power limits in watts and disable setting PSYS
# AC: power rating of the included AC adapter
# DC: battery discharge rate (1c discharge rate)
CFLAGS += \
-DPOWER_LIMIT_PSYS_ENABLE=0 \
-DPOWER_LIMIT_AC=180 \
-DPOWER_LIMIT_DC=80

# 20V power supply
CFLAGS += -DAC_ADAPTER_VOLTAGE=20

# DGPU support
CFLAGS+=-DHAVE_DGPU=1 -DGPU_FAN1=3

# D-notifier support for NVIDIA
CFLAGS+= -DHAVE_D_NOTIFY=1 \
-DD_NOTIFY_D1_MIN_W=180 \
-DD_NOTIFY_D2_MIN_W=80 \
-DD_NOTIFY_D3_MIN_W=75 \
-DD_NOTIFY_D4_MIN_W=70 \
-DD_NOTIFY_D5_MIN_W=65

# Set USB-PD parameters
USBPD=tps65987

# Add common code
include src/board/system76/common/common.mk
Loading
Loading