~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/arm/mach-pxa/z2.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include <linux/gpio_keys.h>
30
30
#include <linux/delay.h>
31
31
#include <linux/regulator/machine.h>
 
32
#include <linux/i2c/pxa-i2c.h>
32
33
 
33
34
#include <asm/mach-types.h>
34
35
#include <asm/mach/arch.h>
40
41
#include <mach/mmc.h>
41
42
#include <plat/pxa27x_keypad.h>
42
43
 
43
 
#include <plat/i2c.h>
44
 
 
45
44
#include "generic.h"
46
45
#include "devices.h"
47
46
 
92
91
        GPIO47_STUART_TXD,
93
92
 
94
93
        /* Keypad */
95
 
        GPIO100_KP_MKIN_0       | WAKEUP_ON_LEVEL_HIGH,
96
 
        GPIO101_KP_MKIN_1       | WAKEUP_ON_LEVEL_HIGH,
97
 
        GPIO102_KP_MKIN_2       | WAKEUP_ON_LEVEL_HIGH,
98
 
        GPIO34_KP_MKIN_3        | WAKEUP_ON_LEVEL_HIGH,
99
 
        GPIO38_KP_MKIN_4        | WAKEUP_ON_LEVEL_HIGH,
100
 
        GPIO16_KP_MKIN_5        | WAKEUP_ON_LEVEL_HIGH,
101
 
        GPIO17_KP_MKIN_6        | WAKEUP_ON_LEVEL_HIGH,
 
94
        GPIO100_KP_MKIN_0,
 
95
        GPIO101_KP_MKIN_1,
 
96
        GPIO102_KP_MKIN_2,
 
97
        GPIO34_KP_MKIN_3,
 
98
        GPIO38_KP_MKIN_4,
 
99
        GPIO16_KP_MKIN_5,
 
100
        GPIO17_KP_MKIN_6,
102
101
        GPIO103_KP_MKOUT_0,
103
102
        GPIO104_KP_MKOUT_1,
104
103
        GPIO105_KP_MKOUT_2,
139
138
        GPIO1_GPIO,             /* Power button */
140
139
        GPIO37_GPIO,            /* Headphone detect */
141
140
        GPIO98_GPIO,            /* Lid switch */
142
 
        GPIO14_GPIO,            /* WiFi Reset */
143
 
        GPIO15_GPIO,            /* WiFi Power */
 
141
        GPIO14_GPIO,            /* WiFi Power */
144
142
        GPIO24_GPIO,            /* WiFi CS */
145
143
        GPIO36_GPIO,            /* WiFi IRQ */
146
144
        GPIO88_GPIO,            /* LCD CS */
205
203
                /* Keypad Backlight */
206
204
                .pwm_id         = 1,
207
205
                .max_brightness = 1023,
208
 
                .dft_brightness = 512,
 
206
                .dft_brightness = 0,
209
207
                .pwm_period_ns  = 1260320,
210
208
        },
211
209
        [1] = {
272
270
 
273
271
static void __init z2_lcd_init(void)
274
272
{
275
 
        set_pxa_fb_info(&z2_lcd_screen);
 
273
        pxa_set_fb_info(NULL, &z2_lcd_screen);
276
274
}
277
275
#else
278
276
static inline void z2_lcd_init(void) {}
310
308
        .active_low             = 1,
311
309
}, {
312
310
        .name                   = "z2:green:charged",
313
 
        .default_trigger        = "none",
 
311
        .default_trigger        = "mmc0",
314
312
        .gpio                   = GPIO85_ZIPITZ2_LED_CHARGED,
315
313
        .active_low             = 1,
316
314
}, {
317
315
        .name                   = "z2:amber:charging",
318
 
        .default_trigger        = "none",
 
316
        .default_trigger        = "Z2-charging-or-full",
319
317
        .gpio                   = GPIO83_ZIPITZ2_LED_CHARGING,
320
318
        .active_low             = 1,
321
319
},
428
426
 ******************************************************************************/
429
427
#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
430
428
static struct gpio_keys_button z2_pxa_buttons[] = {
431
 
        {KEY_POWER, GPIO1_ZIPITZ2_POWER_BUTTON, 0, "Power Button" },
432
 
        {KEY_CLOSE, GPIO98_ZIPITZ2_LID_BUTTON, 0, "Lid Button" },
 
429
        {
 
430
                .code           = KEY_POWER,
 
431
                .gpio           = GPIO1_ZIPITZ2_POWER_BUTTON,
 
432
                .active_low     = 0,
 
433
                .desc           = "Power Button",
 
434
                .wakeup         = 1,
 
435
                .type           = EV_KEY,
 
436
        },
 
437
        {
 
438
                .code           = SW_LID,
 
439
                .gpio           = GPIO98_ZIPITZ2_LID_BUTTON,
 
440
                .active_low     = 1,
 
441
                .desc           = "Lid Switch",
 
442
                .wakeup         = 0,
 
443
                .type           = EV_SW,
 
444
        },
433
445
};
434
446
 
435
447
static struct gpio_keys_platform_data z2_pxa_keys_data = {
462
474
        .batt_I2C_addr  = 0x55,
463
475
        .batt_I2C_reg   = 2,
464
476
        .charge_gpio    = GPIO0_ZIPITZ2_AC_DETECT,
465
 
        .min_voltage    = 2400000,
466
 
        .max_voltage    = 3700000,
467
 
        .batt_div       = 69,
 
477
        .min_voltage    = 3475000,
 
478
        .max_voltage    = 4190000,
 
479
        .batt_div       = 59,
468
480
        .batt_mult      = 1000000,
469
481
        .batt_tech      = POWER_SUPPLY_TECHNOLOGY_LION,
470
482
        .batt_name      = "Z2",
498
510
{
499
511
        int ret = 0;
500
512
 
501
 
        ret = gpio_request(GPIO15_ZIPITZ2_WIFI_POWER, "WiFi Power");
 
513
        ret = gpio_request(GPIO14_ZIPITZ2_WIFI_POWER, "WiFi Power");
502
514
        if (ret)
503
515
                goto err;
504
516
 
505
 
        ret = gpio_direction_output(GPIO15_ZIPITZ2_WIFI_POWER, 1);
506
 
        if (ret)
507
 
                goto err2;
508
 
 
509
 
        ret = gpio_request(GPIO14_ZIPITZ2_WIFI_RESET, "WiFi Reset");
510
 
        if (ret)
511
 
                goto err2;
512
 
 
513
 
        ret = gpio_direction_output(GPIO14_ZIPITZ2_WIFI_RESET, 0);
514
 
        if (ret)
515
 
                goto err3;
516
 
 
517
 
        /* Reset the card */
 
517
        ret = gpio_direction_output(GPIO14_ZIPITZ2_WIFI_POWER, 1);
 
518
        if (ret)
 
519
                goto err2;
 
520
 
 
521
        /* Wait until card is powered on */
518
522
        mdelay(180);
519
 
        gpio_set_value(GPIO14_ZIPITZ2_WIFI_RESET, 1);
520
 
        mdelay(20);
521
523
 
522
524
        spi->bits_per_word = 16;
523
525
        spi->mode = SPI_MODE_2,
526
528
 
527
529
        return 0;
528
530
 
529
 
err3:
530
 
        gpio_free(GPIO14_ZIPITZ2_WIFI_RESET);
531
531
err2:
532
 
        gpio_free(GPIO15_ZIPITZ2_WIFI_POWER);
 
532
        gpio_free(GPIO14_ZIPITZ2_WIFI_POWER);
533
533
err:
534
534
        return ret;
535
535
};
536
536
 
537
537
static int z2_lbs_spi_teardown(struct spi_device *spi)
538
538
{
539
 
        gpio_set_value(GPIO14_ZIPITZ2_WIFI_RESET, 0);
540
 
        gpio_set_value(GPIO15_ZIPITZ2_WIFI_POWER, 0);
541
 
        gpio_free(GPIO14_ZIPITZ2_WIFI_RESET);
542
 
        gpio_free(GPIO15_ZIPITZ2_WIFI_POWER);
 
539
        gpio_set_value(GPIO14_ZIPITZ2_WIFI_POWER, 0);
 
540
        gpio_free(GPIO14_ZIPITZ2_WIFI_POWER);
 
541
 
543
542
        return 0;
544
 
 
545
543
};
546
544
 
547
545
static struct pxa2xx_spi_chip z2_lbs_chip_info = {