Skip to main content
r/kernel icon

r/kernel

members
online

Typec ucsi get_voltage_now this is HW, FW or kernel issue… even it is an issue? Typec ucsi get_voltage_now this is HW, FW or kernel issue… even it is an issue?

On Debian 13 with kernel 6.12.63 and a Framework 16 laptop and the original 180W adapter. Tested on two different laptop, on different FW, same resoult.

First seeable issue: Freon does not report the 180W charger voltage, it is just clamped to 5V or 0V the battery is reporting charging status, from the wattage is calculated over 140W usage, so the HW is working and negotiating well, amper rating always get to 5A.

Second, the issue after digging:

root@FW16-WJ:/sys/kernel/tracing# cat trace

tracer: nop

entries-in-buffer/entries-written: 4/4 #P:16

_-----=> irqs-off/BH-disabled

/ _----=> need-resched

| / _—=> hardirq/softirq

|| / _–=> preempt-depth

||| / _-=> migrate-disable

|||| / delay

TASK-PID CPU# ||||| TIMESTAMP FUNCTION

| | | ||||| | |

kworker/4:1-256 [004] … 2776.087270: ucsi_connector_change: port0 status: change=4802, opmode=0, connected=0, sourcing=0, partner_flags=0, partner_type=0, request_data_obj=00000000, BC status=0

kworker/14:2-12098 [014] … 2778.510402: ucsi_connector_change: port0 status: change=4800, opmode=4, connected=1, sourcing=0, partner_flags=1, partner_type=1, request_data_obj=00000000, BC status=1

kworker/14:1-319 [014] … 2778.834544: ucsi_connector_change: port0 status: change=0a42, opmode=3, connected=1, sourcing=0, partner_flags=1, partner_type=2, request_data_obj=42c709c2, BC status=1

kworker/14:1-319 [014] … 2779.402235: ucsi_connector_change: port0 status: change=0240, opmode=3, connected=1, sourcing=0, partner_flags=1, partner_type=2, request_data_obj=92c7d1f4, BC status=1

From this: The Negotiation Timeline ​2776.087: Disconnect/Reset (connected=0). ​2778.510: Connection (connected=1, opmode=4 “PD 3.0”).

​2778.834: Intermediate Negotiation (request_data_obj=42c709c2) ​Position: 4 (Likely the 20V Profile). ​Current: ~4.5A. ​System boots up at 20V (Safe Mode), sometime seeable in freon one brief glitch 20V appears.

​2779.402: Final EPR Negotiation (request_data_obj=92c7d1f4) ​Position: 9 (The 36V EPR Profile?). ​Current: 5.0A. ​System successfully switches to 180W.

Another approach: (yeah, my dumb head tought this is enough dangerous to try out, so bad example below, with my basic knowledge of C programming and zero knowledge in kernel how-to)

modified kernel module (added one line debug): drivers/usb/typec/ucsi/psy.c: static int ucsi_psy_get_voltage_now

…. switch (opmode) { case UCSI_CONSTAT_PWR_OPMODE_PD: index = EPR_RDO_OBJ_POS(con->rdo); val->intval = pdo_fixed_voltage(pdo) * 1000; if (val->intval == 0) {

printk(KERN_ERR “UCSI_VOLT_DEBUG: Index=%d PDO=0x%08x RDO=0x%08x CalcVolts=%d\n”, index, pdo, con->rdo, val->intval);

int pdo_type = (pdo >> 30) & 3; if (pdo_type != PDO_TYPE_FIXED) { u32 rdo_volts = ((con->rdo >> 9) & 0x7FF) * 20000; if (rdo_volts > 0) val->intval = rdo_volts; } } else { val->intval = 0; } break; ….

Output when it is connected (supressed non related outputs):

[ 1369.044900] UCSI_VOLT_DEBUG: Index=4 PDO=0x00000000 RDO=0x42c709c2 CalcVolts=0

[ 1369.109456] UCSI_VOLT_DEBUG: Index=4 PDO=0x00000000 RDO=0x42c709c2 CalcVolts=0

[ 1369.585152] UCSI_VOLT_DEBUG: Index=9 PDO=0x00000000 RDO=0x92c7d1f4 CalcVolts=0

[ 1369.713070] UCSI_VOLT_DEBUG: Index=9 PDO=0x00000000 RDO=0x92c7d1f4 CalcVolts=0

[ 1370.015427] ucsi_acpi USBC000:00: unknown error 256

[ 1370.273931] UCSI_VOLT_DEBUG: Index=9 PDO=0x00000000 RDO=0x92c7d1f4 CalcVolts=0

[ 1370.336943] UCSI_VOLT_DEBUG: Index=9 PDO=0x00000000 RDO=0x92c7d1f4 CalcVolts=0

[ 1371.960918] UCSI_VOLT_DEBUG: Index=9 PDO=0x00000000 RDO=0x92c7d1f4 CalcVolts=0

The kernel is cannot handle the profile above 4 or the profile is not reported by the firmware above 4?

Voltage report bytes are zeroed out, is this by the 180W adapter is fixed voltage EPR or it is firmware error?

Lastly… I am missing something, overreacting or my install is broken and there is some one-liner what will solve this? Please help what to check next, to provide more data if this is considered a kernel related issue?


There's only one Ozempic®. Only Novo Nordisk manufactures semaglutide medicines, like Ozempic®. Ask a healthcare professional about Ozempic® today.

See the following links for Boxed Warning: Medication Guide & Safety Information

media poster



Minimizing execution time of a function when introducing another call Minimizing execution time of a function when introducing another call

So, i need to modify a serial driver (drivers/tty/serial), inside the function meson_uart_set_termios. It needs to be called there, for our use case. I am worried that if i call a custom function within this function, it might cause some side effects. It will definitely cause that function longer to execute. So is there a way to minimize this time or is the extra time that's needed, an acceptable design?