forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/arch/arm/mach-pxa/spitz.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Support for Sharp SL-Cxx00 Series of PDAs
34 * Models: SL-C3000 (Spitz), SL-C1000 (Akita) and SL-C3100 (Borzoi)
....@@ -5,11 +6,6 @@
56 * Copyright (c) 2005 Richard Purdie
67 *
78 * 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
- *
139 */
1410
1511 #include <linux/kernel.h>
....@@ -18,6 +14,7 @@
1814 #include <linux/delay.h>
1915 #include <linux/gpio_keys.h>
2016 #include <linux/gpio.h>
17
+#include <linux/gpio/machine.h>
2118 #include <linux/leds.h>
2219 #include <linux/i2c.h>
2320 #include <linux/platform_data/i2c-pxa.h>
....@@ -528,13 +525,33 @@
528525 }
529526 }
530527
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
+
531550 static struct corgi_lcd_platform_data spitz_lcdcon_info = {
532551 .init_mode = CORGI_LCD_MODE_VGA,
533552 .max_intensity = 0x2f,
534553 .default_intensity = 0x1f,
535554 .limit_mask = 0x0b,
536
- .gpio_backlight_cont = SPITZ_GPIO_BACKLIGHT_CONT,
537
- .gpio_backlight_on = SPITZ_GPIO_BACKLIGHT_ON,
538555 .kick_battery = spitz_bl_kick_battery,
539556 };
540557
....@@ -571,18 +588,16 @@
571588 },
572589 };
573590
574
-static struct pxa2xx_spi_master spitz_spi_info = {
591
+static struct pxa2xx_spi_controller spitz_spi_info = {
575592 .num_chipselect = 3,
576593 };
577594
578595 static void __init spitz_spi_init(void)
579596 {
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);
586601
587602 pxa2xx_set_spi_info(2, &spitz_spi_info);
588603 spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices));
....@@ -615,13 +630,22 @@
615630 .detect_delay_ms = 250,
616631 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
617632 .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
+ },
621644 };
622645
623646 static void __init spitz_mmc_init(void)
624647 {
648
+ gpiod_add_lookup_table(&spitz_mci_gpio_table);
625649 pxa_set_mci_info(&spitz_mci_platform_data);
626650 }
627651 #else