Skip to content

tps6598x: add spmi transport#594

Draft
yuyuyureka wants to merge 4 commits into
AsahiLinux:mainfrom
yuyuyureka:tps6598x-spmi
Draft

tps6598x: add spmi transport#594
yuyuyureka wants to merge 4 commits into
AsahiLinux:mainfrom
yuyuyureka:tps6598x-spmi

Conversation

@yuyuyureka

@yuyuyureka yuyuyureka commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@yuyuyureka yuyuyureka force-pushed the tps6598x-spmi branch 4 times, most recently from d70e31e to 48791d5 Compare June 8, 2026 19:02
@yuyuyureka yuyuyureka marked this pull request as ready for review June 8, 2026 19:03
@yuyuyureka yuyuyureka force-pushed the tps6598x-spmi branch 3 times, most recently from 877ed68 to 98fe907 Compare June 8, 2026 19:05

@svenpeter42 svenpeter42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a quick glance, will take a look at the rest probably on the weekend

Comment thread src/tps6598x.c Outdated
return -1;
if (val == reg)
break;
if (val != (reg | 0x80))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you know what 0x80 means here? please #define these magic numbers here (and further below) if possilbe

Comment thread src/tps6598x.c Outdated
if (dev->spmi) {
if (tps6598x_spmi_select_reg(dev, reg) < 0)
return -1;
if (spmi_ext_write(dev->spmi, dev->addr, 0xa0, data, len) < 0)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's 0xa0?

Comment thread src/tps6598x.c Outdated
if (dev->spmi) {
if (tps6598x_spmi_select_reg(dev, reg) < 0)
return -1;
if (spmi_ext_read(dev->spmi, dev->addr, 0x20, data, len) < 0)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's 0x20?

@yuyuyureka

Copy link
Copy Markdown
Contributor Author

Updated with defines for the offsets. According to https://asahilinux.org/docs/hw/peripherals/ace3/, 0xa0 is an alias to 0x20, so I'm re-using that as TPS_SPMI_REG_DATA.

@yuyuyureka yuyuyureka force-pushed the tps6598x-spmi branch 4 times, most recently from a830196 to b44e722 Compare June 13, 2026 09:44
@yuyuyureka yuyuyureka marked this pull request as draft June 13, 2026 11:04
@yuyuyureka

Copy link
Copy Markdown
Contributor Author

Marked as draft because something is weird with commands which take >1 byte params, like LOCK

@yuyuyureka yuyuyureka force-pushed the tps6598x-spmi branch 2 times, most recently from e4165c4 to 325af1b Compare July 2, 2026 16:11
@yuyuyureka yuyuyureka force-pushed the tps6598x-spmi branch 4 times, most recently from fad5f08 to f719680 Compare July 3, 2026 21:22
@yuyuyureka yuyuyureka marked this pull request as ready for review July 3, 2026 21:29
@yuyuyureka

Copy link
Copy Markdown
Contributor Author

Rebased and marked ready, as USE_DEBUG_USB is working on the J700 / MacBook Neo!

@yuyuyureka yuyuyureka force-pushed the tps6598x-spmi branch 2 times, most recently from 7f8d34d to c66784d Compare July 7, 2026 05:57
@svenpeter42

Copy link
Copy Markdown
Member

i'm a bit confused why there are rust changes in this PR now, I don't see them used anywhere.

@WhatAmISupposedToPutHere

Copy link
Copy Markdown
Member

i'm a bit confused why there are rust changes in this PR now, I don't see them used anywhere.

Those look like they were accidentally pulled from #614 somehow

Comment thread src/tps6598x.c Outdated
int it = mngr_node;
ADT_FOREACH_CHILD(adt, it)
{
if (adt_is_compatible(adt, it, "usbc,cd3217"))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it's too late or too hot but I can't really follow what's going on here anymore. can you maybe add a few comments? or maybe split this out into multiple functions?

I think this should be !adt_is_compatible though

@yuyuyureka

yuyuyureka commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

The Rust changes were required for adt_is_compatible not to crash when running on nodes without a compatible prop (which is the case on some first-children of i2c nodes on M4+ devices). They're now already merged into main (through #614).

I will make this into a draft again, because I need to add a check for spmi gen4+ first, otherwise it will crash M5+ devices while trying to initialize the hpm.

@yuyuyureka yuyuyureka marked this pull request as draft July 14, 2026 07:19
Signed-off-by: Yureka <yureka@cyberchaos.dev>
Signed-off-by: Yureka <yureka@cyberchaos.dev>
Signed-off-by: Yureka <yureka@cyberchaos.dev>
Signed-off-by: Yureka <yureka@cyberchaos.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants