Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl/coh901: use generic pinconf enums and parameters

Adjust the COH 901 driver to use the standard enums for
biasing and driving pins, alter signature of config function
to suit the framework.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+13 -43
+13 -43
drivers/pinctrl/pinctrl-coh901.c
··· 26 26 #include <mach/gpio-u300.h> 27 27 28 28 /* 29 - * Bias modes for U300 GPIOs 30 - * 31 - * GPIO_U300_CONFIG_BIAS_UNKNOWN: this bias mode is not known to us 32 - * GPIO_U300_CONFIG_BIAS_FLOAT: no specific bias, the GPIO will float or state 33 - * is not controlled by software 34 - * GPIO_U300_CONFIG_BIAS_PULL_UP: the GPIO will be pulled up (usually with high 35 - * impedance to VDD) 36 - */ 37 - #define GPIO_U300_CONFIG_BIAS_UNKNOWN 0x1000 38 - #define GPIO_U300_CONFIG_BIAS_FLOAT 0x1001 39 - #define GPIO_U300_CONFIG_BIAS_PULL_UP 0x1002 40 - 41 - /* 42 - * Drive modes for U300 GPIOs (output) 43 - * 44 - * GPIO_U300_CONFIG_DRIVE_PUSH_PULL: the GPIO will be driven actively high and 45 - * low, this is the most typical case and is typically achieved with two 46 - * active transistors on the output 47 - * GPIO_U300_CONFIG_DRIVE_OPEN_DRAIN: the GPIO will be driven with open drain 48 - * (open collector) which means it is usually wired with other output 49 - * ports which are then pulled up with an external resistor 50 - * GPIO_U300_CONFIG_DRIVE_OPEN_SOURCE: the GPIO will be driven with open drain 51 - * (open emitter) which is the same as open drain mutatis mutandis but 52 - * pulled to ground 53 - */ 54 - #define GPIO_U300_CONFIG_DRIVE_PUSH_PULL 0x2000 55 - #define GPIO_U300_CONFIG_DRIVE_OPEN_DRAIN 0x2001 56 - #define GPIO_U300_CONFIG_DRIVE_OPEN_SOURCE 0x2002 57 - 58 - /* 59 29 * Register definitions for COH 901 335 variant 60 30 */ 61 31 #define U300_335_PORT_STRIDE (0x1C) ··· 151 181 #define BS365_GPIO_NUM_PORTS 5 152 182 153 183 #define U300_FLOATING_INPUT { \ 154 - .bias_mode = GPIO_U300_CONFIG_BIAS_FLOAT, \ 184 + .bias_mode = PIN_CONFIG_BIAS_HIGH_IMPEDANCE, \ 155 185 .output = false, \ 156 186 } 157 187 158 188 #define U300_PULL_UP_INPUT { \ 159 - .bias_mode = GPIO_U300_CONFIG_BIAS_PULL_UP, \ 189 + .bias_mode = PIN_CONFIG_BIAS_PULL_UP, \ 160 190 .output = false, \ 161 191 } 162 192 ··· 419 449 } 420 450 421 451 static int u300_gpio_config(struct gpio_chip *chip, unsigned offset, 422 - u16 param, unsigned long *data) 452 + enum pin_config_param param, unsigned long data) 423 453 { 424 454 struct u300_gpio *gpio = to_u300_gpio(chip); 425 455 unsigned long flags; ··· 427 457 428 458 local_irq_save(flags); 429 459 switch (param) { 430 - case GPIO_U300_CONFIG_BIAS_UNKNOWN: 431 - case GPIO_U300_CONFIG_BIAS_FLOAT: 460 + case PIN_CONFIG_BIAS_DISABLE: 461 + case PIN_CONFIG_BIAS_HIGH_IMPEDANCE: 432 462 val = readl(U300_PIN_REG(offset, per)); 433 463 writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, per)); 434 464 break; 435 - case GPIO_U300_CONFIG_BIAS_PULL_UP: 465 + case PIN_CONFIG_BIAS_PULL_UP: 436 466 val = readl(U300_PIN_REG(offset, per)); 437 467 writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, per)); 438 468 break; 439 - case GPIO_U300_CONFIG_DRIVE_PUSH_PULL: 469 + case PIN_CONFIG_DRIVE_PUSH_PULL: 440 470 val = readl(U300_PIN_REG(offset, pcr)); 441 471 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK 442 472 << ((offset & 0x07) << 1)); ··· 444 474 << ((offset & 0x07) << 1)); 445 475 writel(val, U300_PIN_REG(offset, pcr)); 446 476 break; 447 - case GPIO_U300_CONFIG_DRIVE_OPEN_DRAIN: 477 + case PIN_CONFIG_DRIVE_OPEN_DRAIN: 448 478 val = readl(U300_PIN_REG(offset, pcr)); 449 479 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK 450 480 << ((offset & 0x07) << 1)); ··· 452 482 << ((offset & 0x07) << 1)); 453 483 writel(val, U300_PIN_REG(offset, pcr)); 454 484 break; 455 - case GPIO_U300_CONFIG_DRIVE_OPEN_SOURCE: 485 + case PIN_CONFIG_DRIVE_OPEN_SOURCE: 456 486 val = readl(U300_PIN_REG(offset, pcr)); 457 487 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK 458 488 << ((offset & 0x07) << 1)); ··· 621 651 622 652 /* Deactivate bias mode for output */ 623 653 u300_gpio_config(&gpio->chip, offset, 624 - GPIO_U300_CONFIG_BIAS_FLOAT, 625 - NULL); 654 + PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 655 + 0); 626 656 627 657 /* Set drive mode for output */ 628 658 u300_gpio_config(&gpio->chip, offset, 629 - GPIO_U300_CONFIG_DRIVE_PUSH_PULL, NULL); 659 + PIN_CONFIG_DRIVE_PUSH_PULL, 0); 630 660 631 661 dev_dbg(gpio->dev, "set up pin %d as output, value: %d\n", 632 662 offset, conf->outval); ··· 637 667 u300_gpio_set(&gpio->chip, offset, 0); 638 668 639 669 /* Set bias mode for input */ 640 - u300_gpio_config(&gpio->chip, offset, conf->bias_mode, NULL); 670 + u300_gpio_config(&gpio->chip, offset, conf->bias_mode, 0); 641 671 642 672 dev_dbg(gpio->dev, "set up pin %d as input, bias: %04x\n", 643 673 offset, conf->bias_mode);