diff mbox series

[v4,2/3] pinctrl: scmi: add blocklist

Message ID 20240505-pinctrl-scmi-oem-v3-v4-2-7c99f989e9ba@nxp.com (mailing list archive)
State Superseded
Headers show
Series pinctrl: scmi: support i.MX95 OEM extensions | expand

Commit Message

Peng Fan (OSS) May 5, 2024, 3:47 a.m. UTC
From: Peng Fan <peng.fan@nxp.com>

i.MX95 will have its own pinctrl scmi driver, so need block
pinctrl-scmi driver for i.MX95, otherwise there will be two pinctrl
devices for a single scmi protocol@19.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/pinctrl/pinctrl-scmi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Rob Herring (Arm) May 7, 2024, 7:14 p.m. UTC | #1
On Sun, May 05, 2024 at 11:47:18AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> i.MX95 will have its own pinctrl scmi driver, so need block
> pinctrl-scmi driver for i.MX95, otherwise there will be two pinctrl
> devices for a single scmi protocol@19.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/pinctrl/pinctrl-scmi.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/pinctrl/pinctrl-scmi.c b/drivers/pinctrl/pinctrl-scmi.c
> index 036bc1e3fc6c..331ca20ac68b 100644
> --- a/drivers/pinctrl/pinctrl-scmi.c
> +++ b/drivers/pinctrl/pinctrl-scmi.c
> @@ -11,6 +11,7 @@
>  #include <linux/errno.h>
>  #include <linux/module.h>
>  #include <linux/mod_devicetable.h>
> +#include <linux/of.h>
>  #include <linux/scmi_protocol.h>
>  #include <linux/slab.h>
>  #include <linux/types.h>
> @@ -504,6 +505,11 @@ static int pinctrl_scmi_get_pins(struct scmi_pinctrl *pmx,
>  	return 0;
>  }
>  
> +static const struct of_device_id scmi_pinctrl_blocklist[] = {
> +	{ .compatible = "fsl,imx95", },
> +	{ }
> +};
> +
>  static int scmi_pinctrl_probe(struct scmi_device *sdev)
>  {
>  	int ret;
> @@ -511,10 +517,14 @@ static int scmi_pinctrl_probe(struct scmi_device *sdev)
>  	struct scmi_pinctrl *pmx;
>  	const struct scmi_handle *handle;
>  	struct scmi_protocol_handle *ph;
> +	struct device_node *np __free(device_node) = of_find_node_by_path("/");
>  
>  	if (!sdev->handle)
>  		return -EINVAL;
>  
> +	if (of_match_node(scmi_pinctrl_blocklist, np))
> +		return -ENODEV;

Use of_machine_compatible_match() instead.

> +
>  	handle = sdev->handle;
>  
>  	pinctrl_ops = handle->devm_protocol_get(sdev, SCMI_PROTOCOL_PINCTRL, &ph);
> 
> -- 
> 2.37.1
>
diff mbox series

Patch

diff --git a/drivers/pinctrl/pinctrl-scmi.c b/drivers/pinctrl/pinctrl-scmi.c
index 036bc1e3fc6c..331ca20ac68b 100644
--- a/drivers/pinctrl/pinctrl-scmi.c
+++ b/drivers/pinctrl/pinctrl-scmi.c
@@ -11,6 +11,7 @@ 
 #include <linux/errno.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
+#include <linux/of.h>
 #include <linux/scmi_protocol.h>
 #include <linux/slab.h>
 #include <linux/types.h>
@@ -504,6 +505,11 @@  static int pinctrl_scmi_get_pins(struct scmi_pinctrl *pmx,
 	return 0;
 }
 
+static const struct of_device_id scmi_pinctrl_blocklist[] = {
+	{ .compatible = "fsl,imx95", },
+	{ }
+};
+
 static int scmi_pinctrl_probe(struct scmi_device *sdev)
 {
 	int ret;
@@ -511,10 +517,14 @@  static int scmi_pinctrl_probe(struct scmi_device *sdev)
 	struct scmi_pinctrl *pmx;
 	const struct scmi_handle *handle;
 	struct scmi_protocol_handle *ph;
+	struct device_node *np __free(device_node) = of_find_node_by_path("/");
 
 	if (!sdev->handle)
 		return -EINVAL;
 
+	if (of_match_node(scmi_pinctrl_blocklist, np))
+		return -ENODEV;
+
 	handle = sdev->handle;
 
 	pinctrl_ops = handle->devm_protocol_get(sdev, SCMI_PROTOCOL_PINCTRL, &ph);