| .. | .. |
|---|
| 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> |
|---|
| 16 | | -#include <linux/module.h> /* symbol_get ; symbol_put */ |
|---|
| 17 | 12 | #include <linux/platform_device.h> |
|---|
| 18 | 13 | #include <linux/delay.h> |
|---|
| 19 | 14 | #include <linux/gpio_keys.h> |
|---|
| 20 | 15 | #include <linux/gpio.h> |
|---|
| 16 | +#include <linux/gpio/machine.h> |
|---|
| 21 | 17 | #include <linux/leds.h> |
|---|
| 22 | 18 | #include <linux/i2c.h> |
|---|
| 23 | 19 | #include <linux/platform_data/i2c-pxa.h> |
|---|
| .. | .. |
|---|
| 517 | 513 | .gpio_cs = SPITZ_GPIO_ADS7846_CS, |
|---|
| 518 | 514 | }; |
|---|
| 519 | 515 | |
|---|
| 520 | | -static void spitz_bl_kick_battery(void) |
|---|
| 521 | | -{ |
|---|
| 522 | | - void (*kick_batt)(void); |
|---|
| 516 | +static struct gpiod_lookup_table spitz_lcdcon_gpio_table = { |
|---|
| 517 | + .dev_id = "spi2.1", |
|---|
| 518 | + .table = { |
|---|
| 519 | + GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_BACKLIGHT_CONT, |
|---|
| 520 | + "BL_CONT", GPIO_ACTIVE_LOW), |
|---|
| 521 | + GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_BACKLIGHT_ON, |
|---|
| 522 | + "BL_ON", GPIO_ACTIVE_HIGH), |
|---|
| 523 | + { }, |
|---|
| 524 | + }, |
|---|
| 525 | +}; |
|---|
| 523 | 526 | |
|---|
| 524 | | - kick_batt = symbol_get(sharpsl_battery_kick); |
|---|
| 525 | | - if (kick_batt) { |
|---|
| 526 | | - kick_batt(); |
|---|
| 527 | | - symbol_put(sharpsl_battery_kick); |
|---|
| 528 | | - } |
|---|
| 529 | | -} |
|---|
| 527 | +static struct gpiod_lookup_table akita_lcdcon_gpio_table = { |
|---|
| 528 | + .dev_id = "spi2.1", |
|---|
| 529 | + .table = { |
|---|
| 530 | + GPIO_LOOKUP("gpio-pxa", AKITA_GPIO_BACKLIGHT_CONT, |
|---|
| 531 | + "BL_CONT", GPIO_ACTIVE_LOW), |
|---|
| 532 | + GPIO_LOOKUP("gpio-pxa", AKITA_GPIO_BACKLIGHT_ON, |
|---|
| 533 | + "BL_ON", GPIO_ACTIVE_HIGH), |
|---|
| 534 | + { }, |
|---|
| 535 | + }, |
|---|
| 536 | +}; |
|---|
| 530 | 537 | |
|---|
| 531 | 538 | static struct corgi_lcd_platform_data spitz_lcdcon_info = { |
|---|
| 532 | 539 | .init_mode = CORGI_LCD_MODE_VGA, |
|---|
| 533 | 540 | .max_intensity = 0x2f, |
|---|
| 534 | 541 | .default_intensity = 0x1f, |
|---|
| 535 | 542 | .limit_mask = 0x0b, |
|---|
| 536 | | - .gpio_backlight_cont = SPITZ_GPIO_BACKLIGHT_CONT, |
|---|
| 537 | | - .gpio_backlight_on = SPITZ_GPIO_BACKLIGHT_ON, |
|---|
| 538 | | - .kick_battery = spitz_bl_kick_battery, |
|---|
| 543 | + .kick_battery = sharpsl_battery_kick, |
|---|
| 539 | 544 | }; |
|---|
| 540 | 545 | |
|---|
| 541 | 546 | static struct pxa2xx_spi_chip spitz_lcdcon_chip = { |
|---|
| .. | .. |
|---|
| 571 | 576 | }, |
|---|
| 572 | 577 | }; |
|---|
| 573 | 578 | |
|---|
| 574 | | -static struct pxa2xx_spi_master spitz_spi_info = { |
|---|
| 579 | +static struct pxa2xx_spi_controller spitz_spi_info = { |
|---|
| 575 | 580 | .num_chipselect = 3, |
|---|
| 576 | 581 | }; |
|---|
| 577 | 582 | |
|---|
| 578 | 583 | static void __init spitz_spi_init(void) |
|---|
| 579 | 584 | { |
|---|
| 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 | | - } |
|---|
| 585 | + if (machine_is_akita()) |
|---|
| 586 | + gpiod_add_lookup_table(&akita_lcdcon_gpio_table); |
|---|
| 587 | + else |
|---|
| 588 | + gpiod_add_lookup_table(&spitz_lcdcon_gpio_table); |
|---|
| 586 | 589 | |
|---|
| 587 | 590 | pxa2xx_set_spi_info(2, &spitz_spi_info); |
|---|
| 588 | 591 | spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); |
|---|
| .. | .. |
|---|
| 615 | 618 | .detect_delay_ms = 250, |
|---|
| 616 | 619 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
|---|
| 617 | 620 | .setpower = spitz_mci_setpower, |
|---|
| 618 | | - .gpio_card_detect = SPITZ_GPIO_nSD_DETECT, |
|---|
| 619 | | - .gpio_card_ro = SPITZ_GPIO_nSD_WP, |
|---|
| 620 | | - .gpio_power = -1, |
|---|
| 621 | +}; |
|---|
| 622 | + |
|---|
| 623 | +static struct gpiod_lookup_table spitz_mci_gpio_table = { |
|---|
| 624 | + .dev_id = "pxa2xx-mci.0", |
|---|
| 625 | + .table = { |
|---|
| 626 | + GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_DETECT, |
|---|
| 627 | + "cd", GPIO_ACTIVE_LOW), |
|---|
| 628 | + GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_WP, |
|---|
| 629 | + "wp", GPIO_ACTIVE_LOW), |
|---|
| 630 | + { }, |
|---|
| 631 | + }, |
|---|
| 621 | 632 | }; |
|---|
| 622 | 633 | |
|---|
| 623 | 634 | static void __init spitz_mmc_init(void) |
|---|
| 624 | 635 | { |
|---|
| 636 | + gpiod_add_lookup_table(&spitz_mci_gpio_table); |
|---|
| 625 | 637 | pxa_set_mci_info(&spitz_mci_platform_data); |
|---|
| 626 | 638 | } |
|---|
| 627 | 639 | #else |
|---|