Alsa-devel
Threads by month
- ----- 2025 -----
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
February 2024
- 114 participants
- 185 discussions

[PATCH] ASoC: cs35l56: Must clear HALO_STATE before issuing SYSTEM_RESET
by Richard Fitzgerald 21 Feb '24
by Richard Fitzgerald 21 Feb '24
21 Feb '24
The driver must write 0 to HALO_STATE before sending the SYSTEM_RESET
command to the firmware.
HALO_STATE is in DSP memory, which is preserved across a soft reset.
The SYSTEM_RESET command does not change the value of HALO_STATE.
There is period of time while the CS35L56 is resetting, before the
firmware has started to boot, where a read of HALO_STATE will return
the value it had before the SYSTEM_RESET. If the driver does not
clear HALO_STATE, this would return BOOT_DONE status even though the
firmware has not booted.
Signed-off-by: Richard Fitzgerald <rf(a)opensource.cirrus.com>
Fixes: 8a731fd37f8b ("ASoC: cs35l56: Move utility functions to shared file")
---
sound/soc/codecs/cs35l56-shared.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c
index 995d979b6d87..cb4e83126b08 100644
--- a/sound/soc/codecs/cs35l56-shared.c
+++ b/sound/soc/codecs/cs35l56-shared.c
@@ -335,6 +335,7 @@ void cs35l56_wait_min_reset_pulse(void)
EXPORT_SYMBOL_NS_GPL(cs35l56_wait_min_reset_pulse, SND_SOC_CS35L56_SHARED);
static const struct reg_sequence cs35l56_system_reset_seq[] = {
+ REG_SEQ0(CS35L56_DSP1_HALO_STATE, 0),
REG_SEQ0(CS35L56_DSP_VIRTUAL1_MBOX_1, CS35L56_MBOX_CMD_SYSTEM_RESET),
};
--
2.30.2
2
1

21 Feb '24
This patch will remove redundant delay and minimise
total suspend() function call time.
Signed-off-by: Vitaly Rodionov <vitalyr(a)opensource.cirrus.com>
---
include/sound/cs42l42.h | 5 ++---
sound/soc/codecs/cs42l42.c | 1 -
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/include/sound/cs42l42.h b/include/sound/cs42l42.h
index 3994e933db19..1bd8eee54f66 100644
--- a/include/sound/cs42l42.h
+++ b/include/sound/cs42l42.h
@@ -809,8 +809,7 @@
#define CS42L42_PLL_LOCK_TIMEOUT_US 1250
#define CS42L42_HP_ADC_EN_TIME_US 20000
#define CS42L42_PDN_DONE_POLL_US 1000
-#define CS42L42_PDN_DONE_TIMEOUT_US 200000
-#define CS42L42_PDN_DONE_TIME_MS 100
-#define CS42L42_FILT_DISCHARGE_TIME_MS 46
+#define CS42L42_PDN_DONE_TIMEOUT_US 235000
+#define CS42L42_PDN_DONE_TIME_MS 65
#endif /* __CS42L42_H */
diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c
index 2d11c5125f73..60d366e53526 100644
--- a/sound/soc/codecs/cs42l42.c
+++ b/sound/soc/codecs/cs42l42.c
@@ -2195,7 +2195,6 @@ int cs42l42_suspend(struct device *dev)
/* Discharge FILT+ */
regmap_update_bits(cs42l42->regmap, CS42L42_PWR_CTL2,
CS42L42_DISCHARGE_FILT_MASK, CS42L42_DISCHARGE_FILT_MASK);
- msleep(CS42L42_FILT_DISCHARGE_TIME_MS);
regcache_cache_only(cs42l42->regmap, true);
gpiod_set_value_cansleep(cs42l42->reset_gpio, 0);
--
2.40.1
2
1

[PATCH 1/5] ASoC: amd: ps: refactor acp device configuration read logic
by Vijendar Mukunda 21 Feb '24
by Vijendar Mukunda 21 Feb '24
21 Feb '24
Refactor acp device configuration read logic and use common function
to scan SoundWire devices.
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda(a)amd.com>
---
sound/soc/amd/Kconfig | 17 ++++
sound/soc/amd/ps/acp63.h | 11 +++
sound/soc/amd/ps/pci-ps.c | 176 +++++++++++---------------------------
3 files changed, 78 insertions(+), 126 deletions(-)
diff --git a/sound/soc/amd/Kconfig b/sound/soc/amd/Kconfig
index 273688c05317..fa74635cee08 100644
--- a/sound/soc/amd/Kconfig
+++ b/sound/soc/amd/Kconfig
@@ -132,9 +132,26 @@ config SND_SOC_AMD_RPL_ACP6x
Say m if you have such a device.
If unsure select "N".
+config SND_SOC_AMD_SOUNDWIRE_LINK_BASELINE
+ tristate
+ select SOUNDWIRE_AMD if SND_SOC_AMD_SOUNDWIRE != n
+ select SND_AMD_SOUNDWIRE_ACPI if ACPI
+
+config SND_SOC_AMD_SOUNDWIRE
+ tristate "Support for SoundWire based AMD platforms"
+ default SND_SOC_AMD_SOUNDWIRE_LINK_BASELINE
+ depends on SND_SOC_AMD_SOUNDWIRE_LINK_BASELINE
+ depends on ACPI && SOUNDWIRE
+ depends on !(SOUNDWIRE=m && SND_SOC_AMD_SOUNDWIRE_LINK_BASELINE=y)
+ help
+ This adds support for SoundWire for AMD platforms.
+ Say Y if you want to enable SoundWire links with SOF.
+ If unsure select "N".
+
config SND_SOC_AMD_PS
tristate "AMD Audio Coprocessor-v6.3 Pink Sardine support"
select SND_AMD_ACP_CONFIG
+ select SND_SOC_AMD_SOUNDWIRE_LINK_BASELINE
depends on X86 && PCI && ACPI
help
This option enables Audio Coprocessor i.e ACP v6.3 support on
diff --git a/sound/soc/amd/ps/acp63.h b/sound/soc/amd/ps/acp63.h
index 8b853b8d0219..123b9ade69d4 100644
--- a/sound/soc/amd/ps/acp63.h
+++ b/sound/soc/amd/ps/acp63.h
@@ -5,6 +5,7 @@
* Copyright (C) 2022, 2023 Advanced Micro Devices, Inc. All rights reserved.
*/
+#include <linux/soundwire/sdw_amd.h>
#include <sound/acp63_chip_offset_byte.h>
#define ACP_DEVICE_ID 0x15E2
@@ -263,6 +264,11 @@ struct sdw_dma_ring_buf_reg {
* @sdw0_dev_index: SoundWire Manager-0 platform device index
* @sdw1_dev_index: SoundWire Manager-1 platform device index
* @sdw_dma_dev_index: SoundWire DMA controller platform device index
+ * @info: SoundWire AMD information found in ACPI tables
+ * @is_sdw_dev: flag set to true when any SoundWire manager instances are available
+ * @is_pdm_dev: flag set to true when ACP PDM controller exists
+ * @is_pdm_config: flat set to true when PDM configuration is selected from BIOS
+ * @is_sdw_config: flag set to true when SDW configuration is selected from BIOS
* @sdw0-dma_intr_stat: DMA interrupt status array for SoundWire manager-SW0 instance
* @sdw_dma_intr_stat: DMA interrupt status array for SoundWire manager-SW1 instance
* @acp_reset: flag set to true when bus reset is applied across all
@@ -282,6 +288,11 @@ struct acp63_dev_data {
u16 sdw0_dev_index;
u16 sdw1_dev_index;
u16 sdw_dma_dev_index;
+ struct sdw_amd_acpi_info info;
+ bool is_sdw_dev;
+ bool is_pdm_dev;
+ bool is_pdm_config;
+ bool is_sdw_config;
u16 sdw0_dma_intr_stat[ACP63_SDW0_DMA_MAX_STREAMS];
u16 sdw1_dma_intr_stat[ACP63_SDW1_DMA_MAX_STREAMS];
bool acp_reset;
diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c
index 5927eef04170..c97e418a88ce 100644
--- a/sound/soc/amd/ps/pci-ps.c
+++ b/sound/soc/amd/ps/pci-ps.c
@@ -237,122 +237,51 @@ static irqreturn_t acp63_irq_handler(int irq, void *dev_id)
return IRQ_NONE;
}
-static int sdw_amd_scan_controller(struct device *dev)
+#if IS_ENABLED(CONFIG_SND_SOC_AMD_SOUNDWIRE)
+static int acp_scan_sdw_devices(struct device *dev, u64 addr)
{
+ struct acpi_device *sdw_dev;
struct acp63_dev_data *acp_data;
- struct fwnode_handle *link;
- char name[32];
- u32 sdw_manager_bitmap;
- u8 count = 0;
- u32 acp_sdw_power_mode = 0;
- int index;
- int ret;
acp_data = dev_get_drvdata(dev);
- /*
- * Current implementation is based on MIPI DisCo 2.0 spec.
- * Found controller, find links supported.
- */
- ret = fwnode_property_read_u32_array((acp_data->sdw_fw_node), "mipi-sdw-manager-list",
- &sdw_manager_bitmap, 1);
-
- if (ret) {
- dev_dbg(dev, "Failed to read mipi-sdw-manager-list: %d\n", ret);
- return -EINVAL;
- }
- count = hweight32(sdw_manager_bitmap);
- /* Check count is within bounds */
- if (count > AMD_SDW_MAX_MANAGERS) {
- dev_err(dev, "Manager count %d exceeds max %d\n", count, AMD_SDW_MAX_MANAGERS);
- return -EINVAL;
- }
+ if (!addr)
+ return -ENODEV;
- if (!count) {
- dev_dbg(dev, "No SoundWire Managers detected\n");
- return -EINVAL;
- }
- dev_dbg(dev, "ACPI reports %d SoundWire Manager devices\n", count);
- acp_data->sdw_manager_count = count;
- for (index = 0; index < count; index++) {
- scnprintf(name, sizeof(name), "mipi-sdw-link-%d-subproperties", index);
- link = fwnode_get_named_child_node(acp_data->sdw_fw_node, name);
- if (!link) {
- dev_err(dev, "Manager node %s not found\n", name);
- return -EIO;
- }
+ sdw_dev = acpi_find_child_device(ACPI_COMPANION(dev), addr, 0);
+ if (!sdw_dev)
+ return -ENODEV;
- ret = fwnode_property_read_u32(link, "amd-sdw-power-mode", &acp_sdw_power_mode);
- if (ret)
- return ret;
- /*
- * when SoundWire configuration is selected from acp pin config,
- * based on manager instances count, acp init/de-init sequence should be
- * executed as part of PM ops only when Bus reset is applied for the active
- * SoundWire manager instances.
- */
- if (acp_sdw_power_mode != AMD_SDW_POWER_OFF_MODE) {
- acp_data->acp_reset = false;
- return 0;
- }
- }
+ acp_data->info.handle = sdw_dev->handle;
+ acp_data->info.count = AMD_SDW_MAX_MANAGERS;
+ return amd_sdw_scan_controller(&acp_data->info);
+}
+#else
+static int acp_scan_sdw_devices(struct device *dev, u64 addr)
+{
return 0;
}
+#endif
-static int get_acp63_device_config(u32 config, struct pci_dev *pci, struct acp63_dev_data *acp_data)
+static int get_acp63_device_config(struct pci_dev *pci, struct acp63_dev_data *acp_data)
{
- struct acpi_device *dmic_dev;
- struct acpi_device *sdw_dev;
+ struct acpi_device *pdm_dev;
const union acpi_object *obj;
+ u32 config;
bool is_dmic_dev = false;
bool is_sdw_dev = false;
int ret;
- dmic_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), ACP63_DMIC_ADDR, 0);
- if (dmic_dev) {
- /* is_dmic_dev flag will be set when ACP PDM controller device exists */
- if (!acpi_dev_get_property(dmic_dev, "acp-audio-device-type",
- ACPI_TYPE_INTEGER, &obj) &&
- obj->integer.value == ACP_DMIC_DEV)
- is_dmic_dev = true;
- }
-
- sdw_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), ACP63_SDW_ADDR, 0);
- if (sdw_dev) {
- acp_data->sdw_fw_node = acpi_fwnode_handle(sdw_dev);
- ret = sdw_amd_scan_controller(&pci->dev);
- /* is_sdw_dev flag will be set when SoundWire Manager device exists */
- if (!ret)
- is_sdw_dev = true;
- }
- if (!is_dmic_dev && !is_sdw_dev)
- return -ENODEV;
- dev_dbg(&pci->dev, "Audio Mode %d\n", config);
+ config = readl(acp_data->acp63_base + ACP_PIN_CONFIG);
switch (config) {
case ACP_CONFIG_4:
case ACP_CONFIG_5:
case ACP_CONFIG_10:
case ACP_CONFIG_11:
- if (is_dmic_dev) {
- acp_data->pdev_config = ACP63_PDM_DEV_CONFIG;
- acp_data->pdev_count = ACP63_PDM_MODE_DEVS;
- }
+ acp_data->is_pdm_config = true;
break;
case ACP_CONFIG_2:
case ACP_CONFIG_3:
- if (is_sdw_dev) {
- switch (acp_data->sdw_manager_count) {
- case 1:
- acp_data->pdev_config = ACP63_SDW_DEV_CONFIG;
- acp_data->pdev_count = ACP63_SDW0_MODE_DEVS;
- break;
- case 2:
- acp_data->pdev_config = ACP63_SDW_DEV_CONFIG;
- acp_data->pdev_count = ACP63_SDW0_SDW1_MODE_DEVS;
- break;
- default:
- return -EINVAL;
- }
- }
+ acp_data->is_sdw_config = true;
break;
case ACP_CONFIG_6:
case ACP_CONFIG_7:
@@ -360,40 +289,36 @@ static int get_acp63_device_config(u32 config, struct pci_dev *pci, struct acp63
case ACP_CONFIG_8:
case ACP_CONFIG_13:
case ACP_CONFIG_14:
- if (is_dmic_dev && is_sdw_dev) {
- switch (acp_data->sdw_manager_count) {
- case 1:
- acp_data->pdev_config = ACP63_SDW_PDM_DEV_CONFIG;
- acp_data->pdev_count = ACP63_SDW0_PDM_MODE_DEVS;
- break;
- case 2:
- acp_data->pdev_config = ACP63_SDW_PDM_DEV_CONFIG;
- acp_data->pdev_count = ACP63_SDW0_SDW1_PDM_MODE_DEVS;
- break;
- default:
- return -EINVAL;
- }
- } else if (is_dmic_dev) {
- acp_data->pdev_config = ACP63_PDM_DEV_CONFIG;
- acp_data->pdev_count = ACP63_PDM_MODE_DEVS;
- } else if (is_sdw_dev) {
- switch (acp_data->sdw_manager_count) {
- case 1:
- acp_data->pdev_config = ACP63_SDW_DEV_CONFIG;
- acp_data->pdev_count = ACP63_SDW0_MODE_DEVS;
- break;
- case 2:
- acp_data->pdev_config = ACP63_SDW_DEV_CONFIG;
- acp_data->pdev_count = ACP63_SDW0_SDW1_MODE_DEVS;
- break;
- default:
- return -EINVAL;
- }
- }
+ acp_data->is_pdm_config = true;
+ acp_data->is_sdw_config = true;
break;
default:
break;
}
+
+ if (acp_data->is_pdm_config) {
+ pdm_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), ACP63_DMIC_ADDR, 0);
+ if (pdm_dev) {
+ /* is_dmic_dev flag will be set when ACP PDM controller device exists */
+ if (!acpi_dev_get_property(pdm_dev, "acp-audio-device-type",
+ ACPI_TYPE_INTEGER, &obj) &&
+ obj->integer.value == ACP_DMIC_DEV)
+ is_dmic_dev = true;
+ }
+ }
+
+ if (acp_data->is_sdw_config) {
+ ret = acp_scan_sdw_devices(&pci->dev, ACP63_SDW_ADDR);
+ if (!ret && acp_data->info.link_mask)
+ is_sdw_dev = true;
+ }
+
+ acp_data->is_pdm_dev = is_dmic_dev;
+ acp_data->is_sdw_dev = is_sdw_dev;
+ if (!is_dmic_dev && !is_sdw_dev) {
+ dev_dbg(&pci->dev, "No PDM or SoundWire manager devices found\n");
+ return -ENODEV;
+ }
return 0;
}
@@ -576,7 +501,6 @@ static int snd_acp63_probe(struct pci_dev *pci,
struct acp63_dev_data *adata;
u32 addr;
u32 irqflags, flag;
- int val;
int ret;
irqflags = IRQF_SHARED;
@@ -637,8 +561,7 @@ static int snd_acp63_probe(struct pci_dev *pci,
dev_err(&pci->dev, "ACP PCI IRQ request failed\n");
goto de_init;
}
- val = readl(adata->acp63_base + ACP_PIN_CONFIG);
- ret = get_acp63_device_config(val, pci, adata);
+ ret = get_acp63_device_config(pci, adata);
/* ACP PCI driver probe should be continued even PDM or SoundWire Devices are not found */
if (ret) {
dev_dbg(&pci->dev, "get acp device config failed:%d\n", ret);
@@ -740,4 +663,5 @@ module_pci_driver(ps_acp63_driver);
MODULE_AUTHOR("Vijendar.Mukunda(a)amd.com");
MODULE_AUTHOR("Syed.SabaKareem(a)amd.com");
MODULE_DESCRIPTION("AMD ACP Pink Sardine PCI driver");
+MODULE_IMPORT_NS(SND_AMD_SOUNDWIRE_ACPI);
MODULE_LICENSE("GPL v2");
--
2.34.1
2
5
The tas2783 is a smart audio amplifier with integrated MIPI SoundWire
interface (Version 1.2.1 compliant), I2C, and I2S/TDM interfaces designed
for portable applications. An on-chip DSP supports Texas Instruments
SmartAmp speaker protection algorithm. The integrated speaker voltage and
current sense provides for real-time monitoring of lodspeakers.
The ASoC component provides the majority of the functionality of the
device, all the audio functions.
Signed-off-by: Shenghao Ding <shenghao-ding(a)ti.com>
---
Change in v8:
- simplify tasdevice_set_sdw_stream
- fixed some Linux coding style
- fixed the spelling mistakes
- Select left/right channel based on unique id
- a longer description has been added
- remove unused crc8 in KCONFIG
- Invert of RE here means reciprocal of RE
- correct indentation
- correct the wrong pow calibrated register
- correct comment on RESET register
- fixed usually lines don't end with an open parenthesis
- fixed tasdevice_sdw_shutdown
- use defines for function, entity, etc. for readable
- remove unnecessary codec_lock in component_probe()
- remove struct sdw_stream_data
- remove unused macro definitions
- use BIT(2) and BIT(1) instead of 0x2 and 0x1
- implement pm_runtime
- reg_start is u8, reg_start + i only adds i byte, it should be
reg_start + i * 4, because the calibration values
- fixed total_sz in tas2783_calibration
- add a define for TASDEVICE_REG(0, 0, 0x0a)
- rework macro style in header file
- Add select CRC32
- rewrite the mute and the return value handling
- Add comments on bin file
- Add link_id into the fw name to distinguish the same sdw id on different
sdw id.
- remove unnecessary mutex_lock
- use set_active() in tasdevice_io_init and move all other parts in the
probe.
- move pm_runtime_get_noresume to the probe
- fix the return value of putvol function
- add put_noidle in tasdevice_sdw_remove
- remove unused header file(of.h)
- correct the style of the multi-line comment
- Set the readable registers in tas2783_readable_register for debugfs
- Use new PM macros
- Use default put and get inline SOC_SINGLE_RANGE_TLV and
SOC_SINGLE_SX_TLV
- Use respective %pt to log the calibrated time
- Remove unnecessary struct tm
- Add trailing comma tasdevice_dapm_widgets and tasdevice_audio_map
- Rewrite the return value handling in tasdevice_sdw_probe
- use dev_num instead of id.unique_id
- rework the log
---
sound/soc/codecs/Kconfig | 16 +
sound/soc/codecs/Makefile | 2 +
sound/soc/codecs/tas2783-sdw.c | 844 +++++++++++++++++++++++++++++++++
sound/soc/codecs/tas2783.h | 103 ++++
4 files changed, 965 insertions(+)
create mode 100644 sound/soc/codecs/tas2783-sdw.c
create mode 100644 sound/soc/codecs/tas2783.h
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 59f9742e9ff4..6ba3fd0c0811 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -247,6 +247,7 @@ config SND_SOC_ALL_CODECS
imply SND_SOC_TAS2781_COMLIB
imply SND_SOC_TAS2781_FMWLIB
imply SND_SOC_TAS2781_I2C
+ imply SND_SOC_TAS2783
imply SND_SOC_TAS5086
imply SND_SOC_TAS571X
imply SND_SOC_TAS5720
@@ -1847,6 +1848,21 @@ config SND_SOC_TAS2781_I2C
algo coefficient setting, for one, two or even multiple TAS2781
chips.
+config SND_SOC_TAS2783
+ tristate "Texas Instruments TAS2783 speaker amplifier (sdw)"
+ depends on SOUNDWIRE
+ depends on EFI
+ select REGMAP
+ select REGMAP_SOUNDWIRE
+ select CRC32
+ select CRC32_SARWATE
+ help
+ Enable support for Texas Instruments TAS2783 Smart Amplifier
+ Digital input mono Class-D and DSP-inside audio power amplifiers.
+ TAS2783 supports the MIPI SoundWire v1.2 compatible interface
+ for audio and control data. At the end of calibrated data appends
+ the crc data with crc32_sarwate for error detection.
+
config SND_SOC_TAS5086
tristate "Texas Instruments TAS5086 speaker amplifier"
depends on I2C
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index f53baa2b9565..6afceb126ae3 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -284,6 +284,7 @@ snd-soc-tas2770-objs := tas2770.o
snd-soc-tas2781-comlib-objs := tas2781-comlib.o
snd-soc-tas2781-fmwlib-objs := tas2781-fmwlib.o
snd-soc-tas2781-i2c-objs := tas2781-i2c.o
+snd-soc-tas2783-objs := tas2783-sdw.o
snd-soc-tfa9879-objs := tfa9879.o
snd-soc-tfa989x-objs := tfa989x.o
snd-soc-tlv320adc3xxx-objs := tlv320adc3xxx.o
@@ -664,6 +665,7 @@ obj-$(CONFIG_SND_SOC_TAS2780) += snd-soc-tas2780.o
obj-$(CONFIG_SND_SOC_TAS2781_COMLIB) += snd-soc-tas2781-comlib.o
obj-$(CONFIG_SND_SOC_TAS2781_FMWLIB) += snd-soc-tas2781-fmwlib.o
obj-$(CONFIG_SND_SOC_TAS2781_I2C) += snd-soc-tas2781-i2c.o
+obj-$(CONFIG_SND_SOC_TAS2783) += snd-soc-tas2783.o
obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o
obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o
obj-$(CONFIG_SND_SOC_TAS5720) += snd-soc-tas5720.o
diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c
new file mode 100644
index 000000000000..ebb7102828c5
--- /dev/null
+++ b/sound/soc/codecs/tas2783-sdw.c
@@ -0,0 +1,844 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// ALSA SoC Texas Instruments TAS2783 Audio Smart Amplifier
+//
+// Copyright (C) 2023 - 2024 Texas Instruments Incorporated
+// https://www.ti.com
+//
+// Author: Baojun Xu <baojun.xu(a)ti.com>
+// Kevin Lu <kevin-lu(a)ti.com>
+// Shenghao Ding <shenghao-ding(a)ti.com>
+//
+
+#include <asm/unaligned.h>
+#include <linux/acpi.h>
+#include <linux/crc32.h>
+#include <linux/efi.h>
+#include <linux/err.h>
+#include <linux/firmware.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/pm.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/soundwire/sdw.h>
+#include <linux/soundwire/sdw_registers.h>
+#include <linux/soundwire/sdw_type.h>
+#include <sound/pcm_params.h>
+#include <sound/sdw.h>
+#include <sound/soc.h>
+#include <sound/tlv.h>
+
+#include <sound/tas2781-tlv.h>
+#include "tas2783.h"
+
+static const unsigned int tas2783_cali_reg[] = {
+ TAS2783_CALIBRATION_RE, /* Resistance */
+ TAS2783_CALIBRATION_RE_LOW, /* Low limitation of RE */
+ TAS2783_CALIBRATION_INV_RE, /* Reciprocal of RE */
+ TAS2783_CALIBRATION_POW, /* RMS Power */
+ TAS2783_CALIBRATION_TLIMIT /* Temperature limitation */
+};
+
+static const struct reg_default tas2783_reg_defaults[] = {
+ /* Default values for ROM mode. Activated. */
+ { 0x8002, 0x1a }, /* AMP inactive. */
+ { 0x8097, 0xc8 },
+ { 0x80b5, 0x74 },
+ { 0x8099, 0x20 },
+ { 0xfe8d, 0x0d },
+ { 0xfebe, 0x4a },
+ { 0x8230, 0x00 },
+ { 0x8231, 0x00 },
+ { 0x8232, 0x00 },
+ { 0x8233, 0x01 },
+ { 0x8418, 0x00 }, /* Set volume to 0 dB. */
+ { 0x8419, 0x00 },
+ { 0x841a, 0x00 },
+ { 0x841b, 0x00 },
+ { 0x8428, 0x40 }, /* Unmute channel */
+ { 0x8429, 0x00 },
+ { 0x842a, 0x00 },
+ { 0x842b, 0x00 },
+ { 0x8548, 0x00 }, /* Set volume to 0 dB. */
+ { 0x8549, 0x00 },
+ { 0x854a, 0x00 },
+ { 0x854b, 0x00 },
+ { 0x8558, 0x40 }, /* Unmute channel */
+ { 0x8559, 0x00 },
+ { 0x855a, 0x00 },
+ { 0x855b, 0x00 },
+ { 0x800a, 0x3a }, /* Enable both channel */
+ { 0x800e, 0x44 },
+ { 0x800f, 0x40 },
+ { 0x805c, 0x99 },
+ { SDW_SDCA_CTL(TAS2783_FUNC_TYPE_SMART_AMP, TAS2783_SDCA_ENT_FU21,
+ TAS2783_SDCA_CTL_FU_MUTE, 0), 0 },
+ { SDW_SDCA_CTL(TAS2783_FUNC_TYPE_SMART_AMP, TAS2783_SDCA_ENT_FU21,
+ TAS2783_SDCA_CTL_FU_VOLUME, 0), 0 },
+ { SDW_SDCA_CTL(TAS2783_FUNC_TYPE_SMART_AMP, TAS2783_SDCA_ENT_FU23,
+ TAS2783_SDCA_CTL_FU_MUTE, 0), 0 },
+};
+
+static bool tas2783_readable_register(struct device *dev,
+ unsigned int reg)
+{
+ switch (reg) {
+ case 0x8000 ... 0x807F: /* Page 0 */
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool tas2783_volatile_register(struct device *dev,
+ unsigned int reg)
+{
+ switch (reg) {
+ /*
+ * Only software reset register was volatiled.
+ * Bit is self clearing.
+ * 0b = Don't reset
+ * 1b = reset
+ */
+ case 0x8001:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static const struct regmap_config tasdevice_regmap = {
+ .reg_bits = 32,
+ .val_bits = 8,
+ .readable_reg = tas2783_readable_register,
+ .volatile_reg = tas2783_volatile_register,
+ .max_register = 0x44ffffff,
+ .reg_defaults = tas2783_reg_defaults,
+ .num_reg_defaults = ARRAY_SIZE(tas2783_reg_defaults),
+ .cache_type = REGCACHE_RBTREE,
+ .use_single_read = true,
+ .use_single_write = true,
+};
+
+static const struct snd_kcontrol_new tas2783_snd_controls[] = {
+ SOC_SINGLE_RANGE_TLV("Digital Volume", TAS2783_DVC_LVL,
+ 0, 0, 200, 1, dvc_tlv),
+ SOC_SINGLE_SX_TLV("Amp Gain Volume", TAS2783_AMP_LEVEL,
+ 1, 0, 20, amp_vol_tlv),
+};
+
+static void tas2783_apply_calib(struct tasdevice_priv *tas_dev,
+ unsigned int *cali_data)
+{
+ struct regmap *map = tas_dev->regmap;
+ u8 *cali_start;
+ u16 dev_num;
+ int ret;
+
+ if (!tas_dev->sdw_peripheral) {
+ dev_err(tas_dev->dev, "%s: peripheral doesn't exist.\n",
+ __func__);
+ return;
+ }
+
+ dev_num = clamp(tas_dev->sdw_peripheral->dev_num, 1, 4) - 1;
+ /*
+ * The area saving tas2783 calibrated data is specified by its
+ * dev_num. cali_start is the first address of current tas2783's
+ * calibrated data.
+ */
+ cali_start = (u8 *)(cali_data + dev_num * sizeof(tas2783_cali_reg));
+ for (int i = 0; i < ARRAY_SIZE(tas2783_cali_reg); i++) {
+ ret = regmap_bulk_write(map, tas2783_cali_reg[i],
+ &cali_start[4 * i], 4);
+ if (ret) {
+ dev_err(tas_dev->dev, "Cali failed %x:%d\n",
+ tas2783_cali_reg[i], ret);
+ break;
+ }
+ }
+}
+
+/*
+ * Load the calibration data, including speaker impedance, f0, etc.
+ * Calibration is done by the manufacturer in the factory. The calibration
+ * data are used by the algorithm for calculating the speaker temperature,
+ * speaker membrane excursion and f0 in real time during playback.
+ * The DSP will work with default data values if calibrated data are
+ * missing or are invalid.
+ * Layout of calibrated Data in UEFI:
+ * Calibrated Data of Dev 0 (20 bytes)
+ * Calibrated Data of Dev 1 (20 bytes)
+ * Calibrated Data of Dev 2 (20 bytes)
+ * Calibrated Data of Dev 3 (20 bytes)
+ * CRC (4 bytes)
+ */
+static void tas2783_calibration(struct tasdevice_priv *tas_dev)
+{
+ efi_guid_t efi_guid = EFI_GUID(0x1f52d2a1, 0xbb3a, 0x457d, 0xbc,
+ 0x09, 0x43, 0xa3, 0xf4, 0x31, 0x0a, 0x92);
+ static efi_char16_t efi_name[] = L"CALI_DATA";
+ unsigned int attr = 0, crc;
+ unsigned int *tmp_val;
+ efi_status_t status;
+
+ tas_dev->cali_data.total_sz = 0;
+
+ status = efi.get_variable(efi_name, &efi_guid, &attr,
+ &tas_dev->cali_data.total_sz, tas_dev->cali_data.data);
+ if (status == EFI_BUFFER_TOO_SMALL) {
+ status = efi.get_variable(efi_name, &efi_guid, &attr,
+ &tas_dev->cali_data.total_sz,
+ tas_dev->cali_data.data);
+ dev_dbg(tas_dev->dev, "cali get %lx bytes result:%ld\n",
+ tas_dev->cali_data.total_sz, status);
+ }
+ if (status != 0) {
+ /* Failed got calibration data from EFI. */
+ dev_dbg(tas_dev->dev, "No calibration data in UEFI.");
+ return;
+ }
+
+ tmp_val = (unsigned int *)tas_dev->cali_data.data;
+
+ crc = crc32(~0, tas_dev->cali_data.data, 84) ^ ~0;
+
+ if (crc == tmp_val[21]) {
+ /* Date and time of when calibration was done. */
+ tas2783_apply_calib(tas_dev, tmp_val);
+ dev_dbg(tas_dev->dev, "%ptTs", &tmp_val[20]);
+ } else {
+ dev_dbg(tas_dev->dev, "CRC 0x%08x not match 0x%08x\n",
+ crc, tmp_val[21]);
+ tas_dev->cali_data.total_sz = 0;
+ }
+}
+
+static void tasdevice_dspfw_ready(const struct firmware *fmw,
+ void *context)
+{
+ struct tasdevice_priv *tas_dev =
+ (struct tasdevice_priv *) context;
+ struct tas2783_firmware_node *p;
+ struct regmap *map = tas_dev->regmap;
+ unsigned char *buf = NULL;
+ int offset = 0, img_sz;
+ int ret;
+
+ if (!fmw || !fmw->data) {
+ dev_warn(tas_dev->dev,
+ "%s: failed to read %s: work in bypass-dsp mode.\n",
+ __func__, tas_dev->dspfw_binaryname);
+ return;
+ }
+ buf = (unsigned char *)fmw->data;
+
+ img_sz = get_unaligned_le32(&buf[offset]);
+ offset += sizeof(img_sz);
+ if (img_sz != fmw->size) {
+ dev_warn(tas_dev->dev, "%s: size not matching, %d %u.",
+ __func__, (int)fmw->size, img_sz);
+ return;
+ }
+
+ while (offset < img_sz) {
+ p = (struct tas2783_firmware_node *)(buf + offset);
+ if (p->length > 1) {
+ ret = regmap_bulk_write(map, p->download_addr,
+ buf + offset + sizeof(unsigned int) * 5, p->length);
+ } else {
+ ret = regmap_write(map, p->download_addr,
+ *(buf + offset + sizeof(unsigned int) * 5));
+ }
+
+ if (ret != 0) {
+ dev_dbg(tas_dev->dev,
+ "%s: load FW fail: %d, work in bypass.\n",
+ __func__, ret);
+ return;
+ }
+ offset += sizeof(unsigned int) * 5 + p->length;
+ }
+
+ tas2783_calibration(tas_dev);
+}
+
+static const struct snd_soc_dapm_widget tasdevice_dapm_widgets[] = {
+ SND_SOC_DAPM_AIF_IN("ASI", "ASI Playback", 0, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_AIF_OUT("ASI OUT", "ASI Capture", 0, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_OUTPUT("OUT"),
+ SND_SOC_DAPM_INPUT("DMIC"),
+};
+
+static const struct snd_soc_dapm_route tasdevice_audio_map[] = {
+ {"OUT", NULL, "ASI"},
+ {"ASI OUT", NULL, "DMIC"},
+};
+
+static int tasdevice_set_sdw_stream(struct snd_soc_dai *dai,
+ void *sdw_stream, int direction)
+{
+ snd_soc_dai_dma_data_set(dai, direction, sdw_stream);
+
+ return 0;
+}
+
+static void tasdevice_sdw_shutdown(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ snd_soc_dai_set_dma_data(dai, substream, NULL);
+}
+
+static int tasdevice_sdw_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
+{
+ struct snd_soc_component *component = dai->component;
+ struct tasdevice_priv *tas_priv =
+ snd_soc_component_get_drvdata(component);
+ struct sdw_stream_config stream_config = {0};
+ struct sdw_port_config port_config = {0};
+ struct sdw_stream_runtime *sdw_stream;
+ int ret;
+
+ dev_dbg(dai->dev, "%s: dai_name %s", __func__, dai->name);
+ sdw_stream = snd_soc_dai_get_dma_data(dai, substream);
+
+ if (!sdw_stream)
+ return -EINVAL;
+
+ if (!tas_priv->sdw_peripheral)
+ return -EINVAL;
+
+ /* SoundWire specific configuration */
+ snd_sdw_params_to_config(substream, params,
+ &stream_config, &port_config);
+
+ /* port 1 for playback */
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ port_config.num = 1;
+ else
+ port_config.num = 2;
+
+ ret = sdw_stream_add_slave(tas_priv->sdw_peripheral,
+ &stream_config, &port_config, 1, sdw_stream);
+ if (ret) {
+ dev_err(dai->dev, "%s: Unable to configure port\n", __func__);
+ return ret;
+ }
+
+ dev_dbg(dai->dev, "%s: format: %i rate: %i\n", __func__,
+ params_format(params), params_rate(params));
+
+ return 0;
+}
+
+static int tasdevice_sdw_pcm_hw_free(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ struct snd_soc_component *component = dai->component;
+ struct tasdevice_priv *tas_priv =
+ snd_soc_component_get_drvdata(component);
+ struct sdw_stream_runtime *sdw_stream =
+ snd_soc_dai_get_dma_data(dai, substream);
+
+ if (!tas_priv->sdw_peripheral)
+ return -EINVAL;
+
+ sdw_stream_remove_slave(tas_priv->sdw_peripheral, sdw_stream);
+
+ return 0;
+}
+
+static int tasdevice_mute(struct snd_soc_dai *dai, int mute,
+ int direction)
+{
+ struct snd_soc_component *component = dai->component;
+ struct tasdevice_priv *tas_dev =
+ snd_soc_component_get_drvdata(component);
+ struct regmap *map = tas_dev->regmap;
+ int ret;
+
+ dev_dbg(tas_dev->dev, "%s: %d.\n", __func__, mute);
+
+ if (mute) {
+ if (direction == SNDRV_PCM_STREAM_CAPTURE) {
+ ret = regmap_update_bits(map, TAS2873_REG_PWR_CTRL,
+ TAS2783_REG_AEF_MASK,
+ TAS2783_REG_AEF_INACTIVE);
+ if (ret)
+ dev_err(tas_dev->dev,
+ "%s: Disable AEF failed.\n", __func__);
+ } else {
+ /* FU23 mute (0x40400108) */
+ ret = regmap_write(map,
+ SDW_SDCA_CTL(TAS2783_FUNC_TYPE_SMART_AMP,
+ TAS2783_SDCA_ENT_FU23,
+ TAS2783_SDCA_CTL_FU_MUTE, 0), 1);
+ if (ret) {
+ dev_err(tas_dev->dev,
+ "%s: FU23 mute failed.\n", __func__);
+ goto out;
+ }
+ /*
+ * Both playback and echo data will be shutdown in
+ * playback stream.
+ */
+ ret = regmap_update_bits(map, TAS2873_REG_PWR_CTRL,
+ TAS2783_REG_PWR_MODE_MASK |
+ TAS2783_REG_AEF_MASK,
+ TAS2783_REG_PWR_MODE_ACTIVE |
+ TAS2783_REG_PWR_MODE_SW_PWD);
+ if (ret) {
+ dev_err(tas_dev->dev,
+ "%s: PWR&AEF shutdown failed.\n",
+ __func__);
+ goto out;
+ }
+ tas_dev->pstream = false;
+ }
+ } else {
+ /* FU23 Unmute, 0x40400108. */
+ if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ ret = regmap_write(map,
+ SDW_SDCA_CTL(TAS2783_FUNC_TYPE_SMART_AMP,
+ TAS2783_SDCA_ENT_FU23,
+ TAS2783_SDCA_CTL_FU_MUTE, 0), 0);
+ if (ret) {
+ dev_err(tas_dev->dev,
+ "%s: FU23 Unmute failed.\n", __func__);
+ goto out;
+ }
+ ret = regmap_update_bits(map, TAS2873_REG_PWR_CTRL,
+ TAS2783_REG_PWR_MODE_MASK,
+ TAS2783_REG_PWR_MODE_ACTIVE);
+ if (ret) {
+ dev_err(tas_dev->dev,
+ "%s: PWR Unmute failed.\n", __func__);
+ goto out;
+ }
+ tas_dev->pstream = true;
+ } else {
+ /* Capture stream is the echo ref data for voice.
+ * Without playback, it can't be active.
+ */
+ if (tas_dev->pstream == true) {
+ ret = regmap_update_bits(map,
+ TAS2873_REG_PWR_CTRL,
+ TAS2783_REG_AEF_MASK,
+ TAS2783_REG_AEF_ACTIVE);
+ if (ret) {
+ dev_err(tas_dev->dev,
+ "%s: AEF enable failed.\n",
+ __func__);
+ goto out;
+ }
+ } else {
+ dev_err(tas_dev->dev,
+ "%s: No playback, no AEF!", __func__);
+ ret = -EINVAL;
+ }
+ }
+ }
+out:
+ if (ret)
+ dev_err(tas_dev->dev, "Mute or unmute %d failed %d.\n",
+ mute, ret);
+
+ return ret;
+}
+
+static const struct snd_soc_dai_ops tasdevice_dai_ops = {
+ .mute_stream = tasdevice_mute,
+ .hw_params = tasdevice_sdw_hw_params,
+ .hw_free = tasdevice_sdw_pcm_hw_free,
+ .set_stream = tasdevice_set_sdw_stream,
+ .shutdown = tasdevice_sdw_shutdown,
+};
+
+static struct snd_soc_dai_driver tasdevice_dai_driver[] = {
+ {
+ .name = "tas2783-codec",
+ .id = 0,
+ .playback = {
+ .stream_name = "Playback",
+ .channels_min = 1,
+ .channels_max = 4,
+ .rates = TAS2783_DEVICE_RATES,
+ .formats = TAS2783_DEVICE_FORMATS,
+ },
+ .capture = {
+ .stream_name = "Capture",
+ .channels_min = 1,
+ .channels_max = 4,
+ .rates = TAS2783_DEVICE_RATES,
+ .formats = TAS2783_DEVICE_FORMATS,
+ },
+ .ops = &tasdevice_dai_ops,
+ .symmetric_rate = 1,
+ },
+};
+
+static int tasdevice_comp_probe(struct snd_soc_component *comp)
+{
+ struct tasdevice_priv *tas_dev = snd_soc_component_get_drvdata(comp);
+ acpi_handle handle = ACPI_HANDLE(tas_dev->dev);
+ const struct firmware *fw_entry = NULL;
+ const char *sub = NULL;
+ int ret, value_sdw;
+
+ if (handle) {
+ sub = acpi_get_subsystem_id(handle);
+ if (IS_ERR(sub))
+ sub = NULL;
+ }
+
+ tas_dev->component = comp;
+
+ /*
+ * Each tas2783 in the system has its own dspfw.
+ */
+ if (comp->name_prefix) {
+ /*
+ * name_prefix.bin stores the dsp firmware including speaker
+ * protection algorithm, audio acoustic algorithm, speaker
+ * characters and algorithm params, it must be copied into
+ * firmware folder.
+ */
+ scnprintf(tas_dev->dspfw_binaryname,
+ TAS2783_DSPFW_FILENAME_LEN, "%s-tas2783.bin",
+ comp->name_prefix);
+ } else {
+ /* Compatible with the previous naming rule */
+ if (sub) {
+ /*
+ * subsystem_id-link_id[0,1,...,N]-dev_num[1,...,4].bin stores
+ * the dsp firmware including speaker protection algorithm,
+ * audio acoustic algorithm, speaker characters and algorithm
+ * params, it must be copied into firmware folder.
+ */
+ scnprintf(tas_dev->dspfw_binaryname,
+ TAS2783_DSPFW_FILENAME_LEN,
+ "%s-%d-%d.bin", sub,
+ tas_dev->sdw_peripheral->bus->link_id,
+ tas_dev->sdw_peripheral->dev_num);
+ } else {
+ /*
+ * tas2783-link_id[0,1,...,N]-dev_num[1,...,4].bin stores
+ * the dsp firmware including speaker protection algorithm,
+ * audio acoustic algorithm, speaker characters and algorithm
+ * params, it must be copied into firmware folder.
+ */
+ scnprintf(tas_dev->dspfw_binaryname,
+ TAS2783_DSPFW_FILENAME_LEN,
+ "tas2783-%d-%d.bin",
+ tas_dev->sdw_peripheral->bus->link_id,
+ tas_dev->sdw_peripheral->dev_num);
+ }
+ }
+
+ ret = request_firmware(&fw_entry, tas_dev->dspfw_binaryname,
+ tas_dev->dev);
+ if (ret) {
+ dev_err(tas_dev->dev,
+ "%s: request_firmware %x open status: %d.\n", __func__,
+ tas_dev->sdw_peripheral->id.unique_id, ret);
+ goto out;
+ }
+
+ tasdevice_dspfw_ready(fw_entry, tas_dev);
+
+ /* Select left/right channel based on device number. */
+ value_sdw = 0x1a;
+ value_sdw |= (tas_dev->sdw_peripheral->dev_num & BIT(0)) << 4;
+ dev_dbg(tas_dev->dev, "%s: dev_num = %u", __func__,
+ tas_dev->sdw_peripheral->dev_num);
+ regmap_write(tas_dev->regmap, TAS2783_REG_TDM_RX_CFG, value_sdw);
+ if (ret != 0)
+ dev_warn(tas_dev->dev, "%s: L/R setting failed: %d.\n",
+ __func__, ret);
+
+out:
+ if (fw_entry)
+ release_firmware(fw_entry);
+ return 0;
+}
+
+static const struct snd_soc_component_driver
+ soc_codec_driver_tasdevice = {
+ .probe = tasdevice_comp_probe,
+ .controls = tas2783_snd_controls,
+ .num_controls = ARRAY_SIZE(tas2783_snd_controls),
+ .dapm_widgets = tasdevice_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(tasdevice_dapm_widgets),
+ .dapm_routes = tasdevice_audio_map,
+ .num_dapm_routes = ARRAY_SIZE(tasdevice_audio_map),
+ .idle_bias_on = 1,
+ .endianness = 1,
+};
+
+static int tasdevice_init(struct tasdevice_priv *tas_dev)
+{
+ int ret;
+
+ dev_set_drvdata(tas_dev->dev, tas_dev);
+
+ ret = devm_snd_soc_register_component(tas_dev->dev,
+ &soc_codec_driver_tasdevice,
+ tasdevice_dai_driver, ARRAY_SIZE(tasdevice_dai_driver));
+ if (ret) {
+ dev_err(tas_dev->dev, "%s: codec register error:%d.\n",
+ __func__, ret);
+ return ret;
+ }
+
+ /* set autosuspend parameters */
+ pm_runtime_set_autosuspend_delay(tas_dev->dev, 3000);
+ pm_runtime_use_autosuspend(tas_dev->dev);
+
+ /* make sure the device does not suspend immediately */
+ pm_runtime_mark_last_busy(tas_dev->dev);
+ pm_runtime_enable(tas_dev->dev);
+
+ return 0;
+}
+
+static int tasdevice_read_prop(struct sdw_slave *slave)
+{
+ struct sdw_slave_prop *prop = &slave->prop;
+ struct sdw_dpn_prop *dpn;
+ unsigned long addr;
+ int nval, i, j;
+ u32 bit;
+
+ prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
+ prop->quirks = SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY;
+
+ prop->paging_support = true;
+
+ /* first we need to allocate memory for set bits in port lists */
+ prop->source_ports = BIT(2); /* BITMAP: 00000100 */
+ prop->sink_ports = BIT(1); /* BITMAP: 00000010 */
+
+ nval = hweight32(prop->source_ports);
+ prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval,
+ sizeof(*prop->src_dpn_prop), GFP_KERNEL);
+ if (!prop->src_dpn_prop)
+ return -ENOMEM;
+
+ i = 0;
+ dpn = prop->src_dpn_prop;
+ addr = prop->source_ports;
+ for_each_set_bit(bit, &addr, 32) {
+ dpn[i].num = bit;
+ dpn[i].type = SDW_DPN_FULL;
+ dpn[i].simple_ch_prep_sm = true;
+ dpn[i].ch_prep_timeout = 10;
+ i++;
+ }
+
+ /* do this again for sink now */
+ nval = hweight32(prop->sink_ports);
+ prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval,
+ sizeof(*prop->sink_dpn_prop), GFP_KERNEL);
+ if (!prop->sink_dpn_prop)
+ return -ENOMEM;
+
+ j = 0;
+ dpn = prop->sink_dpn_prop;
+ addr = prop->sink_ports;
+ for_each_set_bit(bit, &addr, 32) {
+ dpn[j].num = bit;
+ dpn[j].type = SDW_DPN_FULL;
+ dpn[j].simple_ch_prep_sm = true;
+ dpn[j].ch_prep_timeout = 10;
+ j++;
+ }
+
+ /* set the timeout values */
+ prop->clk_stop_timeout = 20;
+
+ return 0;
+}
+
+static int tasdevice_io_init(struct device *dev,
+ struct sdw_slave *slave)
+{
+ struct tasdevice_priv *tas_priv = dev_get_drvdata(dev);
+ int ret;
+
+ regcache_cache_only(tas_priv->regmap, false);
+
+ if (tas_priv->first_hw_init) {
+ regcache_cache_bypass(tas_priv->regmap, true);
+ } else {
+ /*
+ * PM runtime is only enabled when a Slave reports as Attached
+ * Update count of parent 'active' children
+ */
+ pm_runtime_set_active(&slave->dev);
+ }
+
+ /* sw reset */
+ ret = regmap_write(tas_priv->regmap, TAS2873_REG_SWRESET,
+ TAS2873_REG_SWRESET_RESET);
+ if (ret) {
+ dev_err(tas_priv->dev, "Reset failed.\n");
+ goto out;
+ }
+
+ if (tas_priv->first_hw_init) {
+ regcache_cache_bypass(tas_priv->regmap, false);
+ regcache_mark_dirty(tas_priv->regmap);
+ }
+
+ tas_priv->first_hw_init = true;
+ tas_priv->hw_init = true;
+
+out:
+ return ret;
+}
+
+static int tasdevice_update_status(struct sdw_slave *slave,
+ enum sdw_slave_status status)
+{
+ struct tasdevice_priv *tas_priv = dev_get_drvdata(&slave->dev);
+
+ /* Update the status */
+ tas_priv->status = status;
+
+ if (status == SDW_SLAVE_UNATTACHED)
+ tas_priv->hw_init = false;
+ /*
+ * Perform initialization only if slave status
+ * is present and hw_init flag is false
+ */
+ if (tas_priv->hw_init || tas_priv->status != SDW_SLAVE_ATTACHED)
+ return 0;
+
+ /* perform I/O transfers required for Slave initialization */
+ return tasdevice_io_init(&slave->dev, slave);
+}
+
+/*
+ * slave_ops: callbacks for get_clock_stop_mode, clock_stop and
+ * port_prep are not defined for now
+ */
+static const struct sdw_slave_ops tasdevice_sdw_ops = {
+ .read_prop = tasdevice_read_prop,
+ .update_status = tasdevice_update_status,
+};
+
+static int tasdevice_sdw_probe(struct sdw_slave *peripheral,
+ const struct sdw_device_id *id)
+{
+ struct device *dev = &peripheral->dev;
+ struct tasdevice_priv *tas_dev;
+
+ tas_dev = devm_kzalloc(dev, sizeof(*tas_dev), GFP_KERNEL);
+ if (!tas_dev)
+ return -ENOMEM;
+
+ tas_dev->dev = dev;
+ tas_dev->chip_id = id->driver_data;
+ tas_dev->sdw_peripheral = peripheral;
+ /*
+ * Mark hw_init to false
+ * HW init will be performed when device reports present
+ */
+ tas_dev->hw_init = false;
+ tas_dev->first_hw_init = false;
+
+ dev_set_drvdata(dev, tas_dev);
+
+ tas_dev->regmap = devm_regmap_init_sdw(peripheral, &tasdevice_regmap);
+ if (IS_ERR(tas_dev->regmap))
+ return dev_err_probe(dev, PTR_ERR(tas_dev->regmap),
+ "Failed devm_regmap_init_sdw.");
+
+ return tasdevice_init(tas_dev);
+}
+
+static int tasdevice_sdw_remove(struct sdw_slave *peripheral)
+{
+ struct tasdevice_priv *tas_dev = dev_get_drvdata(&peripheral->dev);
+
+ if (tas_dev->first_hw_init)
+ pm_runtime_disable(tas_dev->dev);
+
+ return 0;
+}
+
+static const struct sdw_device_id tasdevice_sdw_id[] = {
+ SDW_SLAVE_ENTRY(0x0102, 0x0000, 0),
+ {}
+};
+MODULE_DEVICE_TABLE(sdw, tasdevice_sdw_id);
+
+static int __maybe_unused tas2783_sdca_dev_suspend(struct device *dev)
+{
+ struct tasdevice_priv *tas_priv = dev_get_drvdata(dev);
+
+ if (!tas_priv->hw_init)
+ return 0;
+
+ regcache_cache_only(tas_priv->regmap, true);
+
+ return 0;
+}
+
+#define TAS2783_PROBE_TIMEOUT_MS 5000
+
+static int __maybe_unused tas2783_sdca_dev_resume(struct device *dev)
+{
+ struct sdw_slave *slave = dev_to_sdw_dev(dev);
+ struct tasdevice_priv *tas_priv = dev_get_drvdata(dev);
+ unsigned long time;
+
+ if (!tas_priv->first_hw_init)
+ return 0;
+
+ if (!slave->unattach_request)
+ goto regmap_sync;
+
+ time = wait_for_completion_timeout(&slave->initialization_complete,
+ msecs_to_jiffies(TAS2783_PROBE_TIMEOUT_MS));
+ if (!time) {
+ dev_err(&slave->dev, "Init not complete, timed out\n");
+ sdw_show_ping_status(slave->bus, true);
+
+ return -ETIMEDOUT;
+ }
+
+regmap_sync:
+ slave->unattach_request = 0;
+ regcache_cache_only(tas_priv->regmap, false);
+ regcache_sync(tas_priv->regmap);
+
+ return 0;
+}
+
+static const struct dev_pm_ops tas2783_sdca_pm = {
+ SYSTEM_SLEEP_PM_OPS(tas2783_sdca_dev_suspend,
+ tas2783_sdca_dev_resume)
+ RUNTIME_PM_OPS(tas2783_sdca_dev_suspend,
+ tas2783_sdca_dev_resume, NULL)
+};
+
+static struct sdw_driver tasdevice_sdw_driver = {
+ .driver = {
+ .name = "slave-tas2783",
+ .pm = &tas2783_sdca_pm,
+ },
+ .probe = tasdevice_sdw_probe,
+ .remove = tasdevice_sdw_remove,
+ .ops = &tasdevice_sdw_ops,
+ .id_table = tasdevice_sdw_id,
+};
+
+module_sdw_driver(tasdevice_sdw_driver);
+
+MODULE_AUTHOR("Baojun Xu <baojun.xu(a)ti.com>");
+MODULE_AUTHOR("Shenghao Ding <shenghao-ding(a)ti.com>");
+MODULE_DESCRIPTION("ASoC TAS2783 SoundWire Driver");
+MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/tas2783.h b/sound/soc/codecs/tas2783.h
new file mode 100644
index 000000000000..41bdce1964ff
--- /dev/null
+++ b/sound/soc/codecs/tas2783.h
@@ -0,0 +1,103 @@
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * ALSA SoC Texas Instruments TAS2783 Audio Smart Amplifier
+ *
+ * Copyright (C) 2023 - 2024 Texas Instruments Incorporated
+ * https://www.ti.com
+ *
+ * Author: Baojun Xu <baojun.xu(a)ti.com>
+ * Shenghao Ding <shenghao-ding(a)ti.com>
+ */
+
+#ifndef __TAS2783_H__
+#define __TAS2783_H__
+
+#define TAS2783_DEVICE_RATES (SNDRV_PCM_RATE_44100 | \
+ SNDRV_PCM_RATE_48000 | \
+ SNDRV_PCM_RATE_96000 | \
+ SNDRV_PCM_RATE_88200)
+
+#define TAS2783_DEVICE_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
+ SNDRV_PCM_FMTBIT_S24_LE | \
+ SNDRV_PCM_FMTBIT_S32_LE)
+
+/* BOOK, PAGE Control Register */
+#define TASDEVICE_REG(book, page, reg) ((book * 256 * 256) + 0x8000 + \
+ (page * 128) + reg)
+
+/*Software Reset */
+#define TAS2873_REG_SWRESET TASDEVICE_REG(0x0, 0x00, 0x01)
+#define TAS2873_REG_SWRESET_MASK BIT(0)
+#define TAS2873_REG_SWRESET_RESET BIT(0)
+
+#define TAS2873_REG_PWR_CTRL TASDEVICE_REG(0x0, 0x00, 0x02)
+#define TAS2783_REG_AEF_MASK GENMASK(4, 3)
+#define TAS2783_REG_AEF_ACTIVE 0
+#define TAS2783_REG_AEF_INACTIVE GENMASK(4, 3)
+#define TAS2783_REG_PWR_MODE_MASK GENMASK(2, 0)
+#define TAS2783_REG_PWR_MODE_ACTIVE 0
+#define TAS2783_REG_PWR_MODE_SW_PWD BIT(1)
+
+#define TAS2783_REG_TDM_RX_CFG TASDEVICE_REG(0x0, 0x00, 0x0a)
+
+/* Volume control */
+#define TAS2783_DVC_LVL TASDEVICE_REG(0x0, 0x00, 0x1a)
+#define TAS2783_AMP_LEVEL TASDEVICE_REG(0x0, 0x00, 0x03)
+#define TAS2783_AMP_LEVEL_MASK GENMASK(5, 1)
+
+/* Calibration data */
+#define TAS2783_CALIBRATION_RE TASDEVICE_REG(0x0, 0x17, 0x74)
+#define TAS2783_CALIBRATION_RE_LOW TASDEVICE_REG(0x0, 0x18, 0x14)
+#define TAS2783_CALIBRATION_INV_RE TASDEVICE_REG(0x0, 0x18, 0x0c)
+#define TAS2783_CALIBRATION_POW TASDEVICE_REG(0x0, 0x13, 0x70)
+#define TAS2783_CALIBRATION_TLIMIT TASDEVICE_REG(0x0, 0x18, 0x7c)
+
+/* TAS2783 SDCA Control - function number */
+#define TAS2783_FUNC_TYPE_SMART_AMP 0x01
+
+/* TAS2783 SDCA entity */
+#define TAS2783_SDCA_ENT_FU21 0x01
+#define TAS2783_SDCA_ENT_FU23 0x02
+
+/* TAS2783 SDCA control */
+#define TAS2783_SDCA_CTL_REQ_POWER_STATE 0x01
+#define TAS2783_SDCA_CTL_FU_MUTE 0x01
+#define TAS2783_SDCA_CTL_FU_VOLUME 0x02
+#define TAS2783_SDCA_CTL_UDMPU_CLUSTER 0x10
+
+#define TAS2783_DEVICE_CHANNEL_LEFT 1
+#define TAS2783_DEVICE_CHANNEL_RIGHT 2
+#define TAS2783_DSPFW_FILENAME_LEN 64
+
+#define TAS2783_MAX_CALIDATA_SIZE 252
+
+struct tas2783_firmware_node {
+ unsigned int vendor_id;
+ unsigned int file_id;
+ unsigned int version_id;
+ unsigned int length;
+ unsigned int download_addr;
+};
+
+struct calibration_data {
+ unsigned long total_sz;
+ unsigned char data[TAS2783_MAX_CALIDATA_SIZE];
+};
+
+struct tasdevice_priv {
+ struct snd_soc_component *component;
+ struct calibration_data cali_data;
+ struct sdw_slave *sdw_peripheral;
+ enum sdw_slave_status status;
+ struct sdw_bus_params params;
+ struct regmap *regmap;
+ struct device *dev;
+ unsigned char dspfw_binaryname[TAS2783_DSPFW_FILENAME_LEN];
+ unsigned char dev_name[32];
+ unsigned int chip_id;
+ bool pstream;
+ bool hw_init;
+ bool first_hw_init;
+};
+
+#endif /*__TAS2783_H__ */
--
2.34.1
4
3

20 Feb '24
From: Anton Yakovlev <anton.yakovlev(a)opensynergy.com>
Changes in v2
- Fix reporting of incorrect number of items for ENUMERATED controls
Implementation of support for audio controls in accordance with the
extension of the virtio sound device specification[1] planned for
virtio-v1.3-cs01.
Design of virtual audio controls is based on and derived from ALSA
audio controls. It allows the driver to perform all standard operations,
such as reading and writing audio control value, as well as working with
metadata (represented in the TLV form).
The driver part was tested on top of the Linux 5.10 kernel.
As a device part was used OpenSynergy proprietary implementation.
[1] https://lists.oasis-open.org/archives/virtio-comment/202104/msg00013.html
Anton Yakovlev (1):
ALSA: virtio: add support for audio controls
include/uapi/linux/virtio_snd.h | 154 +++++++++++
sound/virtio/Makefile | 1 +
sound/virtio/virtio_card.c | 21 ++
sound/virtio/virtio_card.h | 22 ++
sound/virtio/virtio_kctl.c | 464 ++++++++++++++++++++++++++++++++
5 files changed, 662 insertions(+)
create mode 100644 sound/virtio/virtio_kctl.c
--
2.25.1
4
4
Linux regressions mailing list <regressions(a)lists.linux.dev>
Subject: Re: [REGRESSION] Acp5x probing regression introduced between kernel 6.7.2 -> 6.7.4
In-Reply-To: <7a0cd63f-8a83-4dc5-8763-63dcdae8d68a(a)leemhuis.info>
References: <CAD_nV8BG0t7US=+C28kQOR==712MPfZ9m-fuKksgoZCgrEByCw(a)mail.gmail.com>
<7a0cd63f-8a83-4dc5-8763-63dcdae8d68a(a)leemhuis.info>
User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0
On Sun, 11 Feb 2024 18:19:25 +0100,
Linux regression tracking (Thorsten Leemhuis) wrote:
>
> [CCing a few people]
>
> On 11.02.24 15:34, Ted Chang wrote:
> >
> > I noticed 6.7.4Â has introduced a regression for the steam deck. The LCD
> > steam deck can no longer probe the acp5x audio chipset anymore. This
> > regression does not affect the 6.8.x series. I did not test kernel
> > 6.7.3 because Opensuse tumbleweed skipped the update on my machine.
>
> Thx for your report. FWIW, problems like this can be caused by all
> sorts of changes, but obviously those in the area of audio support
> are most likely to cause this. There are just a few in the
> v6.7.2..v6.7.4 range[1]. Among them a commit that is related to
> acp5x, that's why I CCed its author as well (Venkata Prasad Potturu).
>
> Maybe one of the new recipients will have an idea. If not, you most
> likely will have to bisect this and check if mainline is affected
> as well.[2]
>
> Ciao, Thorsten
>
> [1]
> $ git log --oneline v6.7.2..v6.7.4 sound/
> f3570675bf09af ASoC: codecs: wsa883x: fix PA volume control
> 2f8e9b77ca2fea ASoC: codecs: lpass-wsa-macro: fix compander volume hack
> 5b465d6384e4eb ASoC: codecs: wcd938x: fix headphones volume controls
> 1673211a38012e ASoC: qcom: sc8280xp: limit speaker volumes
> 242b5bffa23a9c ASoC: codecs: rtq9128: Fix TDM enable and DAI format control flow
> 2c272ff9859601 ASoC: codecs: rtq9128: Fix PM_RUNTIME usage
> 4a28302b2c681e ALSA: hda/conexant: Fix headset auto detect fail in cx8070 and SN6140
> e37a96941fdd53 ALSA: hda: intel-dspcfg: add filters for ARL-S and ARL
> ffa3eea886c6fe ALSA: hda: Intel: add HDA_ARL PCI ID support
> 4b6986b170f2f2 ASoC: amd: Add new dmi entries for acp5x platform
This one is the only relevant change, I suppose.
The machine matches with 'Valve Jupiter'.
Interestingly, the system seems working with 6.8-rc3, so some piece
might be missing. Or simply reverting this patch should fix.
Takashi
> e38ad4ace20b4d ALSA: hda: Refer to correct stream index at loops
> a434c75e0671f9 soundwire: fix initializing sysfs for same devices on different buses
>
> [2] I'm working on a guide that describes what's needed:
> https://www.leemhuis.info/files/misc/How%20to%20bisect%20a%20Linux%20kernel…
>
> > Steps to reproduce the problem
> > 1. Obtain a steam deck
> > 2. Install kernel 6.7.4
> > 3. Boot the device and you will see dummy output in gnome shell
> >
> > Observed kernel logs.
> >
> > [ 8.755614] cs35l41 spi-VLV1776:00: supply VA not found, using dummy regulator
> > [ 8.760506] cs35l41 spi-VLV1776:00: supply VP not found, using dummy regulator
> > [ 8.777148] cs35l41 spi-VLV1776:00: Cirrus Logic CS35L41 (35a40), Revision: B2
> > [ 8.777471] cs35l41 spi-VLV1776:01: supply VA not found, using dummy regulator
> > [ 8.777532] cs35l41 spi-VLV1776:01: supply VP not found, using dummy regulator
> > [ 8.777709] cs35l41 spi-VLV1776:01: Reset line busy, assuming shared reset
> > [ 8.788465] cs35l41 spi-VLV1776:01: Cirrus Logic CS35L41 (35a40), Revision: B2
> > [ 8.877280] snd_hda_intel 0000:04:00.1: enabling device (0000 -> 0002)
> > [ 8.877595] snd_hda_intel 0000:04:00.1: Handle vga_switcheroo audio client
> > [ 8.889913] snd_acp_pci 0000:04:00.5: enabling device (0000 -> 0002)
> > [ 8.890063] snd_acp_pci 0000:04:00.5: Unsupported device revision:0x50
> > [ 8.890129] snd_acp_pci: probe of 0000:04:00.5 failed with error -22
> > [ 8.906136] snd_hda_intel 0000:04:00.1: bound 0000:04:00.0 (ops amdgpu_dm_audio_component_bind_ops [amdgpu]
> >
> >
> > No kernel module in use shown.
> >
> > 04:00.5 Multimedia controller [0480]: Advanced Micro Devices, Inc. [AMD]
> > ACP/ACP3X/ACP6x Audio Coprocessor [1022:15e2] (rev 50)
> > Subsystem: Valve Software Device [1e44:1776]
> > Flags: fast devsel, IRQ 70, IOMMU group 4
> > Memory at 80380000 (32-bit, non-prefetchable) [size=256K]
> > Capabilities: <access denied>
> > Kernel modules: snd_pci_acp3x, snd_rn_pci_acp3x, snd_pci_acp5x,
> > snd_pci_acp6x, snd_acp_pci, snd_rpl_pci_acp6x, snd_pci_ps,
> > snd_sof_amd_renoir, snd_sof_amd_rembrandt, snd_sof_amd_vangogh,
> > snd_sof_amd_acp63
> >
> >
> > Information for package kernel-default:
> > ---------------------------------------
> > Repository : openSUSE-Tumbleweed-Oss
> > Name : kernel-default
> > Version : 6.7.4-1.1
> > Arch : x86_64
> > Vendor : openSUSE
> > Installed Size : 240.3 MiB
> > Installed : Yes
> > Status : up-to-date
> > Source package : kernel-default-6.7.4-1.1.nosrc
> > Upstream URL : https://www.kernel.org/ <https://www.kernel.org/>
> > Summary : The Standard Kernel
> > Description :
> > The standard kernel for both uniprocessor and multiprocessor systems.
> >
> >
> > Source Timestamp: 2024-02-06 05:32:37 +0000
> > GIT Revision: 01735a3e65287585dd830a6a3d33d909a4f9ae7f
> > GIT Branch: stable
> >
> > Handle 0x0000, DMI type 0, 26 bytes
> > BIOS Information
> > Vendor: Valve
> > Version: F7A0120
> > Release Date: 12/01/2023
> > Address: 0xE0000
> > Runtime Size: 128 kB
> > BIOS Revision: 1.20
> > Firmware Revision: 1.16
> >
> > #regzbot introduced: v6.7.2..v6.7.4
> >
3
5
The local helper function to compare the given pair of cycle count
evaluates them. If the left value is less than the right value, the
function returns negative value.
If the safe cycle is less than the current cycle, it is the case of
cycle lost. However, it is not currently handled properly.
This commit fixes the bug.
Cc: <stable(a)vger.kernel.org>
Fixes: 705794c53b00 ("ALSA: firewire-lib: check cycle continuity")
Signed-off-by: Takashi Sakamoto <o-takashi(a)sakamocchi.jp>
---
sound/firewire/amdtp-stream.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index a13c0b408aad..7be17bca257f 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -951,7 +951,7 @@ static int generate_tx_packet_descs(struct amdtp_stream *s, struct pkt_desc *des
// to the reason.
unsigned int safe_cycle = increment_ohci_cycle_count(next_cycle,
IR_JUMBO_PAYLOAD_MAX_SKIP_CYCLES);
- lost = (compare_ohci_cycle_count(safe_cycle, cycle) > 0);
+ lost = (compare_ohci_cycle_count(safe_cycle, cycle) < 0);
}
if (lost) {
dev_err(&s->unit->device, "Detect discontinuity of cycle: %d %d\n",
--
2.40.1
2
1

19 Feb '24
Hi,
There used to be a company called Miglia Technologies Ltd. in the UK,
and the company was selling a product called Harmony Audio in 2004. Upon
obtaining the product by chance recently and examining its internals, it
was revealed that it utilizes Oxford Semiconductor OXFW970 for its
communication function in IEEE 1394 bus.
This patchset adds support for the model.
Takashi Sakamoto (4):
ALSA: oxfw: use const qualifier for immutable argument
ALSA: oxfw: support the case that AV/C Stream Format Information
command is not available
ALSA: firewire-lib: handle quirk to calculate payload quadlets as data
block counter
ALSA: oxfw: add support for Miglia Harmony Audio
sound/firewire/amdtp-stream.c | 12 ++--
sound/firewire/amdtp-stream.h | 4 ++
sound/firewire/oxfw/oxfw-stream.c | 100 +++++++++++++++++++++++-------
sound/firewire/oxfw/oxfw.c | 10 ++-
sound/firewire/oxfw/oxfw.h | 7 ++-
5 files changed, 103 insertions(+), 30 deletions(-)
--
2.40.1
2
5

[PATCH] clk: constify the of_phandle_args argument of of_clk_provider
by Krzysztof Kozlowski 19 Feb '24
by Krzysztof Kozlowski 19 Feb '24
19 Feb '24
None of the implementations of the get() and get_hw() callbacks of
"struct of_clk_provider" modify the contents of received of_phandle_args
pointer. They treat it as read-only variable used to find the clock to
return. Make obvious that implementations are not supposed to modify
the of_phandle_args, by making it a pointer to const.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)linaro.org>
---
drivers/clk/at91/pmc.c | 3 +-
drivers/clk/at91/pmc.h | 3 +-
drivers/clk/baikal-t1/clk-ccu-div.c | 2 +-
drivers/clk/baikal-t1/clk-ccu-pll.c | 2 +-
drivers/clk/bcm/clk-kona-setup.c | 2 +-
drivers/clk/clk-axm5516.c | 2 +-
drivers/clk/clk-cdce706.c | 2 +-
drivers/clk/clk-cdce925.c | 2 +-
drivers/clk/clk-k210.c | 2 +-
drivers/clk/clk-lochnagar.c | 2 +-
drivers/clk/clk-max77686.c | 2 +-
drivers/clk/clk-max9485.c | 2 +-
drivers/clk/clk-qoriq.c | 3 +-
drivers/clk/clk-renesas-pcie.c | 2 +-
drivers/clk/clk-rk808.c | 2 +-
drivers/clk/clk-scpi.c | 2 +-
drivers/clk/clk-si521xx.c | 2 +-
drivers/clk/clk-si5341.c | 2 +-
drivers/clk/clk-si5351.c | 4 +--
drivers/clk/clk-sparx5.c | 3 +-
drivers/clk/clk-stm32f4.c | 2 +-
drivers/clk/clk-versaclock3.c | 2 +-
drivers/clk/clk-versaclock5.c | 2 +-
drivers/clk/clk-versaclock7.c | 2 +-
drivers/clk/clk.c | 30 ++++++++++---------
drivers/clk/hisilicon/clk-hi3660-stub.c | 2 +-
drivers/clk/imx/clk-imx8qxp-lpcg.c | 2 +-
drivers/clk/imx/clk-scu.c | 2 +-
drivers/clk/imx/clk-scu.h | 2 +-
drivers/clk/keystone/sci-clk.c | 3 +-
drivers/clk/meson/meson-clkc-utils.c | 3 +-
drivers/clk/meson/meson-clkc-utils.h | 3 +-
drivers/clk/mvebu/common.c | 2 +-
drivers/clk/mvebu/cp110-system-controller.c | 2 +-
drivers/clk/mvebu/kirkwood.c | 2 +-
drivers/clk/nxp/clk-lpc18xx-ccu.c | 2 +-
drivers/clk/qcom/clk-rpm.c | 2 +-
drivers/clk/qcom/clk-rpmh.c | 2 +-
drivers/clk/qcom/clk-smd-rpm.c | 2 +-
drivers/clk/qcom/clk-spmi-pmic-div.c | 2 +-
drivers/clk/qcom/common.c | 2 +-
drivers/clk/qcom/krait-cc.c | 2 +-
drivers/clk/renesas/r9a06g032-clocks.c | 2 +-
drivers/clk/renesas/renesas-cpg-mssr.c | 2 +-
drivers/clk/renesas/rzg2l-cpg.c | 2 +-
.../clk/starfive/clk-starfive-jh7100-audio.c | 3 +-
drivers/clk/starfive/clk-starfive-jh7100.c | 3 +-
.../clk/starfive/clk-starfive-jh7110-aon.c | 3 +-
.../clk/starfive/clk-starfive-jh7110-isp.c | 3 +-
.../clk/starfive/clk-starfive-jh7110-pll.c | 3 +-
.../clk/starfive/clk-starfive-jh7110-stg.c | 3 +-
.../clk/starfive/clk-starfive-jh7110-sys.c | 3 +-
.../clk/starfive/clk-starfive-jh7110-vout.c | 3 +-
drivers/clk/tegra/clk-bpmp.c | 2 +-
drivers/clk/tegra/clk-tegra124.c | 2 +-
drivers/clk/tegra/clk-tegra20.c | 2 +-
drivers/clk/tegra/clk-tegra30.c | 2 +-
drivers/clk/ti/clkctrl.c | 2 +-
drivers/clk/ux500/u8500_of_clk.c | 4 +--
drivers/clk/versatile/clk-sp810.c | 2 +-
drivers/media/platform/ti/omap3isp/isp.c | 3 +-
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 6 ++--
include/linux/clk-provider.h | 28 ++++++++---------
include/linux/clk.h | 4 +--
sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c | 2 +-
65 files changed, 115 insertions(+), 95 deletions(-)
diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
index 5aa9c1f1c886..64ec624ffc15 100644
--- a/drivers/clk/at91/pmc.c
+++ b/drivers/clk/at91/pmc.c
@@ -44,7 +44,8 @@ int of_at91_get_clk_range(struct device_node *np, const char *propname,
}
EXPORT_SYMBOL_GPL(of_at91_get_clk_range);
-struct clk_hw *of_clk_hw_pmc_get(struct of_phandle_args *clkspec, void *data)
+struct clk_hw *of_clk_hw_pmc_get(const struct of_phandle_args *clkspec,
+ void *data)
{
unsigned int type = clkspec->args[0];
unsigned int idx = clkspec->args[1];
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
index 0f52e80bcd49..09ae26d0cece 100644
--- a/drivers/clk/at91/pmc.h
+++ b/drivers/clk/at91/pmc.h
@@ -126,7 +126,8 @@ struct pmc_data *pmc_data_allocate(unsigned int ncore, unsigned int nsystem,
int of_at91_get_clk_range(struct device_node *np, const char *propname,
struct clk_range *range);
-struct clk_hw *of_clk_hw_pmc_get(struct of_phandle_args *clkspec, void *data);
+struct clk_hw *of_clk_hw_pmc_get(const struct of_phandle_args *clkspec,
+ void *data);
struct clk_hw * __init
at91_clk_register_audio_pll_frac(struct regmap *regmap, const char *name,
diff --git a/drivers/clk/baikal-t1/clk-ccu-div.c b/drivers/clk/baikal-t1/clk-ccu-div.c
index 84555a00f950..97ea3d747a78 100644
--- a/drivers/clk/baikal-t1/clk-ccu-div.c
+++ b/drivers/clk/baikal-t1/clk-ccu-div.c
@@ -322,7 +322,7 @@ static int ccu_div_find_sys_regs(struct ccu_div_data *data)
return 0;
}
-static struct clk_hw *ccu_div_of_clk_hw_get(struct of_phandle_args *clkspec,
+static struct clk_hw *ccu_div_of_clk_hw_get(const struct of_phandle_args *clkspec,
void *priv)
{
struct ccu_div_data *data = priv;
diff --git a/drivers/clk/baikal-t1/clk-ccu-pll.c b/drivers/clk/baikal-t1/clk-ccu-pll.c
index fce02ce77347..0e71d5967794 100644
--- a/drivers/clk/baikal-t1/clk-ccu-pll.c
+++ b/drivers/clk/baikal-t1/clk-ccu-pll.c
@@ -126,7 +126,7 @@ static int ccu_pll_find_sys_regs(struct ccu_pll_data *data)
return 0;
}
-static struct clk_hw *ccu_pll_of_clk_hw_get(struct of_phandle_args *clkspec,
+static struct clk_hw *ccu_pll_of_clk_hw_get(const struct of_phandle_args *clkspec,
void *priv)
{
struct ccu_pll_data *data = priv;
diff --git a/drivers/clk/bcm/clk-kona-setup.c b/drivers/clk/bcm/clk-kona-setup.c
index 338558f6fbae..1149bcd7617f 100644
--- a/drivers/clk/bcm/clk-kona-setup.c
+++ b/drivers/clk/bcm/clk-kona-setup.c
@@ -773,7 +773,7 @@ static bool ccu_data_valid(struct ccu_data *ccu)
}
static struct clk_hw *
-of_clk_kona_onecell_get(struct of_phandle_args *clkspec, void *data)
+of_clk_kona_onecell_get(const struct of_phandle_args *clkspec, void *data)
{
struct ccu_data *ccu = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/clk-axm5516.c b/drivers/clk/clk-axm5516.c
index 4a3462ee8f3e..458f44f4c08e 100644
--- a/drivers/clk/clk-axm5516.c
+++ b/drivers/clk/clk-axm5516.c
@@ -512,7 +512,7 @@ static struct axxia_clk *axmclk_clocks[] = {
};
static struct clk_hw *
-of_clk_axmclk_get(struct of_phandle_args *clkspec, void *unused)
+of_clk_axmclk_get(const struct of_phandle_args *clkspec, void *unused)
{
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/clk-cdce706.c b/drivers/clk/clk-cdce706.c
index dd3d42d9ad86..1db9fc5d2af7 100644
--- a/drivers/clk/clk-cdce706.c
+++ b/drivers/clk/clk-cdce706.c
@@ -618,7 +618,7 @@ static int cdce706_register_clkouts(struct cdce706_dev_data *cdce)
}
static struct clk_hw *
-of_clk_cdce_get(struct of_phandle_args *clkspec, void *data)
+of_clk_cdce_get(const struct of_phandle_args *clkspec, void *data)
{
struct cdce706_dev_data *cdce = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/clk-cdce925.c b/drivers/clk/clk-cdce925.c
index b0122093c6ff..48135ee578c5 100644
--- a/drivers/clk/clk-cdce925.c
+++ b/drivers/clk/clk-cdce925.c
@@ -576,7 +576,7 @@ static int cdce925_regmap_i2c_read(void *context,
}
static struct clk_hw *
-of_clk_cdce925_get(struct of_phandle_args *clkspec, void *_data)
+of_clk_cdce925_get(const struct of_phandle_args *clkspec, void *_data)
{
struct clk_cdce925_chip *data = _data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c
index 7b7329a907ab..2333ed3ed7a2 100644
--- a/drivers/clk/clk-k210.c
+++ b/drivers/clk/clk-k210.c
@@ -875,7 +875,7 @@ static inline void __init k210_register_clk_child(struct device_node *np,
k210_register_clk(np, ksc, id, &parent_data, 1, 0);
}
-static struct clk_hw *k210_clk_hw_onecell_get(struct of_phandle_args *clkspec,
+static struct clk_hw *k210_clk_hw_onecell_get(const struct of_phandle_args *clkspec,
void *data)
{
struct k210_sysclk *ksc = data;
diff --git a/drivers/clk/clk-lochnagar.c b/drivers/clk/clk-lochnagar.c
index 5561a2c66b69..5b773787a225 100644
--- a/drivers/clk/clk-lochnagar.c
+++ b/drivers/clk/clk-lochnagar.c
@@ -215,7 +215,7 @@ static const struct clk_ops lochnagar_clk_ops = {
};
static struct clk_hw *
-lochnagar_of_clk_hw_get(struct of_phandle_args *clkspec, void *data)
+lochnagar_of_clk_hw_get(const struct of_phandle_args *clkspec, void *data)
{
struct lochnagar_clk_priv *priv = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/clk-max77686.c b/drivers/clk/clk-max77686.c
index 3727d5472450..3ce2453c116c 100644
--- a/drivers/clk/clk-max77686.c
+++ b/drivers/clk/clk-max77686.c
@@ -145,7 +145,7 @@ static const struct clk_ops max77686_clk_ops = {
};
static struct clk_hw *
-of_clk_max77686_get(struct of_phandle_args *clkspec, void *data)
+of_clk_max77686_get(const struct of_phandle_args *clkspec, void *data)
{
struct max77686_clk_driver_data *drv_data = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/clk-max9485.c b/drivers/clk/clk-max9485.c
index be9020b6c789..050246008514 100644
--- a/drivers/clk/clk-max9485.c
+++ b/drivers/clk/clk-max9485.c
@@ -246,7 +246,7 @@ static const struct max9485_clk max9485_clks[MAX9485_NUM_CLKS] = {
};
static struct clk_hw *
-max9485_of_clk_get(struct of_phandle_args *clkspec, void *data)
+max9485_of_clk_get(const struct of_phandle_args *clkspec, void *data)
{
struct max9485_driver_data *drvdata = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c
index 4dcde305944c..95baeca8c031 100644
--- a/drivers/clk/clk-qoriq.c
+++ b/drivers/clk/clk-qoriq.c
@@ -1384,7 +1384,8 @@ static void __init core_pll_init(struct device_node *np)
}
}
-static struct clk *clockgen_clk_get(struct of_phandle_args *clkspec, void *data)
+static struct clk *clockgen_clk_get(const struct of_phandle_args *clkspec,
+ void *data)
{
struct clockgen *cg = data;
struct clk *clk;
diff --git a/drivers/clk/clk-renesas-pcie.c b/drivers/clk/clk-renesas-pcie.c
index 53e21ac302e6..0fad48ff0f95 100644
--- a/drivers/clk/clk-renesas-pcie.c
+++ b/drivers/clk/clk-renesas-pcie.c
@@ -270,7 +270,7 @@ static void rs9_update_config(struct rs9_driver_data *rs9)
}
static struct clk_hw *
-rs9_of_clk_get(struct of_phandle_args *clkspec, void *data)
+rs9_of_clk_get(const struct of_phandle_args *clkspec, void *data)
{
struct rs9_driver_data *rs9 = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/clk-rk808.c b/drivers/clk/clk-rk808.c
index f7412b137e5e..05e5047e7ce8 100644
--- a/drivers/clk/clk-rk808.c
+++ b/drivers/clk/clk-rk808.c
@@ -72,7 +72,7 @@ static const struct clk_ops rk808_clkout2_ops = {
};
static struct clk_hw *
-of_clk_rk808_get(struct of_phandle_args *clkspec, void *data)
+of_clk_rk808_get(const struct of_phandle_args *clkspec, void *data)
{
struct rk808_clkout *rk808_clkout = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/clk-scpi.c b/drivers/clk/clk-scpi.c
index 108b697bd317..8125e6ac7916 100644
--- a/drivers/clk/clk-scpi.c
+++ b/drivers/clk/clk-scpi.c
@@ -172,7 +172,7 @@ struct scpi_clk_data {
};
static struct clk_hw *
-scpi_of_clk_src_get(struct of_phandle_args *clkspec, void *data)
+scpi_of_clk_src_get(const struct of_phandle_args *clkspec, void *data)
{
struct scpi_clk *sclk;
struct scpi_clk_data *clk_data = data;
diff --git a/drivers/clk/clk-si521xx.c b/drivers/clk/clk-si521xx.c
index 4f7b74f889f1..5912bc5ad375 100644
--- a/drivers/clk/clk-si521xx.c
+++ b/drivers/clk/clk-si521xx.c
@@ -269,7 +269,7 @@ static void si521xx_diff_idx_to_reg_bit(const u16 chip_info, const int idx,
}
static struct clk_hw *
-si521xx_of_clk_get(struct of_phandle_args *clkspec, void *data)
+si521xx_of_clk_get(const struct of_phandle_args *clkspec, void *data)
{
struct si521xx *si = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c
index 6e8dd7387cfd..4acf1daabcdf 100644
--- a/drivers/clk/clk-si5341.c
+++ b/drivers/clk/clk-si5341.c
@@ -957,7 +957,7 @@ static int si5341_is_programmed_already(struct clk_si5341 *data)
}
static struct clk_hw *
-of_clk_si5341_get(struct of_phandle_args *clkspec, void *_data)
+of_clk_si5341_get(const struct of_phandle_args *clkspec, void *_data)
{
struct clk_si5341 *data = _data;
unsigned int idx = clkspec->args[1];
diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
index 4ce83c5265b8..3b325167c072 100644
--- a/drivers/clk/clk-si5351.c
+++ b/drivers/clk/clk-si5351.c
@@ -1390,7 +1390,7 @@ static int si5351_dt_parse(struct i2c_client *client,
}
static struct clk_hw *
-si53351_of_clk_get(struct of_phandle_args *clkspec, void *data)
+si53351_of_clk_get(const struct of_phandle_args *clkspec, void *data)
{
struct si5351_driver_data *drvdata = data;
unsigned int idx = clkspec->args[0];
@@ -1409,7 +1409,7 @@ static int si5351_dt_parse(struct i2c_client *client, enum si5351_variant varian
}
static struct clk_hw *
-si53351_of_clk_get(struct of_phandle_args *clkspec, void *data)
+si53351_of_clk_get(const struct of_phandle_args *clkspec, void *data)
{
return NULL;
}
diff --git a/drivers/clk/clk-sparx5.c b/drivers/clk/clk-sparx5.c
index 0fad0c1a0186..b352cdc289b6 100644
--- a/drivers/clk/clk-sparx5.c
+++ b/drivers/clk/clk-sparx5.c
@@ -229,7 +229,8 @@ static const struct clk_ops s5_pll_ops = {
.recalc_rate = s5_pll_recalc_rate,
};
-static struct clk_hw *s5_clk_hw_get(struct of_phandle_args *clkspec, void *data)
+static struct clk_hw *s5_clk_hw_get(const struct of_phandle_args *clkspec,
+ void *data)
{
struct s5_clk_data *s5_clk = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c
index 07c13ebe327d..daa21cc8851b 100644
--- a/drivers/clk/clk-stm32f4.c
+++ b/drivers/clk/clk-stm32f4.c
@@ -872,7 +872,7 @@ static int stm32f4_rcc_lookup_clk_idx(u8 primary, u8 secondary)
}
static struct clk_hw *
-stm32f4_rcc_lookup_clk(struct of_phandle_args *clkspec, void *data)
+stm32f4_rcc_lookup_clk(const struct of_phandle_args *clkspec, void *data)
{
int i = stm32f4_rcc_lookup_clk_idx(clkspec->args[0], clkspec->args[1]);
diff --git a/drivers/clk/clk-versaclock3.c b/drivers/clk/clk-versaclock3.c
index 76d7ea1964c3..257160509310 100644
--- a/drivers/clk/clk-versaclock3.c
+++ b/drivers/clk/clk-versaclock3.c
@@ -964,7 +964,7 @@ static struct vc3_hw_data clk_mux[] = {
}
};
-static struct clk_hw *vc3_of_clk_get(struct of_phandle_args *clkspec,
+static struct clk_hw *vc3_of_clk_get(const struct of_phandle_args *clkspec,
void *data)
{
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c
index 6d31cd54d7cf..9a25e96955bd 100644
--- a/drivers/clk/clk-versaclock5.c
+++ b/drivers/clk/clk-versaclock5.c
@@ -731,7 +731,7 @@ static const struct clk_ops vc5_clk_out_ops = {
.get_parent = vc5_clk_out_get_parent,
};
-static struct clk_hw *vc5_of_clk_get(struct of_phandle_args *clkspec,
+static struct clk_hw *vc5_of_clk_get(const struct of_phandle_args *clkspec,
void *data)
{
struct vc5_driver_data *vc5 = data;
diff --git a/drivers/clk/clk-versaclock7.c b/drivers/clk/clk-versaclock7.c
index f323263e32c3..8345a946c1ec 100644
--- a/drivers/clk/clk-versaclock7.c
+++ b/drivers/clk/clk-versaclock7.c
@@ -174,7 +174,7 @@ struct vc7_bank_src_map {
} src;
};
-static struct clk_hw *vc7_of_clk_get(struct of_phandle_args *clkspec,
+static struct clk_hw *vc7_of_clk_get(const struct of_phandle_args *clkspec,
void *data)
{
struct vc7_driver_data *vc7 = data;
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 2253c154a824..cfb1dfeeb329 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -342,7 +342,7 @@ static struct clk_core *clk_core_lookup(const char *name)
static int of_parse_clkspec(const struct device_node *np, int index,
const char *name, struct of_phandle_args *out_args);
static struct clk_hw *
-of_clk_get_hw_from_clkspec(struct of_phandle_args *clkspec);
+of_clk_get_hw_from_clkspec(const struct of_phandle_args *clkspec);
#else
static inline int of_parse_clkspec(const struct device_node *np, int index,
const char *name,
@@ -351,7 +351,7 @@ static inline int of_parse_clkspec(const struct device_node *np, int index,
return -ENOENT;
}
static inline struct clk_hw *
-of_clk_get_hw_from_clkspec(struct of_phandle_args *clkspec)
+of_clk_get_hw_from_clkspec(const struct of_phandle_args *clkspec)
{
return ERR_PTR(-ENOENT);
}
@@ -4818,8 +4818,8 @@ struct of_clk_provider {
struct list_head link;
struct device_node *node;
- struct clk *(*get)(struct of_phandle_args *clkspec, void *data);
- struct clk_hw *(*get_hw)(struct of_phandle_args *clkspec, void *data);
+ struct clk *(*get)(const struct of_phandle_args *clkspec, void *data);
+ struct clk_hw *(*get_hw)(const struct of_phandle_args *clkspec, void *data);
void *data;
};
@@ -4830,20 +4830,22 @@ static const struct of_device_id __clk_of_table_sentinel
static LIST_HEAD(of_clk_providers);
static DEFINE_MUTEX(of_clk_mutex);
-struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
+struct clk *of_clk_src_simple_get(const struct of_phandle_args *clkspec,
void *data)
{
return data;
}
EXPORT_SYMBOL_GPL(of_clk_src_simple_get);
-struct clk_hw *of_clk_hw_simple_get(struct of_phandle_args *clkspec, void *data)
+struct clk_hw *of_clk_hw_simple_get(const struct of_phandle_args *clkspec,
+ void *data)
{
return data;
}
EXPORT_SYMBOL_GPL(of_clk_hw_simple_get);
-struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data)
+struct clk *of_clk_src_onecell_get(const struct of_phandle_args *clkspec,
+ void *data)
{
struct clk_onecell_data *clk_data = data;
unsigned int idx = clkspec->args[0];
@@ -4858,7 +4860,7 @@ struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data)
EXPORT_SYMBOL_GPL(of_clk_src_onecell_get);
struct clk_hw *
-of_clk_hw_onecell_get(struct of_phandle_args *clkspec, void *data)
+of_clk_hw_onecell_get(const struct of_phandle_args *clkspec, void *data)
{
struct clk_hw_onecell_data *hw_data = data;
unsigned int idx = clkspec->args[0];
@@ -4881,7 +4883,7 @@ EXPORT_SYMBOL_GPL(of_clk_hw_onecell_get);
* This function is *deprecated*. Use of_clk_add_hw_provider() instead.
*/
int of_clk_add_provider(struct device_node *np,
- struct clk *(*clk_src_get)(struct of_phandle_args *clkspec,
+ struct clk *(*clk_src_get)(const struct of_phandle_args *clkspec,
void *data),
void *data)
{
@@ -4923,7 +4925,7 @@ EXPORT_SYMBOL_GPL(of_clk_add_provider);
* @data: context pointer for @get callback.
*/
int of_clk_add_hw_provider(struct device_node *np,
- struct clk_hw *(*get)(struct of_phandle_args *clkspec,
+ struct clk_hw *(*get)(const struct of_phandle_args *clkspec,
void *data),
void *data)
{
@@ -4997,7 +4999,7 @@ static struct device_node *get_clk_provider_node(struct device *dev)
* Return: 0 on success or an errno on failure.
*/
int devm_of_clk_add_hw_provider(struct device *dev,
- struct clk_hw *(*get)(struct of_phandle_args *clkspec,
+ struct clk_hw *(*get)(const struct of_phandle_args *clkspec,
void *data),
void *data)
{
@@ -5123,7 +5125,7 @@ static int of_parse_clkspec(const struct device_node *np, int index,
static struct clk_hw *
__of_clk_get_hw_from_provider(struct of_clk_provider *provider,
- struct of_phandle_args *clkspec)
+ const struct of_phandle_args *clkspec)
{
struct clk *clk;
@@ -5137,7 +5139,7 @@ __of_clk_get_hw_from_provider(struct of_clk_provider *provider,
}
static struct clk_hw *
-of_clk_get_hw_from_clkspec(struct of_phandle_args *clkspec)
+of_clk_get_hw_from_clkspec(const struct of_phandle_args *clkspec)
{
struct of_clk_provider *provider;
struct clk_hw *hw = ERR_PTR(-EPROBE_DEFER);
@@ -5166,7 +5168,7 @@ of_clk_get_hw_from_clkspec(struct of_phandle_args *clkspec)
* providers, an input is a clock specifier data structure as returned
* from the of_parse_phandle_with_args() function call.
*/
-struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec)
+struct clk *of_clk_get_from_provider(const struct of_phandle_args *clkspec)
{
struct clk_hw *hw = of_clk_get_hw_from_clkspec(clkspec);
diff --git a/drivers/clk/hisilicon/clk-hi3660-stub.c b/drivers/clk/hisilicon/clk-hi3660-stub.c
index 3a653d54bee0..1dd7fb7cfa5b 100644
--- a/drivers/clk/hisilicon/clk-hi3660-stub.c
+++ b/drivers/clk/hisilicon/clk-hi3660-stub.c
@@ -108,7 +108,7 @@ static struct hi3660_stub_clk hi3660_stub_clks[HI3660_CLK_STUB_NUM] = {
DEFINE_CLK_STUB(HI3660_CLK_STUB_DDR, 0x00040309, "clk-ddrc")
};
-static struct clk_hw *hi3660_stub_clk_hw_get(struct of_phandle_args *clkspec,
+static struct clk_hw *hi3660_stub_clk_hw_get(const struct of_phandle_args *clkspec,
void *data)
{
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.c b/drivers/clk/imx/clk-imx8qxp-lpcg.c
index d0ccaa040225..feb2e4a61b6c 100644
--- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
+++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
@@ -159,7 +159,7 @@ static const struct imx8qxp_ss_lpcg imx8qxp_ss_lsio = {
#define IMX_LPCG_MAX_CLKS 8
-static struct clk_hw *imx_lpcg_of_clk_src_get(struct of_phandle_args *clkspec,
+static struct clk_hw *imx_lpcg_of_clk_src_get(const struct of_phandle_args *clkspec,
void *data)
{
struct clk_hw_onecell_data *hw_data = data;
diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
index e48a904c0013..d357dc337741 100644
--- a/drivers/clk/imx/clk-scu.c
+++ b/drivers/clk/imx/clk-scu.c
@@ -517,7 +517,7 @@ struct clk_hw *__imx_clk_scu(struct device *dev, const char *name,
return hw;
}
-struct clk_hw *imx_scu_of_clk_src_get(struct of_phandle_args *clkspec,
+struct clk_hw *imx_scu_of_clk_src_get(const struct of_phandle_args *clkspec,
void *data)
{
unsigned int rsrc = clkspec->args[0];
diff --git a/drivers/clk/imx/clk-scu.h b/drivers/clk/imx/clk-scu.h
index af7b697f51ca..38db6a1905d0 100644
--- a/drivers/clk/imx/clk-scu.h
+++ b/drivers/clk/imx/clk-scu.h
@@ -27,7 +27,7 @@ extern const struct imx_clk_scu_rsrc_table imx_clk_scu_rsrc_imx8qm;
int imx_clk_scu_init(struct device_node *np,
const struct imx_clk_scu_rsrc_table *data);
-struct clk_hw *imx_scu_of_clk_src_get(struct of_phandle_args *clkspec,
+struct clk_hw *imx_scu_of_clk_src_get(const struct of_phandle_args *clkspec,
void *data);
struct clk_hw *imx_clk_scu_alloc_dev(const char *name,
const char * const *parents,
diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
index 35fe197dd303..ba27fb22f973 100644
--- a/drivers/clk/keystone/sci-clk.c
+++ b/drivers/clk/keystone/sci-clk.c
@@ -375,7 +375,8 @@ static int _cmp_sci_clk(const void *a, const void *b)
* when a corresponding of_clk_get call is executed. Returns a pointer
* to the TI SCI hw clock struct, or ERR_PTR value in failure.
*/
-static struct clk_hw *sci_clk_get(struct of_phandle_args *clkspec, void *data)
+static struct clk_hw *sci_clk_get(const struct of_phandle_args *clkspec,
+ void *data)
{
struct sci_clk_provider *provider = data;
struct sci_clk **clk;
diff --git a/drivers/clk/meson/meson-clkc-utils.c b/drivers/clk/meson/meson-clkc-utils.c
index 7370644e8092..904b482bf47b 100644
--- a/drivers/clk/meson/meson-clkc-utils.c
+++ b/drivers/clk/meson/meson-clkc-utils.c
@@ -8,7 +8,8 @@
#include <linux/module.h>
#include "meson-clkc-utils.h"
-struct clk_hw *meson_clk_hw_get(struct of_phandle_args *clkspec, void *clk_hw_data)
+struct clk_hw *meson_clk_hw_get(const struct of_phandle_args *clkspec,
+ void *clk_hw_data)
{
const struct meson_clk_hw_data *data = clk_hw_data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/meson/meson-clkc-utils.h b/drivers/clk/meson/meson-clkc-utils.h
index fe6f40728949..3889ead76a07 100644
--- a/drivers/clk/meson/meson-clkc-utils.h
+++ b/drivers/clk/meson/meson-clkc-utils.h
@@ -14,6 +14,7 @@ struct meson_clk_hw_data {
unsigned int num;
};
-struct clk_hw *meson_clk_hw_get(struct of_phandle_args *clkspec, void *clk_hw_data);
+struct clk_hw *meson_clk_hw_get(const struct of_phandle_args *clkspec,
+ void *clk_hw_data);
#endif
diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c
index 785dbede4835..19cd62152175 100644
--- a/drivers/clk/mvebu/common.c
+++ b/drivers/clk/mvebu/common.c
@@ -199,7 +199,7 @@ struct clk_gating_ctrl {
static struct clk_gating_ctrl *ctrl;
static struct clk *clk_gating_get_src(
- struct of_phandle_args *clkspec, void *data)
+ const struct of_phandle_args *clkspec, void *data)
{
int n;
diff --git a/drivers/clk/mvebu/cp110-system-controller.c b/drivers/clk/mvebu/cp110-system-controller.c
index 03c59bf22106..8f6e2dd3e044 100644
--- a/drivers/clk/mvebu/cp110-system-controller.c
+++ b/drivers/clk/mvebu/cp110-system-controller.c
@@ -192,7 +192,7 @@ static void cp110_unregister_gate(struct clk_hw *hw)
kfree(to_cp110_gate_clk(hw));
}
-static struct clk_hw *cp110_of_clk_get(struct of_phandle_args *clkspec,
+static struct clk_hw *cp110_of_clk_get(const struct of_phandle_args *clkspec,
void *data)
{
struct clk_hw_onecell_data *clk_data = data;
diff --git a/drivers/clk/mvebu/kirkwood.c b/drivers/clk/mvebu/kirkwood.c
index 8bc893df4736..b2b9a7a7a8fb 100644
--- a/drivers/clk/mvebu/kirkwood.c
+++ b/drivers/clk/mvebu/kirkwood.c
@@ -269,7 +269,7 @@ static const struct clk_muxing_soc_desc kirkwood_mux_desc[] __initconst = {
};
static struct clk *clk_muxing_get_src(
- struct of_phandle_args *clkspec, void *data)
+ const struct of_phandle_args *clkspec, void *data)
{
struct clk_muxing_ctrl *ctrl = (struct clk_muxing_ctrl *)data;
int n;
diff --git a/drivers/clk/nxp/clk-lpc18xx-ccu.c b/drivers/clk/nxp/clk-lpc18xx-ccu.c
index ddb28b38f549..3d8299b7e790 100644
--- a/drivers/clk/nxp/clk-lpc18xx-ccu.c
+++ b/drivers/clk/nxp/clk-lpc18xx-ccu.c
@@ -109,7 +109,7 @@ static struct lpc18xx_clk_branch clk_branches[] = {
{"base_sdio_clk", "sdio", CLK_SDIO, 0},
};
-static struct clk *lpc18xx_ccu_branch_clk_get(struct of_phandle_args *clkspec,
+static struct clk *lpc18xx_ccu_branch_clk_get(const struct of_phandle_args *clkspec,
void *data)
{
struct lpc18xx_branch_clk_data *clk_data = data;
diff --git a/drivers/clk/qcom/clk-rpm.c b/drivers/clk/qcom/clk-rpm.c
index 745026ef4d9c..b7e048237bc0 100644
--- a/drivers/clk/qcom/clk-rpm.c
+++ b/drivers/clk/qcom/clk-rpm.c
@@ -514,7 +514,7 @@ static const struct of_device_id rpm_clk_match_table[] = {
};
MODULE_DEVICE_TABLE(of, rpm_clk_match_table);
-static struct clk_hw *qcom_rpm_clk_hw_get(struct of_phandle_args *clkspec,
+static struct clk_hw *qcom_rpm_clk_hw_get(const struct of_phandle_args *clkspec,
void *data)
{
struct rpm_cc *rcc = data;
diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
index bb82abeed88f..8c2c6aa3a793 100644
--- a/drivers/clk/qcom/clk-rpmh.c
+++ b/drivers/clk/qcom/clk-rpmh.c
@@ -793,7 +793,7 @@ static const struct clk_rpmh_desc clk_rpmh_x1e80100 = {
.num_clks = ARRAY_SIZE(x1e80100_rpmh_clocks),
};
-static struct clk_hw *of_clk_rpmh_hw_get(struct of_phandle_args *clkspec,
+static struct clk_hw *of_clk_rpmh_hw_get(const struct of_phandle_args *clkspec,
void *data)
{
struct clk_rpmh_desc *rpmh = data;
diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c
index 8602c02047d0..5d7e0cd2d450 100644
--- a/drivers/clk/qcom/clk-smd-rpm.c
+++ b/drivers/clk/qcom/clk-smd-rpm.c
@@ -1232,7 +1232,7 @@ static const struct of_device_id rpm_smd_clk_match_table[] = {
};
MODULE_DEVICE_TABLE(of, rpm_smd_clk_match_table);
-static struct clk_hw *qcom_smdrpm_clk_hw_get(struct of_phandle_args *clkspec,
+static struct clk_hw *qcom_smdrpm_clk_hw_get(const struct of_phandle_args *clkspec,
void *data)
{
const struct rpm_smd_clk_desc *desc = data;
diff --git a/drivers/clk/qcom/clk-spmi-pmic-div.c b/drivers/clk/qcom/clk-spmi-pmic-div.c
index f394031eb0e5..3f65aead519d 100644
--- a/drivers/clk/qcom/clk-spmi-pmic-div.c
+++ b/drivers/clk/qcom/clk-spmi-pmic-div.c
@@ -181,7 +181,7 @@ struct spmi_pmic_div_clk_cc {
};
static struct clk_hw *
-spmi_pmic_div_clk_hw_get(struct of_phandle_args *clkspec, void *data)
+spmi_pmic_div_clk_hw_get(const struct of_phandle_args *clkspec, void *data)
{
struct spmi_pmic_div_clk_cc *cc = data;
int idx = clkspec->args[0] - 1; /* Start at 1 instead of 0 */
diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c
index 75f09e6e057e..0ae6f8ea607a 100644
--- a/drivers/clk/qcom/common.c
+++ b/drivers/clk/qcom/common.c
@@ -220,7 +220,7 @@ static void qcom_cc_drop_protected(struct device *dev, struct qcom_cc *cc)
}
}
-static struct clk_hw *qcom_cc_clk_hw_get(struct of_phandle_args *clkspec,
+static struct clk_hw *qcom_cc_clk_hw_get(const struct of_phandle_args *clkspec,
void *data)
{
struct qcom_cc *cc = data;
diff --git a/drivers/clk/qcom/krait-cc.c b/drivers/clk/qcom/krait-cc.c
index ae325f4e1047..181f4096a506 100644
--- a/drivers/clk/qcom/krait-cc.c
+++ b/drivers/clk/qcom/krait-cc.c
@@ -324,7 +324,7 @@ static struct clk_hw *krait_add_clks(struct device *dev, int id, bool unique_aux
return pri_mux;
}
-static struct clk *krait_of_get(struct of_phandle_args *clkspec, void *data)
+static struct clk *krait_of_get(const struct of_phandle_args *clkspec, void *data)
{
unsigned int idx = clkspec->args[0];
struct clk **clks = data;
diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c
index c1348e2d450c..f8ea88663fca 100644
--- a/drivers/clk/renesas/r9a06g032-clocks.c
+++ b/drivers/clk/renesas/r9a06g032-clocks.c
@@ -733,7 +733,7 @@ struct r9a06g032_clk_gate {
#define to_r9a06g032_gate(_hw) container_of(_hw, struct r9a06g032_clk_gate, hw)
-static int create_add_module_clock(struct of_phandle_args *clkspec,
+static int create_add_module_clock(const struct of_phandle_args *clkspec,
struct device *dev)
{
struct clk *clk;
diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c
index 1b421b809796..c172444ee766 100644
--- a/drivers/clk/renesas/renesas-cpg-mssr.c
+++ b/drivers/clk/renesas/renesas-cpg-mssr.c
@@ -273,7 +273,7 @@ static const struct clk_ops cpg_mstp_clock_ops = {
};
static
-struct clk *cpg_mssr_clk_src_twocell_get(struct of_phandle_args *clkspec,
+struct clk *cpg_mssr_clk_src_twocell_get(const struct of_phandle_args *clkspec,
void *data)
{
unsigned int clkidx = clkspec->args[1];
diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cpg.c
index 3d2daa4ba2a4..7464a298b2e5 100644
--- a/drivers/clk/renesas/rzg2l-cpg.c
+++ b/drivers/clk/renesas/rzg2l-cpg.c
@@ -1052,7 +1052,7 @@ rzg2l_cpg_pll_clk_register(const struct cpg_core_clk *core,
}
static struct clk
-*rzg2l_cpg_clk_src_twocell_get(struct of_phandle_args *clkspec,
+*rzg2l_cpg_clk_src_twocell_get(const struct of_phandle_args *clkspec,
void *data)
{
unsigned int clkidx = clkspec->args[1];
diff --git a/drivers/clk/starfive/clk-starfive-jh7100-audio.c b/drivers/clk/starfive/clk-starfive-jh7100-audio.c
index 1fcf4e62f347..79feba75ea43 100644
--- a/drivers/clk/starfive/clk-starfive-jh7100-audio.c
+++ b/drivers/clk/starfive/clk-starfive-jh7100-audio.c
@@ -84,7 +84,8 @@ static const struct jh71x0_clk_data jh7100_audclk_data[] = {
JH7100_AUDCLK_AUDIO_12288),
};
-static struct clk_hw *jh7100_audclk_get(struct of_phandle_args *clkspec, void *data)
+static struct clk_hw *jh7100_audclk_get(const struct of_phandle_args *clkspec,
+ void *data)
{
struct jh71x0_clk_priv *priv = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/starfive/clk-starfive-jh7100.c b/drivers/clk/starfive/clk-starfive-jh7100.c
index 03f6f26a15d8..b7e43f4847d2 100644
--- a/drivers/clk/starfive/clk-starfive-jh7100.c
+++ b/drivers/clk/starfive/clk-starfive-jh7100.c
@@ -267,7 +267,8 @@ static const struct jh71x0_clk_data jh7100_clk_data[] __initconst = {
JH71X0_GATE(JH7100_CLK_SYSERR_APB, "syserr_apb", 0, JH7100_CLK_APB2_BUS),
};
-static struct clk_hw *jh7100_clk_get(struct of_phandle_args *clkspec, void *data)
+static struct clk_hw *jh7100_clk_get(const struct of_phandle_args *clkspec,
+ void *data)
{
struct jh71x0_clk_priv *priv = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/starfive/clk-starfive-jh7110-aon.c b/drivers/clk/starfive/clk-starfive-jh7110-aon.c
index 418efdad719b..d05da683a544 100644
--- a/drivers/clk/starfive/clk-starfive-jh7110-aon.c
+++ b/drivers/clk/starfive/clk-starfive-jh7110-aon.c
@@ -54,7 +54,8 @@ static const struct jh71x0_clk_data jh7110_aonclk_data[] = {
JH71X0_GATE(JH7110_AONCLK_RTC_CAL, "rtc_cal", 0, JH7110_AONCLK_OSC),
};
-static struct clk_hw *jh7110_aonclk_get(struct of_phandle_args *clkspec, void *data)
+static struct clk_hw *jh7110_aonclk_get(const struct of_phandle_args *clkspec,
+ void *data)
{
struct jh71x0_clk_priv *priv = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/starfive/clk-starfive-jh7110-isp.c b/drivers/clk/starfive/clk-starfive-jh7110-isp.c
index 929b8788279e..518c4a8d4200 100644
--- a/drivers/clk/starfive/clk-starfive-jh7110-isp.c
+++ b/drivers/clk/starfive/clk-starfive-jh7110-isp.c
@@ -75,7 +75,8 @@ static inline int jh7110_isp_top_rst_init(struct jh71x0_clk_priv *priv)
return reset_control_deassert(top_rsts);
}
-static struct clk_hw *jh7110_ispclk_get(struct of_phandle_args *clkspec, void *data)
+static struct clk_hw *jh7110_ispclk_get(const struct of_phandle_args *clkspec,
+ void *data)
{
struct jh71x0_clk_priv *priv = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/starfive/clk-starfive-jh7110-pll.c b/drivers/clk/starfive/clk-starfive-jh7110-pll.c
index 3598390e8fd0..3c53459c554b 100644
--- a/drivers/clk/starfive/clk-starfive-jh7110-pll.c
+++ b/drivers/clk/starfive/clk-starfive-jh7110-pll.c
@@ -442,7 +442,8 @@ static const struct clk_ops jh7110_pll_ops = {
.debug_init = jh7110_pll_debug_init,
};
-static struct clk_hw *jh7110_pll_get(struct of_phandle_args *clkspec, void *data)
+static struct clk_hw *jh7110_pll_get(const struct of_phandle_args *clkspec,
+ void *data)
{
struct jh7110_pll_priv *priv = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/starfive/clk-starfive-jh7110-stg.c b/drivers/clk/starfive/clk-starfive-jh7110-stg.c
index dafcb7190592..0fba5de830e9 100644
--- a/drivers/clk/starfive/clk-starfive-jh7110-stg.c
+++ b/drivers/clk/starfive/clk-starfive-jh7110-stg.c
@@ -75,7 +75,8 @@ static const struct jh71x0_clk_data jh7110_stgclk_data[] = {
JH71X0_GATE(JH7110_STGCLK_DMA1P_AHB, "dma1p_ahb", 0, JH7110_STGCLK_STG_AXIAHB),
};
-static struct clk_hw *jh7110_stgclk_get(struct of_phandle_args *clkspec, void *data)
+static struct clk_hw *jh7110_stgclk_get(const struct of_phandle_args *clkspec,
+ void *data)
{
struct jh71x0_clk_priv *priv = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/starfive/clk-starfive-jh7110-sys.c b/drivers/clk/starfive/clk-starfive-jh7110-sys.c
index 8f5e5abfa178..6ea25b959091 100644
--- a/drivers/clk/starfive/clk-starfive-jh7110-sys.c
+++ b/drivers/clk/starfive/clk-starfive-jh7110-sys.c
@@ -323,7 +323,8 @@ static const struct jh71x0_clk_data jh7110_sysclk_data[] __initconst = {
JH7110_SYSCLK_OSC),
};
-static struct clk_hw *jh7110_sysclk_get(struct of_phandle_args *clkspec, void *data)
+static struct clk_hw *jh7110_sysclk_get(const struct of_phandle_args *clkspec,
+ void *data)
{
struct jh71x0_clk_priv *priv = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/starfive/clk-starfive-jh7110-vout.c b/drivers/clk/starfive/clk-starfive-jh7110-vout.c
index 10cc1ec43925..7f69a4d75126 100644
--- a/drivers/clk/starfive/clk-starfive-jh7110-vout.c
+++ b/drivers/clk/starfive/clk-starfive-jh7110-vout.c
@@ -80,7 +80,8 @@ static int jh7110_vout_top_rst_init(struct jh71x0_clk_priv *priv)
return reset_control_deassert(top_rst);
}
-static struct clk_hw *jh7110_voutclk_get(struct of_phandle_args *clkspec, void *data)
+static struct clk_hw *jh7110_voutclk_get(const struct of_phandle_args *clkspec,
+ void *data)
{
struct jh71x0_clk_priv *priv = data;
unsigned int idx = clkspec->args[0];
diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c
index 7bfba0afd778..9c53ab9b8a00 100644
--- a/drivers/clk/tegra/clk-bpmp.c
+++ b/drivers/clk/tegra/clk-bpmp.c
@@ -654,7 +654,7 @@ static void tegra_bpmp_unregister_clocks(struct tegra_bpmp *bpmp)
clk_hw_unregister(&bpmp->clocks[i]->hw);
}
-static struct clk_hw *tegra_bpmp_clk_of_xlate(struct of_phandle_args *clkspec,
+static struct clk_hw *tegra_bpmp_clk_of_xlate(const struct of_phandle_args *clkspec,
void *data)
{
unsigned int id = clkspec->args[0], i;
diff --git a/drivers/clk/tegra/clk-tegra124.c b/drivers/clk/tegra/clk-tegra124.c
index 6c46592d794e..87f1e5bc5c0e 100644
--- a/drivers/clk/tegra/clk-tegra124.c
+++ b/drivers/clk/tegra/clk-tegra124.c
@@ -1502,7 +1502,7 @@ static void __init tegra124_132_clock_init_pre(struct device_node *np)
writel(plld_base, clk_base + PLLD_BASE);
}
-static struct clk *tegra124_clk_src_onecell_get(struct of_phandle_args *clkspec,
+static struct clk *tegra124_clk_src_onecell_get(const struct of_phandle_args *clkspec,
void *data)
{
struct clk_hw *hw;
diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c
index 2c58ce25af75..8a7e17d3379a 100644
--- a/drivers/clk/tegra/clk-tegra20.c
+++ b/drivers/clk/tegra/clk-tegra20.c
@@ -1069,7 +1069,7 @@ static const struct of_device_id pmc_match[] __initconst = {
static bool tegra20_car_initialized;
-static struct clk *tegra20_clk_src_onecell_get(struct of_phandle_args *clkspec,
+static struct clk *tegra20_clk_src_onecell_get(const struct of_phandle_args *clkspec,
void *data)
{
struct clk_hw *parent_hw;
diff --git a/drivers/clk/tegra/clk-tegra30.c b/drivers/clk/tegra/clk-tegra30.c
index 82a8cb9545eb..4317c68cdeb4 100644
--- a/drivers/clk/tegra/clk-tegra30.c
+++ b/drivers/clk/tegra/clk-tegra30.c
@@ -1273,7 +1273,7 @@ static struct tegra_audio_clk_info tegra30_audio_plls[] = {
static bool tegra30_car_initialized;
-static struct clk *tegra30_clk_src_onecell_get(struct of_phandle_args *clkspec,
+static struct clk *tegra30_clk_src_onecell_get(const struct of_phandle_args *clkspec,
void *data)
{
struct clk_hw *hw;
diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
index 607e34d8e289..31df051c116c 100644
--- a/drivers/clk/ti/clkctrl.c
+++ b/drivers/clk/ti/clkctrl.c
@@ -221,7 +221,7 @@ static const struct clk_ops omap4_clkctrl_clk_ops = {
.init = omap2_init_clk_clkdm,
};
-static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec,
+static struct clk_hw *_ti_omap4_clkctrl_xlate(const struct of_phandle_args *clkspec,
void *data)
{
struct omap_clkctrl_provider *provider = data;
diff --git a/drivers/clk/ux500/u8500_of_clk.c b/drivers/clk/ux500/u8500_of_clk.c
index 8e2f6c65db2a..aba91ca5ca07 100644
--- a/drivers/clk/ux500/u8500_of_clk.c
+++ b/drivers/clk/ux500/u8500_of_clk.c
@@ -26,7 +26,7 @@ static struct clk_hw *clkout_clk[2];
#define PRCC_KCLK_STORE(clk, base, bit) \
prcc_kclk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] = clk
-static struct clk *ux500_twocell_get(struct of_phandle_args *clkspec,
+static struct clk *ux500_twocell_get(const struct of_phandle_args *clkspec,
void *data)
{
struct clk **clk_data = data;
@@ -71,7 +71,7 @@ static const char * const u8500_clkout_parents[] = {
"clk009",
};
-static struct clk_hw *ux500_clkout_get(struct of_phandle_args *clkspec,
+static struct clk_hw *ux500_clkout_get(const struct of_phandle_args *clkspec,
void *data)
{
u32 id, source, divider;
diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c
index 45adac1b4630..5fd21c13f546 100644
--- a/drivers/clk/versatile/clk-sp810.c
+++ b/drivers/clk/versatile/clk-sp810.c
@@ -68,7 +68,7 @@ static const struct clk_ops clk_sp810_timerclken_ops = {
.set_parent = clk_sp810_timerclken_set_parent,
};
-static struct clk *clk_sp810_timerclken_of_get(struct of_phandle_args *clkspec,
+static struct clk *clk_sp810_timerclken_of_get(const struct of_phandle_args *clkspec,
void *data)
{
struct clk_sp810 *sp810 = data;
diff --git a/drivers/media/platform/ti/omap3isp/isp.c b/drivers/media/platform/ti/omap3isp/isp.c
index 1cda23244c7b..e2c78f9ab797 100644
--- a/drivers/media/platform/ti/omap3isp/isp.c
+++ b/drivers/media/platform/ti/omap3isp/isp.c
@@ -281,7 +281,8 @@ static const struct clk_ops isp_xclk_ops = {
static const char *isp_xclk_parent_name = "cam_mclk";
-static struct clk *isp_xclk_src_get(struct of_phandle_args *clkspec, void *data)
+static struct clk *isp_xclk_src_get(const struct of_phandle_args *clkspec,
+ void *data)
{
unsigned int idx = clkspec->args[0];
struct isp_device *isp = data;
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index b6908a03da58..46a77df32dff 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -3136,7 +3136,8 @@ static const struct clk_ops qmp_dp_link_clk_ops = {
.recalc_rate = qmp_dp_link_clk_recalc_rate,
};
-static struct clk_hw *qmp_dp_clks_hw_get(struct of_phandle_args *clkspec, void *data)
+static struct clk_hw *qmp_dp_clks_hw_get(const struct of_phandle_args *clkspec,
+ void *data)
{
struct qmp_combo *qmp = data;
unsigned int idx = clkspec->args[0];
@@ -3177,7 +3178,8 @@ static int phy_dp_clks_register(struct qmp_combo *qmp, struct device_node *np)
return 0;
}
-static struct clk_hw *qmp_combo_clk_hw_get(struct of_phandle_args *clkspec, void *data)
+static struct clk_hw *qmp_combo_clk_hw_get(const struct of_phandle_args *clkspec,
+ void *data)
{
struct qmp_combo *qmp = data;
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 1293c38ddb7f..d58313368924 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -1532,25 +1532,25 @@ struct clk_hw_onecell_data {
#ifdef CONFIG_OF
int of_clk_add_provider(struct device_node *np,
- struct clk *(*clk_src_get)(struct of_phandle_args *args,
+ struct clk *(*clk_src_get)(const struct of_phandle_args *args,
void *data),
void *data);
int of_clk_add_hw_provider(struct device_node *np,
- struct clk_hw *(*get)(struct of_phandle_args *clkspec,
+ struct clk_hw *(*get)(const struct of_phandle_args *clkspec,
void *data),
void *data);
int devm_of_clk_add_hw_provider(struct device *dev,
- struct clk_hw *(*get)(struct of_phandle_args *clkspec,
+ struct clk_hw *(*get)(const struct of_phandle_args *clkspec,
void *data),
void *data);
void of_clk_del_provider(struct device_node *np);
-struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
+struct clk *of_clk_src_simple_get(const struct of_phandle_args *clkspec,
void *data);
-struct clk_hw *of_clk_hw_simple_get(struct of_phandle_args *clkspec,
+struct clk_hw *of_clk_hw_simple_get(const struct of_phandle_args *clkspec,
void *data);
-struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data);
-struct clk_hw *of_clk_hw_onecell_get(struct of_phandle_args *clkspec,
+struct clk *of_clk_src_onecell_get(const struct of_phandle_args *clkspec, void *data);
+struct clk_hw *of_clk_hw_onecell_get(const struct of_phandle_args *clkspec,
void *data);
int of_clk_parent_fill(struct device_node *np, const char **parents,
unsigned int size);
@@ -1560,21 +1560,21 @@ int of_clk_detect_critical(struct device_node *np, int index,
#else /* !CONFIG_OF */
static inline int of_clk_add_provider(struct device_node *np,
- struct clk *(*clk_src_get)(struct of_phandle_args *args,
+ struct clk *(*clk_src_get)(const struct of_phandle_args *args,
void *data),
void *data)
{
return 0;
}
static inline int of_clk_add_hw_provider(struct device_node *np,
- struct clk_hw *(*get)(struct of_phandle_args *clkspec,
+ struct clk_hw *(*get)(const struct of_phandle_args *clkspec,
void *data),
void *data)
{
return 0;
}
static inline int devm_of_clk_add_hw_provider(struct device *dev,
- struct clk_hw *(*get)(struct of_phandle_args *clkspec,
+ struct clk_hw *(*get)(const struct of_phandle_args *clkspec,
void *data),
void *data)
{
@@ -1583,22 +1583,22 @@ static inline int devm_of_clk_add_hw_provider(struct device *dev,
static inline void of_clk_del_provider(struct device_node *np) {}
static inline struct clk *of_clk_src_simple_get(
- struct of_phandle_args *clkspec, void *data)
+ const struct of_phandle_args *clkspec, void *data)
{
return ERR_PTR(-ENOENT);
}
static inline struct clk_hw *
-of_clk_hw_simple_get(struct of_phandle_args *clkspec, void *data)
+of_clk_hw_simple_get(const struct of_phandle_args *clkspec, void *data)
{
return ERR_PTR(-ENOENT);
}
static inline struct clk *of_clk_src_onecell_get(
- struct of_phandle_args *clkspec, void *data)
+ const struct of_phandle_args *clkspec, void *data)
{
return ERR_PTR(-ENOENT);
}
static inline struct clk_hw *
-of_clk_hw_onecell_get(struct of_phandle_args *clkspec, void *data)
+of_clk_hw_onecell_get(const struct of_phandle_args *clkspec, void *data)
{
return ERR_PTR(-ENOENT);
}
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 06f1b292f8a0..8e3c44ff89da 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -1141,7 +1141,7 @@ static inline struct clk *clk_get_optional(struct device *dev, const char *id)
#if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
struct clk *of_clk_get(struct device_node *np, int index);
struct clk *of_clk_get_by_name(struct device_node *np, const char *name);
-struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec);
+struct clk *of_clk_get_from_provider(const struct of_phandle_args *clkspec);
#else
static inline struct clk *of_clk_get(struct device_node *np, int index)
{
@@ -1152,7 +1152,7 @@ static inline struct clk *of_clk_get_by_name(struct device_node *np,
{
return ERR_PTR(-ENOENT);
}
-static inline struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec)
+static inline struct clk *of_clk_get_from_provider(const struct of_phandle_args *clkspec)
{
return ERR_PTR(-ENOENT);
}
diff --git a/sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c b/sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c
index e758411603be..b846707baa89 100644
--- a/sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c
+++ b/sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c
@@ -106,7 +106,7 @@ static const struct clk_ops clk_vote_q6dsp_ops = {
};
-static struct clk_hw *q6dsp_of_clk_hw_get(struct of_phandle_args *clkspec,
+static struct clk_hw *q6dsp_of_clk_hw_get(const struct of_phandle_args *clkspec,
void *data)
{
struct q6dsp_cc *cc = data;
--
2.34.1
7
10

[PATCH AUTOSEL 5.10 04/16] ASoC: codecs: wcd934x: drop unneeded regulator include
by Sasha Levin 18 Feb '24
by Sasha Levin 18 Feb '24
18 Feb '24
From: Krzysztof Kozlowski <krzysztof.kozlowski(a)linaro.org>
[ Upstream commit 35314e39dabcfb256832654ad0e856a9fba744bd ]
Driver does not use any regulator code, so drop redundant include of
regulator/consumer.h header.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)linaro.org>
Link: https://msgid.link/r/20240117151208.1219755-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie(a)kernel.org>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
---
sound/soc/codecs/wcd934x.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c
index 104751ac6cd1..dbed3a646524 100644
--- a/sound/soc/codecs/wcd934x.c
+++ b/sound/soc/codecs/wcd934x.c
@@ -13,7 +13,6 @@
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
-#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/slimbus.h>
#include <sound/pcm_params.h>
--
2.43.0
2
1