| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Support for Sharp SL-Cxx00 Series of PDAs |
|---|
| 3 | 4 | * Models: SL-C3000 (Spitz), SL-C1000 (Akita) and SL-C3100 (Borzoi) |
|---|
| .. | .. |
|---|
| 5 | 6 | * Copyright (c) 2005 Richard Purdie |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * Based on Sharp's 2.4 kernel patches/lubbock.c |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 10 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 11 | | - * published by the Free Software Foundation. |
|---|
| 12 | | - * |
|---|
| 13 | 9 | */ |
|---|
| 14 | 10 | |
|---|
| 15 | 11 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 18 | 14 | #include <linux/delay.h> |
|---|
| 19 | 15 | #include <linux/gpio_keys.h> |
|---|
| 20 | 16 | #include <linux/gpio.h> |
|---|
| 17 | +#include <linux/gpio/machine.h> |
|---|
| 21 | 18 | #include <linux/leds.h> |
|---|
| 22 | 19 | #include <linux/i2c.h> |
|---|
| 23 | 20 | #include <linux/platform_data/i2c-pxa.h> |
|---|
| .. | .. |
|---|
| 528 | 525 | } |
|---|
| 529 | 526 | } |
|---|
| 530 | 527 | |
|---|
| 528 | +static struct gpiod_lookup_table spitz_lcdcon_gpio_table = { |
|---|
| 529 | + .dev_id = "spi2.1", |
|---|
| 530 | + .table = { |
|---|
| 531 | + GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_BACKLIGHT_CONT, |
|---|
| 532 | + "BL_CONT", GPIO_ACTIVE_LOW), |
|---|
| 533 | + GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_BACKLIGHT_ON, |
|---|
| 534 | + "BL_ON", GPIO_ACTIVE_HIGH), |
|---|
| 535 | + { }, |
|---|
| 536 | + }, |
|---|
| 537 | +}; |
|---|
| 538 | + |
|---|
| 539 | +static struct gpiod_lookup_table akita_lcdcon_gpio_table = { |
|---|
| 540 | + .dev_id = "spi2.1", |
|---|
| 541 | + .table = { |
|---|
| 542 | + GPIO_LOOKUP("gpio-pxa", AKITA_GPIO_BACKLIGHT_CONT, |
|---|
| 543 | + "BL_CONT", GPIO_ACTIVE_LOW), |
|---|
| 544 | + GPIO_LOOKUP("gpio-pxa", AKITA_GPIO_BACKLIGHT_ON, |
|---|
| 545 | + "BL_ON", GPIO_ACTIVE_HIGH), |
|---|
| 546 | + { }, |
|---|
| 547 | + }, |
|---|
| 548 | +}; |
|---|
| 549 | + |
|---|
| 531 | 550 | static struct corgi_lcd_platform_data spitz_lcdcon_info = { |
|---|
| 532 | 551 | .init_mode = CORGI_LCD_MODE_VGA, |
|---|
| 533 | 552 | .max_intensity = 0x2f, |
|---|
| 534 | 553 | .default_intensity = 0x1f, |
|---|
| 535 | 554 | .limit_mask = 0x0b, |
|---|
| 536 | | - .gpio_backlight_cont = SPITZ_GPIO_BACKLIGHT_CONT, |
|---|
| 537 | | - .gpio_backlight_on = SPITZ_GPIO_BACKLIGHT_ON, |
|---|
| 538 | 555 | .kick_battery = spitz_bl_kick_battery, |
|---|
| 539 | 556 | }; |
|---|
| 540 | 557 | |
|---|
| .. | .. |
|---|
| 571 | 588 | }, |
|---|
| 572 | 589 | }; |
|---|
| 573 | 590 | |
|---|
| 574 | | -static struct pxa2xx_spi_master spitz_spi_info = { |
|---|
| 591 | +static struct pxa2xx_spi_controller spitz_spi_info = { |
|---|
| 575 | 592 | .num_chipselect = 3, |
|---|
| 576 | 593 | }; |
|---|
| 577 | 594 | |
|---|
| 578 | 595 | static void __init spitz_spi_init(void) |
|---|
| 579 | 596 | { |
|---|
| 580 | | - struct corgi_lcd_platform_data *lcd_data = &spitz_lcdcon_info; |
|---|
| 581 | | - |
|---|
| 582 | | - if (machine_is_akita()) { |
|---|
| 583 | | - lcd_data->gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT; |
|---|
| 584 | | - lcd_data->gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON; |
|---|
| 585 | | - } |
|---|
| 597 | + if (machine_is_akita()) |
|---|
| 598 | + gpiod_add_lookup_table(&akita_lcdcon_gpio_table); |
|---|
| 599 | + else |
|---|
| 600 | + gpiod_add_lookup_table(&spitz_lcdcon_gpio_table); |
|---|
| 586 | 601 | |
|---|
| 587 | 602 | pxa2xx_set_spi_info(2, &spitz_spi_info); |
|---|
| 588 | 603 | spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); |
|---|
| .. | .. |
|---|
| 615 | 630 | .detect_delay_ms = 250, |
|---|
| 616 | 631 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
|---|
| 617 | 632 | .setpower = spitz_mci_setpower, |
|---|
| 618 | | - .gpio_card_detect = SPITZ_GPIO_nSD_DETECT, |
|---|
| 619 | | - .gpio_card_ro = SPITZ_GPIO_nSD_WP, |
|---|
| 620 | | - .gpio_power = -1, |
|---|
| 633 | +}; |
|---|
| 634 | + |
|---|
| 635 | +static struct gpiod_lookup_table spitz_mci_gpio_table = { |
|---|
| 636 | + .dev_id = "pxa2xx-mci.0", |
|---|
| 637 | + .table = { |
|---|
| 638 | + GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_DETECT, |
|---|
| 639 | + "cd", GPIO_ACTIVE_LOW), |
|---|
| 640 | + GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_WP, |
|---|
| 641 | + "wp", GPIO_ACTIVE_LOW), |
|---|
| 642 | + { }, |
|---|
| 643 | + }, |
|---|
| 621 | 644 | }; |
|---|
| 622 | 645 | |
|---|
| 623 | 646 | static void __init spitz_mmc_init(void) |
|---|
| 624 | 647 | { |
|---|
| 648 | + gpiod_add_lookup_table(&spitz_mci_gpio_table); |
|---|
| 625 | 649 | pxa_set_mci_info(&spitz_mci_platform_data); |
|---|
| 626 | 650 | } |
|---|
| 627 | 651 | #else |
|---|