From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Daniel Baluta <daniel.baluta@gmail.com>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
andriy.shevchenko@intel.com, Takashi Iwai <tiwai@suse.de>,
Liam Girdwood <liam.r.girdwood@linux.intel.com>,
vkoul@kernel.org, Mark Brown <broonie@kernel.org>,
alan@linux.intel.com, sound-open-firmware@alsa-project.org
Subject: Re: [PATCH v3 01/14] ASoC: SOF: Add Sound Open Firmware driver core
Date: Wed, 12 Dec 2018 16:35:45 -0600 [thread overview]
Message-ID: <d51998a3-433d-8d57-6afd-2b5a7087e83a@linux.intel.com> (raw)
In-Reply-To: <CAEnQRZCErG3MGpMG229Lmcf38tmS_MQeo9Z5-Egd0vSGzt6W-w@mail.gmail.com>
Hi Daniel,
On 12/12/18 2:42 PM, Daniel Baluta wrote:
> Thanks a lot Pierre, Liam and all the people at Intel for does such a great job
> with this project!
you're welcome, thanks for the comments
>
> Few comments inline:
>
> <snip>
>
>> +/* SOF probe type */
>> +enum sof_device_type {
>> + SOF_DEVICE_PCI = 0,
>> + SOF_DEVICE_APCI,
>> + SOF_DEVICE_SPI
> Maybe comma after last element here? We have at least one more: SOF_DEVICE_DT.
Based on the comments from Andy, we've already removed this type since
it's not really needed any longer. We would probably need to have a
sof-dt-dev.c file to deal with the different enumeration style but we'd
need a platform to work with (or patches welcome). Hint hint wink wink.
>
>> +static int sof_probe(struct platform_device *pdev)
>> +{
>> + struct snd_sof_pdata *plat_data = dev_get_platdata(&pdev->dev);
>> + struct snd_sof_dev *sdev;
>> + const char *drv_name;
>> + const void *mach;
>> + int size;
>> + int ret;
>> +
>> + sdev = devm_kzalloc(&pdev->dev, sizeof(*sdev), GFP_KERNEL);
>> + if (!sdev)
>> + return -ENOMEM;
>> +
>> + dev_dbg(&pdev->dev, "probing SOF DSP device....\n");
>> +
>> + /* initialize sof device */
>> + sdev->dev = &pdev->dev;
>> + sdev->parent = plat_data->dev;
>> + if (plat_data->type == SOF_DEVICE_PCI)
>> + sdev->pci = container_of(plat_data->dev, struct pci_dev, dev);
>> + sdev->ops = plat_data->machine->pdata;
>> +
>> + sdev->pdata = plat_data;
>> + sdev->first_boot = true;
>> + INIT_LIST_HEAD(&sdev->pcm_list);
>> + INIT_LIST_HEAD(&sdev->kcontrol_list);
>> + INIT_LIST_HEAD(&sdev->widget_list);
>> + INIT_LIST_HEAD(&sdev->dai_list);
>> + INIT_LIST_HEAD(&sdev->route_list);
>> + dev_set_drvdata(&pdev->dev, sdev);
>> + spin_lock_init(&sdev->ipc_lock);
>> + spin_lock_init(&sdev->hw_lock);
>> +
>> + /* set up platform component driver */
>> + snd_sof_new_platform_drv(sdev);
>> +
>> + /* set default timeouts if none provided */
>> + if (plat_data->desc->ipc_timeout == 0)
>> + sdev->ipc_timeout = TIMEOUT_DEFAULT_IPC;
>> + else
>> + sdev->ipc_timeout = plat_data->desc->ipc_timeout;
>> + if (plat_data->desc->boot_timeout == 0)
>> + sdev->boot_timeout = TIMEOUT_DEFAULT_BOOT;
>> + else
>> + sdev->boot_timeout = plat_data->desc->boot_timeout;
>> +
>> + /* probe the DSP hardware */
>> + ret = snd_sof_probe(sdev);
> Something looks fishy here.
>
> I couldn't find this function's definition anywhere in the first
> patch which means that after first patch the code doesn't compile :D.
>
> For bisection reasons would be great if the code compiles after each patch.
the build is only added last (in the 37th patch). We didn't really plan
to be able to compile the initial patches one after the other. we
*could* add the core compilation earlier and add support for each device
incrementally, but you need a set of files that are somewhat
interdependent first.
>
> <snip>
>
>> + /* now register audio DSP platform driver and dai */
>> + ret = snd_soc_register_component(&pdev->dev, &sdev->plat_drv,
>> + sdev->ops->drv,
>> + sdev->ops->num_drv);
>> + if (ret < 0) {
>> + dev_err(sdev->dev,
>> + "error: failed to register DSP DAI driver %d\n", ret);
>> + goto comp_err;
> This goes to snd_soc_unregister_component which is not really needed because
> the component didn't register succcesfully.
Right. we went through a series of checks for error flows and missed
this one. Thanks for reporting this.
>
> <snd>
>
>> +comp_err:
>> + snd_soc_unregister_component(&pdev->dev);
>> + snd_sof_free_topology(sdev);
> It is not very clear to me where does the snd_sof_load_topology it is called
> so that there is a need to free it here.
the free_topology part is something we are currently looking it. It
seems that the framework frees almost everything. It's one of the
difficulties we are facing, it's not always obvious what the topology
framework does for you and what needs to be freed manually. It's a
known open we will fix shortly.
>
>> +static int sof_remove(struct platform_device *pdev)
>> +{
>> + struct snd_sof_dev *sdev = dev_get_drvdata(&pdev->dev);
>> + struct snd_sof_pdata *pdata = sdev->pdata;
>> +
>> + if (pdata && !IS_ERR(pdata->pdev_mach))
>> + platform_device_unregister(pdata->pdev_mach);
>> +
>> + snd_soc_unregister_component(&pdev->dev);
>> + snd_sof_fw_unload(sdev);
>> + snd_sof_ipc_free(sdev);
>> + snd_sof_free_debug(sdev);
>> + snd_sof_free_trace(sdev);
>> + snd_sof_remove(sdev);
> There is no snd_sof_free_topology here. Which means that either this
> call is not needed in the
> probe function or it is missing from here.
The topology is leaded in sof_pcm_probe and released in sof_pcm_remove.
But like I said above it's not clear if we need to really free anything...
>
>> +void snd_sof_shutdown(struct device *dev)
>> +{
>> +}
>> +EXPORT_SYMBOL(snd_sof_shutdown);
> I would avoid this empty function calls for the moment.
> Will add it later when there is a need for it.
yes, we removed it already.
>
> <snip>
>
>> +/*
>> + * SOF Device Level.
>> + */
>> +struct snd_sof_dev {
>> + struct device *dev;
>> + struct device *parent;
>> + spinlock_t ipc_lock; /* lock for IPC users */
>> + spinlock_t hw_lock; /* lock for HW IO access */
>> + struct pci_dev *pci;
>> +
>> + /* ASoC components */
>> + struct snd_soc_component_driver plat_drv;
>> +
>> + /* DSP firmware boot */
>> + wait_queue_head_t boot_wait;
>> + u32 boot_complete;
>> + u32 first_boot;
>> +
>> + /* DSP HW differentiation */
>> + struct snd_sof_pdata *pdata;
>> + const struct snd_sof_dsp_ops *ops;
>> + struct sof_intel_hda_dev *hda; /* for HDA based DSP HW */
> Just a design question. Is it ok to hold SOC specific data here? For example on
> arm there is no HDA but there is some other DAI. Would it be ok for me to just
> add it here?
Darn, this was added more than a year ago and should have been
cleaned-up. There is absolutely no reason why we have an Intel-specific
definition in there, as you mentioned it it should have been a pointer
to SoC-specific data. we'll fix this. nice catch, much appreciated.
-Pierre
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply other threads:[~2018-12-12 22:35 UTC|newest]
Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-11 21:23 [PATCH v3 00/14] Sound Open Firmware (SOF) core Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 01/14] ASoC: SOF: Add Sound Open Firmware driver core Pierre-Louis Bossart
2018-12-11 22:20 ` Andy Shevchenko
2018-12-11 23:20 ` Pierre-Louis Bossart
2018-12-12 7:51 ` Takashi Iwai
2018-12-12 14:53 ` Pierre-Louis Bossart
2018-12-12 20:42 ` Daniel Baluta
2018-12-12 22:35 ` Pierre-Louis Bossart [this message]
2019-01-29 16:49 ` Daniel Baluta
2019-01-30 16:12 ` Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 02/14] ASoC: SOF: Add Sound Open Firmware KControl support Pierre-Louis Bossart
2018-12-11 22:23 ` Andy Shevchenko
2018-12-11 22:48 ` Pierre-Louis Bossart
2018-12-11 23:25 ` Andy Shevchenko
2018-12-12 20:18 ` Pierre-Louis Bossart
2018-12-12 7:35 ` Takashi Iwai
2018-12-12 15:01 ` Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 03/14] ASoC: SOF: Add driver debug support Pierre-Louis Bossart
2018-12-11 22:32 ` Andy Shevchenko
2018-12-11 23:29 ` Pierre-Louis Bossart
2019-01-09 19:40 ` Mark Brown
2019-01-10 20:47 ` Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 04/14] ASoC: SOF: Add support for IPC IO between DSP and Host Pierre-Louis Bossart
2018-12-11 22:57 ` Andy Shevchenko
2018-12-11 23:38 ` Pierre-Louis Bossart
2018-12-12 8:17 ` Takashi Iwai
2018-12-12 15:19 ` Pierre-Louis Bossart
2018-12-12 15:34 ` Takashi Iwai
2018-12-13 5:24 ` Keyon Jie
2018-12-13 7:48 ` Takashi Iwai
2018-12-13 9:13 ` Keyon Jie
2018-12-13 8:06 ` Keyon Jie
2018-12-13 8:59 ` rander.wang
2019-01-09 20:37 ` Mark Brown
2019-01-10 20:11 ` Pierre-Louis Bossart
2019-01-22 19:04 ` Mark Brown
2019-01-22 21:05 ` Pierre-Louis Bossart
2019-01-22 21:13 ` Mark Brown
2019-01-23 5:51 ` [Sound-open-firmware] " Keyon Jie
2019-01-14 15:10 ` Daniel Baluta
2019-01-14 17:39 ` Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 05/14] ASoC: SOF: Add PCM operations support Pierre-Louis Bossart
2018-12-12 8:04 ` Takashi Iwai
2018-12-12 13:12 ` Andy Shevchenko
2018-12-12 15:29 ` [Sound-open-firmware] " Pierre-Louis Bossart
2018-12-12 15:43 ` Takashi Iwai
2018-12-12 16:10 ` Pierre-Louis Bossart
2018-12-12 22:09 ` Daniel Baluta
2018-12-11 21:23 ` [PATCH v3 06/14] ASoC: SOF: Add support for loading topologies Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 07/14] ASoC: SOF: Add DSP firmware logger support Pierre-Louis Bossart
2018-12-11 23:21 ` Andy Shevchenko
2018-12-11 23:43 ` Pierre-Louis Bossart
2018-12-12 6:44 ` Takashi Iwai
2018-12-12 11:11 ` Takashi Iwai
2018-12-12 16:04 ` [Sound-open-firmware] " Pierre-Louis Bossart
2018-12-12 16:12 ` Takashi Iwai
2018-12-12 17:01 ` Pierre-Louis Bossart
2019-01-09 20:44 ` Mark Brown
2019-01-09 21:39 ` Pierre-Louis Bossart
2019-01-22 18:57 ` Mark Brown
2019-01-22 20:33 ` Pierre-Louis Bossart
2019-01-22 20:41 ` Mark Brown
2019-01-22 20:52 ` Pierre-Louis Bossart
2019-01-22 21:08 ` Mark Brown
2019-01-22 21:13 ` Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 08/14] ASoC: SOF: Add DSP HW abstraction operations Pierre-Louis Bossart
2018-12-11 23:16 ` Andy Shevchenko
2018-12-11 23:45 ` Pierre-Louis Bossart
2019-01-09 20:51 ` Mark Brown
2019-01-09 21:37 ` Pierre-Louis Bossart
2019-01-22 18:56 ` Mark Brown
2018-12-11 21:23 ` [PATCH v3 09/14] ASoC: SOF: Add firmware loader support Pierre-Louis Bossart
2018-12-11 22:38 ` Andy Shevchenko
2018-12-11 23:54 ` Pierre-Louis Bossart
2019-01-09 20:55 ` Mark Brown
2018-12-12 11:23 ` Takashi Iwai
2018-12-12 16:06 ` [Sound-open-firmware] " Pierre-Louis Bossart
2019-01-09 21:02 ` Mark Brown
2019-01-09 21:24 ` Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 10/14] ASoC: SOF: Add userspace ABI support Pierre-Louis Bossart
2018-12-21 11:10 ` Daniel Baluta
2018-12-21 14:59 ` [Sound-open-firmware] " Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 11/14] ASoC: SOF: Add PM support Pierre-Louis Bossart
2018-12-12 11:32 ` Takashi Iwai
2018-12-12 16:08 ` Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 12/14] ASoC: SOF: Add Nocodec machine driver support Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 13/14] ASoC: SOF: Add xtensa support Pierre-Louis Bossart
2018-12-11 23:08 ` Andy Shevchenko
2018-12-12 0:00 ` Pierre-Louis Bossart
[not found] ` <93aff9af-c693-c951-4821-e9e334133ed0@linux.intel.com>
2018-12-13 9:58 ` [Sound-open-firmware] " rander.wang
2018-12-17 13:45 ` Takashi Iwai
2018-12-17 14:24 ` Mark Brown
2018-12-11 21:23 ` [PATCH v3 14/14] ASoC: SOF: Add utils Pierre-Louis Bossart
2018-12-11 23:06 ` Andy Shevchenko
2018-12-12 0:06 ` Pierre-Louis Bossart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d51998a3-433d-8d57-6afd-2b5a7087e83a@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alan@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=andriy.shevchenko@intel.com \
--cc=broonie@kernel.org \
--cc=daniel.baluta@gmail.com \
--cc=liam.r.girdwood@linux.intel.com \
--cc=sound-open-firmware@alsa-project.org \
--cc=tiwai@suse.de \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox