Skip to content

Commit 614ec58

Browse files
JohnAZoidbergkiram9
andcommitted
fwk: Allow customizing CCG8 battery messages
Add data structures pd_battery_cap_t and pd_battery_status_t for sending them to CCG8 to let it respond with the correct data to attached USB-C devices. The PD_CONTROL command 0x3D is used for both reading or writing PD response message data. This command is used to write data into the CCGx PD Controller internal memory that will be used to automatically respond to the appropriate PD message requests. Or, the command can be used to read the data out that has been previously written. Or, the command can be used to delete response data that has been previously written. Before writing the 0x3D command value to the PD_CONTROL register, a structure of data should be stored in the HPI Write Data Memory area. The structure of data defines the operation and what type of response data will be read or written. When reading data, the data will be returned attached to the 0x1E response value of the HPI_RESPONSE register. Based on HPI spec revT. BUG=https://app.clickup.com/t/86eqqrpxk BRANCH=fwk-lilac-27116 TEST=Can be tested by either Allion Lab or by connecting to another Framework system with USB-C cable (or just left to right side, differente PD controller) and then using the below EC commands. ``` > cypdctl verbose 1 [106.531310 verbose=1] > cypdmsg 3 batterycap [108.838891 sent extended message] > [108.843688 PD Controller 1 Port 1 Code 0x02 Event Len: 0x00] [108.847452 PD Controller 1 Port 1 Code 0xac Response Len: 0x0d] Port:3 Data:0xa58b0900ac3201005e02580200 cypdmsg 3 batterystatus [119.565269 sent extended message] > [119.570445 PD Controller 1 Port 1 Code 0x02 Event Len: 0x00] [119.575211 PD Controller 1 Port 1 Code 0xa2 Response Len: 0x08] Port:3 Data:0xa51d000000060e01 cypdmsg 3 test [138.066727 sent extended message] > [138.072073 PD Controller 1 Port 1 Code 0x02 Event Len: 0x00] [138.075480 PD Controller 1 Port 1 Code 0xa4 Response Len: 0x00] ``` Signed-off-by: Daniel Schaefer <dhs@frame.work> Signed-off-by: Kieran Levin <ktl@frame.work> Co-authored-by: Daniel Schaefer <dhs@frame.work> Co-authored-by: Kieran Levin <ktl@frame.work>
1 parent 46dbf9c commit 614ec58

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

zephyr/program/framework/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,14 @@ config PD_CCG8_CUSTOMIZE_BATT_MESSAGE
143143
Enable customize battery response for GRL test, EC will write specific
144144
register 0x4f to PD for GET_BATTERY_CAP and GET_BATTERY_STATUS.
145145

146+
config PD_CCG8_CUSTOMIZE_BATT_MESSAGE
147+
bool "Enable CCG8 Customize battery response"
148+
default n
149+
depends on PD_CHIP_CCG8
150+
help
151+
Enable customize battery response for GRL test, EC will write specific
152+
register 0x4f to PD for GET_BATTERY_CAP and GET_BATTERY_STATUS.
153+
146154
config PD_COMMON_VBUS_CONTROL
147155
bool "Enable CCG common vbus control"
148156
help

zephyr/program/framework/src/cypress_pd_common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,7 @@ DECLARE_HOOK(HOOK_AC_CHANGE, pd_batt_init_deferred, HOOK_PRIO_DEFAULT);
14761476
DECLARE_HOOK(HOOK_BATTERY_SOC_CHANGE, pd_batt_init_deferred, HOOK_PRIO_DEFAULT);
14771477

14781478

1479+
14791480
static void cypd_handle_state(int controller)
14801481
{
14811482
int data;

0 commit comments

Comments
 (0)