All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Stephan Gerhold <stephan@gerhold.net>,
	Bjorn Andersson <andersson@kernel.org>
Cc: Andy Gross <agross@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org
Subject: Re: [PATCH 10/14] soc: qcom: Add RPM processor/subsystem driver
Date: Mon, 5 Jun 2023 21:06:54 +0200	[thread overview]
Message-ID: <04745990-d270-b37c-7ac8-dff24b03e02b@linaro.org> (raw)
In-Reply-To: <20230531-rpm-rproc-v1-10-e0a3b6de1f14@gerhold.net>



On 5.06.2023 09:08, Stephan Gerhold wrote:
> Add a simple driver for the qcom,rpm-proc compatible that registers the
> "smd-edge" and populates other children defined in the device tree.
> 
> Note that the DT schema belongs to the remoteproc subsystem while this
> driver is added inside soc/qcom. I argue that the RPM *is* a remoteproc,
> but as an implementation detail in Linux it can currently not benefit
> from anything provided by the remoteproc subsystem. The RPM firmware is
> usually already loaded and started by earlier components in the boot
> chain and is not meant to be ever restarted.
> 
> To avoid breaking existing kernel configurations the driver is always
> built when smd-rpm.c is also built. They belong closely together anyway.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
>  drivers/soc/qcom/Makefile   |  2 +-
>  drivers/soc/qcom/rpm-proc.c | 76 +++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 77 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile
> index 99114c71092b..113b9ff2ad43 100644
> --- a/drivers/soc/qcom/Makefile
> +++ b/drivers/soc/qcom/Makefile
> @@ -18,7 +18,7 @@ obj-$(CONFIG_QCOM_RPM_MASTER_STATS)	+= rpm_master_stats.o
>  obj-$(CONFIG_QCOM_RPMH)		+= qcom_rpmh.o
>  qcom_rpmh-y			+= rpmh-rsc.o
>  qcom_rpmh-y			+= rpmh.o
> -obj-$(CONFIG_QCOM_SMD_RPM)	+= smd-rpm.o
> +obj-$(CONFIG_QCOM_SMD_RPM)	+= rpm-proc.o smd-rpm.o
>  obj-$(CONFIG_QCOM_SMEM) +=	smem.o
>  obj-$(CONFIG_QCOM_SMEM_STATE) += smem_state.o
>  obj-$(CONFIG_QCOM_SMP2P)	+= smp2p.o
> diff --git a/drivers/soc/qcom/rpm-proc.c b/drivers/soc/qcom/rpm-proc.c
> new file mode 100644
> index 000000000000..0652be7f7895
> --- /dev/null
> +++ b/drivers/soc/qcom/rpm-proc.c
> @@ -0,0 +1,76 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/* Copyright (c) 2021-2023, Stephan Gerhold <stephan@gerhold.net> */
> +
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_platform.h>
> +#include <linux/platform_device.h>
> +#include <linux/rpmsg/qcom_smd.h>
> +
> +static int rpm_proc_probe(struct platform_device *pdev)
> +{
> +	struct qcom_smd_edge *edge = NULL;
> +	struct device *dev = &pdev->dev;
> +	struct device_node *edge_node;
> +	int ret;
> +
> +	edge_node = of_get_child_by_name(dev->of_node, "smd-edge");
> +	if (edge_node) {
> +		edge = qcom_smd_register_edge(dev, edge_node);
> +		if (IS_ERR(edge))
> +			return dev_err_probe(dev, PTR_ERR(edge),
> +					     "Failed to register smd-edge\n");
Need of_node_put in both success and IS_ERR paths

> +	}
> +
> +	ret = devm_of_platform_populate(dev);
> +	if (ret) {
> +		dev_err(dev, "Failed to populate children devices: %d\n", ret);
I may be having a brain lag moment but I think it should be "child"
singular, otherwise it sounds like they're devices for children!

> +		goto err;
> +	}
> +
> +	platform_set_drvdata(pdev, edge);
> +	return 0;
> +err:
> +	if (edge)
> +		qcom_smd_unregister_edge(edge);
> +	return ret;
> +}
> +
> +static void rpm_proc_remove(struct platform_device *pdev)
> +{
> +	struct qcom_smd_edge *edge = platform_get_drvdata(pdev);
> +
> +	if (edge)
> +		qcom_smd_unregister_edge(edge);
> +}
> +
> +static const struct of_device_id rpm_proc_of_match[] = {
> +	{ .compatible = "qcom,rpm-proc", },
> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, rpm_proc_of_match);
> +
> +static struct platform_driver rpm_proc_driver = {
> +	.probe = rpm_proc_probe,
> +	.remove_new = rpm_proc_remove,
> +	.driver = {
> +		.name = "qcom-rpm-proc",
> +		.of_match_table = rpm_proc_of_match,
> +	},
> +};
> +
> +static int __init rpm_proc_init(void)
> +{
> +	return platform_driver_register(&rpm_proc_driver);
> +}
> +arch_initcall(rpm_proc_init);
Maybe we can go as early as core...

Konrad
> +
> +static void __exit rpm_proc_exit(void)
> +{
> +	platform_driver_unregister(&rpm_proc_driver);
> +}
> +module_exit(rpm_proc_exit);
> +
> +MODULE_DESCRIPTION("Qualcomm RPM processor/subsystem driver");
> +MODULE_AUTHOR("Stephan Gerhold <stephan@gerhold.net>");
> +MODULE_LICENSE("GPL");
> 

  reply	other threads:[~2023-06-05 19:07 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05  7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
2023-06-05  7:08 ` [PATCH 01/14] dt-bindings soc: qcom: smd-rpm: Fix sort order Stephan Gerhold
2023-06-06  6:25   ` Krzysztof Kozlowski
2023-06-05  7:08 ` [PATCH 02/14] dt-bindings: soc: qcom: smd-rpm: Add MSM8909 to qcom,smd-channels Stephan Gerhold
2023-06-06  6:26   ` Krzysztof Kozlowski
2023-06-05  7:08 ` [PATCH 03/14] dt-bindings: soc: qcom: smd-rpm: Add some more compatibles Stephan Gerhold
2023-06-06  6:27   ` Krzysztof Kozlowski
2023-06-05  7:08 ` [PATCH 04/14] soc: qcom: smd-rpm: Match rpmsg channel instead of compatible Stephan Gerhold
2023-06-05 18:49   ` Konrad Dybcio
2023-06-05  7:08 ` [PATCH 05/14] dt-bindings: remoteproc: Add Qualcomm RPM processor/subsystem Stephan Gerhold
2023-06-05  8:33   ` Rob Herring
2023-06-05  9:16     ` Stephan Gerhold
2023-06-06  6:36   ` Krzysztof Kozlowski
2023-06-06  8:55     ` Stephan Gerhold
2023-06-07  8:32       ` Krzysztof Kozlowski
2023-06-05  7:08 ` [PATCH 06/14] dt-bindings: soc: qcom: smd-rpm: Use qcom,rpm-proc in example Stephan Gerhold
2023-06-05  8:33   ` Rob Herring
2023-06-05  9:20     ` Stephan Gerhold
2023-06-06  6:37   ` Krzysztof Kozlowski
2023-06-06  9:06     ` Stephan Gerhold
2023-06-06  9:17       ` Krzysztof Kozlowski
2023-06-05  7:08 ` [PATCH 07/14] dt-bindings: qcom: smd: Mark as deprecated Stephan Gerhold
2023-06-05  7:08 ` [PATCH 08/14] soc: qcom: smem: Add qcom_smem_is_available() Stephan Gerhold
2023-06-05 18:53   ` Konrad Dybcio
2023-06-05 19:13     ` Stephan Gerhold
2023-06-05  7:08 ` [PATCH 09/14] rpmsg: qcom_smd: Use qcom_smem_is_available() Stephan Gerhold
2023-06-05 18:56   ` Konrad Dybcio
2023-06-05 19:18     ` Stephan Gerhold
2023-06-05 19:45       ` Konrad Dybcio
2023-06-05  7:08 ` [PATCH 10/14] soc: qcom: Add RPM processor/subsystem driver Stephan Gerhold
2023-06-05 19:06   ` Konrad Dybcio [this message]
2023-06-05 19:51     ` Stephan Gerhold
2023-06-05 19:55       ` Konrad Dybcio
2023-06-05 20:31   ` kernel test robot
2023-06-05  7:08 ` [PATCH 11/14] arm64: dts: qcom: Add rpm-proc node for SMD platforms Stephan Gerhold
2023-06-05 19:07   ` Konrad Dybcio
2023-06-05  7:08 ` [PATCH 12/14] arm64: dts: qcom: Add rpm-proc node for GLINK gplatforms Stephan Gerhold
2023-06-05 19:43   ` Konrad Dybcio
2023-06-05 19:55     ` Stephan Gerhold
2023-06-05  7:08 ` [PATCH 13/14] ARM: dts: qcom: Add rpm-proc node for SMD platforms Stephan Gerhold
2023-06-05  7:08 ` [PATCH 14/14] ARM: dts: qcom: apq8064: Drop redundant /smd node Stephan Gerhold
2023-06-05 19:00   ` Konrad Dybcio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=04745990-d270-b37c-7ac8-dff24b03e02b@linaro.org \
    --to=konrad.dybcio@linaro.org \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=robh+dt@kernel.org \
    --cc=stephan@gerhold.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.