Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: SOF: Intel: hda: define parse_platform_ext_manifest op

Define the parse_platform_ext_manifest() op for HDA platforms to parse
the SOF_EXT_MAN_CAVS_CONFIG_CAVS_LPRO config item to determine if the FW
is configured for LPRO. The default clock configuration is assumed to be
HPRO in the absence of this item in the extended manifest.
New member clk_config_lpro is added to struct sof_intel_hda_dev to store
the FW clock config information and that this will be used later to perform
platform-specific operations in the post_fw_run op.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20201127164022.2498406-3-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Fred Oh and committed by
Mark Brown
edbaaada e984f3ef

+84
+3
sound/soc/sof/intel/apl.c
··· 92 92 .pre_fw_run = hda_dsp_pre_fw_run, 93 93 .post_fw_run = hda_dsp_post_fw_run, 94 94 95 + /* parse platform specific extended manifest */ 96 + .parse_platform_ext_manifest = hda_dsp_ext_man_get_cavs_config_data, 97 + 95 98 /* dsp core power up/down */ 96 99 .core_power_up = hda_dsp_enable_core, 97 100 .core_power_down = hda_dsp_core_reset_power_down,
+3
sound/soc/sof/intel/cnl.c
··· 294 294 .pre_fw_run = hda_dsp_pre_fw_run, 295 295 .post_fw_run = hda_dsp_post_fw_run, 296 296 297 + /* parse platform specific extended manifest */ 298 + .parse_platform_ext_manifest = hda_dsp_ext_man_get_cavs_config_data, 299 + 297 300 /* dsp core power up/down */ 298 301 .core_power_up = hda_dsp_enable_core, 299 302 .core_power_down = hda_dsp_core_reset_power_down,
+33
sound/soc/sof/intel/ext_manifest.h
··· 1 + /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ 2 + /* 3 + * This file is provided under a dual BSD/GPLv2 license. When using or 4 + * redistributing this file, you may do so under either license. 5 + * 6 + * Copyright(c) 2020 Intel Corporation. All rights reserved. 7 + */ 8 + 9 + /* 10 + * Intel extended manifest is a extra place to store Intel cavs specific 11 + * metadata about firmware, for example LPRO/HPRO configuration is 12 + * Intel cavs specific. This part of output binary is not signed. 13 + */ 14 + 15 + #ifndef __INTEL_CAVS_EXT_MANIFEST_H__ 16 + #define __INTEL_CAVS_EXT_MANIFEST_H__ 17 + 18 + #include <sound/sof/ext_manifest.h> 19 + 20 + /* EXT_MAN_ELEM_PLATFORM_CONFIG_DATA elements identificators */ 21 + enum sof_cavs_config_elem_type { 22 + SOF_EXT_MAN_CAVS_CONFIG_EMPTY = 0, 23 + SOF_EXT_MAN_CAVS_CONFIG_CAVS_LPRO = 1, 24 + }; 25 + 26 + /* EXT_MAN_ELEM_PLATFORM_CONFIG_DATA elements */ 27 + struct sof_ext_man_cavs_config_data { 28 + struct sof_ext_man_elem_header hdr; 29 + 30 + struct sof_config_elem elems[]; 31 + } __packed; 32 + 33 + #endif /* __INTEL_CAVS_EXT_MANIFEST_H__ */
+35
sound/soc/sof/intel/hda-loader.c
··· 19 19 #include <sound/hdaudio_ext.h> 20 20 #include <sound/hda_register.h> 21 21 #include <sound/sof.h> 22 + #include "ext_manifest.h" 22 23 #include "../ops.h" 23 24 #include "hda.h" 24 25 ··· 470 469 471 470 /* re-enable clock gating and power gating */ 472 471 return hda_dsp_ctrl_clock_power_gating(sdev, true); 472 + } 473 + 474 + int hda_dsp_ext_man_get_cavs_config_data(struct snd_sof_dev *sdev, 475 + const struct sof_ext_man_elem_header *hdr) 476 + { 477 + const struct sof_ext_man_cavs_config_data *config_data = 478 + container_of(hdr, struct sof_ext_man_cavs_config_data, hdr); 479 + struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; 480 + int i, elem_num; 481 + 482 + /* calculate total number of config data elements */ 483 + elem_num = (hdr->size - sizeof(struct sof_ext_man_elem_header)) 484 + / sizeof(struct sof_config_elem); 485 + if (elem_num <= 0) { 486 + dev_err(sdev->dev, "cavs config data is inconsistent: %d\n", elem_num); 487 + return -EINVAL; 488 + } 489 + 490 + for (i = 0; i < elem_num; i++) 491 + switch (config_data->elems[i].token) { 492 + case SOF_EXT_MAN_CAVS_CONFIG_EMPTY: 493 + /* skip empty token */ 494 + break; 495 + case SOF_EXT_MAN_CAVS_CONFIG_CAVS_LPRO: 496 + hda->clk_config_lpro = config_data->elems[i].value; 497 + dev_dbg(sdev->dev, "FW clock config: %s\n", 498 + hda->clk_config_lpro ? "LPRO" : "HPRO"); 499 + break; 500 + default: 501 + dev_warn(sdev->dev, "unsupported token type: %d\n", 502 + config_data->elems[i].token); 503 + } 504 + 505 + return 0; 473 506 }
+7
sound/soc/sof/intel/hda.h
··· 447 447 448 448 /* sdw context allocated by SoundWire driver */ 449 449 struct sdw_intel_ctx *sdw; 450 + 451 + /* FW clock config, 0:HPRO, 1:LPRO */ 452 + bool clk_config_lpro; 450 453 }; 451 454 452 455 static inline struct hdac_bus *sof_to_bus(struct snd_sof_dev *s) ··· 620 617 /* pre and post fw run ops */ 621 618 int hda_dsp_pre_fw_run(struct snd_sof_dev *sdev); 622 619 int hda_dsp_post_fw_run(struct snd_sof_dev *sdev); 620 + 621 + /* parse platform specific ext manifest ops */ 622 + int hda_dsp_ext_man_get_cavs_config_data(struct snd_sof_dev *sdev, 623 + const struct sof_ext_man_elem_header *hdr); 623 624 624 625 /* 625 626 * HDA Controller Operations.
+3
sound/soc/sof/intel/tgl.c
··· 84 84 .pre_fw_run = hda_dsp_pre_fw_run, 85 85 .post_fw_run = hda_dsp_post_fw_run, 86 86 87 + /* parse platform specific extended manifest */ 88 + .parse_platform_ext_manifest = hda_dsp_ext_man_get_cavs_config_data, 89 + 87 90 /* dsp core power up/down */ 88 91 .core_power_up = hda_dsp_enable_core, 89 92 .core_power_down = hda_dsp_core_reset_power_down,