pinctrl-meson.c (a9a1d2a7827c9cf780966d0879c73ef5a91380e9) pinctrl-meson.c (634e40b0c2bde81051e309cdfe4c26bbca3164ec)
1/*
2 * Pin controller and GPIO driver for Amlogic Meson SoCs
3 *
4 * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.

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

394 }
395
396 return 0;
397}
398
399static int meson_pinconf_group_get(struct pinctrl_dev *pcdev,
400 unsigned int group, unsigned long *config)
401{
1/*
2 * Pin controller and GPIO driver for Amlogic Meson SoCs
3 *
4 * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.

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

394 }
395
396 return 0;
397}
398
399static int meson_pinconf_group_get(struct pinctrl_dev *pcdev,
400 unsigned int group, unsigned long *config)
401{
402 return -ENOSYS;
402 return -ENOTSUPP;
403}
404
405static const struct pinconf_ops meson_pinconf_ops = {
406 .pin_config_get = meson_pinconf_get,
407 .pin_config_set = meson_pinconf_set,
408 .pin_config_group_get = meson_pinconf_group_get,
409 .pin_config_group_set = meson_pinconf_group_set,
410 .is_generic = true,
411};
412
403}
404
405static const struct pinconf_ops meson_pinconf_ops = {
406 .pin_config_get = meson_pinconf_get,
407 .pin_config_set = meson_pinconf_set,
408 .pin_config_group_get = meson_pinconf_group_get,
409 .pin_config_group_set = meson_pinconf_group_set,
410 .is_generic = true,
411};
412
413static int meson_gpio_request(struct gpio_chip *chip, unsigned gpio)
414{
415 return pinctrl_gpio_request(chip->base + gpio);
416}
417
418static void meson_gpio_free(struct gpio_chip *chip, unsigned gpio)
419{
420 struct meson_pinctrl *pc = gpiochip_get_data(chip);
421
422 pinctrl_gpio_free(pc->data->pin_base + gpio);
423}
424
425static int meson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
426{
427 struct meson_pinctrl *pc = gpiochip_get_data(chip);
428 unsigned int reg, bit, pin;
429 struct meson_bank *bank;
430 int ret;
431
432 pin = pc->data->pin_base + gpio;

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

534};
535
536static int meson_gpiolib_register(struct meson_pinctrl *pc)
537{
538 int ret;
539
540 pc->chip.label = pc->data->name;
541 pc->chip.parent = pc->dev;
413static int meson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
414{
415 struct meson_pinctrl *pc = gpiochip_get_data(chip);
416 unsigned int reg, bit, pin;
417 struct meson_bank *bank;
418 int ret;
419
420 pin = pc->data->pin_base + gpio;

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

522};
523
524static int meson_gpiolib_register(struct meson_pinctrl *pc)
525{
526 int ret;
527
528 pc->chip.label = pc->data->name;
529 pc->chip.parent = pc->dev;
542 pc->chip.request = meson_gpio_request;
543 pc->chip.free = meson_gpio_free;
530 pc->chip.request = gpiochip_generic_request;
531 pc->chip.free = gpiochip_generic_free;
544 pc->chip.direction_input = meson_gpio_direction_input;
545 pc->chip.direction_output = meson_gpio_direction_output;
546 pc->chip.get = meson_gpio_get;
547 pc->chip.set = meson_gpio_set;
532 pc->chip.direction_input = meson_gpio_direction_input;
533 pc->chip.direction_output = meson_gpio_direction_output;
534 pc->chip.get = meson_gpio_get;
535 pc->chip.set = meson_gpio_set;
548 pc->chip.base = pc->data->pin_base;
536 pc->chip.base = -1;
549 pc->chip.ngpio = pc->data->num_pins;
550 pc->chip.can_sleep = false;
551 pc->chip.of_node = pc->of_node;
552 pc->chip.of_gpio_n_cells = 2;
553
554 ret = gpiochip_add_data(&pc->chip, pc);
555 if (ret) {
556 dev_err(pc->dev, "can't add gpio chip %s\n",

--- 130 unchanged lines hidden ---
537 pc->chip.ngpio = pc->data->num_pins;
538 pc->chip.can_sleep = false;
539 pc->chip.of_node = pc->of_node;
540 pc->chip.of_gpio_n_cells = 2;
541
542 ret = gpiochip_add_data(&pc->chip, pc);
543 if (ret) {
544 dev_err(pc->dev, "can't add gpio chip %s\n",

--- 130 unchanged lines hidden ---