Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a87a2b5
ASoC: SOF: Move the definition of enum snd_sof_fw_state to global header
ujfalusi Aug 13, 2021
4d512ec
ASoC: SOF: Introduce a macro to set the firmware state
ujfalusi Aug 16, 2021
44b2a43
ASoC: SOF: debug: Print out the fw_state along with the DSP dump
ujfalusi Aug 18, 2021
9115f5b
ASoC: SOF: Introduce new firmware state: SOF_FW_CRASHED
ujfalusi Aug 17, 2021
476d4c0
ASoC: soc-component: Add support module get/put on open for compresse…
ujfalusi Jul 23, 2021
7274b1c
ASoC: SOF: Introduce IPC SOF client support
ranj063 Oct 22, 2020
6a772ce
ASoC: SOF: core/ops: Add support for client registration
ranj063 Oct 22, 2020
a858cfa
ASoC: SOF: core: Unregister machine driver before IPC and debugfs
ujfalusi Jul 23, 2021
49abfdc
ASoC: SOF: ipc: Read and pass the whole message to handlers for IPC e…
ujfalusi Jul 6, 2021
11f3b3a
ASoC: SOF: clients: Add support for IPC rx and firmware state change
ujfalusi Jul 6, 2021
20c9323
ASoC: SOF: clients: Add support for auxdev suspend/resume handling
ujfalusi Jul 9, 2021
9e32894
ASoC: SOF: clients: Add API to get the SOF firmware version
ujfalusi Jul 7, 2021
bcaad35
ASoC: SOF: clients: Add API to manage the module refcount of SOF core
ujfalusi Jul 21, 2021
92a48c2
ASoC: SOF: intel: hda-trace: Pass the dma buffer pointer to hda_dsp_t…
ujfalusi Jul 9, 2021
9e675f2
ASoC: SOF: Split up utils.c into sof-utils and iomem-utils
ujfalusi Jul 15, 2021
deb5a0c
ASoC: SOF: Convert the generic IPC flood test into SOF client
ranj063 Oct 22, 2020
cba8df9
ASoC: SOF: sof-client-ipc-test: Protection against removal while in use
ujfalusi Jul 22, 2021
64a91b8
ASoC: SOF: sof-client-ipc-test: Block the test if the firmware has cr…
ujfalusi Aug 20, 2021
5f585a8
ASoC: SOF: Convert the generic probe support to SOF client
ujfalusi Jun 9, 2021
d6a888d
ASoC: SOF: sof-client-probes: Add module parameter to enable probes s…
ujfalusi Aug 9, 2021
6677eec
ASoC: SOF: sof-client-probes: Protection against removal while in use
ujfalusi Jul 22, 2021
68d6c63
ASoC: SOF: sof-client-probes: Block the capture if the firmware is cr…
ujfalusi Aug 20, 2021
39459f7
ASoC: SOF: Add optional SOF client for dma-trace support
ujfalusi Jul 6, 2021
9e6b984
ASoC: SOF: imx: Enable SOF client version of dma-trace
ujfalusi Aug 18, 2021
e8bab41
ASoC: SOF: Switch to the client driver for dma-trace support
ujfalusi Jul 19, 2021
5c75bc5
ASoC: SOF: sof-client-dma-trace: Add protection against file/module r…
ujfalusi Jul 21, 2021
b3089af
ASoC: SOF: sof-client-dma-trace: Block the dtrace if the firmware has…
ujfalusi Aug 20, 2021
b269552
ASoC: SOF: sof-client-dma-trace: Simplify count adjustment in trace_read
ujfalusi Jul 16, 2021
fd4a66c
ASoC: SOF: sof-client-dma-trace: Coding style cleanups
ujfalusi Jul 16, 2021
5e3f492
ASoC: SOF: sof-client-ipc-test: Code cleanup for consistency
ujfalusi Jul 22, 2021
f763eea
ASoC: SOF: sof-client-probes: Code cleanup for consistency
ujfalusi Jul 22, 2021
3bd20bb
ASoC: SOF: sof-client-dma-trace: Code cleanup for consistency
ujfalusi Jul 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions sound/soc/soc-component.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,23 +425,49 @@ EXPORT_SYMBOL_GPL(snd_soc_component_exit_regmap);

#endif

static int snd_soc_component_compr_module_get(struct snd_soc_component *component,
struct snd_compr_stream *cstream)
{
int ret = 0;

if (component->driver->module_get_upon_open == 1 &&
!try_module_get(component->dev->driver->owner))
ret = -ENODEV;

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.

question: Why is this different from the regular components?

int snd_soc_component_module_get(struct snd_soc_component *component,
				 struct snd_pcm_substream *substream,
				 int upon_open)
{
	int ret = 0;

	if (component->driver->module_get_upon_open == !!upon_open &&
	    !try_module_get(component->dev->driver->owner))
		ret = -ENODEV;

	/* mark substream if succeeded */
	if (ret == 0)
		soc_component_mark_push(component, substream, module);

	return soc_component_ret(component, ret);
}

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.

The snd_soc_component_module_get() is used for compressed only via snd_soc_component_module_get_when_probe() wrapper where the substream parameter is NULL. We can not use the snd_soc_component_module_get_when_open() with compress stream as:

int snd_soc_component_module_get(struct snd_soc_component *component,
				 struct snd_pcm_substream *substream,
				 int upon_open);

expects snd_pcm_substream and not snd_compr_stream.

I should have used snd_soc_component_compr_module_get_when_open() and snd_soc_component_compr_module_put_when_close() to make it a cleaner

It might worth adding another mark to struct snd_soc_component, like struct snd_compr_stream *mark_compr_module;
or
convert the struct snd_pcm_substream *mark_module; to void *mark_module;
or
convert all marks to void *

IN the case of the later two the snd_soc_component_module_get() should have void *for the substream, probably named asmark`

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.

Should we try to send it upstream to get feedback which way this should be?
I have now the renamed version locally, introducing snd_soc_component_compr_module_get_when_open() and snd_soc_component_compr_module_put_when_close()

We piggyback on compr_open mark to manage the module_get/put to avoid introducing bigger changes for the framework and at the end the same thing is done for the normal components.

return soc_component_ret(component, ret);
}

static void snd_soc_component_compr_module_put(struct snd_soc_component *component,
struct snd_compr_stream *cstream)
{
if (component->driver->module_get_upon_open == 1)
module_put(component->dev->driver->owner);
}

int snd_soc_component_compr_open(struct snd_compr_stream *cstream)
{
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component;
int i, ret;
int ret = 0;
int i;

for_each_rtd_components(rtd, i, component) {
ret = snd_soc_component_compr_module_get(component, cstream);
if (ret < 0)
break;

if (component->driver->compress_ops &&
component->driver->compress_ops->open) {
ret = component->driver->compress_ops->open(component, cstream);
if (ret < 0)
return soc_component_ret(component, ret);
if (ret < 0) {
snd_soc_component_compr_module_put(component, cstream);
break;
}
}
soc_component_mark_push(component, cstream, compr_open);
}

return 0;
return soc_component_ret(component, ret);
}
EXPORT_SYMBOL_GPL(snd_soc_component_compr_open);

Expand All @@ -461,6 +487,7 @@ void snd_soc_component_compr_free(struct snd_compr_stream *cstream,
component->driver->compress_ops->free(component, cstream);

soc_component_mark_pop(component, cstream, compr_open);
snd_soc_component_compr_module_put(component, cstream);
}
}
EXPORT_SYMBOL_GPL(snd_soc_component_compr_free);
Expand Down