forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
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,19 +6,14 @@
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>
16
-#include <linux/module.h> /* symbol_get ; symbol_put */
1712 #include <linux/platform_device.h>
1813 #include <linux/delay.h>
1914 #include <linux/gpio_keys.h>
2015 #include <linux/gpio.h>
16
+#include <linux/gpio/machine.h>
2117 #include <linux/leds.h>
2218 #include <linux/i2c.h>
2319 #include <linux/platform_data/i2c-pxa.h>
....@@ -517,25 +513,34 @@
517513 .gpio_cs = SPITZ_GPIO_ADS7846_CS,
518514 };
519515
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
+};
523526
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
+};
530537
531538 static struct corgi_lcd_platform_data spitz_lcdcon_info = {
532539 .init_mode = CORGI_LCD_MODE_VGA,
533540 .max_intensity = 0x2f,
534541 .default_intensity = 0x1f,
535542 .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,
539544 };
540545
541546 static struct pxa2xx_spi_chip spitz_lcdcon_chip = {
....@@ -571,18 +576,16 @@
571576 },
572577 };
573578
574
-static struct pxa2xx_spi_master spitz_spi_info = {
579
+static struct pxa2xx_spi_controller spitz_spi_info = {
575580 .num_chipselect = 3,
576581 };
577582
578583 static void __init spitz_spi_init(void)
579584 {
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);
586589
587590 pxa2xx_set_spi_info(2, &spitz_spi_info);
588591 spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices));
....@@ -615,13 +618,22 @@
615618 .detect_delay_ms = 250,
616619 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
617620 .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
+ },
621632 };
622633
623634 static void __init spitz_mmc_init(void)
624635 {
636
+ gpiod_add_lookup_table(&spitz_mci_gpio_table);
625637 pxa_set_mci_info(&spitz_mci_platform_data);
626638 }
627639 #else