Skip to content

ASoC: max98363: don't return on success reading revision ID - #4503

Merged
plbossart merged 1 commit into
thesofproject:topic/sof-devfrom
bardliao:for-max98363
Aug 3, 2023
Merged

plbossart merged 1 commit into
thesofproject:topic/sof-devfrom
bardliao:for-max98363

Conversation

@bardliao

@bardliao bardliao commented Aug 2, 2023

Copy link
Copy Markdown
Collaborator

We need to do remaining tasks when we read revision ID successfully. And we should put runtime pm before return error.

Fixes: 18c0af9 ("ASoC: max98363: add soundwire amplifier driver")

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.

@bardliao I'm not sure I follow the first part of your commit message. We are already doing all the remaining steps in case of success, isn't it? In case of error, we need mark last busy and then suspend no?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@bardliao I'm not sure I follow the first part of your commit message. We are already doing all the remaining steps in case of success, isn't it? In case of error, we need mark last busy and then suspend no?

@ranj063 The existing code return ret on success, and doesn't do the tasks after line 182. I didn't mark last busy before suspend is because it is very likely that there is something wrong with sdw bus when regmap_read return error and I hope the codec can go into suspend immediately and don't access the regmap.

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.

@bardliao why does that have to prevent marking when the device was last busy?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@bardliao why does that have to prevent marking when the device was last busy?

It will suspend after 3 sec from last busy, because of pm_runtime_set_autosuspend_delay(dev, 3000);

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.

@bardliao can you send this upstream when you have a moment? I have too many patches on my plate already :-)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@bardliao can you send this upstream when you have a moment? I have too many patches on my plate already :-)

Sure

Comment thread sound/soc/codecs/max98363.c Outdated
ret = regmap_read(max98363->regmap, MAX98363_R21FF_REV_ID, &reg);
if (!ret) {
dev_info(dev, "Revision ID: %X\n", reg);
} else {

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.

need pm_runtime_mark_last_busy(dev); here

or better, add a label and jump to the end of the function.

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.

I also don't understand what happens if the regmap_read() returns an error, we keep going?

What is the purpose of this check, something does not add up or I need more coffee.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

need pm_runtime_mark_last_busy(dev); here

or better, add a label and jump to the end of the function.

Sure, I will add a lebel.

I also don't understand what happens if the regmap_read() returns an error, we keep going?
What is the purpose of this check, something does not add up or I need more coffee.

Originally, it will keep going only when regmap_read() returns an error, and that was a bug. That is the reason why max98363 keep active.

max98363_io_init needs to keep going when we read revision ID
successfully.

Fixes: 18c0af9 ("ASoC: max98363: add soundwire amplifier driver")
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
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