Skip to content

soundwire: bus: update Slave status in sdw_clear_slave_status - #2928

Closed
bardliao wants to merge 2 commits into
thesofproject:topic/sof-devfrom
bardliao:update-codec-status
Closed

bardliao wants to merge 2 commits into
thesofproject:topic/sof-devfrom
bardliao:update-codec-status

Conversation

@bardliao

Copy link
Copy Markdown
Collaborator

sdw_update_slave_status() will call the update_status() callback to
inform Slaves and do the corresponding tasks. We modify Slave status to
SDW_SLAVE_UNATTACHED but not update Slave status in sdw_clear_slave_status()
will lead to Slave status will never be updated elsewhere due to the
status is not changed.

Signed-off-by: Bard Liao yung-chuan.liao@linux.intel.com

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Patch is good, but the commit message could be improved a bit.

Comment thread drivers/soundwire/bus.c
Call to sdw_update_slave_status() needs to be added to sdw_clear_slave_
status() to ensure Slaves are informed of the new status via update_
status() callback.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
@bardliao
bardliao force-pushed the update-codec-status branch from 7135507 to 2ef85f7 Compare May 18, 2021 01:41
hw_init will be set to false when Slave is unattached and will be set to
true after io init is done. So we should test hw_init after io init.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
@bardliao
bardliao requested a review from naveen-manohar as a code owner May 18, 2021 02:50

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @bardliao !

@bardliao

Copy link
Copy Markdown
Collaborator Author

Thanks @bardliao !

I would like to let @plbossart has a chance to review next week.

@plbossart

Copy link
Copy Markdown
Member

I am not sure if this works in all cases @bardliao. The intent of the if (!hw_init) test in the resume() stage was to make sure we do not wait for the initialization complete in the case where there are 'ghost' devices exposed in ACPI tables but not physically populated in hardware. Are you sure this doesn't lead to reports of 'timeouts' with e.g. RT700 devices that are copy/pasted in all RVPs configs?

@plbossart

plbossart commented May 24, 2021 •

Copy link
Copy Markdown
Member

I am not sure if this works in all cases @bardliao. The intent of the if (!hw_init) test in the resume() stage was to make sure we do not wait for the initialization complete in the case where there are 'ghost' devices exposed in ACPI tables but not physically populated in hardware. Are you sure this doesn't lead to reports of 'timeouts' with e.g. RT700 devices that are copy/pasted in all RVPs configs?

I also don't know if the test for hw_init done after the wait_for_completion(initialization_complete) is actually doing anything. If the attach fails, then hw_init will not be set. Conversely if the device attaches, hw_init will be set already. Testing it in the resume doesn't accomplish anything.

Maybe the right fix is to use

if (!first_hw_init) // instead of if (!hw_init)
   return 0;

wait_for_completion(&initialization_complete);

That way if we resume a device that never attached then we just do nothing.

@bardliao

Copy link
Copy Markdown
Collaborator Author

I am not sure if this works in all cases @bardliao. The intent of the if (!hw_init) test in the resume() stage was to make sure we do not wait for the initialization complete in the case where there are 'ghost' devices exposed in ACPI tables but not physically populated in hardware. Are you sure this doesn't lead to reports of 'timeouts' with e.g. RT700 devices that are copy/pasted in all RVPs configs?

I also don't know if the test for hw_init done after the wait_for_completion(initialization_complete) is actually doing anything. If the attach fails, then hw_init will not be set. Conversely if the device attaches, hw_init will be set already. Testing it in the resume doesn't accomplish anything.

Maybe the right fix is to use

if (!first_hw_init) // instead of if (!hw_init)
   return 0;

wait_for_completion(&initialization_complete);

That way if we resume a device that never attached then we just do nothing.

Ack

@plbossart

Copy link
Copy Markdown
Member

closing since PR #2941 implements the same fixes.

@plbossart plbossart closed this May 26, 2021
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.

4 participants