From 7a02db5182a412b6a63dab37b9a5d763e9f3e812 Mon Sep 17 00:00:00 2001 From: Raghavendra Rao Ananta Date: Sun, 29 Mar 2020 19:32:38 -0700 Subject: [PATCH] soc: qcom: Add support for proxy consumers on of_devlink A target may contain multiple defconfigs, but only one device-tree configuration. Such a target may have device-drivers that are only enabled in a particular defconfig, while disabled in the others. For the kernel that boots up with disabled configuration, since the device-tree node exists, the of_devlink logic expects the driver to be probed, which is not possible. As a result, the sync-state remains incomplete. Hence, add support for a proxy consumer driver that shows a proxy-presence of the main driver to satisfy the sync-state. Change-Id: Ica8c2599fb66420c67e6a72e9b35e7afc0ae3220 Signed-off-by: Raghavendra Rao Ananta --- drivers/soc/qcom/Kconfig | 13 ++++++++ drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/qcom_proxy_of_consumer.c | 39 +++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 drivers/soc/qcom/qcom_proxy_of_consumer.c diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index 0391fee270f3..0583f5e8f82d 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -115,6 +115,19 @@ config MSM_QBT_HANDLER from the queue. It also creates an input device to send key events such as KEY_POWER, KEY_HOME. +config QCOM_PROXY_OF_CONSUMER + tristate "Qualcomm Technologies, Inc. OF proxy consumer driver" + help + A target may contain multiple defconfigs, but only one device-tree + configuration. Such a target may have device-drivers that are + only enabled in a particular defconfig, while disabled in the + others. For the kernel that boots up with disabled configuration, + since the device-tree node exists, the of_devlink logic expects + the driver to be probed, which is not possible. As a result, the + sync-state remains incomplete. + This proxy consumer driver shows a proxy-presence of the main + driver to satisfy the sync-state. + config QCOM_GSBI tristate "QCOM General Serial Bus Interface" depends on ARCH_QCOM || COMPILE_TEST diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile index 9b5209bc9949..5787eb3a558a 100644 --- a/drivers/soc/qcom/Makefile +++ b/drivers/soc/qcom/Makefile @@ -32,6 +32,7 @@ obj-$(CONFIG_QCOM_SMSM) += smsm.o obj-$(CONFIG_MSM_CORE_HANG_DETECT) += core_hang_detect.o obj-$(CONFIG_QCOM_SECURE_BUFFER) += secure_buffer.o obj-$(CONFIG_QCOM_SOCINFO) += socinfo.o +obj-$(CONFIG_QCOM_PROXY_OF_CONSUMER) += qcom_proxy_of_consumer.o obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o obj-$(CONFIG_QCOM_IPCC) += qcom_ipcc.o obj-$(CONFIG_QCOM_RUN_QUEUE_STATS) += rq_stats.o diff --git a/drivers/soc/qcom/qcom_proxy_of_consumer.c b/drivers/soc/qcom/qcom_proxy_of_consumer.c new file mode 100644 index 000000000000..a0473fb34cc5 --- /dev/null +++ b/drivers/soc/qcom/qcom_proxy_of_consumer.c @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2020, The Linux Foundation. All rights reserved. + */ + +#include +#include +#include + +/* + * of_match table that contains a list of compatible strings for the + * drivers that are disabled, but needed to make an appearance to + * satisfy of_devlink. + */ +static const struct of_device_id qcom_proxy_of_consumer_match[] = { +#if !IS_ENABLED(CONFIG_SERIAL_MSM_GENI_CONSOLE) + { .compatible = "qcom,msm-geni-console"}, +#endif + {} +}; + +static int qcom_proxy_of_consumer_probe(struct platform_device *pdev) +{ + dev_dbg(&pdev->dev, "Proxy probing\n"); + return 0; +} + +static struct platform_driver qcom_proxy_of_consumer_driver = { + .probe = qcom_proxy_of_consumer_probe, + .driver = { + .name = "qcom_proxy_of_consumer", + .of_match_table = qcom_proxy_of_consumer_match, + }, +}; + +module_platform_driver(qcom_proxy_of_consumer_driver); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("Qualcomm Technologies, of proxy consumer driver");