]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap2/board-n800.c
REMOVE OMAP LEGACY CODE: Reset clocks and PM code to mainline
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-n800.c
index 7a412451c183ed4ad850a7c851739de79cd3c77e..f1552f0d7b61948e921ed8e94422a8f0a9ddef6f 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/tsc2301.h>
+#include <linux/spi/tsc2005.h>
 #include <linux/input.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/i2c.h>
 #include <linux/i2c/lm8323.h>
-#include <asm/hardware.h>
+#include <linux/i2c/menelaus.h>
+#include <linux/i2c/lp5521.h>
+#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
-#include <asm/arch/gpio.h>
-#include <asm/arch/usb.h>
-#include <asm/arch/board.h>
-#include <asm/arch/common.h>
-#include <asm/arch/mcspi.h>
-#include <asm/arch/menelaus.h>
-#include <asm/arch/lcd_mipid.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/gpio-switch.h>
-#include <asm/arch/omapfb.h>
-#include <asm/arch/blizzard.h>
+#include <mach/gpio.h>
+#include <mach/usb.h>
+#include <mach/board.h>
+#include <mach/common.h>
+#include <mach/mcspi.h>
+#include <mach/lcd_mipid.h>
+#include <mach/clock.h>
+#include <mach/gpio-switch.h>
+#include <mach/omapfb.h>
+#include <mach/blizzard.h>
+#include <mach/board-nokia.h>
 
 #include <../drivers/cbus/tahvo.h>
 #include <../drivers/media/video/tcm825x.h>
@@ -110,30 +113,33 @@ static s16 rx44_keymap[LM8323_KEYMAP_SIZE] = {
 };
 
 static struct lm8323_platform_data lm8323_pdata = {
-       .repeat = 0, /* Repeat is handled in userspace for now. */
-       .keymap = rx44_keymap,
-
-       .name = "Internal keyboard",
-       .pwm1_name = "keyboard",
-       .pwm2_name = "cover",
+       .repeat         = 0, /* Repeat is handled in userspace for now. */
+       .keymap         = rx44_keymap,
+       .size_x         = 8,
+       .size_y         = 8,
+       .debounce_time  = 12,
+       .active_time    = 500,
+
+       .name           = "Internal keyboard",
+       .pwm1_name      = "n810::keyboard",
+       .pwm2_name      = "n810::cover",
 };
 #endif
 
 void __init nokia_n800_init_irq(void)
 {
-       omap2_init_common_hw();
+       omap2_init_common_hw(NULL);
        omap_init_irq();
        omap_gpio_init();
 
 #ifdef CONFIG_OMAP_STI
-       if (omap_request_gpio(N800_STI_GPIO) < 0) {
+       if (gpio_request(N800_STI_GPIO, "STI") < 0) {
                printk(KERN_ERR "Failed to request GPIO %d for STI\n",
                       N800_STI_GPIO);
                return;
        }
 
-       omap_set_gpio_direction(N800_STI_GPIO, 0);
-       omap_set_gpio_dataout(N800_STI_GPIO, 0);
+       gpio_direction_output(N800_STI_GPIO, 0);
 #endif
 }
 
@@ -177,7 +183,7 @@ static void mipid_shutdown(struct mipid_platform_data *pdata)
 {
        if (pdata->nreset_gpio != -1) {
                pr_info("shutdown LCD\n");
-               omap_set_gpio_dataout(pdata->nreset_gpio, 0);
+               gpio_set_value(pdata->nreset_gpio, 0);
                msleep(120);
        }
 }
@@ -231,12 +237,12 @@ static void blizzard_power_up(struct device *dev)
        msleep(10);
 
        blizzard_enable_clocks(1);
-       omap_set_gpio_dataout(N800_BLIZZARD_POWERDOWN_GPIO, 1);
+       gpio_set_value(N800_BLIZZARD_POWERDOWN_GPIO, 1);
 }
 
 static void blizzard_power_down(struct device *dev)
 {
-       omap_set_gpio_dataout(N800_BLIZZARD_POWERDOWN_GPIO, 0);
+       gpio_set_value(N800_BLIZZARD_POWERDOWN_GPIO, 0);
        blizzard_enable_clocks(0);
 
        /* Vcore to 1.005V */
@@ -254,32 +260,21 @@ static void __init blizzard_dev_init(void)
 {
        int r;
 
-       r = omap_request_gpio(N800_BLIZZARD_POWERDOWN_GPIO);
+       r = gpio_request(N800_BLIZZARD_POWERDOWN_GPIO, "Blizzard pd");
        if (r < 0)
                return;
-       omap_set_gpio_direction(N800_BLIZZARD_POWERDOWN_GPIO, 0);
-       omap_set_gpio_dataout(N800_BLIZZARD_POWERDOWN_GPIO, 1);
+       gpio_direction_output(N800_BLIZZARD_POWERDOWN_GPIO, 1);
 
        blizzard_get_clocks();
        omapfb_set_ctrl_platform_data(&n800_blizzard_data);
 }
 
-static struct omap_mmc_config n800_mmc_config __initdata = {
-       .mmc [0] = {
-               .enabled                = 1,
-               .wire4                  = 1,
-       },
-};
-
-extern struct omap_mmc_platform_data n800_mmc_data;
-
 static struct omap_board_config_kernel n800_config[] __initdata = {
        { OMAP_TAG_UART,                        &n800_uart_config },
        { OMAP_TAG_FBMEM,                       &n800_fbmem0_config },
        { OMAP_TAG_FBMEM,                       &n800_fbmem1_config },
        { OMAP_TAG_FBMEM,                       &n800_fbmem2_config },
        { OMAP_TAG_TMP105,                      &n800_tmp105_config },
-       { OMAP_TAG_MMC,                         &n800_mmc_config },
 };
 
 static struct tsc2301_platform_data tsc2301_config = {
@@ -314,7 +309,7 @@ static void tsc2301_dev_init(void)
        r = gpio_request(gpio, "tsc2301 KBD IRQ");
        if (r >= 0) {
                gpio_direction_input(gpio);
-               tsc2301_config.keyb_int = OMAP_GPIO_IRQ(gpio);
+               tsc2301_config.keyb_int = gpio_to_irq(gpio);
        } else {
                printk(KERN_ERR "unable to get KBD GPIO");
        }
@@ -323,7 +318,7 @@ static void tsc2301_dev_init(void)
        r = gpio_request(gpio, "tsc2301 DAV IRQ");
        if (r >= 0) {
                gpio_direction_input(gpio);
-               tsc2301_config.dav_int = OMAP_GPIO_IRQ(gpio);
+               tsc2301_config.dav_int = gpio_to_irq(gpio);
        } else {
                printk(KERN_ERR "unable to get DAV GPIO");
        }
@@ -342,15 +337,15 @@ static int __init tea5761_dev_init(void)
                pr_debug("Enabling tea5761 at GPIO %d\n",
                         enable_gpio);
 
-               if (omap_request_gpio(enable_gpio) < 0) {
+               if (gpio_request(enable_gpio, "TEA5761 enable") < 0) {
                        printk(KERN_ERR "Can't request GPIO %d\n",
                               enable_gpio);
                        return -ENODEV;
                }
 
-               omap_set_gpio_direction(enable_gpio, 0);
+               gpio_direction_output(enable_gpio, 0);
                udelay(50);
-               omap_set_gpio_dataout(enable_gpio, 1);
+               gpio_set_value(enable_gpio, 1);
        }
 
        return 0;
@@ -371,21 +366,34 @@ static struct omap2_mcspi_device_config cx3110x_mcspi_config = {
        .single_channel = 1,
 };
 
+#ifdef CONFIG_TOUCHSCREEN_TSC2005
+static struct tsc2005_platform_data tsc2005_config = {
+       .reset_gpio = 94,
+       .dav_gpio = 106
+};
+
+static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
+       .turbo_mode     = 0,
+       .single_channel = 1,
+};
+#endif
+
 static struct spi_board_info n800_spi_board_info[] __initdata = {
-       [0] = {
+       {
                .modalias       = "lcd_mipid",
                .bus_num        = 1,
                .chip_select    = 1,
                .max_speed_hz   = 4000000,
                .controller_data= &mipid_mcspi_config,
                .platform_data  = &n800_mipid_platform_data,
-       }, [1] = {
+       }, {
                .modalias       = "cx3110x",
                .bus_num        = 2,
                .chip_select    = 0,
                .max_speed_hz   = 48000000,
                .controller_data= &cx3110x_mcspi_config,
-       }, [2] = {
+       },
+       {
                .modalias       = "tsc2301",
                .bus_num        = 1,
                .chip_select    = 0,
@@ -395,6 +403,73 @@ static struct spi_board_info n800_spi_board_info[] __initdata = {
        },
 };
 
+static struct spi_board_info n810_spi_board_info[] __initdata = {
+       {
+               .modalias        = "lcd_mipid",
+               .bus_num         = 1,
+               .chip_select     = 1,
+               .max_speed_hz    = 4000000,
+               .controller_data = &mipid_mcspi_config,
+               .platform_data   = &n800_mipid_platform_data,
+       },
+       {
+               .modalias        = "cx3110x",
+               .bus_num         = 2,
+               .chip_select     = 0,
+               .max_speed_hz    = 48000000,
+               .controller_data = &cx3110x_mcspi_config,
+       },
+       {
+               .modalias        = "tsc2005",
+               .bus_num         = 1,
+               .chip_select     = 0,
+               .max_speed_hz    = 6000000,
+               .controller_data = &tsc2005_mcspi_config,
+               .platform_data   = &tsc2005_config,
+       },
+};
+
+static void __init tsc2005_set_config(void)
+{
+       const struct omap_lcd_config *conf;
+
+       conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
+       if (conf != NULL) {
+#ifdef CONFIG_TOUCHSCREEN_TSC2005
+               if (strcmp(conf->panel_name, "lph8923") == 0) {
+                       tsc2005_config.ts_x_plate_ohm = 180;
+                       tsc2005_config.ts_hw_avg = 0;
+                       tsc2005_config.ts_ignore_last = 0;
+                       tsc2005_config.ts_touch_pressure = 1500;
+                       tsc2005_config.ts_stab_time = 100;
+                       tsc2005_config.ts_pressure_max = 2048;
+                       tsc2005_config.ts_pressure_fudge = 2;
+                       tsc2005_config.ts_x_max = 4096;
+                       tsc2005_config.ts_x_fudge = 4;
+                       tsc2005_config.ts_y_max = 4096;
+                       tsc2005_config.ts_y_fudge = 7;
+               } else if (strcmp(conf->panel_name, "ls041y3") == 0) {
+                       tsc2005_config.ts_x_plate_ohm = 280;
+                       tsc2005_config.ts_hw_avg = 0;
+                       tsc2005_config.ts_ignore_last = 0;
+                       tsc2005_config.ts_touch_pressure = 1500;
+                       tsc2005_config.ts_stab_time = 1000;
+                       tsc2005_config.ts_pressure_max = 2048;
+                       tsc2005_config.ts_pressure_fudge = 2;
+                       tsc2005_config.ts_x_max = 4096;
+                       tsc2005_config.ts_x_fudge = 4;
+                       tsc2005_config.ts_y_max = 4096;
+                       tsc2005_config.ts_y_fudge = 7;
+               } else {
+                       printk(KERN_ERR "Unknown panel type, set default "
+                              "touchscreen configuration\n");
+                       tsc2005_config.ts_x_plate_ohm = 200;
+                       tsc2005_config.ts_stab_time = 100;
+               }
+#endif
+       }
+}
+
 #if defined(CONFIG_CBUS_RETU) && defined(CONFIG_LEDS_OMAP_PWM)
 
 void retu_keypad_led_set_power(struct omap_pwm_led_platform_data *self,
@@ -494,10 +569,20 @@ static struct omap_gpio_switch n800_gpio_switches[] __initdata = {
        },
 };
 
+#if defined(CONFIG_CBUS_RETU_HEADSET)
+static struct platform_device retu_headset_device = {
+       .name   = "retu-headset",
+       .id     = -1,
+};
+#endif
+
 static struct platform_device *n800_devices[] __initdata = {
 #if defined(CONFIG_CBUS_RETU) && defined(CONFIG_LEDS_OMAP_PWM)
        &n800_keypad_led_device,
 #endif
+#if defined(CONFIG_CBUS_RETU_HEADSET)
+       &retu_headset_device,
+#endif
 };
 
 #ifdef CONFIG_MENELAUS
@@ -559,29 +644,44 @@ static struct i2c_board_info __initdata n800_i2c_board_info_1[] = {
        },
 };
 
+static struct lp5521_platform_data n810_lp5521_platform_data = {
+       .mode           = LP5521_MODE_DIRECT_CONTROL,
+       .label          = "n810",
+       .red_present    = true,
+       .green_present  = true,
+       .blue_present   = true,
+};
+
 extern struct tcm825x_platform_data n800_tcm825x_platform_data;
 
-static struct i2c_board_info __initdata n800_i2c_board_info_2[] = {
-#if defined (CONFIG_VIDEO_TCM825X) || defined (CONFIG_VIDEO_TCM825X_MODULE)
+static struct i2c_board_info __initdata_or_module n8x0_i2c_board_info_2[] = {
        {
                I2C_BOARD_INFO(TCM825X_NAME, TCM825X_I2C_ADDR),
+#if defined (CONFIG_VIDEO_TCM825X) || defined (CONFIG_VIDEO_TCM825X_MODULE)
                .platform_data = &n800_tcm825x_platform_data,
-       },
 #endif
-#if defined(CONFIG_RADIO_TEA5761) || defined(CONFIG_RADIO_TEA5761_MODULE)
+       },
+};
+
+
+static struct i2c_board_info __initdata_or_module n800_i2c_board_info_2[] = {
        {
                I2C_BOARD_INFO("tea5761", 0x10),
        },
-#endif
+};
+
+static struct i2c_board_info __initdata_or_module n810_i2c_board_info_2[] = {
        {
                I2C_BOARD_INFO("lm8323", 0x45),
-               .type           = "lm8323",
                .irq            = OMAP_GPIO_IRQ(109),
                .platform_data  = &lm8323_pdata,
        },
        {
                I2C_BOARD_INFO("tsl2563", 0x29),
-               .type           = "tsl2563",
+       },
+       {
+               I2C_BOARD_INFO("lp5521", 0x32),
+               .platform_data = &n810_lp5521_platform_data,
        },
 };
 
@@ -595,13 +695,26 @@ void __init nokia_n800_common_init(void)
        n800_dsp_init();
        n800_usb_init();
        n800_cam_init();
-       spi_register_board_info(n800_spi_board_info,
+       if (machine_is_nokia_n800())
+               spi_register_board_info(n800_spi_board_info,
                                ARRAY_SIZE(n800_spi_board_info));
+       if (machine_is_nokia_n810()) {
+               tsc2005_set_config();
+               spi_register_board_info(n810_spi_board_info,
+                               ARRAY_SIZE(n810_spi_board_info));
+       }
        omap_serial_init();
        omap_register_i2c_bus(1, 400, n800_i2c_board_info_1,
                              ARRAY_SIZE(n800_i2c_board_info_1));
-       omap_register_i2c_bus(2, 400, n800_i2c_board_info_2,
-                             ARRAY_SIZE(n800_i2c_board_info_2));
+       omap_register_i2c_bus(2, 400, n8x0_i2c_board_info_2,
+                             ARRAY_SIZE(n8x0_i2c_board_info_2));
+       if (machine_is_nokia_n800())
+               i2c_register_board_info(2, n800_i2c_board_info_2,
+                       ARRAY_SIZE(n800_i2c_board_info_2));
+       if (machine_is_nokia_n810())
+               i2c_register_board_info(2, n810_i2c_board_info_2,
+                       ARRAY_SIZE(n810_i2c_board_info_2));
+               
        mipid_dev_init();
        blizzard_dev_init();
 }
@@ -610,7 +723,6 @@ static void __init nokia_n800_init(void)
 {
        nokia_n800_common_init();
 
-       n800_audio_init(&tsc2301_config);
        n800_ts_set_config();
        tsc2301_dev_init();
        tea5761_dev_init();