| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Support for Sharp SL-C7xx PDAs |
|---|
| 3 | 4 | * Models: SL-C700 (Corgi), SL-C750 (Shepherd), SL-C760 (Husky) |
|---|
| .. | .. |
|---|
| 5 | 6 | * Copyright (c) 2004-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> |
|---|
| .. | .. |
|---|
| 24 | 20 | #include <linux/mtd/physmap.h> |
|---|
| 25 | 21 | #include <linux/pm.h> |
|---|
| 26 | 22 | #include <linux/gpio.h> |
|---|
| 23 | +#include <linux/gpio/machine.h> |
|---|
| 27 | 24 | #include <linux/backlight.h> |
|---|
| 28 | 25 | #include <linux/i2c.h> |
|---|
| 29 | 26 | #include <linux/platform_data/i2c-pxa.h> |
|---|
| .. | .. |
|---|
| 493 | 490 | static struct pxamci_platform_data corgi_mci_platform_data = { |
|---|
| 494 | 491 | .detect_delay_ms = 250, |
|---|
| 495 | 492 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
|---|
| 496 | | - .gpio_card_detect = CORGI_GPIO_nSD_DETECT, |
|---|
| 497 | | - .gpio_card_ro = CORGI_GPIO_nSD_WP, |
|---|
| 498 | | - .gpio_power = CORGI_GPIO_SD_PWR, |
|---|
| 499 | 493 | }; |
|---|
| 500 | 494 | |
|---|
| 495 | +static struct gpiod_lookup_table corgi_mci_gpio_table = { |
|---|
| 496 | + .dev_id = "pxa2xx-mci.0", |
|---|
| 497 | + .table = { |
|---|
| 498 | + /* Card detect on GPIO 9 */ |
|---|
| 499 | + GPIO_LOOKUP("gpio-pxa", CORGI_GPIO_nSD_DETECT, |
|---|
| 500 | + "cd", GPIO_ACTIVE_LOW), |
|---|
| 501 | + /* Write protect on GPIO 7 */ |
|---|
| 502 | + GPIO_LOOKUP("gpio-pxa", CORGI_GPIO_nSD_WP, |
|---|
| 503 | + "wp", GPIO_ACTIVE_LOW), |
|---|
| 504 | + /* Power on GPIO 33 */ |
|---|
| 505 | + GPIO_LOOKUP("gpio-pxa", CORGI_GPIO_SD_PWR, |
|---|
| 506 | + "power", GPIO_ACTIVE_HIGH), |
|---|
| 507 | + { }, |
|---|
| 508 | + }, |
|---|
| 509 | +}; |
|---|
| 501 | 510 | |
|---|
| 502 | 511 | /* |
|---|
| 503 | 512 | * Irda |
|---|
| .. | .. |
|---|
| 517 | 526 | }; |
|---|
| 518 | 527 | |
|---|
| 519 | 528 | #if IS_ENABLED(CONFIG_SPI_PXA2XX) |
|---|
| 520 | | -static struct pxa2xx_spi_master corgi_spi_info = { |
|---|
| 529 | +static struct pxa2xx_spi_controller corgi_spi_info = { |
|---|
| 521 | 530 | .num_chipselect = 3, |
|---|
| 522 | 531 | }; |
|---|
| 523 | 532 | |
|---|
| .. | .. |
|---|
| 554 | 563 | } |
|---|
| 555 | 564 | } |
|---|
| 556 | 565 | |
|---|
| 566 | +static struct gpiod_lookup_table corgi_lcdcon_gpio_table = { |
|---|
| 567 | + .dev_id = "spi1.1", |
|---|
| 568 | + .table = { |
|---|
| 569 | + GPIO_LOOKUP("gpio-pxa", CORGI_GPIO_BACKLIGHT_CONT, |
|---|
| 570 | + "BL_CONT", GPIO_ACTIVE_HIGH), |
|---|
| 571 | + { }, |
|---|
| 572 | + }, |
|---|
| 573 | +}; |
|---|
| 574 | + |
|---|
| 557 | 575 | static struct corgi_lcd_platform_data corgi_lcdcon_info = { |
|---|
| 558 | 576 | .init_mode = CORGI_LCD_MODE_VGA, |
|---|
| 559 | 577 | .max_intensity = 0x2f, |
|---|
| 560 | 578 | .default_intensity = 0x1f, |
|---|
| 561 | 579 | .limit_mask = 0x0b, |
|---|
| 562 | | - .gpio_backlight_cont = CORGI_GPIO_BACKLIGHT_CONT, |
|---|
| 563 | | - .gpio_backlight_on = -1, |
|---|
| 564 | 580 | .kick_battery = corgi_bl_kick_battery, |
|---|
| 565 | 581 | }; |
|---|
| 566 | 582 | |
|---|
| .. | .. |
|---|
| 600 | 616 | static void __init corgi_init_spi(void) |
|---|
| 601 | 617 | { |
|---|
| 602 | 618 | pxa2xx_set_spi_info(1, &corgi_spi_info); |
|---|
| 619 | + gpiod_add_lookup_table(&corgi_lcdcon_gpio_table); |
|---|
| 603 | 620 | spi_register_board_info(ARRAY_AND_SIZE(corgi_spi_devices)); |
|---|
| 604 | 621 | } |
|---|
| 605 | 622 | #else |
|---|
| .. | .. |
|---|
| 731 | 748 | corgi_init_spi(); |
|---|
| 732 | 749 | |
|---|
| 733 | 750 | pxa_set_udc_info(&udc_info); |
|---|
| 751 | + gpiod_add_lookup_table(&corgi_mci_gpio_table); |
|---|
| 734 | 752 | pxa_set_mci_info(&corgi_mci_platform_data); |
|---|
| 735 | 753 | pxa_set_ficp_info(&corgi_ficp_platform_data); |
|---|
| 736 | 754 | pxa_set_i2c_info(NULL); |
|---|