Merge tag 'acpi-5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[sfrench/cifs-2.6.git] / arch / arm / mach-pxa / magician.c
index 14c0f80bc9e7cf1c7d00e73e65c8eb20e71760f7..75abc21083ebb2efd613a060ccc9ddd1c1da7630 100644 (file)
@@ -645,9 +645,8 @@ static struct regulator_init_data bq24022_init_data = {
        .consumer_supplies      = bq24022_consumers,
 };
 
-static struct gpio bq24022_gpios[] = {
-       { EGPIO_MAGICIAN_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" },
-};
+
+static enum gpiod_flags bq24022_gpiod_gflags[] = { GPIOD_OUT_LOW };
 
 static struct gpio_regulator_state bq24022_states[] = {
        { .value = 100000, .gpios = (0 << 0) },
@@ -657,12 +656,10 @@ static struct gpio_regulator_state bq24022_states[] = {
 static struct gpio_regulator_config bq24022_info = {
        .supply_name            = "bq24022",
 
-       .enable_gpio            = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
-       .enable_high            = 0,
        .enabled_at_boot        = 1,
 
-       .gpios                  = bq24022_gpios,
-       .nr_gpios               = ARRAY_SIZE(bq24022_gpios),
+       .gflags = bq24022_gpiod_gflags,
+       .ngpios = ARRAY_SIZE(bq24022_gpiod_gflags),
 
        .states                 = bq24022_states,
        .nr_states              = ARRAY_SIZE(bq24022_states),
@@ -679,6 +676,17 @@ static struct platform_device bq24022 = {
        },
 };
 
+static struct gpiod_lookup_table bq24022_gpiod_table = {
+       .dev_id = "gpio-regulator",
+       .table = {
+               GPIO_LOOKUP("gpio-pxa", EGPIO_MAGICIAN_BQ24022_ISET2,
+                           NULL, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("gpio-pxa", GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
+                           "enable", GPIO_ACTIVE_LOW),
+               { },
+       },
+};
+
 /*
  * fixed regulator for ads7846
  */
@@ -775,12 +783,31 @@ static struct pxamci_platform_data magician_mci_info = {
        .ocr_mask               = MMC_VDD_32_33|MMC_VDD_33_34,
        .init                   = magician_mci_init,
        .exit                   = magician_mci_exit,
-       .gpio_card_detect       = -1,
-       .gpio_card_ro           = EGPIO_MAGICIAN_nSD_READONLY,
        .gpio_card_ro_invert    = 1,
-       .gpio_power             = EGPIO_MAGICIAN_SD_POWER,
 };
 
+/*
+ * Write protect on EGPIO register 5 index 4, this is on the second HTC
+ * EGPIO chip which starts at register 4, so we need offset 8+4=12 on that
+ * particular chip.
+ */
+#define EGPIO_MAGICIAN_nSD_READONLY_OFFSET 12
+/*
+ * Power on EGPIO register 2 index 0, so this is on the first HTC EGPIO chip
+ * starting at register 0 so we need offset 2*8+0 = 16 on that chip.
+ */
+#define EGPIO_MAGICIAN_nSD_POWER_OFFSET 16
+
+static struct gpiod_lookup_table magician_mci_gpio_table = {
+       .dev_id = "pxa2xx-mci.0",
+       .table = {
+               GPIO_LOOKUP("htc-egpio-1", EGPIO_MAGICIAN_nSD_READONLY_OFFSET,
+                           "wp", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("htc-egpio-0", EGPIO_MAGICIAN_nSD_POWER_OFFSET,
+                           "power", GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
 
 /*
  * USB OHCI
@@ -913,7 +940,7 @@ struct pxa2xx_spi_chip tsc2046_chip_info = {
        .gpio_cs        = GPIO14_MAGICIAN_TSC2046_CS,
 };
 
-static struct pxa2xx_spi_master magician_spi_info = {
+static struct pxa2xx_spi_controller magician_spi_info = {
        .num_chipselect = 1,
        .enable_dma     = 1,
 };
@@ -979,6 +1006,7 @@ static void __init magician_init(void)
        i2c_register_board_info(1,
                ARRAY_AND_SIZE(magician_pwr_i2c_board_info));
 
+       gpiod_add_lookup_table(&magician_mci_gpio_table);
        pxa_set_mci_info(&magician_mci_info);
        pxa_set_ohci_info(&magician_ohci_info);
        pxa_set_udc_info(&magician_udc_info);
@@ -1007,6 +1035,7 @@ static void __init magician_init(void)
        regulator_register_always_on(0, "power", pwm_backlight_supply,
                ARRAY_SIZE(pwm_backlight_supply), 5000000);
 
+       gpiod_add_lookup_table(&bq24022_gpiod_table);
        platform_add_devices(ARRAY_AND_SIZE(devices));
 }