diff --git a/drivers/soc/qcom/qcom_proxy_of_consumer.c b/drivers/soc/qcom/qcom_proxy_of_consumer.c index 6eda788cf862..d99bcde07118 100644 --- a/drivers/soc/qcom/qcom_proxy_of_consumer.c +++ b/drivers/soc/qcom/qcom_proxy_of_consumer.c @@ -6,6 +6,14 @@ #include #include #include +#include +#include + +#define QCOM_PROXY_CONSUMER_AMBA_ID(pid) \ + { \ + .id = pid, \ + .mask = 0x000fffff, \ + } /* * of_match table that contains a list of compatible strings for the @@ -22,12 +30,42 @@ static const struct of_device_id qcom_proxy_of_consumer_match[] = { {} }; +static const struct amba_id qcom_proxy_amba_of_consumer_match[] = { +#if !IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) + QCOM_PROXY_CONSUMER_AMBA_ID(0x000bb95d), /* Cortex-A53 */ + QCOM_PROXY_CONSUMER_AMBA_ID(0x000bb95e), /* Cortex-A57 */ + QCOM_PROXY_CONSUMER_AMBA_ID(0x000bb95a), /* Cortex-A72 */ + QCOM_PROXY_CONSUMER_AMBA_ID(0x000bb959), /* Cortex-A73 */ + QCOM_PROXY_CONSUMER_AMBA_ID(0x000bb9da), /* Cortex-A35 */ + QCOM_PROXY_CONSUMER_AMBA_ID(0x000f0205), /* QCOM Kryo */ + QCOM_PROXY_CONSUMER_AMBA_ID(0x000f0211), /* QCOM Kryo */ + QCOM_PROXY_CONSUMER_AMBA_ID(0x000bb802), /* QCOM Kryo 385 Cortex-A55 */ + QCOM_PROXY_CONSUMER_AMBA_ID(0x000bb803), /* QCOM Kryo 385 Cortex-A75 */ +#endif + {} +}; + static int qcom_proxy_of_consumer_probe(struct platform_device *pdev) { dev_dbg(&pdev->dev, "Proxy probing\n"); return 0; } +static int qcom_proxy_amba_of_consumer_probe(struct amba_device *adev, + const struct amba_id *id) +{ + dev_dbg(&adev->dev, "Proxy probing\n"); + + /* Before calling this probe, the amba framework votes for the clk + * by default. It removes the vote only during the runtime suspend + * of the device. Hence, explicilty decrement the usage count of + * the device for the suspend to happen. + */ + pm_runtime_put(&adev->dev); + + return 0; +} + static struct platform_driver qcom_proxy_of_consumer_driver = { .probe = qcom_proxy_of_consumer_probe, .driver = { @@ -36,7 +74,41 @@ static struct platform_driver qcom_proxy_of_consumer_driver = { }, }; -module_platform_driver(qcom_proxy_of_consumer_driver); +static struct amba_driver qcom_proxy_amba_of_consumer_driver = { + .probe = qcom_proxy_amba_of_consumer_probe, + .id_table = qcom_proxy_amba_of_consumer_match, + .drv = { + .name = "qcom_proxy_amba_of_consumer", + }, +}; + +static int __init qcom_proxy_of_init(void) +{ + int ret; + + ret = platform_driver_register(&qcom_proxy_of_consumer_driver); + if (ret < 0) + return ret; + + ret = amba_driver_register(&qcom_proxy_amba_of_consumer_driver); + if (ret < 0) + goto amba_fail; + + return 0; + +amba_fail: + platform_driver_unregister(&qcom_proxy_of_consumer_driver); + return ret; +} + +static void __exit qcom_proxy_of_exit(void) +{ + amba_driver_unregister(&qcom_proxy_amba_of_consumer_driver); + platform_driver_unregister(&qcom_proxy_of_consumer_driver); +} + +module_init(qcom_proxy_of_init); +module_exit(qcom_proxy_of_exit); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("Qualcomm Technologies, of proxy consumer driver");