~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/soc/sof/sof-acpi-dev.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /sound/soc/sof/sof-acpi-dev.c (Version linux-6.11.5) and /sound/soc/sof/sof-acpi-dev.c (Version linux-5.5.19)


  1 // SPDX-License-Identifier: (GPL-2.0-only OR B !!   1 // SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
  2 //                                                  2 //
  3 // This file is provided under a dual BSD/GPLv      3 // This file is provided under a dual BSD/GPLv2 license.  When using or
  4 // redistributing this file, you may do so und      4 // redistributing this file, you may do so under either license.
  5 //                                                  5 //
  6 // Copyright(c) 2018 Intel Corporation         !!   6 // Copyright(c) 2018 Intel Corporation. All rights reserved.
  7 //                                                  7 //
  8 // Author: Liam Girdwood <liam.r.girdwood@linu      8 // Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
  9 //                                                  9 //
 10                                                    10 
 11 #include <linux/acpi.h>                            11 #include <linux/acpi.h>
 12 #include <linux/firmware.h>                        12 #include <linux/firmware.h>
 13 #include <linux/module.h>                          13 #include <linux/module.h>
 14 #include <linux/pm_runtime.h>                      14 #include <linux/pm_runtime.h>
 15 #include <sound/soc-acpi.h>                        15 #include <sound/soc-acpi.h>
 16 #include <sound/soc-acpi-intel-match.h>            16 #include <sound/soc-acpi-intel-match.h>
 17 #include <sound/sof.h>                             17 #include <sound/sof.h>
 18 #include "../intel/common/soc-intel-quirks.h"      18 #include "../intel/common/soc-intel-quirks.h"
 19 #include "ops.h"                                   19 #include "ops.h"
 20 #include "sof-acpi-dev.h"                      << 
 21                                                    20 
 22 /* platform specific devices */                    21 /* platform specific devices */
 23 #include "intel/shim.h"                            22 #include "intel/shim.h"
 24                                                    23 
 25 static char *fw_path;                              24 static char *fw_path;
 26 module_param(fw_path, charp, 0444);                25 module_param(fw_path, charp, 0444);
 27 MODULE_PARM_DESC(fw_path, "alternate path for      26 MODULE_PARM_DESC(fw_path, "alternate path for SOF firmware.");
 28                                                    27 
 29 static char *tplg_path;                            28 static char *tplg_path;
 30 module_param(tplg_path, charp, 0444);              29 module_param(tplg_path, charp, 0444);
 31 MODULE_PARM_DESC(tplg_path, "alternate path fo     30 MODULE_PARM_DESC(tplg_path, "alternate path for SOF topology.");
 32                                                    31 
 33 static int sof_acpi_debug;                         32 static int sof_acpi_debug;
 34 module_param_named(sof_acpi_debug, sof_acpi_de     33 module_param_named(sof_acpi_debug, sof_acpi_debug, int, 0444);
 35 MODULE_PARM_DESC(sof_acpi_debug, "SOF ACPI deb     34 MODULE_PARM_DESC(sof_acpi_debug, "SOF ACPI debug options (0x0 all off)");
 36                                                    35 
 37 #define SOF_ACPI_DISABLE_PM_RUNTIME BIT(0)         36 #define SOF_ACPI_DISABLE_PM_RUNTIME BIT(0)
 38                                                    37 
 39 const struct dev_pm_ops sof_acpi_pm = {        !!  38 #if IS_ENABLED(CONFIG_SND_SOC_SOF_HASWELL)
                                                   >>  39 static const struct sof_dev_desc sof_acpi_haswell_desc = {
                                                   >>  40         .machines = snd_soc_acpi_intel_haswell_machines,
                                                   >>  41         .resindex_lpe_base = 0,
                                                   >>  42         .resindex_pcicfg_base = 1,
                                                   >>  43         .resindex_imr_base = -1,
                                                   >>  44         .irqindex_host_ipc = 0,
                                                   >>  45         .chip_info = &hsw_chip_info,
                                                   >>  46         .default_fw_path = "intel/sof",
                                                   >>  47         .default_tplg_path = "intel/sof-tplg",
                                                   >>  48         .nocodec_fw_filename = "sof-hsw.ri",
                                                   >>  49         .nocodec_tplg_filename = "sof-hsw-nocodec.tplg",
                                                   >>  50         .ops = &sof_hsw_ops,
                                                   >>  51         .arch_ops = &sof_xtensa_arch_ops
                                                   >>  52 };
                                                   >>  53 #endif
                                                   >>  54 
                                                   >>  55 #if IS_ENABLED(CONFIG_SND_SOC_SOF_BROADWELL)
                                                   >>  56 static const struct sof_dev_desc sof_acpi_broadwell_desc = {
                                                   >>  57         .machines = snd_soc_acpi_intel_broadwell_machines,
                                                   >>  58         .resindex_lpe_base = 0,
                                                   >>  59         .resindex_pcicfg_base = 1,
                                                   >>  60         .resindex_imr_base = -1,
                                                   >>  61         .irqindex_host_ipc = 0,
                                                   >>  62         .chip_info = &bdw_chip_info,
                                                   >>  63         .default_fw_path = "intel/sof",
                                                   >>  64         .default_tplg_path = "intel/sof-tplg",
                                                   >>  65         .nocodec_fw_filename = "sof-bdw.ri",
                                                   >>  66         .nocodec_tplg_filename = "sof-bdw-nocodec.tplg",
                                                   >>  67         .ops = &sof_bdw_ops,
                                                   >>  68         .arch_ops = &sof_xtensa_arch_ops
                                                   >>  69 };
                                                   >>  70 #endif
                                                   >>  71 
                                                   >>  72 #if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
                                                   >>  73 
                                                   >>  74 /* BYTCR uses different IRQ index */
                                                   >>  75 static const struct sof_dev_desc sof_acpi_baytrailcr_desc = {
                                                   >>  76         .machines = snd_soc_acpi_intel_baytrail_machines,
                                                   >>  77         .resindex_lpe_base = 0,
                                                   >>  78         .resindex_pcicfg_base = 1,
                                                   >>  79         .resindex_imr_base = 2,
                                                   >>  80         .irqindex_host_ipc = 0,
                                                   >>  81         .chip_info = &byt_chip_info,
                                                   >>  82         .default_fw_path = "intel/sof",
                                                   >>  83         .default_tplg_path = "intel/sof-tplg",
                                                   >>  84         .nocodec_fw_filename = "sof-byt.ri",
                                                   >>  85         .nocodec_tplg_filename = "sof-byt-nocodec.tplg",
                                                   >>  86         .ops = &sof_byt_ops,
                                                   >>  87         .arch_ops = &sof_xtensa_arch_ops
                                                   >>  88 };
                                                   >>  89 
                                                   >>  90 static const struct sof_dev_desc sof_acpi_baytrail_desc = {
                                                   >>  91         .machines = snd_soc_acpi_intel_baytrail_machines,
                                                   >>  92         .resindex_lpe_base = 0,
                                                   >>  93         .resindex_pcicfg_base = 1,
                                                   >>  94         .resindex_imr_base = 2,
                                                   >>  95         .irqindex_host_ipc = 5,
                                                   >>  96         .chip_info = &byt_chip_info,
                                                   >>  97         .default_fw_path = "intel/sof",
                                                   >>  98         .default_tplg_path = "intel/sof-tplg",
                                                   >>  99         .nocodec_fw_filename = "sof-byt.ri",
                                                   >> 100         .nocodec_tplg_filename = "sof-byt-nocodec.tplg",
                                                   >> 101         .ops = &sof_byt_ops,
                                                   >> 102         .arch_ops = &sof_xtensa_arch_ops
                                                   >> 103 };
                                                   >> 104 
                                                   >> 105 static const struct sof_dev_desc sof_acpi_cherrytrail_desc = {
                                                   >> 106         .machines = snd_soc_acpi_intel_cherrytrail_machines,
                                                   >> 107         .resindex_lpe_base = 0,
                                                   >> 108         .resindex_pcicfg_base = 1,
                                                   >> 109         .resindex_imr_base = 2,
                                                   >> 110         .irqindex_host_ipc = 5,
                                                   >> 111         .chip_info = &cht_chip_info,
                                                   >> 112         .default_fw_path = "intel/sof",
                                                   >> 113         .default_tplg_path = "intel/sof-tplg",
                                                   >> 114         .nocodec_fw_filename = "sof-cht.ri",
                                                   >> 115         .nocodec_tplg_filename = "sof-cht-nocodec.tplg",
                                                   >> 116         .ops = &sof_cht_ops,
                                                   >> 117         .arch_ops = &sof_xtensa_arch_ops
                                                   >> 118 };
                                                   >> 119 
                                                   >> 120 #endif
                                                   >> 121 
                                                   >> 122 static const struct dev_pm_ops sof_acpi_pm = {
 40         SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspen    123         SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspend, snd_sof_resume)
 41         SET_RUNTIME_PM_OPS(snd_sof_runtime_sus    124         SET_RUNTIME_PM_OPS(snd_sof_runtime_suspend, snd_sof_runtime_resume,
 42                            snd_sof_runtime_idl    125                            snd_sof_runtime_idle)
 43 };                                                126 };
 44 EXPORT_SYMBOL_NS(sof_acpi_pm, SND_SOC_SOF_ACPI << 
 45                                                   127 
 46 static void sof_acpi_probe_complete(struct dev    128 static void sof_acpi_probe_complete(struct device *dev)
 47 {                                                 129 {
 48         dev_dbg(dev, "Completing SOF ACPI prob << 
 49                                                << 
 50         if (sof_acpi_debug & SOF_ACPI_DISABLE_    130         if (sof_acpi_debug & SOF_ACPI_DISABLE_PM_RUNTIME)
 51                 return;                           131                 return;
 52                                                   132 
 53         /* allow runtime_pm */                    133         /* allow runtime_pm */
 54         pm_runtime_set_autosuspend_delay(dev,     134         pm_runtime_set_autosuspend_delay(dev, SND_SOF_SUSPEND_DELAY_MS);
 55         pm_runtime_use_autosuspend(dev);          135         pm_runtime_use_autosuspend(dev);
 56         pm_runtime_enable(dev);                   136         pm_runtime_enable(dev);
 57 }                                                 137 }
 58                                                   138 
 59 int sof_acpi_probe(struct platform_device *pde !! 139 static int sof_acpi_probe(struct platform_device *pdev)
 60 {                                                 140 {
 61         struct device *dev = &pdev->dev;          141         struct device *dev = &pdev->dev;
                                                   >> 142         const struct sof_dev_desc *desc;
                                                   >> 143         struct snd_soc_acpi_mach *mach;
 62         struct snd_sof_pdata *sof_pdata;          144         struct snd_sof_pdata *sof_pdata;
                                                   >> 145         const struct snd_sof_dsp_ops *ops;
                                                   >> 146         int ret;
 63                                                   147 
 64         dev_dbg(dev, "ACPI DSP detected");     !! 148         dev_dbg(&pdev->dev, "ACPI DSP detected");
 65                                                   149 
 66         sof_pdata = devm_kzalloc(dev, sizeof(*    150         sof_pdata = devm_kzalloc(dev, sizeof(*sof_pdata), GFP_KERNEL);
 67         if (!sof_pdata)                           151         if (!sof_pdata)
 68                 return -ENOMEM;                   152                 return -ENOMEM;
 69                                                   153 
 70         if (!desc->ops) {                      !! 154         desc = device_get_match_data(dev);
                                                   >> 155         if (!desc)
                                                   >> 156                 return -ENODEV;
                                                   >> 157 
                                                   >> 158 #if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
                                                   >> 159         if (desc == &sof_acpi_baytrail_desc && soc_intel_is_byt_cr(pdev))
                                                   >> 160                 desc = &sof_acpi_baytrailcr_desc;
                                                   >> 161 #endif
                                                   >> 162 
                                                   >> 163         /* get ops for platform */
                                                   >> 164         ops = desc->ops;
                                                   >> 165         if (!ops) {
 71                 dev_err(dev, "error: no matchi    166                 dev_err(dev, "error: no matching ACPI descriptor ops\n");
 72                 return -ENODEV;                   167                 return -ENODEV;
 73         }                                         168         }
 74                                                   169 
                                                   >> 170 #if IS_ENABLED(CONFIG_SND_SOC_SOF_FORCE_NOCODEC_MODE)
                                                   >> 171         /* force nocodec mode */
                                                   >> 172         dev_warn(dev, "Force to use nocodec mode\n");
                                                   >> 173         mach = devm_kzalloc(dev, sizeof(*mach), GFP_KERNEL);
                                                   >> 174         if (!mach)
                                                   >> 175                 return -ENOMEM;
                                                   >> 176         ret = sof_nocodec_setup(dev, sof_pdata, mach, desc, ops);
                                                   >> 177         if (ret < 0)
                                                   >> 178                 return ret;
                                                   >> 179 #else
                                                   >> 180         /* find machine */
                                                   >> 181         mach = snd_soc_acpi_find_machine(desc->machines);
                                                   >> 182         if (!mach) {
                                                   >> 183                 dev_warn(dev, "warning: No matching ASoC machine driver found\n");
                                                   >> 184         } else {
                                                   >> 185                 sof_pdata->fw_filename = mach->sof_fw_filename;
                                                   >> 186                 sof_pdata->tplg_filename = mach->sof_tplg_filename;
                                                   >> 187         }
                                                   >> 188 #endif
                                                   >> 189 
                                                   >> 190         if (mach) {
                                                   >> 191                 mach->mach_params.platform = dev_name(dev);
                                                   >> 192                 mach->mach_params.acpi_ipc_irq_index = desc->irqindex_host_ipc;
                                                   >> 193         }
                                                   >> 194 
                                                   >> 195         sof_pdata->machine = mach;
 75         sof_pdata->desc = desc;                   196         sof_pdata->desc = desc;
 76         sof_pdata->dev = &pdev->dev;              197         sof_pdata->dev = &pdev->dev;
                                                   >> 198         sof_pdata->platform = dev_name(dev);
 77                                                   199 
 78         sof_pdata->ipc_file_profile_base.ipc_t !! 200         /* alternate fw and tplg filenames ? */
 79         sof_pdata->ipc_file_profile_base.fw_pa !! 201         if (fw_path)
 80         sof_pdata->ipc_file_profile_base.tplg_ !! 202                 sof_pdata->fw_filename_prefix = fw_path;
                                                   >> 203         else
                                                   >> 204                 sof_pdata->fw_filename_prefix =
                                                   >> 205                         sof_pdata->desc->default_fw_path;
                                                   >> 206 
                                                   >> 207         if (tplg_path)
                                                   >> 208                 sof_pdata->tplg_filename_prefix = tplg_path;
                                                   >> 209         else
                                                   >> 210                 sof_pdata->tplg_filename_prefix =
                                                   >> 211                         sof_pdata->desc->default_tplg_path;
 81                                                   212 
 82         /* set callback to be called on succes !! 213 #if IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE)
                                                   >> 214         /* set callback to enable runtime_pm */
 83         sof_pdata->sof_probe_complete = sof_ac    215         sof_pdata->sof_probe_complete = sof_acpi_probe_complete;
 84                                                !! 216 #endif
 85         /* call sof helper for DSP hardware pr    217         /* call sof helper for DSP hardware probe */
 86         return snd_sof_device_probe(dev, sof_p !! 218         ret = snd_sof_device_probe(dev, sof_pdata);
                                                   >> 219         if (ret) {
                                                   >> 220                 dev_err(dev, "error: failed to probe DSP hardware!\n");
                                                   >> 221                 return ret;
                                                   >> 222         }
                                                   >> 223 
                                                   >> 224 #if !IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE)
                                                   >> 225         sof_acpi_probe_complete(dev);
                                                   >> 226 #endif
                                                   >> 227 
                                                   >> 228         return ret;
 87 }                                                 229 }
 88 EXPORT_SYMBOL_NS(sof_acpi_probe, SND_SOC_SOF_A << 
 89                                                   230 
 90 void sof_acpi_remove(struct platform_device *p !! 231 static int sof_acpi_remove(struct platform_device *pdev)
 91 {                                                 232 {
 92         struct device *dev = &pdev->dev;       << 
 93                                                << 
 94         if (!(sof_acpi_debug & SOF_ACPI_DISABL    233         if (!(sof_acpi_debug & SOF_ACPI_DISABLE_PM_RUNTIME))
 95                 pm_runtime_disable(dev);       !! 234                 pm_runtime_disable(&pdev->dev);
 96                                                   235 
 97         /* call sof helper for DSP hardware re    236         /* call sof helper for DSP hardware remove */
 98         snd_sof_device_remove(dev);            !! 237         snd_sof_device_remove(&pdev->dev);
                                                   >> 238 
                                                   >> 239         return 0;
 99 }                                                 240 }
100 EXPORT_SYMBOL_NS(sof_acpi_remove, SND_SOC_SOF_ !! 241 
                                                   >> 242 static const struct acpi_device_id sof_acpi_match[] = {
                                                   >> 243 #if IS_ENABLED(CONFIG_SND_SOC_SOF_HASWELL)
                                                   >> 244         { "INT33C8", (unsigned long)&sof_acpi_haswell_desc },
                                                   >> 245 #endif
                                                   >> 246 #if IS_ENABLED(CONFIG_SND_SOC_SOF_BROADWELL)
                                                   >> 247         { "INT3438", (unsigned long)&sof_acpi_broadwell_desc },
                                                   >> 248 #endif
                                                   >> 249 #if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
                                                   >> 250         { "80860F28", (unsigned long)&sof_acpi_baytrail_desc },
                                                   >> 251         { "808622A8", (unsigned long)&sof_acpi_cherrytrail_desc },
                                                   >> 252 #endif
                                                   >> 253         { }
                                                   >> 254 };
                                                   >> 255 MODULE_DEVICE_TABLE(acpi, sof_acpi_match);
                                                   >> 256 
                                                   >> 257 /* acpi_driver definition */
                                                   >> 258 static struct platform_driver snd_sof_acpi_driver = {
                                                   >> 259         .probe = sof_acpi_probe,
                                                   >> 260         .remove = sof_acpi_remove,
                                                   >> 261         .driver = {
                                                   >> 262                 .name = "sof-audio-acpi",
                                                   >> 263                 .pm = &sof_acpi_pm,
                                                   >> 264                 .acpi_match_table = ACPI_PTR(sof_acpi_match),
                                                   >> 265         },
                                                   >> 266 };
                                                   >> 267 module_platform_driver(snd_sof_acpi_driver);
101                                                   268 
102 MODULE_LICENSE("Dual BSD/GPL");                   269 MODULE_LICENSE("Dual BSD/GPL");
103 MODULE_DESCRIPTION("SOF support for ACPI platf << 
104                                                   270 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php