The SM in kernel might be bit more convoluted so was wondering if we can handle this in userland. The changelog for this patch says that for test case was sending whole file, surely that is not an optimal approach.
It's rather common to have to deal with very small files, even with PCM, e.g. for notifications. It's actually a classic test case that exposes design issues in drivers, where e.g. the last part of the notification is not played.
Should we allow folks to send whole file to kernel and then issue partial drain?
I don't think there should be a conceptual limitation here. If the userspace knows that the last part of the file is smaller than a fragment it should be able to issue a drain (or partial drain if it's a gapless solution).
However now that I think of it, I am not sure what happens if the file is smaller than a fragment. That may very well be a limitation in the design.