]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
clk: qcom: Add SM6115 LPASSCC
authorKonrad Dybcio <konrad.dybcio@linaro.org>
Thu, 12 Dec 2024 00:25:51 +0000 (00:25 +0000)
committerBjorn Andersson <andersson@kernel.org>
Wed, 8 Jan 2025 02:29:39 +0000 (20:29 -0600)
SM6115 (and its derivatives or similar SoCs) has an LPASS clock
controller block which provides audio-related resets.

Add the required code to support them.

[alexey.klimov] fixed compilation errors after rebase,
slightly changed the commit message

Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
Link: https://lore.kernel.org/r/20241212002551.2902954-3-alexey.klimov@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/clk/qcom/Kconfig
drivers/clk/qcom/Makefile
drivers/clk/qcom/lpasscc-sm6115.c [new file with mode: 0644]

index 2daff198aeb3fc860d754bfbdffdcd8027592052..f2e207e36907bf20df6909711ee478ff2bbf7e6e 100644 (file)
@@ -1278,6 +1278,15 @@ config SM_GPUCC_8650
          Say Y if you want to support graphics controller devices and
          functionality such as 3D graphics.
 
+config SM_LPASSCC_6115
+       tristate "SM6115 Low Power Audio Subsystem (LPASS) Clock Controller"
+       depends on ARM64 || COMPILE_TEST
+       select SM_GCC_6115
+       help
+         Support for the LPASS clock controller on SM6115 devices.
+         Say Y if you want to toggle LPASS-adjacent resets within
+         this clock controller to reset the LPASS subsystem.
+
 config SM_TCSRCC_8550
        tristate "SM8550 TCSR Clock Controller"
        depends on ARM64 || COMPILE_TEST
index 6665049cb8c89bf04128d701c1b1822a3a51f2f8..0db2f98bcb3e0b3d2be73a43cbad853c82ec4519 100644 (file)
@@ -159,6 +159,7 @@ obj-$(CONFIG_SM_GPUCC_8350) += gpucc-sm8350.o
 obj-$(CONFIG_SM_GPUCC_8450) += gpucc-sm8450.o
 obj-$(CONFIG_SM_GPUCC_8550) += gpucc-sm8550.o
 obj-$(CONFIG_SM_GPUCC_8650) += gpucc-sm8650.o
+obj-$(CONFIG_SM_LPASSCC_6115) += lpasscc-sm6115.o
 obj-$(CONFIG_SM_TCSRCC_8550) += tcsrcc-sm8550.o
 obj-$(CONFIG_SM_TCSRCC_8650) += tcsrcc-sm8650.o
 obj-$(CONFIG_SM_TCSRCC_8750) += tcsrcc-sm8750.o
diff --git a/drivers/clk/qcom/lpasscc-sm6115.c b/drivers/clk/qcom/lpasscc-sm6115.c
new file mode 100644 (file)
index 0000000..8ffdab7
--- /dev/null
@@ -0,0 +1,85 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2022, 2023 Linaro Limited
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+
+#include <dt-bindings/clock/qcom,sm6115-lpasscc.h>
+
+#include "common.h"
+#include "reset.h"
+
+static const struct qcom_reset_map lpass_audiocc_sm6115_resets[] = {
+       [LPASS_AUDIO_SWR_RX_CGCR] =  { .reg = 0x98, .bit = 1, .udelay = 500 },
+};
+
+static struct regmap_config lpass_audiocc_sm6115_regmap_config = {
+       .reg_bits = 32,
+       .reg_stride = 4,
+       .val_bits = 32,
+       .name = "lpass-audio-csr",
+       .max_register = 0x1000,
+};
+
+static const struct qcom_cc_desc lpass_audiocc_sm6115_reset_desc = {
+       .config = &lpass_audiocc_sm6115_regmap_config,
+       .resets = lpass_audiocc_sm6115_resets,
+       .num_resets = ARRAY_SIZE(lpass_audiocc_sm6115_resets),
+};
+
+static const struct qcom_reset_map lpasscc_sm6115_resets[] = {
+       [LPASS_SWR_TX_CONFIG_CGCR] = { .reg = 0x100, .bit = 1, .udelay = 500 },
+};
+
+static struct regmap_config lpasscc_sm6115_regmap_config = {
+       .reg_bits = 32,
+       .reg_stride = 4,
+       .val_bits = 32,
+       .name = "lpass-tcsr",
+       .max_register = 0x1000,
+};
+
+static const struct qcom_cc_desc lpasscc_sm6115_reset_desc = {
+       .config = &lpasscc_sm6115_regmap_config,
+       .resets = lpasscc_sm6115_resets,
+       .num_resets = ARRAY_SIZE(lpasscc_sm6115_resets),
+};
+
+static const struct of_device_id lpasscc_sm6115_match_table[] = {
+       {
+               .compatible = "qcom,sm6115-lpassaudiocc",
+               .data = &lpass_audiocc_sm6115_reset_desc,
+       }, {
+               .compatible = "qcom,sm6115-lpasscc",
+               .data = &lpasscc_sm6115_reset_desc,
+       },
+       { },
+};
+MODULE_DEVICE_TABLE(of, lpasscc_sm6115_match_table);
+
+static int lpasscc_sm6115_probe(struct platform_device *pdev)
+{
+       const struct qcom_cc_desc *desc = of_device_get_match_data(&pdev->dev);
+
+       return qcom_cc_probe_by_index(pdev, 0, desc);
+}
+
+static struct platform_driver lpasscc_sm6115_driver = {
+       .probe = lpasscc_sm6115_probe,
+       .driver = {
+               .name = "lpasscc-sm6115",
+               .of_match_table = lpasscc_sm6115_match_table,
+       },
+};
+
+module_platform_driver(lpasscc_sm6115_driver);
+
+MODULE_DESCRIPTION("QTI LPASSCC SM6115 Driver");
+MODULE_LICENSE("GPL");