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

Back-port I2C ATR (Address translator) #2536

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
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
12 changes: 2 additions & 10 deletions drivers/i2c/i2c-atr.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ i2c_atr_find_mapping_by_addr(const struct list_head *list, u16 phys_addr)
static int i2c_atr_map_msgs(struct i2c_atr_chan *chan, struct i2c_msg *msgs,
int num)
{
struct i2c_atr *atr = chan->atr;
static struct i2c_atr_alias_pair *c2a;
int i;

Expand All @@ -157,15 +156,8 @@ static int i2c_atr_map_msgs(struct i2c_atr_chan *chan, struct i2c_msg *msgs,

c2a = i2c_atr_find_mapping_by_addr(&chan->alias_list,
msgs[i].addr);
if (!c2a) {
dev_err(atr->dev, "client 0x%02x not mapped!\n",
msgs[i].addr);

while (i--)
msgs[i].addr = chan->orig_addrs[i];

return -ENXIO;
}
if (!c2a)
continue;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Well, the expected question from me is this a valid usecase that should be upstreamed?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this has been upstreamed and this is a backport, or?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If it is, I would expect a cherry-pick which would include additional sign-offs and so I would not question :). Note that I'm speaking about the second patch.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this has not been upstreamed yet. The usecase is that on the same I2C bus of the deserializer you can have multiple serializers (which need the ATR to be able to setup individual communication by changing their address) and then another ATR for the serializer since they need to do address translation for the connected cameras. The serializer ATR provides the final translation of the cameras, and an unknown I2C address reaches this deserializer code, which we just want to pass through.

Copy link
Contributor

Choose a reason for hiding this comment

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

If it is, I would expect a cherry-pick which would include additional sign-offs and so I would not question :). Note that I'm speaking about the second patch.

oh; my bad;
apologies for the noise;
i need to re-adapt to reading these kernel patches

Copy link
Collaborator

@nunojsa nunojsa Jul 10, 2024

Choose a reason for hiding this comment

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

Yes, this has not been upstreamed yet. The usecase is that on the same I2C bus of the deserializer you can have multiple serializers (which need the ATR to be able to setup individual communication by changing their address) and then another ATR for the serializer since they need to do address translation for the connected cameras. The serializer ATR provides the final translation of the cameras, and an unknown I2C address reaches this deserializer code, which we just want to pass through.

I see... I won't opinate much about the patch. Maybe a dev_warn() or dev_dbg() would make sense. Other option would be some DT property to mark an i2c as "pass through" instead of just continuing and ignoring the lack of mapping (if it makes any sense) .

Anyways, most important thing (as you already know :)) is that this is sent upstream.


msgs[i].addr = c2a->alias;
}
Expand Down
Loading