On Thu, Jul 25, 2019 at 06:40:07PM -0500, Pierre-Louis Bossart wrote: > When a Slave reports multiple status in the sticky bits, find the > latest configuration from the mirror of the PING frame status and > update the status directly. > > Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx> > --- > drivers/soundwire/cadence_master.c | 34 ++++++++++++++++++++++++------ > 1 file changed, 28 insertions(+), 6 deletions(-) > > diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c > index 889fa2cd49ae..25d5c7267c15 100644 > --- a/drivers/soundwire/cadence_master.c > +++ b/drivers/soundwire/cadence_master.c > @@ -643,13 +643,35 @@ static int cdns_update_slave_status(struct sdw_cdns *cdns, > > /* first check if Slave reported multiple status */ > if (set_status > 1) { > + u32 val; > + > dev_warn_ratelimited(cdns->dev, > - "Slave reported multiple Status: %d\n", > - mask); > - /* > - * TODO: we need to reread the status here by > - * issuing a PING cmd > - */ > + "Slave %d reported multiple Status: %d\n", > + i, mask); > + > + /* re-check latest status extracted from PING commands */ > + val = cdns_readl(cdns, CDNS_MCP_SLAVE_STAT); > + val >>= (i * 2); Superfluous parentheses. > + > + switch (val & 0x3) { > + case 0: > + status[i] = SDW_SLAVE_UNATTACHED; > + break; > + case 1: > + status[i] = SDW_SLAVE_ATTACHED; > + break; > + case 2: > + status[i] = SDW_SLAVE_ALERT; > + break; > + default: There aren't many values left for the "default" case :-) But I'm not sure whether any of + case 3: or + case 3: + default: would improve readability. Thanks Guennadi > + status[i] = SDW_SLAVE_RESERVED; > + break; > + } > + > + dev_warn_ratelimited(cdns->dev, > + "Slave %d status updated to %d\n", > + i, status[i]); > + > } > } > > -- > 2.20.1 > > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@xxxxxxxxxxxxxxxx > https://mailman.alsa-project.org/mailman/listinfo/alsa-devel _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx https://mailman.alsa-project.org/mailman/listinfo/alsa-devel