gpio-zevio.c (85a3685852d9ac7d92be9d824533c915a4597fa4) gpio-zevio.c (58383c78425e4ee1c077253cf297b641c861c02e)
1/*
2 * GPIO controller in LSI ZEVIO SoCs.
3 *
4 * Author: Fabian Vogt <fabian@ritter-vogt.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.

--- 171 unchanged lines hidden (view full) ---

180 controller = devm_kzalloc(&pdev->dev, sizeof(*controller), GFP_KERNEL);
181 if (!controller)
182 return -ENOMEM;
183
184 platform_set_drvdata(pdev, controller);
185
186 /* Copy our reference */
187 controller->chip.gc = zevio_gpio_chip;
1/*
2 * GPIO controller in LSI ZEVIO SoCs.
3 *
4 * Author: Fabian Vogt <fabian@ritter-vogt.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.

--- 171 unchanged lines hidden (view full) ---

180 controller = devm_kzalloc(&pdev->dev, sizeof(*controller), GFP_KERNEL);
181 if (!controller)
182 return -ENOMEM;
183
184 platform_set_drvdata(pdev, controller);
185
186 /* Copy our reference */
187 controller->chip.gc = zevio_gpio_chip;
188 controller->chip.gc.dev = &pdev->dev;
188 controller->chip.gc.parent = &pdev->dev;
189
190 status = of_mm_gpiochip_add(pdev->dev.of_node, &(controller->chip));
191 if (status) {
192 dev_err(&pdev->dev, "failed to add gpiochip: %d\n", status);
193 return status;
194 }
195
196 spin_lock_init(&controller->lock);
197
198 /* Disable interrupts, they only cause errors */
199 for (i = 0; i < controller->chip.gc.ngpio; i += 8)
200 zevio_gpio_port_set(controller, i, ZEVIO_GPIO_INT_MASK, 0xFF);
201
189
190 status = of_mm_gpiochip_add(pdev->dev.of_node, &(controller->chip));
191 if (status) {
192 dev_err(&pdev->dev, "failed to add gpiochip: %d\n", status);
193 return status;
194 }
195
196 spin_lock_init(&controller->lock);
197
198 /* Disable interrupts, they only cause errors */
199 for (i = 0; i < controller->chip.gc.ngpio; i += 8)
200 zevio_gpio_port_set(controller, i, ZEVIO_GPIO_INT_MASK, 0xFF);
201
202 dev_dbg(controller->chip.gc.dev, "ZEVIO GPIO controller set up!\n");
202 dev_dbg(controller->chip.gc.parent, "ZEVIO GPIO controller set up!\n");
203
204 return 0;
205}
206
207static int zevio_gpio_remove(struct platform_device *pdev)
208{
209 struct zevio_gpio *controller = platform_get_drvdata(pdev);
210

--- 25 unchanged lines hidden ---
203
204 return 0;
205}
206
207static int zevio_gpio_remove(struct platform_device *pdev)
208{
209 struct zevio_gpio *controller = platform_get_drvdata(pdev);
210

--- 25 unchanged lines hidden ---