Lines Matching +full:nxp +full:- +full:imx
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright 2021~2022 NXP
13 #include <linux/firmware/imx/svc/rm.h>
14 #include <dt-bindings/firmware/imx/rsrc.h>
40 if (offset >= chip->ngpio) in imx_scu_gpio_get()
41 return -EINVAL; in imx_scu_gpio_get()
43 mutex_lock(&priv->lock); in imx_scu_gpio_get()
46 err = imx_sc_misc_get_control(priv->handle, in imx_scu_gpio_get()
48 mutex_unlock(&priv->lock); in imx_scu_gpio_get()
51 dev_err(priv->dev, "SCU get failed: %d\n", err); in imx_scu_gpio_get()
63 if (offset >= chip->ngpio) in imx_scu_gpio_set()
66 mutex_lock(&priv->lock); in imx_scu_gpio_set()
69 err = imx_sc_misc_set_control(priv->handle, in imx_scu_gpio_set()
71 mutex_unlock(&priv->lock); in imx_scu_gpio_set()
74 dev_err(priv->dev, "SCU set (%d) failed: %d\n", in imx_scu_gpio_set()
80 if (offset >= chip->ngpio) in imx_scu_gpio_get_direction()
81 return -EINVAL; in imx_scu_gpio_get_direction()
88 struct device *dev = &pdev->dev; in imx_scu_gpio_probe()
93 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); in imx_scu_gpio_probe()
95 return -ENOMEM; in imx_scu_gpio_probe()
97 ret = imx_scu_get_handle(&priv->handle); in imx_scu_gpio_probe()
101 priv->dev = dev; in imx_scu_gpio_probe()
102 mutex_init(&priv->lock); in imx_scu_gpio_probe()
104 gc = &priv->chip; in imx_scu_gpio_probe()
105 gc->base = -1; in imx_scu_gpio_probe()
106 gc->parent = dev; in imx_scu_gpio_probe()
107 gc->ngpio = ARRAY_SIZE(scu_rsrc_arr); in imx_scu_gpio_probe()
108 gc->label = dev_name(dev); in imx_scu_gpio_probe()
109 gc->get = imx_scu_gpio_get; in imx_scu_gpio_probe()
110 gc->set = imx_scu_gpio_set; in imx_scu_gpio_probe()
111 gc->get_direction = imx_scu_gpio_get_direction; in imx_scu_gpio_probe()
119 { .compatible = "fsl,imx8qxp-sc-gpio" },
125 .name = "gpio-imx-scu",
138 MODULE_AUTHOR("Shenwei Wang <shenwei.wang@nxp.com>");
139 MODULE_DESCRIPTION("NXP GPIO over IMX SCU API");