-
Notifications
You must be signed in to change notification settings - Fork 130
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
ASoC: SOF: fix return values for mandatory ops #539
ASoC: SOF: fix return values for mandatory ops #539
Conversation
@plbossart this leaves only the PCM ops but I'm not sure whether they are mandotory or not. Could you please comment? |
78173e0
to
cce1f76
Compare
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.
this looks ok but I'd like error messages to reflect the name of the function with the _ included. That helps for searches.
Also it'd be good to tag the callbacks in the header file as mandatory/optional so that the information is in one place.
cce1f76
to
63c49e4
Compare
@plbossart fixed now. Could you please cross-check if the list of mandatory and optional ops is correct? |
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.
@lgirdwood @keyonjie can you look at the list of mandatory ops and comment? I am afraid we have no documentation of what is expected in a minimal case?
sound/soc/sof/sof-priv.h
Outdated
@@ -67,6 +67,9 @@ struct snd_sof_pdata; | |||
* and DSP device(s). | |||
*/ | |||
struct snd_sof_dsp_ops { | |||
|
|||
/* The following ops are mandatory */ |
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.
it's not very easy to figure out where the list stops. maybe for each op so that is can be searched whether it's optional or mandatory?
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.
- we don't have .remove yet for skl- platforms(please fix that).
- stall, core_power_up/down should be optional.
- write, read, write64, read64, block_read, block_write are same for all our platforms so let's remove them from struct snd_sof_dsp_ops.
Others looks fine.
sound/soc/sof/sof-priv.h
Outdated
@@ -67,6 +67,9 @@ struct snd_sof_pdata; | |||
* and DSP device(s). | |||
*/ | |||
struct snd_sof_dsp_ops { | |||
|
|||
/* The following ops are mandatory */ | |||
|
|||
/* probe and remove */ | |||
int (*remove)(struct snd_sof_dev *sof_dev); |
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.
I agree we should make .remove mandatory, but the fact is that we don't have it on skl- platforms yet, better to fix them together at one shot(e.g. define an empty one at least).
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.
why should .remove be mandatory? if all your driver uses devm_ stuff and the hardware is reset correctly in the .probe, why would we care?
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.
@plbossart going by what remove() does for SKL+, we also disable the DSP in remove(). Given that we are not really unloading the topology from the DSP like we do in the case of load, shouldnt we also be turning off the DSP here?
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.
@plbossart i believe for module load/unload to work in SOF, we should make remove() mandatory so that the DSP can be turned OFF here. Please let me know if you disagree and I'll make changes accordingly.
@keyonjie With SMP enabled in the driver, they are no long optional.
|
for SKL- platforms, we don't have SMP there, I meant those callbacks are not mandatory for snd_sof_dsp_ops (e.g. no need for byt), but they are mandatory for apl/cnl?
|
@keyonjie ok Makes sense |
@keyonjie hsw-spi.c has a different set of ops!
|
63c49e4
to
55b9699
Compare
@keyonjie @plbossart PR updated now. |
@ranj063 can you rebase, there is conflict. Also please mark each function as mandatory/optional, you are mixing the two styles (per function and per block) which will make searches more complicated. |
55b9699
to
f8ab4fc
Compare
@plbossart this one has been updated too. There are 2 lines over 80 chars which checkpatch complains about but I think there's no simple way to address it while keeping the style consistent for marking the ops are madatory/optional. |
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.
Humm, I am not sure I agree with the mandatory support for PCM (SueCreek being the counter example) and there are some inconsistencies between the errors and tags. Maybe we should shoot for a lower bar of what is really mandatory?
sound/soc/sof/ops.h
Outdated
@@ -330,7 +345,8 @@ snd_sof_pcm_platform_pointer(struct snd_sof_dev *sdev, | |||
if (sof_ops(sdev) && sof_ops(sdev)->pcm_pointer) | |||
return sof_ops(sdev)->pcm_pointer(sdev, substream); | |||
|
|||
return 0; | |||
dev_err(sdev->dev, "error: %s not defined\n", __func__); | |||
return -ENOTSUPP; |
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.
Are PCM operations actually required? Take the example of Sue Creek, you may have all the processing done on the device itself with no PCM being passed back to the host?
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.
@plbossart ok i will make these optional
u64 (*read64)(struct snd_sof_dev *sof_dev, void __iomem *addr); | ||
u64 value); /* mandatory */ | ||
u64 (*read64)(struct snd_sof_dev *sof_dev, | ||
void __iomem *addr); /* mandatory */ |
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.
this is inconsistent with the fact that those functions return 0 if not supported?
f8ab4fc
to
84e8463
Compare
@plbossart i've updated the PR based on your comments. |
ping @plbossart |
Ranjani and I are working on PM stuff, this can wait.
… |
84e8463
to
960860b
Compare
@plbossart I've updated this PR now to address your comment about the is_ready() op. There will be conflicts between this one and my other PR where I have changed the name for this op. I will update them depending on which one gets merged first. |
@plbossart please dont merge this. with the return value of undefined values change to < 0, I need to ensure the check is done correctly. |
960860b
to
75d52e6
Compare
@plbossart this one has been updated now. |
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.
Sorry, this still needs more work, some of the mandatory parts are not used so something's wrong.
sound/soc/sof/ipc.c
Outdated
if (is_dsp_ipc_ready < 0) { | ||
spin_unlock_irq(&sdev->ipc_lock); | ||
return -EBUSY; | ||
} |
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.
sorry, what does this do?
The is_ready op is marked a mandatory
int (*is_ready)(struct snd_sof_dev sof_dev); / mandatory */
The comment seems wrong?
sound/soc/sof/sof-priv.h
Outdated
/* FW loading */ | ||
int (*load_firmware)(struct snd_sof_dev *sof_dev); /* mandatory */ | ||
int (*load_module)(struct snd_sof_dev *sof_dev, | ||
struct snd_sof_mod_hdr *hdr); /* mandatory */ |
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.
meh, this is not defined for HDAudio.
sound/soc/sof/sof-priv.h
Outdated
int (*reset)(struct snd_sof_dev *sof_dev); | ||
int (*run)(struct snd_sof_dev *sof_dev); /* mandatory */ | ||
int (*stall)(struct snd_sof_dev *sof_dev); /* optional */ | ||
int (*reset)(struct snd_sof_dev *sof_dev); /* mandatory */ |
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.
meh. not defined for HDaudio.
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.
@plbossart all 3 comments addressed and PR updated now.
75d52e6
to
a88576e
Compare
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.
minor nit-pick on dev_err when we return void, looks ok otherwise
sound/soc/sof/ops.h
Outdated
return; | ||
} | ||
|
||
dev_err(sdev->dev, "error: %s not defined\n", __func__); |
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.
Ah sorry, I just thought about this one. Since this will not interrupt the flow, we may want to add a _once or _ratelimited qualifier to avoid polluting dmesg. Same remark for all cases where we return void.
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.
@plbossart done
Clarify the mandatory and optional dsp ops and fix return value for mandatory ops. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
a88576e
to
421e6e5
Compare
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.
Thanks, merging now.
Fix return value for mandatory ops.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com