-
Notifications
You must be signed in to change notification settings - Fork 132
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
[RFC] Read lane mapping information for soundwire peripherals #4704
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -280,6 +280,35 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave, | |
return 0; | ||
} | ||
|
||
/* | ||
* In MIPI DisCo spec for SoundWire, lane mapping for a slave device is done with | ||
* mipi-sdw-lane-x-mapping properties, where x is 1..7, and the values for those | ||
* properties are mipi-sdw-manager-lane-x or mipi-sdw-peripheral-link-y, where x | ||
* is an integer between 1 to 7 if the lane is connected to a master lane, y is a | ||
* character between A to E if the lane is connected to another slave lane. | ||
*/ | ||
static int sdw_slave_read_lane_mapping(struct sdw_slave *slave) | ||
{ | ||
struct sdw_slave_prop *prop = &slave->prop; | ||
struct device *dev = &slave->dev; | ||
char prop_name[30]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add a define and explanation for the size |
||
const char *prop_val; | ||
size_t len; | ||
int ret, i; | ||
|
||
for (i = 0; i < SDW_MAX_LANES; i++) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i=1, lane0 is always connected |
||
snprintf(prop_name, sizeof(prop_name), "mipi-sdw-lane-%d-mapping", i); | ||
ret = device_property_read_string(dev, prop_name, &prop_val); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why read a string if you are trying to read an hex value? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's the dilemma here, the possible values for the property With the last character y or z, the link is able to be identified, so I just use the last character from the property value string. Here I store them as character, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Because the value shall be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yes, I missed this in the spec, thanks for enlightening me @bardliao and @aiChaoSONG ! I would report a warning on mipi-sdw-peripheral-link- and ignore it because we don't have support for device-to-device communication. We may add this in the future but this requires a complete rework of the 'stream' definition where there is no manager involved. I don't even know how we would represent this with DPCM, all dai links have cpu- and codec DAIs. |
||
if (ret) | ||
continue; | ||
len = strlen(prop_val); | ||
/* The last character is enough to identify the connection */ | ||
prop->lane_maps[i] = prop_val[len - 1]; | ||
dev_err(dev, "[Chao] %c\n", prop->lane_maps[i]); | ||
} | ||
return 0; | ||
} | ||
|
||
/** | ||
* sdw_slave_read_prop() - Read Slave properties | ||
* @slave: SDW Slave | ||
|
@@ -382,6 +411,8 @@ int sdw_slave_read_prop(struct sdw_slave *slave) | |
sdw_slave_read_dpn(slave, prop->sink_dpn_prop, nval, | ||
prop->sink_ports, "sink"); | ||
|
||
sdw_slave_read_lane_mapping(slave); | ||
|
||
return 0; | ||
} | ||
EXPORT_SYMBOL(sdw_slave_read_prop); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
be consistent and use manager/peripheral