Hi Kai, again, and, again
start(substream-A); <= start(substream-B); start(substream-C);
stop(substream-Z); <= stop(substream-B); stop(substream-C);
(snip)
Ohh, yes indeed !! I was confused. But Hmm... I don't want to have substream list on each component... Hmm... I will re-consider it again.
I don't want to have substream list on each components, and keep simple code as much as possible.
My current idea is using ID. What do you think ? It is not super simple though...
int soc_pcm_components_open(struct snd_pcm_substream *substream, u8 id) { int ret = 0;
/* * Add ID to each component to know "which open". */ for_each_rtd_components(rtd, i, component) { if (component->driver->open) { ret = component->driver->open(component, substream); if (ret < 0) return ret;
component->open_id = id; /* add ID */ } }
return 0; }
int soc_pcm_components_close(struct snd_pcm_substream *substream, u8 id) { /* * if ID > 0, it is only target. * if ID == 0, all components are the target */ for_each_rtd_components(rtd, i, component) { if ((id == 0 || id == component->open_id) && component->driver->close) component->driver->close(component, substream); } ... }
=> int soc_pcm_clear(..., u8 id) { ... /* * if ID > 0, it is only target. * if ID == 0, all components are the target */ soc_pcm_components_close(substream, id); ... }
int soc_pcm_close(...) { /* * ID = 0 * All components are target of close */ => soc_pcm_clear(xxx, 0); }
int soc_pcm_open(...) { static u8 id;
/* update ID */ id++; if (id == 0) id++;
... ret = soc_pcm_components_open(substream, id); if (ret < 0) goto open_err; ...
return 0; /* success */
open_err: /* * ID = id * Only this IDs are the target */ => soc_pcm_clear(xxx, id)
return ret; }
Thank you for your help !! Best regards --- Kuninori Morimoto