Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9213839ybi; Wed, 24 Jul 2019 00:05:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2KgNG43Vdv7FGwPSfjdi7G4mhRVKBt1hRkbIhaWtwbKnqc+eJKaaKF0mHRXjkwz8gBroe X-Received: by 2002:a65:51c1:: with SMTP id i1mr58746306pgq.417.1563951944621; Wed, 24 Jul 2019 00:05:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563951944; cv=none; d=google.com; s=arc-20160816; b=s2X9wLN31YUjvG58kIZ/gCtaa853Py2LTc5GT4K9z9P6+QwlICjnneNBQfM8Xm+P/j 6DuHT5AqWJskRJHFsAL49hq7hhT8zW3MVF/zpVnc7jfzJVU4s4xQ2WQ+wlLXEwM79CAY y77VoWcfLyDgHpUlTI+VaOLig1EdwZnFcEUZJv8saesIK6bcNDGy18vQcOoQBPV3UhzI S5Zfrlg/fSnCMk+veQEFcVgFRvkJDO/hfu5euVSHfRpRcfDEZSGwH9kwSrnocPOwB48g EU/FAKADuVpxXEtNTWJHsIWbjCwI15SffFdWQaCqXJRC2p3WykjwC7PaLU7MSbIGjwU2 ZU4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=SgB/LN6qxAiqZqDXD7MESa7fWo999T9KOe+bNiah86o=; b=piulwVaGVTRRRlyJsdMpxuz+bU9RHjqNCGKupAwaJggoJ5Yy7Dja5wxHuA9snIfFoy z2BDbn1IwpbepFd46kpjc1hhnE13KLz0GubdX3CwE4qLmjLvpOdehdFcWKO1U0F/mhgX m3Zx6O0up0aEKhVKR485zzIp7i847L2lkmBwRCCyuKlsuPIXOPewucHFWlEsz4IqRZEP p28U2Ja0Qe2SvhchUQlo+gb94doPHDp0sxwx9fzP3lWUWM7eKU25ZeGJKTNGWVn8jqI3 81KgbXUqsvik47sXNQgq0dK6Wb/esaHrHAA8aBGaNN3S9qJ8j/JASK/5wqdayeBMXY5m gmWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fUzlEFxN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z24si15541794plo.159.2019.07.24.00.05.28; Wed, 24 Jul 2019 00:05:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fUzlEFxN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726115AbfGXHEx (ORCPT + 99 others); Wed, 24 Jul 2019 03:04:53 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:55628 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725882AbfGXHEx (ORCPT ); Wed, 24 Jul 2019 03:04:53 -0400 Received: by mail-wm1-f66.google.com with SMTP id a15so40700164wmj.5; Wed, 24 Jul 2019 00:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SgB/LN6qxAiqZqDXD7MESa7fWo999T9KOe+bNiah86o=; b=fUzlEFxNZnKWldkB/3DAtX/BaMGxHoTAiL9k/3WWXLrH8fjFtZjQbroFWwfMrmG2pl 1VwKV6XUjnRU/gHMh28BtnQVrzUXc2XEQZN7wzfBd8c+u+AaGdMcwrvl/nmJefNe+XOg gxXaayL/BxUpZ+Nom8MZLJpb0TeacnqvLBQjm0RpqYcuT8Y/Gj9aBzbD3kaBZPzjzY/L JWkF9+AOZWlgy71IXap2b5x2ldWTrVvsMnVs1xOAJm0m+LepYaL2Jh8nwyuUS0NEkyaX NFEzAOq82uhHBwknpWHjL9qdIyvF60UDzNycQ0qGQ0b0tfSyQXYfZv9nGlICB2//ofed Pwsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SgB/LN6qxAiqZqDXD7MESa7fWo999T9KOe+bNiah86o=; b=cWgdJh0f8MZaSsxUVh4tsqDv8ZAFQM2NbfJOYCK+YNcT+MlKJIT5cEAnJXdzQ/ju5A a5ibfuL5lRCitZ3KBmA0eOk1T3suXAS/yDwzu+Cr2WgQMGvP7L2w84glVOaDp53DcQA5 n1IL494fzOz4pgElP33DZD0zHCVxR/LqSABoRq5WPh4llT333gG+iwejoyLgsUKjfh3A ypFAXtnm35sJI9TbUAii04oEsQBu6fNYS30q/sdrPsUj3wPRaCFbV1N1xdp5AemRKPQD rASuL4lMJYXnB88UVY7kIz1oBbgHcwqw7+Qaebjkzyq/VE2k2Nkly+4JhV4evyHHfHIa WAeA== X-Gm-Message-State: APjAAAWp4JNh3MYWYNzR47wWycyWP9h9pOd5i+UITALDLF/784NUBRdL k9iht8MrtPInpqZaH/dn+v8nSq7P+oudpmBP/Go= X-Received: by 2002:a7b:c051:: with SMTP id u17mr71152413wmc.25.1563951889935; Wed, 24 Jul 2019 00:04:49 -0700 (PDT) MIME-Version: 1.0 References: <20190723084104.12639-1-daniel.baluta@nxp.com> <20190723084104.12639-4-daniel.baluta@nxp.com> In-Reply-To: From: Daniel Baluta Date: Wed, 24 Jul 2019 10:04:38 +0300 Message-ID: Subject: Re: [Sound-open-firmware] [PATCH v2 3/5] ASoC: SOF: Add DT DSP device support To: Pierre-Louis Bossart Cc: Daniel Baluta , Marco Felsch , Shawn Guo , Mark Rutland , Aisheng Dong , Peng Fan , Anson Huang , Devicetree List , "S.j. Wang" , Linux Kernel Mailing List , Paul Olaru , Rob Herring , dl-linux-imx , Pengutronix Kernel Team , Leonard Crestez , Fabio Estevam , linux-arm-kernel , sound-open-firmware@alsa-project.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 23, 2019 at 6:19 PM Pierre-Louis Bossart wrote: > > > > diff --git a/sound/soc/sof/Kconfig b/sound/soc/sof/Kconfig > > index 61b97fc55bb2..2aa3a1cdf60c 100644 > > --- a/sound/soc/sof/Kconfig > > +++ b/sound/soc/sof/Kconfig > > @@ -36,6 +36,15 @@ config SND_SOC_SOF_ACPI > > Say Y if you need this option > > If unsure select "N". > > > > +config SND_SOC_SOF_DT > > + tristate "SOF DT enumeration support" > > + select SND_SOC_SOF > > + select SND_SOC_SOF_OPTIONS > > + help > > + This adds support for Device Tree enumeration. This option is > > + required to enable i.MX8 devices. > > + Say Y if you need this option. If unsure select "N". > > + > > [snip] > > > diff --git a/sound/soc/sof/imx/Kconfig b/sound/soc/sof/imx/Kconfig > > index fff64a9970f0..fa35994a79c4 100644 > > --- a/sound/soc/sof/imx/Kconfig > > +++ b/sound/soc/sof/imx/Kconfig > > @@ -12,6 +12,7 @@ if SND_SOC_SOF_IMX_TOPLEVEL > > > > config SND_SOC_SOF_IMX8 > > tristate "SOF support for i.MX8" > > + select SND_SOC_SOF_DT > > This looks upside down. You should select SOF_DT first then include the > NXP stuff. > > > help > > This adds support for Sound Open Firmware for NXP i.MX8 platforms > > Say Y if you have such a device. > > diff --git a/sound/soc/sof/sof-dt-dev.c b/sound/soc/sof/sof-dt-dev.c > > new file mode 100644 > > index 000000000000..31429bbb5c7e > > --- /dev/null > > +++ b/sound/soc/sof/sof-dt-dev.c > > @@ -0,0 +1,159 @@ > > +// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) > > +// > > +// Copyright 2019 NXP > > +// > > +// Author: Daniel Baluta > > +// > > + > > +#include > > +#include > > +#include > > +#include > > + > > +#include "ops.h" > > + > > +extern struct snd_sof_dsp_ops sof_imx8_ops; > > + > > +static char *fw_path; > > +module_param(fw_path, charp, 0444); > > +MODULE_PARM_DESC(fw_path, "alternate path for SOF firmware."); > > + > > +static char *tplg_path; > > +module_param(tplg_path, charp, 0444); > > +MODULE_PARM_DESC(tplg_path, "alternate path for SOF topology."); > > + > > +/* platform specific devices */ > > +#if IS_ENABLED(CONFIG_SND_SOC_SOF_IMX8) > > +static struct sof_dev_desc sof_dt_imx8qxp_desc = { > > + .default_fw_path = "imx/sof", > > + .default_tplg_path = "imx/sof-tplg", > > + .nocodec_fw_filename = "sof-imx8.ri", > > + .nocodec_tplg_filename = "sof-imx8-nocodec.tplg", > > + .ops = &sof_imx8_ops, > > +}; > > +#endif > > + > > +static const struct dev_pm_ops sof_dt_pm = { > > + SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspend, snd_sof_resume) > > + SET_RUNTIME_PM_OPS(snd_sof_runtime_suspend, snd_sof_runtime_resume, > > + NULL) > > +}; > > + > > +static void sof_dt_probe_complete(struct device *dev) > > +{ > > + /* allow runtime_pm */ > > + pm_runtime_set_autosuspend_delay(dev, SND_SOF_SUSPEND_DELAY_MS); > > + pm_runtime_use_autosuspend(dev); > > + pm_runtime_enable(dev); > > +} > > + > > +static int sof_dt_probe(struct platform_device *pdev) > > +{ > > + struct device *dev = &pdev->dev; > > + const struct sof_dev_desc *desc; > > + /*TODO: create a generic snd_soc_xxx_mach */ > > + struct snd_soc_acpi_mach *mach; > > I wonder if you really need to use the same structures. For Intel we get > absolutely zero info from the firmware so rely on an ACPI codec ID as a > key to find information on which firmware and topology to use, and which > machine driver to load. You could have all this information in a DT blob? Yes. I see your point. I will still need to make a generic structure for snd_soc_acpi_mach so that everyone can use sof_nocodec_setup function. Maybe something like this: struct snd_soc_mach { union { struct snd_soc_acpi_mach acpi_mach; struct snd_soc_of_mach of_mach; } }; and then change the prototype of sof_nocodec_setup.