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

mailbox: qcom: Add clock driver name in apcs mailbox driver data

Some apcs mailbox devices supports a clock driver, the compatible
strings of devices supporting clock driver along with the clock driver
name are maintained in a separate structure within the mailbox driver.
And the clock driver is added based on device match.

With increase in number of devices supporting the clock feature move the
clock driver name inside the driver data. so that we can use a single
API to get the register offset of mailbox driver and clock driver name
together, and the clock driver will be added based on the driver data.

Signed-off-by: Sivaprakash Murugesan <sivaprak@codeaurora.org>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>

authored by

Sivaprakash Murugesan and committed by
Jassi Brar
9b007938 f3a1381e

+38 -18
+38 -18
drivers/mailbox/qcom-apcs-ipc-mailbox.c
··· 24 24 struct platform_device *clk; 25 25 }; 26 26 27 + struct qcom_apcs_ipc_data { 28 + int offset; 29 + char *clk_name; 30 + }; 31 + 32 + static const struct qcom_apcs_ipc_data ipq8074_apcs_data = { 33 + .offset = 8, .clk_name = NULL 34 + }; 35 + 36 + static const struct qcom_apcs_ipc_data msm8916_apcs_data = { 37 + .offset = 8, .clk_name = "qcom-apcs-msm8916-clk" 38 + }; 39 + 40 + static const struct qcom_apcs_ipc_data msm8996_apcs_data = { 41 + .offset = 16, .clk_name = NULL 42 + }; 43 + 44 + static const struct qcom_apcs_ipc_data msm8998_apcs_data = { 45 + .offset = 8, .clk_name = NULL 46 + }; 47 + 48 + static const struct qcom_apcs_ipc_data apps_shared_apcs_data = { 49 + .offset = 12, .clk_name = NULL 50 + }; 51 + 27 52 static const struct regmap_config apcs_regmap_config = { 28 53 .reg_bits = 32, 29 54 .reg_stride = 4, ··· 73 48 static int qcom_apcs_ipc_probe(struct platform_device *pdev) 74 49 { 75 50 struct qcom_apcs_ipc *apcs; 51 + const struct qcom_apcs_ipc_data *apcs_data; 76 52 struct regmap *regmap; 77 53 struct resource *res; 78 - unsigned long offset; 79 54 void __iomem *base; 80 55 unsigned long i; 81 56 int ret; 82 - const struct of_device_id apcs_clk_match_table[] = { 83 - { .compatible = "qcom,msm8916-apcs-kpss-global", }, 84 - { .compatible = "qcom,qcs404-apcs-apps-global", }, 85 - {} 86 - }; 87 57 88 58 apcs = devm_kzalloc(&pdev->dev, sizeof(*apcs), GFP_KERNEL); 89 59 if (!apcs) ··· 93 73 if (IS_ERR(regmap)) 94 74 return PTR_ERR(regmap); 95 75 96 - offset = (unsigned long)of_device_get_match_data(&pdev->dev); 76 + apcs_data = of_device_get_match_data(&pdev->dev); 97 77 98 78 apcs->regmap = regmap; 99 - apcs->offset = offset; 79 + apcs->offset = apcs_data->offset; 100 80 101 81 /* Initialize channel identifiers */ 102 82 for (i = 0; i < ARRAY_SIZE(apcs->mbox_chans); i++) ··· 113 93 return ret; 114 94 } 115 95 116 - if (of_match_device(apcs_clk_match_table, &pdev->dev)) { 96 + if (apcs_data->clk_name) { 117 97 apcs->clk = platform_device_register_data(&pdev->dev, 118 - "qcom-apcs-msm8916-clk", 98 + apcs_data->clk_name, 119 99 PLATFORM_DEVID_NONE, 120 100 NULL, 0); 121 101 if (IS_ERR(apcs->clk)) ··· 139 119 140 120 /* .data is the offset of the ipc register within the global block */ 141 121 static const struct of_device_id qcom_apcs_ipc_of_match[] = { 142 - { .compatible = "qcom,msm8916-apcs-kpss-global", .data = (void *)8 }, 143 - { .compatible = "qcom,msm8996-apcs-hmss-global", .data = (void *)16 }, 144 - { .compatible = "qcom,msm8998-apcs-hmss-global", .data = (void *)8 }, 145 - { .compatible = "qcom,qcs404-apcs-apps-global", .data = (void *)8 }, 146 - { .compatible = "qcom,sc7180-apss-shared", .data = (void *)12 }, 147 - { .compatible = "qcom,sdm845-apss-shared", .data = (void *)12 }, 148 - { .compatible = "qcom,sm8150-apss-shared", .data = (void *)12 }, 149 - { .compatible = "qcom,ipq8074-apcs-apps-global", .data = (void *)8 }, 122 + { .compatible = "qcom,ipq8074-apcs-apps-global", .data = &ipq8074_apcs_data }, 123 + { .compatible = "qcom,msm8916-apcs-kpss-global", .data = &msm8916_apcs_data }, 124 + { .compatible = "qcom,msm8996-apcs-hmss-global", .data = &msm8996_apcs_data }, 125 + { .compatible = "qcom,msm8998-apcs-hmss-global", .data = &msm8998_apcs_data }, 126 + { .compatible = "qcom,qcs404-apcs-apps-global", .data = &msm8916_apcs_data }, 127 + { .compatible = "qcom,sc7180-apss-shared", .data = &apps_shared_apcs_data }, 128 + { .compatible = "qcom,sdm845-apss-shared", .data = &apps_shared_apcs_data }, 129 + { .compatible = "qcom,sm8150-apss-shared", .data = &apps_shared_apcs_data }, 150 130 {} 151 131 }; 152 132 MODULE_DEVICE_TABLE(of, qcom_apcs_ipc_of_match);