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

ALSA/ASoC/SoundWire: Intel: update maximum number

Merge series from Bard Liao <yung-chuan.liao@linux.intel.com>:

Intel new platforms can have up to 5 SoundWire links.
This series does not apply to SoundWire tree due to recent changes in
machine driver. Can we go via ASoC tree with Vinod's Acked-by tag?

+57 -7
+7
drivers/soundwire/intel.h
··· 222 222 return false; 223 223 } 224 224 225 + static inline int sdw_intel_get_link_count(struct sdw_intel *sdw) 226 + { 227 + if (SDW_INTEL_CHECK_OPS(sdw, get_link_count)) 228 + return SDW_INTEL_OPS(sdw, get_link_count)(sdw); 229 + return 4; /* default on older generations */ 230 + } 231 + 225 232 /* common bus management */ 226 233 int intel_start_bus(struct sdw_intel *sdw); 227 234 int intel_start_bus_after_reset(struct sdw_intel *sdw);
+20
drivers/soundwire/intel_ace2x.c
··· 706 706 __func__, sdw->instance, dev_num); 707 707 } 708 708 709 + static int intel_get_link_count(struct sdw_intel *sdw) 710 + { 711 + int ret; 712 + 713 + ret = hdac_bus_eml_get_count(sdw->link_res->hbus, true, AZX_REG_ML_LEPTR_ID_SDW); 714 + if (!ret) { 715 + dev_err(sdw->cdns.dev, "%s: could not retrieve link count\n", __func__); 716 + return -ENODEV; 717 + } 718 + 719 + if (ret > SDW_INTEL_MAX_LINKS) { 720 + dev_err(sdw->cdns.dev, "%s: link count %d exceed max %d\n", __func__, ret, SDW_INTEL_MAX_LINKS); 721 + return -EINVAL; 722 + } 723 + 724 + return ret; 725 + } 726 + 709 727 const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops = { 710 728 .debugfs_init = intel_ace2x_debugfs_init, 711 729 .debugfs_exit = intel_ace2x_debugfs_exit, 730 + 731 + .get_link_count = intel_get_link_count, 712 732 713 733 .register_dai = intel_register_dai, 714 734
+14
drivers/soundwire/intel_auxdevice.c
··· 317 317 bus->link_id = auxdev->id; 318 318 bus->clk_stop_timeout = 1; 319 319 320 + /* 321 + * paranoia check: make sure ACPI-reported number of links is aligned with 322 + * hardware capabilities. 323 + */ 324 + ret = sdw_intel_get_link_count(sdw); 325 + if (ret < 0) { 326 + dev_err(dev, "%s: sdw_intel_get_link_count failed: %d\n", __func__, ret); 327 + return ret; 328 + } 329 + if (ret <= sdw->instance) { 330 + dev_err(dev, "%s: invalid link id %d, link count %d\n", __func__, auxdev->id, ret); 331 + return -EINVAL; 332 + } 333 + 320 334 sdw_cdns_probe(cdns); 321 335 322 336 /* Set ops */
+8
include/linux/soundwire/sdw_intel.h
··· 388 388 /* struct intel_sdw_hw_ops - SoundWire ops for Intel platforms. 389 389 * @debugfs_init: initialize all debugfs capabilities 390 390 * @debugfs_exit: close and cleanup debugfs capabilities 391 + * @get_link_count: fetch link count from hardware registers 391 392 * @register_dai: read all PDI information and register DAIs 392 393 * @check_clock_stop: throw error message if clock is not stopped. 393 394 * @start_bus: normal start ··· 412 411 struct sdw_intel_hw_ops { 413 412 void (*debugfs_init)(struct sdw_intel *sdw); 414 413 void (*debugfs_exit)(struct sdw_intel *sdw); 414 + 415 + int (*get_link_count)(struct sdw_intel *sdw); 415 416 416 417 int (*register_dai)(struct sdw_intel *sdw); 417 418 ··· 449 446 */ 450 447 451 448 #define SDW_INTEL_DEV_NUM_IDA_MIN 6 449 + 450 + /* 451 + * Max number of links supported in hardware 452 + */ 453 + #define SDW_INTEL_MAX_LINKS 5 452 454 453 455 #endif
+2 -3
sound/hda/intel-sdw-acpi.c
··· 17 17 #include <linux/string.h> 18 18 19 19 #define SDW_LINK_TYPE 4 /* from Intel ACPI documentation */ 20 - #define SDW_MAX_LINKS 4 21 20 22 21 static int ctrl_link_mask; 23 22 module_param_named(sdw_link_mask, ctrl_link_mask, int, 0444); ··· 86 87 } 87 88 88 89 /* Check count is within bounds */ 89 - if (count > SDW_MAX_LINKS) { 90 + if (count > SDW_INTEL_MAX_LINKS) { 90 91 dev_err(&adev->dev, "Link count %d exceeds max %d\n", 91 - count, SDW_MAX_LINKS); 92 + count, SDW_INTEL_MAX_LINKS); 92 93 return -EINVAL; 93 94 } 94 95
+3 -1
sound/soc/intel/boards/sof_sdw.c
··· 5 5 * sof_sdw - ASOC Machine driver for Intel SoundWire platforms 6 6 */ 7 7 8 + #include <linux/acpi.h> 8 9 #include <linux/bitmap.h> 9 10 #include <linux/device.h> 10 11 #include <linux/dmi.h> 11 12 #include <linux/module.h> 12 13 #include <linux/soundwire/sdw.h> 13 14 #include <linux/soundwire/sdw_type.h> 15 + #include <linux/soundwire/sdw_intel.h> 14 16 #include <sound/soc-acpi.h> 15 17 #include "sof_sdw_common.h" 16 18 #include "../../codecs/rt711.h" ··· 885 883 struct intel_mc_ctx *intel_ctx = (struct intel_mc_ctx *)ctx->private; 886 884 int ret, i; 887 885 888 - for (i = 0; i < SDW_MAX_LINKS; i++) 886 + for (i = 0; i < SDW_INTEL_MAX_LINKS; i++) 889 887 intel_ctx->sdw_pin_index[i] = SOC_SDW_INTEL_BIDIR_PDI_BASE; 890 888 891 889 /* generate DAI links by each sdw link */
+1 -3
sound/soc/intel/boards/sof_sdw_common.h
··· 19 19 #define SOC_SDW_MAX_CPU_DAIS 16 20 20 #define SOC_SDW_INTEL_BIDIR_PDI_BASE 2 21 21 22 - #define SDW_MAX_LINKS 4 23 - 24 22 /* 8 combinations with 4 links + unused group 0 */ 25 23 #define SDW_MAX_GROUPS 9 26 24 ··· 55 57 struct intel_mc_ctx { 56 58 struct sof_hdmi_private hdmi; 57 59 /* To store SDW Pin index for each SoundWire link */ 58 - unsigned int sdw_pin_index[SDW_MAX_LINKS]; 60 + unsigned int sdw_pin_index[SDW_INTEL_MAX_LINKS]; 59 61 }; 60 62 61 63 extern unsigned long sof_sdw_quirk;
+2
sound/soc/intel/boards/sof_sdw_hdmi.c
··· 5 5 * sof_sdw_hdmi - Helpers to handle HDMI from generic machine driver 6 6 */ 7 7 8 + #include <linux/acpi.h> 8 9 #include <linux/device.h> 9 10 #include <linux/errno.h> 10 11 #include <linux/kernel.h> 11 12 #include <linux/list.h> 13 + #include <linux/soundwire/sdw_intel.h> 12 14 #include <sound/soc.h> 13 15 #include <sound/soc-acpi.h> 14 16 #include <sound/jack.h>