diff options
Diffstat (limited to 'zephyr/program/skyrim/frostflow/src')
-rw-r--r-- | zephyr/program/skyrim/frostflow/src/keyboard.c | 74 | ||||
-rw-r--r-- | zephyr/program/skyrim/frostflow/src/keyboard_customization.c | 85 | ||||
-rw-r--r-- | zephyr/program/skyrim/frostflow/src/ppc_config.c | 46 | ||||
-rw-r--r-- | zephyr/program/skyrim/frostflow/src/thermal.c | 109 | ||||
-rw-r--r-- | zephyr/program/skyrim/frostflow/src/usb_mux_config.c | 62 |
5 files changed, 0 insertions, 376 deletions
diff --git a/zephyr/program/skyrim/frostflow/src/keyboard.c b/zephyr/program/skyrim/frostflow/src/keyboard.c deleted file mode 100644 index 2905f17941..0000000000 --- a/zephyr/program/skyrim/frostflow/src/keyboard.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2022 The ChromiumOS Authors - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "ec_commands.h" -#include "keyboard_scan.h" -#include "timer.h" - -/* Keyboard scan setting */ -__override struct keyboard_scan_config keyscan_config = { - /* Increase from 50 us, because KSO_02 passes through the H1. */ - .output_settle_us = 80, - /* Other values should be the same as the default configuration. */ - .debounce_down_us = 9 * MSEC, - .debounce_up_us = 30 * MSEC, - .scan_period_us = 3 * MSEC, - .min_post_scan_delay_us = 1000, - .poll_timeout_us = 100 * MSEC, - .actual_key_mask = { - 0x1c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x86, 0xff, 0xff, 0x55, 0xff, 0xff, 0xff, 0xff, /* full set */ - }, -}; - -static const struct ec_response_keybd_config frostflow_kb = { - .num_top_row_keys = 10, - .action_keys = { - TK_BACK, /* T1 */ - TK_REFRESH, /* T2 */ - TK_FULLSCREEN, /* T3 */ - TK_OVERVIEW, /* T4 */ - TK_SNAPSHOT, /* T5 */ - TK_BRIGHTNESS_DOWN, /* T6 */ - TK_BRIGHTNESS_UP, /* T7 */ - TK_VOL_MUTE, /* T8 */ - TK_VOL_DOWN, /* T9 */ - TK_VOL_UP, /* T10 */ - }, - .capabilities = KEYBD_CAP_SCRNLOCK_KEY, -}; - -__override const struct ec_response_keybd_config * -board_vivaldi_keybd_config(void) -{ - return &frostflow_kb; -} - -/* - * Row Column info for Top row keys T1 - T15. - * on frostflow_kb keyboard Row Column is customization - * need define row col to mapping matrix layout. - */ -__override const struct key { - uint8_t row; - uint8_t col; -} vivaldi_keys[] = { - { .row = 4, .col = 2 }, /* T1 */ - { .row = 3, .col = 2 }, /* T2 */ - { .row = 2, .col = 2 }, /* T3 */ - { .row = 1, .col = 2 }, /* T4 */ - { .row = 4, .col = 4 }, /* T5 */ - { .row = 3, .col = 4 }, /* T6 */ - { .row = 2, .col = 4 }, /* T7 */ - { .row = 2, .col = 9 }, /* T8 */ - { .row = 1, .col = 9 }, /* T9 */ - { .row = 1, .col = 4 }, /* T10 */ - { .row = 0, .col = 4 }, /* T11 */ - { .row = 1, .col = 5 }, /* T12 */ - { .row = 3, .col = 5 }, /* T13 */ - { .row = 2, .col = 1 }, /* T14 */ - { .row = 0, .col = 1 }, /* T15 */ -}; -BUILD_ASSERT(ARRAY_SIZE(vivaldi_keys) == MAX_TOP_ROW_KEYS); diff --git a/zephyr/program/skyrim/frostflow/src/keyboard_customization.c b/zephyr/program/skyrim/frostflow/src/keyboard_customization.c deleted file mode 100644 index bd02940e03..0000000000 --- a/zephyr/program/skyrim/frostflow/src/keyboard_customization.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2022 The ChromiumOS Authors - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "common.h" -#include "gpio.h" -#include "keyboard_customization.h" -#include "keyboard_protocol.h" -#include "keyboard_raw.h" - -#include <zephyr/drivers/gpio.h> - -static uint16_t scancode_set2[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = { - { 0x0000, 0x0000, 0x0014, 0xe01f, 0xe014, 0x0000, 0x0000, 0x0000 }, - { 0x001f, 0x0076, 0x0017, 0x000e, 0x001c, 0x003a, 0x000d, 0x0016 }, - { 0x006c, 0xe024, 0xe01d, 0xe020, 0xe038, 0xe071, 0x0026, 0x002a }, - { 0x0032, 0x0034, 0x002c, 0x002e, 0x002b, 0x0029, 0x0025, 0x002d }, - { 0x0078, 0xe032, 0xe035, 0xe02c, 0xe02d, 0x0041, 0x001e, 0x001d }, - { 0x0051, 0x0007, 0x005b, 0x000f, 0x0042, 0x0022, 0x003e, 0x0043 }, - { 0x0031, 0x0033, 0x0035, 0x0036, 0x003b, 0x001b, 0x003d, 0x003c }, - { 0x0000, 0x0012, 0x0061, 0x0000, 0x0000, 0x0000, 0x0000, 0x0059 }, - { 0x0055, 0x0052, 0x0054, 0x004e, 0x004c, 0x0024, 0x0044, 0x004d }, - { 0x0045, 0xe021, 0xe023, 0x002f, 0x004b, 0x0049, 0x0046, 0x001a }, - { 0xe011, 0x0000, 0x006a, 0x0000, 0x005d, 0x0000, 0x0011, 0x0000 }, - { 0xe07a, 0x005d, 0xe075, 0x006b, 0x005a, 0xe072, 0x004a, 0x0066 }, - { 0xe06b, 0xe074, 0xe069, 0x0067, 0xe06c, 0x0064, 0x0015, 0xe07d }, - { 0x0073, 0x007c, 0x007b, 0x0074, 0x0071, 0xe04a, 0x0070, 0x0021 }, - { 0x0023, 0xe05a, 0x0075, 0x0079, 0x007a, 0x0072, 0x007d, 0x0069 }, -}; - -uint16_t get_scancode_set2(uint8_t row, uint8_t col) -{ - if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS) - return scancode_set2[col][row]; - return 0; -} - -void set_scancode_set2(uint8_t row, uint8_t col, uint16_t val) -{ - if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS) - scancode_set2[col][row] = val; -} - -#ifdef CONFIG_KEYBOARD_DEBUG -static char keycap_label[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = { - { 'c', KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, - KLLI_UNKNO, KLLI_UNKNO }, - { KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, - KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO }, - { 'q', KLLI_UNKNO, KLLI_UNKNO, KLLI_TAB, '`', '1', KLLI_UNKNO, 'a' }, - { KLLI_R_ALT, KLLI_L_ALT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, - KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO }, - { KLLI_UNKNO, KLLI_SPACE, 'e', KLLI_F4, KLLI_SEARC, '3', KLLI_F3, - KLLI_UNKNO }, - { 'x', 'z', KLLI_F2, KLLI_F1, 's', '2', 'w', KLLI_ESC }, - { 'v', 'b', 'g', 't', '5', '4', 'r', 'f' }, - { 'm', 'n', 'h', 'y', '6', '7', 'u', 'j' }, - { '.', KLLI_DOWN, '\\', 'o', KLLI_F10, '9', KLLI_UNKNO, 'l' }, - { KLLI_R_SHT, KLLI_L_SHT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, - KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO }, - { ',', KLLI_UNKNO, KLLI_F7, KLLI_F6, KLLI_F5, '8', 'i', 'k' }, - { KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_F9, KLLI_UNKNO, KLLI_UNKNO, - KLLI_LEFT, KLLI_UNKNO }, - { KLLI_R_CTR, KLLI_L_CTR, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, - KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO }, - { '/', KLLI_UP, '-', KLLI_UNKNO, '0', 'p', '[', ';' }, - { '\'', KLLI_ENTER, KLLI_UNKNO, KLLI_UNKNO, '=', KLLI_B_SPC, ']', 'd' }, - { KLLI_UNKNO, KLLI_F8, KLLI_RIGHT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, - KLLI_UNKNO, KLLI_UNKNO }, -}; - -char get_keycap_label(uint8_t row, uint8_t col) -{ - if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS) - return keycap_label[col][row]; - return KLLI_UNKNO; -} - -void set_keycap_label(uint8_t row, uint8_t col, char val) -{ - if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS) - keycap_label[col][row] = val; -} -#endif diff --git a/zephyr/program/skyrim/frostflow/src/ppc_config.c b/zephyr/program/skyrim/frostflow/src/ppc_config.c deleted file mode 100644 index 513c025dec..0000000000 --- a/zephyr/program/skyrim/frostflow/src/ppc_config.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright 2022 The ChromiumOS Authors - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* Frostflow board-specific PPC code */ - -#include "driver/ppc/aoz1380_public.h" -#include "driver/ppc/nx20p348x.h" -#include "usbc_ppc.h" - -#include <zephyr/drivers/gpio.h> - -#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args) -#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args) - -/* - * In the AOZ1380 PPC, there are no programmable features. We use - * the attached NCT3807 to control a GPIO to indicate 1A5 or 3A0 - * current limits. - */ -int board_aoz1380_set_vbus_source_current_limit(int port, enum tcpc_rp_value rp) -{ - int rv = EC_SUCCESS; - - rv = gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(ioex_usb_c0_ilim_3a_en), - (rp == TYPEC_RP_3A0) ? 1 : 0); - - return rv; -} - -void ppc_interrupt(enum gpio_signal signal) -{ - switch (signal) { - case GPIO_USB_C0_PPC_INT_ODL: - aoz1380_interrupt(0); - break; - - case GPIO_USB_C1_PPC_INT_ODL: - nx20p348x_interrupt(1); - break; - - default: - break; - } -} diff --git a/zephyr/program/skyrim/frostflow/src/thermal.c b/zephyr/program/skyrim/frostflow/src/thermal.c deleted file mode 100644 index eae8aac25d..0000000000 --- a/zephyr/program/skyrim/frostflow/src/thermal.c +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright 2022 The ChromiumOS Authors - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "common.h" -#include "chipset.h" -#include "fan.h" -#include "tablet_mode.h" -#include "temp_sensor/temp_sensor.h" -#include "thermal.h" -#include "util.h" -#include "console.h" - -#define TEMP_AMB TEMP_SENSOR_ID(DT_NODELABEL(temp_amb)) - -struct fan_step { - /* - * Sensor 0~4 trigger point, set -1 if we're not using this - * sensor to determine fan speed. - */ - int on[TEMP_SENSOR_COUNT]; - /* - * Sensor 0~4 release point, set -1 if we're not using this - * sensor to determine fan speed. - */ - int off[TEMP_SENSOR_COUNT]; - /* Fan rpm */ - uint16_t rpm[FAN_CH_COUNT]; -}; - -#define FAN_TABLE_ENTRY(nd) \ - { \ - .on = DT_PROP(nd, temp_on), \ - .off = DT_PROP(nd, temp_off), \ - .rpm = DT_PROP(nd, rpm_target), \ - }, - -static const struct fan_step fan_table_clamshell[] = { DT_FOREACH_CHILD( - DT_NODELABEL(fan_steps_clamshell), FAN_TABLE_ENTRY) }; - -static const struct fan_step fan_table_tablet[] = { DT_FOREACH_CHILD( - DT_NODELABEL(fan_steps_tablet), FAN_TABLE_ENTRY) }; - -static const struct fan_step *fan_step_table; -#define NUM_FAN_LEVELS ARRAY_SIZE(fan_table_clamshell) - -BUILD_ASSERT(ARRAY_SIZE(fan_table_clamshell) == ARRAY_SIZE(fan_table_tablet)); - -int fan_table_to_rpm(int fan, int *temp) -{ - /* current fan level */ - static int current_level; - /* previous sensor temperature */ - static int prev_tmp[TEMP_SENSOR_COUNT]; - int i; - - if (tablet_get_mode()) - fan_step_table = fan_table_tablet; - else - fan_step_table = fan_table_clamshell; - - /* - * Compare the current and previous temperature, we have - * the three paths : - * 1. decreasing path. (check the release point) - * 2. increasing path. (check the trigger point) - * 3. invariant path. (return the current RPM) - */ - - if (temp[TEMP_AMB] < prev_tmp[TEMP_AMB]) { - for (i = current_level; i > 0; i--) { - if (temp[TEMP_AMB] < fan_step_table[i].off[TEMP_AMB]) - current_level = i - 1; - else - break; - } - } else if (temp[TEMP_AMB] > prev_tmp[TEMP_AMB]) { - for (i = current_level; i < NUM_FAN_LEVELS; i++) { - if (temp[TEMP_AMB] > fan_step_table[i].on[TEMP_AMB]) - current_level = i + 1; - else - break; - } - } - - if (current_level < 0) - current_level = 0; - - if (current_level >= NUM_FAN_LEVELS) - current_level = NUM_FAN_LEVELS - 1; - - for (i = 0; i < TEMP_SENSOR_COUNT; ++i) - prev_tmp[i] = temp[i]; - - return fan_step_table[current_level].rpm[fan]; -} - -void board_override_fan_control(int fan, int *temp) -{ - /* - * In common/fan.c pwm_fan_stop() will turn off fan - * when chipset suspend or shutdown. - */ - if (chipset_in_state(CHIPSET_STATE_ON)) { - fan_set_rpm_mode(fan, 1); - fan_set_rpm_target(fan, fan_table_to_rpm(fan, temp)); - } -} diff --git a/zephyr/program/skyrim/frostflow/src/usb_mux_config.c b/zephyr/program/skyrim/frostflow/src/usb_mux_config.c deleted file mode 100644 index 2ec1dda0be..0000000000 --- a/zephyr/program/skyrim/frostflow/src/usb_mux_config.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright 2022 The ChromiumOS Authors - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* Frostflow board-specific USB-C mux configuration */ - -#include "ioexpander.h" -#include "usbc/usb_muxes.h" - -#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args) -#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args) - -/* - * USB C0 (general) and C1 (just ps8815 DB) use IOEX pins to - * indicate flipped polarity to a protection switch. - */ -static int ioex_set_flip(int port, mux_state_t mux_state) -{ - if (port == 0) { - if (mux_state & USB_PD_MUX_POLARITY_INVERTED) - gpio_pin_set_dt( - GPIO_DT_FROM_NODELABEL(ioex_usb_c0_sbu_flip), - 1); - else - gpio_pin_set_dt( - GPIO_DT_FROM_NODELABEL(ioex_usb_c0_sbu_flip), - 0); - } else { - if (mux_state & USB_PD_MUX_POLARITY_INVERTED) - gpio_pin_set_dt( - GPIO_DT_FROM_NODELABEL(ioex_usb_c1_sbu_flip), - 1); - else - gpio_pin_set_dt( - GPIO_DT_FROM_NODELABEL(ioex_usb_c1_sbu_flip), - 0); - } - - return EC_SUCCESS; -} - -int board_c0_amd_fp6_mux_set(const struct usb_mux *me, mux_state_t mux_state) -{ - /* Set the SBU polarity mux */ - RETURN_ERROR(ioex_set_flip(me->usb_port, mux_state)); - - return EC_SUCCESS; -} - -int board_c1_ps8818_mux_set(const struct usb_mux *me, mux_state_t mux_state) -{ - CPRINTSUSB("C1: PS8818 mux using default tuning"); - - /* Once a DP connection is established, we need to set IN_HPD */ - if (mux_state & USB_PD_MUX_DP_ENABLED) - ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 1); - else - ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 0); - - return 0; -} |