~ [ 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.2.21)


  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 #ifdef CONFIG_X86
                                                   >>  19 #include <asm/iosf_mbi.h>
                                                   >>  20 #endif
                                                   >>  21 
 19 #include "ops.h"                                   22 #include "ops.h"
 20 #include "sof-acpi-dev.h"                      << 
 21                                                    23 
 22 /* platform specific devices */                    24 /* platform specific devices */
 23 #include "intel/shim.h"                            25 #include "intel/shim.h"
 24                                                    26 
 25 static char *fw_path;                              27 static char *fw_path;
 26 module_param(fw_path, charp, 0444);                28 module_param(fw_path, charp, 0444);
 27 MODULE_PARM_DESC(fw_path, "alternate path for      29 MODULE_PARM_DESC(fw_path, "alternate path for SOF firmware.");
 28                                                    30 
 29 static char *tplg_path;                            31 static char *tplg_path;
 30 module_param(tplg_path, charp, 0444);              32 module_param(tplg_path, charp, 0444);
 31 MODULE_PARM_DESC(tplg_path, "alternate path fo     33 MODULE_PARM_DESC(tplg_path, "alternate path for SOF topology.");
 32                                                    34 
 33 static int sof_acpi_debug;                     !!  35 #if IS_ENABLED(CONFIG_SND_SOC_SOF_HASWELL)
 34 module_param_named(sof_acpi_debug, sof_acpi_de !!  36 static const struct sof_dev_desc sof_acpi_haswell_desc = {
 35 MODULE_PARM_DESC(sof_acpi_debug, "SOF ACPI deb !!  37         .machines = snd_soc_acpi_intel_haswell_machines,
                                                   >>  38         .resindex_lpe_base = 0,
                                                   >>  39         .resindex_pcicfg_base = 1,
                                                   >>  40         .resindex_imr_base = -1,
                                                   >>  41         .irqindex_host_ipc = 0,
                                                   >>  42         .chip_info = &hsw_chip_info,
                                                   >>  43         .default_fw_path = "intel/sof",
                                                   >>  44         .default_tplg_path = "intel/sof-tplg",
                                                   >>  45         .nocodec_fw_filename = "sof-hsw.ri",
                                                   >>  46         .nocodec_tplg_filename = "sof-hsw-nocodec.tplg",
                                                   >>  47         .ops = &sof_hsw_ops,
                                                   >>  48         .arch_ops = &sof_xtensa_arch_ops
                                                   >>  49 };
                                                   >>  50 #endif
                                                   >>  51 
                                                   >>  52 #if IS_ENABLED(CONFIG_SND_SOC_SOF_BROADWELL)
                                                   >>  53 static const struct sof_dev_desc sof_acpi_broadwell_desc = {
                                                   >>  54         .machines = snd_soc_acpi_intel_broadwell_machines,
                                                   >>  55         .resindex_lpe_base = 0,
                                                   >>  56         .resindex_pcicfg_base = 1,
                                                   >>  57         .resindex_imr_base = -1,
                                                   >>  58         .irqindex_host_ipc = 0,
                                                   >>  59         .chip_info = &bdw_chip_info,
                                                   >>  60         .default_fw_path = "intel/sof",
                                                   >>  61         .default_tplg_path = "intel/sof-tplg",
                                                   >>  62         .nocodec_fw_filename = "sof-bdw.ri",
                                                   >>  63         .nocodec_tplg_filename = "sof-bdw-nocodec.tplg",
                                                   >>  64         .ops = &sof_bdw_ops,
                                                   >>  65         .arch_ops = &sof_xtensa_arch_ops
                                                   >>  66 };
                                                   >>  67 #endif
                                                   >>  68 
                                                   >>  69 #if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
                                                   >>  70 
                                                   >>  71 /* BYTCR uses different IRQ index */
                                                   >>  72 static const struct sof_dev_desc sof_acpi_baytrailcr_desc = {
                                                   >>  73         .machines = snd_soc_acpi_intel_baytrail_machines,
                                                   >>  74         .resindex_lpe_base = 0,
                                                   >>  75         .resindex_pcicfg_base = 1,
                                                   >>  76         .resindex_imr_base = 2,
                                                   >>  77         .irqindex_host_ipc = 0,
                                                   >>  78         .chip_info = &byt_chip_info,
                                                   >>  79         .default_fw_path = "intel/sof",
                                                   >>  80         .default_tplg_path = "intel/sof-tplg",
                                                   >>  81         .nocodec_fw_filename = "sof-byt.ri",
                                                   >>  82         .nocodec_tplg_filename = "sof-byt-nocodec.tplg",
                                                   >>  83         .ops = &sof_byt_ops,
                                                   >>  84         .arch_ops = &sof_xtensa_arch_ops
                                                   >>  85 };
                                                   >>  86 
                                                   >>  87 static const struct sof_dev_desc sof_acpi_baytrail_desc = {
                                                   >>  88         .machines = snd_soc_acpi_intel_baytrail_machines,
                                                   >>  89         .resindex_lpe_base = 0,
                                                   >>  90         .resindex_pcicfg_base = 1,
                                                   >>  91         .resindex_imr_base = 2,
                                                   >>  92         .irqindex_host_ipc = 5,
                                                   >>  93         .chip_info = &byt_chip_info,
                                                   >>  94         .default_fw_path = "intel/sof",
                                                   >>  95         .default_tplg_path = "intel/sof-tplg",
                                                   >>  96         .nocodec_fw_filename = "sof-byt.ri",
                                                   >>  97         .nocodec_tplg_filename = "sof-byt-nocodec.tplg",
                                                   >>  98         .ops = &sof_byt_ops,
                                                   >>  99         .arch_ops = &sof_xtensa_arch_ops
                                                   >> 100 };
                                                   >> 101 
                                                   >> 102 #ifdef CONFIG_X86 /* TODO: move this to common helper */
                                                   >> 103 
                                                   >> 104 static bool is_byt_cr(struct platform_device *pdev)
                                                   >> 105 {
                                                   >> 106         struct device *dev = &pdev->dev;
                                                   >> 107         int status;
                                                   >> 108 
                                                   >> 109         if (iosf_mbi_available()) {
                                                   >> 110                 u32 bios_status;
                                                   >> 111                 status = iosf_mbi_read(BT_MBI_UNIT_PMC, /* 0x04 PUNIT */
                                                   >> 112                                        MBI_REG_READ, /* 0x10 */
                                                   >> 113                                        0x006, /* BIOS_CONFIG */
                                                   >> 114                                        &bios_status);
                                                   >> 115 
                                                   >> 116                 if (status) {
                                                   >> 117                         dev_err(dev, "could not read PUNIT BIOS_CONFIG\n");
                                                   >> 118                 } else {
                                                   >> 119                         /* bits 26:27 mirror PMIC options */
                                                   >> 120                         bios_status = (bios_status >> 26) & 3;
                                                   >> 121 
                                                   >> 122                         if (bios_status == 1 || bios_status == 3) {
                                                   >> 123                                 dev_info(dev, "Detected Baytrail-CR platform\n");
                                                   >> 124                                 return true;
                                                   >> 125                         }
                                                   >> 126 
                                                   >> 127                         dev_info(dev, "BYT-CR not detected\n");
                                                   >> 128                 }
                                                   >> 129         } else {
                                                   >> 130                 dev_info(dev, "IOSF_MBI not available, no BYT-CR detection\n");
                                                   >> 131         }
                                                   >> 132 
                                                   >> 133         if (platform_get_resource(pdev, IORESOURCE_IRQ, 5) == NULL) {
                                                   >> 134                 /*
                                                   >> 135                  * Some devices detected as BYT-T have only a single IRQ listed,
                                                   >> 136                  * causing platform_get_irq with index 5 to return -ENXIO.
                                                   >> 137                  * The correct IRQ in this case is at index 0, as on BYT-CR.
                                                   >> 138                  */
                                                   >> 139                 dev_info(dev, "Falling back to Baytrail-CR platform\n");
                                                   >> 140                 return true;
                                                   >> 141         }
 36                                                   142 
 37 #define SOF_ACPI_DISABLE_PM_RUNTIME BIT(0)     !! 143         return false;
                                                   >> 144 }
                                                   >> 145 #else
                                                   >> 146 static int is_byt_cr(struct platform_device *pdev)
                                                   >> 147 {
                                                   >> 148         return 0;
                                                   >> 149 }
                                                   >> 150 #endif
                                                   >> 151 
                                                   >> 152 static const struct sof_dev_desc sof_acpi_cherrytrail_desc = {
                                                   >> 153         .machines = snd_soc_acpi_intel_cherrytrail_machines,
                                                   >> 154         .resindex_lpe_base = 0,
                                                   >> 155         .resindex_pcicfg_base = 1,
                                                   >> 156         .resindex_imr_base = 2,
                                                   >> 157         .irqindex_host_ipc = 5,
                                                   >> 158         .chip_info = &cht_chip_info,
                                                   >> 159         .default_fw_path = "intel/sof",
                                                   >> 160         .default_tplg_path = "intel/sof-tplg",
                                                   >> 161         .nocodec_fw_filename = "sof-cht.ri",
                                                   >> 162         .nocodec_tplg_filename = "sof-cht-nocodec.tplg",
                                                   >> 163         .ops = &sof_cht_ops,
                                                   >> 164         .arch_ops = &sof_xtensa_arch_ops
                                                   >> 165 };
 38                                                   166 
 39 const struct dev_pm_ops sof_acpi_pm = {        !! 167 #endif
                                                   >> 168 
                                                   >> 169 static const struct dev_pm_ops sof_acpi_pm = {
 40         SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspen    170         SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspend, snd_sof_resume)
 41         SET_RUNTIME_PM_OPS(snd_sof_runtime_sus    171         SET_RUNTIME_PM_OPS(snd_sof_runtime_suspend, snd_sof_runtime_resume,
 42                            snd_sof_runtime_idl !! 172                            NULL)
 43 };                                                173 };
 44 EXPORT_SYMBOL_NS(sof_acpi_pm, SND_SOC_SOF_ACPI << 
 45                                                   174 
 46 static void sof_acpi_probe_complete(struct dev    175 static void sof_acpi_probe_complete(struct device *dev)
 47 {                                                 176 {
 48         dev_dbg(dev, "Completing SOF ACPI prob << 
 49                                                << 
 50         if (sof_acpi_debug & SOF_ACPI_DISABLE_ << 
 51                 return;                        << 
 52                                                << 
 53         /* allow runtime_pm */                    177         /* allow runtime_pm */
 54         pm_runtime_set_autosuspend_delay(dev,     178         pm_runtime_set_autosuspend_delay(dev, SND_SOF_SUSPEND_DELAY_MS);
 55         pm_runtime_use_autosuspend(dev);          179         pm_runtime_use_autosuspend(dev);
 56         pm_runtime_enable(dev);                   180         pm_runtime_enable(dev);
 57 }                                                 181 }
 58                                                   182 
 59 int sof_acpi_probe(struct platform_device *pde !! 183 static int sof_acpi_probe(struct platform_device *pdev)
 60 {                                                 184 {
 61         struct device *dev = &pdev->dev;          185         struct device *dev = &pdev->dev;
                                                   >> 186         const struct sof_dev_desc *desc;
                                                   >> 187         struct snd_soc_acpi_mach *mach;
 62         struct snd_sof_pdata *sof_pdata;          188         struct snd_sof_pdata *sof_pdata;
                                                   >> 189         const struct snd_sof_dsp_ops *ops;
                                                   >> 190         int ret;
 63                                                   191 
 64         dev_dbg(dev, "ACPI DSP detected");     !! 192         dev_dbg(&pdev->dev, "ACPI DSP detected");
 65                                                   193 
 66         sof_pdata = devm_kzalloc(dev, sizeof(*    194         sof_pdata = devm_kzalloc(dev, sizeof(*sof_pdata), GFP_KERNEL);
 67         if (!sof_pdata)                           195         if (!sof_pdata)
 68                 return -ENOMEM;                   196                 return -ENOMEM;
 69                                                   197 
 70         if (!desc->ops) {                      !! 198         desc = device_get_match_data(dev);
                                                   >> 199         if (!desc)
                                                   >> 200                 return -ENODEV;
                                                   >> 201 
                                                   >> 202 #if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
                                                   >> 203         if (desc == &sof_acpi_baytrail_desc && is_byt_cr(pdev))
                                                   >> 204                 desc = &sof_acpi_baytrailcr_desc;
                                                   >> 205 #endif
                                                   >> 206 
                                                   >> 207         /* get ops for platform */
                                                   >> 208         ops = desc->ops;
                                                   >> 209         if (!ops) {
 71                 dev_err(dev, "error: no matchi    210                 dev_err(dev, "error: no matching ACPI descriptor ops\n");
 72                 return -ENODEV;                   211                 return -ENODEV;
 73         }                                         212         }
 74                                                   213 
                                                   >> 214 #if IS_ENABLED(CONFIG_SND_SOC_SOF_FORCE_NOCODEC_MODE)
                                                   >> 215         /* force nocodec mode */
                                                   >> 216         dev_warn(dev, "Force to use nocodec mode\n");
                                                   >> 217         mach = devm_kzalloc(dev, sizeof(*mach), GFP_KERNEL);
                                                   >> 218         if (!mach)
                                                   >> 219                 return -ENOMEM;
                                                   >> 220         ret = sof_nocodec_setup(dev, sof_pdata, mach, desc, ops);
                                                   >> 221         if (ret < 0)
                                                   >> 222                 return ret;
                                                   >> 223 #else
                                                   >> 224         /* find machine */
                                                   >> 225         mach = snd_soc_acpi_find_machine(desc->machines);
                                                   >> 226         if (!mach) {
                                                   >> 227                 dev_warn(dev, "warning: No matching ASoC machine driver found\n");
                                                   >> 228         } else {
                                                   >> 229                 sof_pdata->fw_filename = mach->sof_fw_filename;
                                                   >> 230                 sof_pdata->tplg_filename = mach->sof_tplg_filename;
                                                   >> 231         }
                                                   >> 232 #endif
                                                   >> 233 
                                                   >> 234         if (mach) {
                                                   >> 235                 mach->mach_params.platform = dev_name(dev);
                                                   >> 236                 mach->mach_params.acpi_ipc_irq_index = desc->irqindex_host_ipc;
                                                   >> 237         }
                                                   >> 238 
                                                   >> 239         sof_pdata->machine = mach;
 75         sof_pdata->desc = desc;                   240         sof_pdata->desc = desc;
 76         sof_pdata->dev = &pdev->dev;              241         sof_pdata->dev = &pdev->dev;
                                                   >> 242         sof_pdata->platform = dev_name(dev);
 77                                                   243 
 78         sof_pdata->ipc_file_profile_base.ipc_t !! 244         /* alternate fw and tplg filenames ? */
 79         sof_pdata->ipc_file_profile_base.fw_pa !! 245         if (fw_path)
 80         sof_pdata->ipc_file_profile_base.tplg_ !! 246                 sof_pdata->fw_filename_prefix = fw_path;
                                                   >> 247         else
                                                   >> 248                 sof_pdata->fw_filename_prefix =
                                                   >> 249                         sof_pdata->desc->default_fw_path;
                                                   >> 250 
                                                   >> 251         if (tplg_path)
                                                   >> 252                 sof_pdata->tplg_filename_prefix = tplg_path;
                                                   >> 253         else
                                                   >> 254                 sof_pdata->tplg_filename_prefix =
                                                   >> 255                         sof_pdata->desc->default_tplg_path;
 81                                                   256 
 82         /* set callback to be called on succes !! 257 #if IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE)
                                                   >> 258         /* set callback to enable runtime_pm */
 83         sof_pdata->sof_probe_complete = sof_ac    259         sof_pdata->sof_probe_complete = sof_acpi_probe_complete;
 84                                                !! 260 #endif
 85         /* call sof helper for DSP hardware pr    261         /* call sof helper for DSP hardware probe */
 86         return snd_sof_device_probe(dev, sof_p !! 262         ret = snd_sof_device_probe(dev, sof_pdata);
                                                   >> 263         if (ret) {
                                                   >> 264                 dev_err(dev, "error: failed to probe DSP hardware!\n");
                                                   >> 265                 return ret;
                                                   >> 266         }
                                                   >> 267 
                                                   >> 268 #if !IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE)
                                                   >> 269         sof_acpi_probe_complete(dev);
                                                   >> 270 #endif
                                                   >> 271 
                                                   >> 272         return ret;
 87 }                                                 273 }
 88 EXPORT_SYMBOL_NS(sof_acpi_probe, SND_SOC_SOF_A << 
 89                                                   274 
 90 void sof_acpi_remove(struct platform_device *p !! 275 static int sof_acpi_remove(struct platform_device *pdev)
 91 {                                                 276 {
 92         struct device *dev = &pdev->dev;       !! 277         pm_runtime_disable(&pdev->dev);
 93                                                << 
 94         if (!(sof_acpi_debug & SOF_ACPI_DISABL << 
 95                 pm_runtime_disable(dev);       << 
 96                                                   278 
 97         /* call sof helper for DSP hardware re    279         /* call sof helper for DSP hardware remove */
 98         snd_sof_device_remove(dev);            !! 280         snd_sof_device_remove(&pdev->dev);
                                                   >> 281 
                                                   >> 282         return 0;
 99 }                                                 283 }
100 EXPORT_SYMBOL_NS(sof_acpi_remove, SND_SOC_SOF_ !! 284 
                                                   >> 285 static const struct acpi_device_id sof_acpi_match[] = {
                                                   >> 286 #if IS_ENABLED(CONFIG_SND_SOC_SOF_HASWELL)
                                                   >> 287         { "INT33C8", (unsigned long)&sof_acpi_haswell_desc },
                                                   >> 288 #endif
                                                   >> 289 #if IS_ENABLED(CONFIG_SND_SOC_SOF_BROADWELL)
                                                   >> 290         { "INT3438", (unsigned long)&sof_acpi_broadwell_desc },
                                                   >> 291 #endif
                                                   >> 292 #if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
                                                   >> 293         { "80860F28", (unsigned long)&sof_acpi_baytrail_desc },
                                                   >> 294         { "808622A8", (unsigned long)&sof_acpi_cherrytrail_desc },
                                                   >> 295 #endif
                                                   >> 296         { }
                                                   >> 297 };
                                                   >> 298 MODULE_DEVICE_TABLE(acpi, sof_acpi_match);
                                                   >> 299 
                                                   >> 300 /* acpi_driver definition */
                                                   >> 301 static struct platform_driver snd_sof_acpi_driver = {
                                                   >> 302         .probe = sof_acpi_probe,
                                                   >> 303         .remove = sof_acpi_remove,
                                                   >> 304         .driver = {
                                                   >> 305                 .name = "sof-audio-acpi",
                                                   >> 306                 .pm = &sof_acpi_pm,
                                                   >> 307                 .acpi_match_table = ACPI_PTR(sof_acpi_match),
                                                   >> 308         },
                                                   >> 309 };
                                                   >> 310 module_platform_driver(snd_sof_acpi_driver);
101                                                   311 
102 MODULE_LICENSE("Dual BSD/GPL");                   312 MODULE_LICENSE("Dual BSD/GPL");
103 MODULE_DESCRIPTION("SOF support for ACPI platf << 
104                                                   313 

~ [ 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