Lines Matching +full:ctrl +full:- +full:module
1 // SPDX-License-Identifier: GPL-2.0-only
8 #include <linux/module.h>
15 * struct airoha_gpio_ctrl - Airoha GPIO driver data
37 struct airoha_gpio_ctrl *ctrl = gc_to_ctrl(gc); in airoha_dir_set() local
38 u32 dir = ioread32(ctrl->dir[gpio / 16]); in airoha_dir_set()
39 u32 output = ioread32(ctrl->output); in airoha_dir_set()
50 iowrite32(dir, ctrl->dir[gpio / 16]); in airoha_dir_set()
53 gc->set(gc, gpio, val); in airoha_dir_set()
55 iowrite32(output, ctrl->output); in airoha_dir_set()
73 struct airoha_gpio_ctrl *ctrl = gc_to_ctrl(gc); in airoha_get_dir() local
74 u32 dir = ioread32(ctrl->dir[gpio / 16]); in airoha_get_dir()
82 struct device *dev = &pdev->dev; in airoha_gpio_probe()
83 struct airoha_gpio_ctrl *ctrl; in airoha_gpio_probe() local
86 ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); in airoha_gpio_probe()
87 if (!ctrl) in airoha_gpio_probe()
88 return -ENOMEM; in airoha_gpio_probe()
90 ctrl->data = devm_platform_ioremap_resource(pdev, 0); in airoha_gpio_probe()
91 if (IS_ERR(ctrl->data)) in airoha_gpio_probe()
92 return PTR_ERR(ctrl->data); in airoha_gpio_probe()
94 ctrl->dir[0] = devm_platform_ioremap_resource(pdev, 1); in airoha_gpio_probe()
95 if (IS_ERR(ctrl->dir[0])) in airoha_gpio_probe()
96 return PTR_ERR(ctrl->dir[0]); in airoha_gpio_probe()
98 ctrl->dir[1] = devm_platform_ioremap_resource(pdev, 2); in airoha_gpio_probe()
99 if (IS_ERR(ctrl->dir[1])) in airoha_gpio_probe()
100 return PTR_ERR(ctrl->dir[1]); in airoha_gpio_probe()
102 ctrl->output = devm_platform_ioremap_resource(pdev, 3); in airoha_gpio_probe()
103 if (IS_ERR(ctrl->output)) in airoha_gpio_probe()
104 return PTR_ERR(ctrl->output); in airoha_gpio_probe()
106 err = bgpio_init(&ctrl->gc, dev, 4, ctrl->data, NULL, in airoha_gpio_probe()
111 ctrl->gc.ngpio = AIROHA_GPIO_MAX; in airoha_gpio_probe()
112 ctrl->gc.owner = THIS_MODULE; in airoha_gpio_probe()
113 ctrl->gc.direction_output = airoha_dir_out; in airoha_gpio_probe()
114 ctrl->gc.direction_input = airoha_dir_in; in airoha_gpio_probe()
115 ctrl->gc.get_direction = airoha_get_dir; in airoha_gpio_probe()
117 return devm_gpiochip_add_data(dev, &ctrl->gc, ctrl); in airoha_gpio_probe()
121 { .compatible = "airoha,en7523-gpio" },
128 .name = "airoha-gpio",