1d0756868SSrinivas Kandagatla // SPDX-License-Identifier: GPL-2.0 2d0756868SSrinivas Kandagatla // Copyright (c) 2021, Linaro Limited 3d0756868SSrinivas Kandagatla 4d0756868SSrinivas Kandagatla #include <linux/err.h> 5d0756868SSrinivas Kandagatla #include <linux/init.h> 6d0756868SSrinivas Kandagatla #include <linux/clk-provider.h> 7d0756868SSrinivas Kandagatla #include <linux/module.h> 8d0756868SSrinivas Kandagatla #include <linux/device.h> 9d0756868SSrinivas Kandagatla #include <linux/platform_device.h> 10d0756868SSrinivas Kandagatla #include <dt-bindings/sound/qcom,q6dsp-lpass-ports.h> 11d0756868SSrinivas Kandagatla #include "q6dsp-lpass-clocks.h" 12d0756868SSrinivas Kandagatla #include "q6prm.h" 13d0756868SSrinivas Kandagatla 14d0756868SSrinivas Kandagatla #define Q6PRM_CLK(id) { \ 15d0756868SSrinivas Kandagatla .clk_id = id, \ 16d0756868SSrinivas Kandagatla .q6dsp_clk_id = Q6PRM_##id, \ 17d0756868SSrinivas Kandagatla .name = #id, \ 18d0756868SSrinivas Kandagatla .rate = 19200000, \ 19d0756868SSrinivas Kandagatla } 20d0756868SSrinivas Kandagatla 21d0756868SSrinivas Kandagatla static const struct q6dsp_clk_init q6prm_clks[] = { 22d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_PRI_MI2S_IBIT), 23d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_PRI_MI2S_EBIT), 24d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_SEC_MI2S_IBIT), 25d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_SEC_MI2S_EBIT), 26d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_TER_MI2S_IBIT), 27d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_TER_MI2S_EBIT), 28d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_QUAD_MI2S_IBIT), 29d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_QUAD_MI2S_EBIT), 30d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_SPEAKER_I2S_IBIT), 31d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_SPEAKER_I2S_EBIT), 32d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_SPEAKER_I2S_OSR), 33d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_QUI_MI2S_IBIT), 34d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_QUI_MI2S_EBIT), 35d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_SEN_MI2S_IBIT), 36d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_SEN_MI2S_EBIT), 37d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_INT0_MI2S_IBIT), 38d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_INT1_MI2S_IBIT), 39d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_INT2_MI2S_IBIT), 40d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_INT3_MI2S_IBIT), 41d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_INT4_MI2S_IBIT), 42d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_INT5_MI2S_IBIT), 43d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_INT6_MI2S_IBIT), 44d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_QUI_MI2S_OSR), 45d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_WSA_CORE_MCLK), 46d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_WSA_CORE_NPL_MCLK), 47d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_VA_CORE_MCLK), 48d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_TX_CORE_MCLK), 49d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_TX_CORE_NPL_MCLK), 50d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_RX_CORE_MCLK), 51d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_RX_CORE_NPL_MCLK), 52d0756868SSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_VA_CORE_2X_MCLK), 53*ea15d3bdSSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_WSA2_CORE_MCLK), 54*ea15d3bdSSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_WSA2_CORE_2X_MCLK), 55*ea15d3bdSSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_RX_CORE_TX_MCLK), 56*ea15d3bdSSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_RX_CORE_TX_2X_MCLK), 57*ea15d3bdSSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_WSA_CORE_TX_MCLK), 58*ea15d3bdSSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_WSA_CORE_TX_2X_MCLK), 59*ea15d3bdSSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_WSA2_CORE_TX_MCLK), 60*ea15d3bdSSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_WSA2_CORE_TX_2X_MCLK), 61*ea15d3bdSSrinivas Kandagatla Q6PRM_CLK(LPASS_CLK_ID_RX_CORE_MCLK2_2X_MCLK), 62d0756868SSrinivas Kandagatla Q6DSP_VOTE_CLK(LPASS_HW_MACRO_VOTE, Q6PRM_HW_CORE_ID_LPASS, 63d0756868SSrinivas Kandagatla "LPASS_HW_MACRO"), 64d0756868SSrinivas Kandagatla Q6DSP_VOTE_CLK(LPASS_HW_DCODEC_VOTE, Q6PRM_HW_CORE_ID_DCODEC, 65d0756868SSrinivas Kandagatla "LPASS_HW_DCODEC"), 66d0756868SSrinivas Kandagatla }; 67d0756868SSrinivas Kandagatla 68d0756868SSrinivas Kandagatla static const struct q6dsp_clk_desc q6dsp_clk_q6prm __maybe_unused = { 69d0756868SSrinivas Kandagatla .clks = q6prm_clks, 70d0756868SSrinivas Kandagatla .num_clks = ARRAY_SIZE(q6prm_clks), 71d0756868SSrinivas Kandagatla .lpass_set_clk = q6prm_set_lpass_clock, 72d0756868SSrinivas Kandagatla .lpass_vote_clk = q6prm_vote_lpass_core_hw, 73d0756868SSrinivas Kandagatla .lpass_unvote_clk = q6prm_unvote_lpass_core_hw, 74d0756868SSrinivas Kandagatla }; 75d0756868SSrinivas Kandagatla 76d0756868SSrinivas Kandagatla #ifdef CONFIG_OF 77d0756868SSrinivas Kandagatla static const struct of_device_id q6prm_clock_device_id[] = { 78d0756868SSrinivas Kandagatla { .compatible = "qcom,q6prm-lpass-clocks", .data = &q6dsp_clk_q6prm }, 79d0756868SSrinivas Kandagatla {}, 80d0756868SSrinivas Kandagatla }; 81d0756868SSrinivas Kandagatla MODULE_DEVICE_TABLE(of, q6prm_clock_device_id); 82d0756868SSrinivas Kandagatla #endif 83d0756868SSrinivas Kandagatla 84d0756868SSrinivas Kandagatla static struct platform_driver q6prm_clock_platform_driver = { 85d0756868SSrinivas Kandagatla .driver = { 86d0756868SSrinivas Kandagatla .name = "q6prm-lpass-clock", 87d0756868SSrinivas Kandagatla .of_match_table = of_match_ptr(q6prm_clock_device_id), 88d0756868SSrinivas Kandagatla }, 89d0756868SSrinivas Kandagatla .probe = q6dsp_clock_dev_probe, 90d0756868SSrinivas Kandagatla }; 91d0756868SSrinivas Kandagatla module_platform_driver(q6prm_clock_platform_driver); 92d0756868SSrinivas Kandagatla 93d0756868SSrinivas Kandagatla MODULE_DESCRIPTION("Q6 Proxy Resource Manager LPASS clock driver"); 94d0756868SSrinivas Kandagatla MODULE_LICENSE("GPL"); 95