Merge branch 'for-3.4' of git://gitorious.org/linux-omap-dss2/linux into fbdev-next

This commit is contained in:
Florian Tobias Schandinat 2012-03-20 08:49:51 +00:00
commit e9fe8a714e
52 changed files with 1005 additions and 5205 deletions

View File

@ -20,6 +20,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <linux/export.h> #include <linux/export.h>
#include <linux/omapfb.h>
#include <media/soc_camera.h> #include <media/soc_camera.h>
@ -169,10 +170,6 @@ static struct omap_usb_config ams_delta_usb_config __initdata = {
.pins[0] = 2, .pins[0] = 2,
}; };
static struct omap_board_config_kernel ams_delta_config[] __initdata = {
{ OMAP_TAG_LCD, &ams_delta_lcd_config },
};
static struct resource ams_delta_nand_resources[] = { static struct resource ams_delta_nand_resources[] = {
[0] = { [0] = {
.start = OMAP1_MPUIO_BASE, .start = OMAP1_MPUIO_BASE,
@ -302,8 +299,6 @@ static void __init ams_delta_init(void)
omap_cfg_reg(J19_1610_CAM_D6); omap_cfg_reg(J19_1610_CAM_D6);
omap_cfg_reg(J18_1610_CAM_D7); omap_cfg_reg(J18_1610_CAM_D7);
omap_board_config = ams_delta_config;
omap_board_config_size = ARRAY_SIZE(ams_delta_config);
omap_serial_init(); omap_serial_init();
omap_register_i2c_bus(1, 100, NULL, 0); omap_register_i2c_bus(1, 100, NULL, 0);
@ -321,6 +316,8 @@ static void __init ams_delta_init(void)
ams_delta_init_fiq(); ams_delta_init_fiq();
omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1); omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1);
omapfb_set_lcd_config(&ams_delta_lcd_config);
} }
static struct plat_serial8250_port ams_delta_modem_ports[] = { static struct plat_serial8250_port ams_delta_modem_ports[] = {

View File

@ -21,6 +21,7 @@
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/smc91x.h> #include <linux/smc91x.h>
#include <linux/omapfb.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
@ -273,27 +274,17 @@ static struct platform_device kp_device = {
.resource = kp_resources, .resource = kp_resources,
}; };
static struct platform_device lcd_device = {
.name = "lcd_p2",
.id = -1,
};
static struct platform_device *devices[] __initdata = { static struct platform_device *devices[] __initdata = {
&nor_device, &nor_device,
&nand_device, &nand_device,
&smc91x_device, &smc91x_device,
&kp_device, &kp_device,
&lcd_device,
}; };
static struct omap_lcd_config fsample_lcd_config = { static struct omap_lcd_config fsample_lcd_config = {
.ctrl_name = "internal", .ctrl_name = "internal",
}; };
static struct omap_board_config_kernel fsample_config[] __initdata = {
{ OMAP_TAG_LCD, &fsample_lcd_config },
};
static void __init omap_fsample_init(void) static void __init omap_fsample_init(void)
{ {
/* Early, board-dependent init */ /* Early, board-dependent init */
@ -352,10 +343,10 @@ static void __init omap_fsample_init(void)
platform_add_devices(devices, ARRAY_SIZE(devices)); platform_add_devices(devices, ARRAY_SIZE(devices));
omap_board_config = fsample_config;
omap_board_config_size = ARRAY_SIZE(fsample_config);
omap_serial_init(); omap_serial_init();
omap_register_i2c_bus(1, 100, NULL, 0); omap_register_i2c_bus(1, 100, NULL, 0);
omapfb_set_lcd_config(&fsample_lcd_config);
} }
/* Only FPGA needs to be mapped here. All others are done with ioremap */ /* Only FPGA needs to be mapped here. All others are done with ioremap */

View File

@ -30,6 +30,7 @@
#include <linux/input.h> #include <linux/input.h>
#include <linux/i2c/tps65010.h> #include <linux/i2c/tps65010.h>
#include <linux/smc91x.h> #include <linux/smc91x.h>
#include <linux/omapfb.h>
#include <mach/hardware.h> #include <mach/hardware.h>
@ -325,18 +326,12 @@ static struct platform_device h2_irda_device = {
.resource = h2_irda_resources, .resource = h2_irda_resources,
}; };
static struct platform_device h2_lcd_device = {
.name = "lcd_h2",
.id = -1,
};
static struct platform_device *h2_devices[] __initdata = { static struct platform_device *h2_devices[] __initdata = {
&h2_nor_device, &h2_nor_device,
&h2_nand_device, &h2_nand_device,
&h2_smc91x_device, &h2_smc91x_device,
&h2_irda_device, &h2_irda_device,
&h2_kp_device, &h2_kp_device,
&h2_lcd_device,
}; };
static void __init h2_init_smc91x(void) static void __init h2_init_smc91x(void)
@ -391,10 +386,6 @@ static struct omap_lcd_config h2_lcd_config __initdata = {
.ctrl_name = "internal", .ctrl_name = "internal",
}; };
static struct omap_board_config_kernel h2_config[] __initdata = {
{ OMAP_TAG_LCD, &h2_lcd_config },
};
static void __init h2_init(void) static void __init h2_init(void)
{ {
h2_init_smc91x(); h2_init_smc91x();
@ -438,13 +429,13 @@ static void __init h2_init(void)
omap_cfg_reg(N19_1610_KBR5); omap_cfg_reg(N19_1610_KBR5);
platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices)); platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
omap_board_config = h2_config;
omap_board_config_size = ARRAY_SIZE(h2_config);
omap_serial_init(); omap_serial_init();
omap_register_i2c_bus(1, 100, h2_i2c_board_info, omap_register_i2c_bus(1, 100, h2_i2c_board_info,
ARRAY_SIZE(h2_i2c_board_info)); ARRAY_SIZE(h2_i2c_board_info));
omap1_usb_init(&h2_usb_config); omap1_usb_init(&h2_usb_config);
h2_mmc_init(); h2_mmc_init();
omapfb_set_lcd_config(&h2_lcd_config);
} }
MACHINE_START(OMAP_H2, "TI-H2") MACHINE_START(OMAP_H2, "TI-H2")

View File

@ -30,6 +30,7 @@
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/i2c/tps65010.h> #include <linux/i2c/tps65010.h>
#include <linux/smc91x.h> #include <linux/smc91x.h>
#include <linux/omapfb.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/page.h> #include <asm/page.h>
@ -370,10 +371,6 @@ static struct omap_lcd_config h3_lcd_config __initdata = {
.ctrl_name = "internal", .ctrl_name = "internal",
}; };
static struct omap_board_config_kernel h3_config[] __initdata = {
{ OMAP_TAG_LCD, &h3_lcd_config },
};
static struct i2c_board_info __initdata h3_i2c_board_info[] = { static struct i2c_board_info __initdata h3_i2c_board_info[] = {
{ {
I2C_BOARD_INFO("tps65013", 0x48), I2C_BOARD_INFO("tps65013", 0x48),
@ -426,13 +423,13 @@ static void __init h3_init(void)
platform_add_devices(devices, ARRAY_SIZE(devices)); platform_add_devices(devices, ARRAY_SIZE(devices));
spi_register_board_info(h3_spi_board_info, spi_register_board_info(h3_spi_board_info,
ARRAY_SIZE(h3_spi_board_info)); ARRAY_SIZE(h3_spi_board_info));
omap_board_config = h3_config;
omap_board_config_size = ARRAY_SIZE(h3_config);
omap_serial_init(); omap_serial_init();
omap_register_i2c_bus(1, 100, h3_i2c_board_info, omap_register_i2c_bus(1, 100, h3_i2c_board_info,
ARRAY_SIZE(h3_i2c_board_info)); ARRAY_SIZE(h3_i2c_board_info));
omap1_usb_init(&h3_usb_config); omap1_usb_init(&h3_usb_config);
h3_mmc_init(); h3_mmc_init();
omapfb_set_lcd_config(&h3_lcd_config);
} }
MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board") MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")

View File

@ -36,6 +36,7 @@
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/ads7846.h> #include <linux/spi/ads7846.h>
#include <linux/omapfb.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
@ -398,10 +399,6 @@ static struct omap_lcd_config htcherald_lcd_config __initdata = {
.ctrl_name = "internal", .ctrl_name = "internal",
}; };
static struct omap_board_config_kernel htcherald_config[] __initdata = {
{ OMAP_TAG_LCD, &htcherald_lcd_config },
};
static struct platform_device lcd_device = { static struct platform_device lcd_device = {
.name = "lcd_htcherald", .name = "lcd_htcherald",
.id = -1, .id = -1,
@ -580,8 +577,6 @@ static void __init htcherald_init(void)
printk(KERN_INFO "HTC Herald init.\n"); printk(KERN_INFO "HTC Herald init.\n");
/* Do board initialization before we register all the devices */ /* Do board initialization before we register all the devices */
omap_board_config = htcherald_config;
omap_board_config_size = ARRAY_SIZE(htcherald_config);
platform_add_devices(devices, ARRAY_SIZE(devices)); platform_add_devices(devices, ARRAY_SIZE(devices));
htcherald_disable_watchdog(); htcherald_disable_watchdog();
@ -598,6 +593,8 @@ static void __init htcherald_init(void)
htc_mmc_data[0] = &htc_mmc1_data; htc_mmc_data[0] = &htc_mmc1_data;
omap1_init_mmc(htc_mmc_data, 1); omap1_init_mmc(htc_mmc_data, 1);
#endif #endif
omapfb_set_lcd_config(&htcherald_lcd_config);
} }
MACHINE_START(HERALD, "HTC Herald") MACHINE_START(HERALD, "HTC Herald")

View File

@ -25,6 +25,7 @@
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/smc91x.h> #include <linux/smc91x.h>
#include <linux/omapfb.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
@ -370,10 +371,6 @@ static inline void innovator_mmc_init(void)
} }
#endif #endif
static struct omap_board_config_kernel innovator_config[] = {
{ OMAP_TAG_LCD, NULL },
};
static void __init innovator_init(void) static void __init innovator_init(void)
{ {
if (cpu_is_omap1510()) if (cpu_is_omap1510())
@ -416,17 +413,15 @@ static void __init innovator_init(void)
#ifdef CONFIG_ARCH_OMAP15XX #ifdef CONFIG_ARCH_OMAP15XX
if (cpu_is_omap1510()) { if (cpu_is_omap1510()) {
omap1_usb_init(&innovator1510_usb_config); omap1_usb_init(&innovator1510_usb_config);
innovator_config[0].data = &innovator1510_lcd_config; omapfb_set_lcd_config(&innovator1510_lcd_config);
} }
#endif #endif
#ifdef CONFIG_ARCH_OMAP16XX #ifdef CONFIG_ARCH_OMAP16XX
if (cpu_is_omap1610()) { if (cpu_is_omap1610()) {
omap1_usb_init(&h2_usb_config); omap1_usb_init(&h2_usb_config);
innovator_config[0].data = &innovator1610_lcd_config; omapfb_set_lcd_config(&innovator1610_lcd_config);
} }
#endif #endif
omap_board_config = innovator_config;
omap_board_config_size = ARRAY_SIZE(innovator_config);
omap_serial_init(); omap_serial_init();
omap_register_i2c_bus(1, 100, NULL, 0); omap_register_i2c_bus(1, 100, NULL, 0);
innovator_mmc_init(); innovator_mmc_init();

View File

@ -31,7 +31,6 @@
#include <plat/board.h> #include <plat/board.h>
#include <plat/keypad.h> #include <plat/keypad.h>
#include "common.h" #include "common.h"
#include <plat/hwa742.h>
#include <plat/lcd_mipid.h> #include <plat/lcd_mipid.h>
#include <plat/mmc.h> #include <plat/mmc.h>
#include <plat/clock.h> #include <plat/clock.h>
@ -99,15 +98,16 @@ static struct mipid_platform_data nokia770_mipid_platform_data = {
.shutdown = mipid_shutdown, .shutdown = mipid_shutdown,
}; };
static struct omap_lcd_config nokia770_lcd_config __initdata = {
.ctrl_name = "hwa742",
};
static void __init mipid_dev_init(void) static void __init mipid_dev_init(void)
{ {
const struct omap_lcd_config *conf; nokia770_mipid_platform_data.nreset_gpio = 13;
nokia770_mipid_platform_data.data_lines = 16;
conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config); omapfb_set_lcd_config(&nokia770_lcd_config);
if (conf != NULL) {
nokia770_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
nokia770_mipid_platform_data.data_lines = conf->data_lines;
}
} }
static void __init ads7846_dev_init(void) static void __init ads7846_dev_init(void)
@ -150,14 +150,9 @@ static struct spi_board_info nokia770_spi_board_info[] __initdata = {
}, },
}; };
static struct hwa742_platform_data nokia770_hwa742_platform_data = {
.te_connected = 1,
};
static void __init hwa742_dev_init(void) static void __init hwa742_dev_init(void)
{ {
clk_add_alias("hwa_sys_ck", NULL, "bclk", NULL); clk_add_alias("hwa_sys_ck", NULL, "bclk", NULL);
omapfb_set_ctrl_platform_data(&nokia770_hwa742_platform_data);
} }
/* assume no Mini-AB port */ /* assume no Mini-AB port */

View File

@ -34,6 +34,7 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/smc91x.h> #include <linux/smc91x.h>
#include <linux/omapfb.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
@ -300,12 +301,6 @@ static struct omap_lcd_config osk_lcd_config __initdata = {
}; };
#endif #endif
static struct omap_board_config_kernel osk_config[] __initdata = {
#ifdef CONFIG_OMAP_OSK_MISTRAL
{ OMAP_TAG_LCD, &osk_lcd_config },
#endif
};
#ifdef CONFIG_OMAP_OSK_MISTRAL #ifdef CONFIG_OMAP_OSK_MISTRAL
#include <linux/input.h> #include <linux/input.h>
@ -549,8 +544,6 @@ static void __init osk_init(void)
osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys(); osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys();
osk_flash_resource.end += SZ_32M - 1; osk_flash_resource.end += SZ_32M - 1;
platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices)); platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
omap_board_config = osk_config;
omap_board_config_size = ARRAY_SIZE(osk_config);
l = omap_readl(USB_TRANSCEIVER_CTRL); l = omap_readl(USB_TRANSCEIVER_CTRL);
l |= (3 << 1); l |= (3 << 1);
@ -567,6 +560,11 @@ static void __init osk_init(void)
omap_register_i2c_bus(1, 400, osk_i2c_board_info, omap_register_i2c_bus(1, 400, osk_i2c_board_info,
ARRAY_SIZE(osk_i2c_board_info)); ARRAY_SIZE(osk_i2c_board_info));
osk_mistral_init(); osk_mistral_init();
#ifdef CONFIG_OMAP_OSK_MISTRAL
omapfb_set_lcd_config(&osk_lcd_config);
#endif
} }
MACHINE_START(OMAP_OSK, "TI-OSK") MACHINE_START(OMAP_OSK, "TI-OSK")

View File

@ -27,6 +27,7 @@
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/apm-emulation.h> #include <linux/apm-emulation.h>
#include <linux/omapfb.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
@ -209,10 +210,6 @@ static struct omap_lcd_config palmte_lcd_config __initdata = {
.ctrl_name = "internal", .ctrl_name = "internal",
}; };
static struct omap_board_config_kernel palmte_config[] __initdata = {
{ OMAP_TAG_LCD, &palmte_lcd_config },
};
static struct spi_board_info palmte_spi_info[] __initdata = { static struct spi_board_info palmte_spi_info[] __initdata = {
{ {
.modalias = "tsc2102", .modalias = "tsc2102",
@ -250,9 +247,6 @@ static void __init omap_palmte_init(void)
omap_cfg_reg(UART3_TX); omap_cfg_reg(UART3_TX);
omap_cfg_reg(UART3_RX); omap_cfg_reg(UART3_RX);
omap_board_config = palmte_config;
omap_board_config_size = ARRAY_SIZE(palmte_config);
platform_add_devices(palmte_devices, ARRAY_SIZE(palmte_devices)); platform_add_devices(palmte_devices, ARRAY_SIZE(palmte_devices));
spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info)); spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info));
@ -260,6 +254,8 @@ static void __init omap_palmte_init(void)
omap_serial_init(); omap_serial_init();
omap1_usb_init(&palmte_usb_config); omap1_usb_init(&palmte_usb_config);
omap_register_i2c_bus(1, 100, NULL, 0); omap_register_i2c_bus(1, 100, NULL, 0);
omapfb_set_lcd_config(&palmte_lcd_config);
} }
MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E") MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")

View File

@ -24,6 +24,7 @@
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/omapfb.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
@ -273,10 +274,6 @@ static struct omap_lcd_config palmtt_lcd_config __initdata = {
.ctrl_name = "internal", .ctrl_name = "internal",
}; };
static struct omap_board_config_kernel palmtt_config[] __initdata = {
{ OMAP_TAG_LCD, &palmtt_lcd_config },
};
static void __init omap_mpu_wdt_mode(int mode) { static void __init omap_mpu_wdt_mode(int mode) {
if (mode) if (mode)
omap_writew(0x8000, OMAP_WDT_TIMER_MODE); omap_writew(0x8000, OMAP_WDT_TIMER_MODE);
@ -298,15 +295,14 @@ static void __init omap_palmtt_init(void)
omap_mpu_wdt_mode(0); omap_mpu_wdt_mode(0);
omap_board_config = palmtt_config;
omap_board_config_size = ARRAY_SIZE(palmtt_config);
platform_add_devices(palmtt_devices, ARRAY_SIZE(palmtt_devices)); platform_add_devices(palmtt_devices, ARRAY_SIZE(palmtt_devices));
spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo)); spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo));
omap_serial_init(); omap_serial_init();
omap1_usb_init(&palmtt_usb_config); omap1_usb_init(&palmtt_usb_config);
omap_register_i2c_bus(1, 100, NULL, 0); omap_register_i2c_bus(1, 100, NULL, 0);
omapfb_set_lcd_config(&palmtt_lcd_config);
} }
MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T") MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")

View File

@ -27,6 +27,7 @@
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/omapfb.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
@ -239,10 +240,6 @@ static struct omap_lcd_config palmz71_lcd_config __initdata = {
.ctrl_name = "internal", .ctrl_name = "internal",
}; };
static struct omap_board_config_kernel palmz71_config[] __initdata = {
{OMAP_TAG_LCD, &palmz71_lcd_config},
};
static irqreturn_t static irqreturn_t
palmz71_powercable(int irq, void *dev_id) palmz71_powercable(int irq, void *dev_id)
{ {
@ -313,9 +310,6 @@ omap_palmz71_init(void)
palmz71_gpio_setup(1); palmz71_gpio_setup(1);
omap_mpu_wdt_mode(0); omap_mpu_wdt_mode(0);
omap_board_config = palmz71_config;
omap_board_config_size = ARRAY_SIZE(palmz71_config);
platform_add_devices(devices, ARRAY_SIZE(devices)); platform_add_devices(devices, ARRAY_SIZE(devices));
spi_register_board_info(palmz71_boardinfo, spi_register_board_info(palmz71_boardinfo,
@ -324,6 +318,8 @@ omap_palmz71_init(void)
omap_serial_init(); omap_serial_init();
omap_register_i2c_bus(1, 100, NULL, 0); omap_register_i2c_bus(1, 100, NULL, 0);
palmz71_gpio_setup(0); palmz71_gpio_setup(0);
omapfb_set_lcd_config(&palmz71_lcd_config);
} }
MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71") MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")

View File

@ -21,6 +21,7 @@
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/smc91x.h> #include <linux/smc91x.h>
#include <linux/omapfb.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
@ -232,27 +233,17 @@ static struct platform_device kp_device = {
.resource = kp_resources, .resource = kp_resources,
}; };
static struct platform_device lcd_device = {
.name = "lcd_p2",
.id = -1,
};
static struct platform_device *devices[] __initdata = { static struct platform_device *devices[] __initdata = {
&nor_device, &nor_device,
&nand_device, &nand_device,
&smc91x_device, &smc91x_device,
&kp_device, &kp_device,
&lcd_device,
}; };
static struct omap_lcd_config perseus2_lcd_config __initdata = { static struct omap_lcd_config perseus2_lcd_config __initdata = {
.ctrl_name = "internal", .ctrl_name = "internal",
}; };
static struct omap_board_config_kernel perseus2_config[] __initdata = {
{ OMAP_TAG_LCD, &perseus2_lcd_config },
};
static void __init perseus2_init_smc91x(void) static void __init perseus2_init_smc91x(void)
{ {
fpga_write(1, H2P2_DBG_FPGA_LAN_RESET); fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
@ -320,10 +311,10 @@ static void __init omap_perseus2_init(void)
platform_add_devices(devices, ARRAY_SIZE(devices)); platform_add_devices(devices, ARRAY_SIZE(devices));
omap_board_config = perseus2_config;
omap_board_config_size = ARRAY_SIZE(perseus2_config);
omap_serial_init(); omap_serial_init();
omap_register_i2c_bus(1, 100, NULL, 0); omap_register_i2c_bus(1, 100, NULL, 0);
omapfb_set_lcd_config(&perseus2_lcd_config);
} }
/* Only FPGA needs to be mapped here. All others are done with ioremap */ /* Only FPGA needs to be mapped here. All others are done with ioremap */

View File

@ -27,6 +27,7 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/export.h> #include <linux/export.h>
#include <linux/omapfb.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
@ -355,11 +356,6 @@ static struct omap_usb_config sx1_usb_config __initdata = {
/*----------- LCD -------------------------*/ /*----------- LCD -------------------------*/
static struct platform_device sx1_lcd_device = {
.name = "lcd_sx1",
.id = -1,
};
static struct omap_lcd_config sx1_lcd_config __initdata = { static struct omap_lcd_config sx1_lcd_config __initdata = {
.ctrl_name = "internal", .ctrl_name = "internal",
}; };
@ -368,14 +364,8 @@ static struct omap_lcd_config sx1_lcd_config __initdata = {
static struct platform_device *sx1_devices[] __initdata = { static struct platform_device *sx1_devices[] __initdata = {
&sx1_flash_device, &sx1_flash_device,
&sx1_kp_device, &sx1_kp_device,
&sx1_lcd_device,
&sx1_irda_device, &sx1_irda_device,
}; };
/*-----------------------------------------*/
static struct omap_board_config_kernel sx1_config[] __initdata = {
{ OMAP_TAG_LCD, &sx1_lcd_config },
};
/*-----------------------------------------*/ /*-----------------------------------------*/
@ -391,8 +381,6 @@ static void __init omap_sx1_init(void)
platform_add_devices(sx1_devices, ARRAY_SIZE(sx1_devices)); platform_add_devices(sx1_devices, ARRAY_SIZE(sx1_devices));
omap_board_config = sx1_config;
omap_board_config_size = ARRAY_SIZE(sx1_config);
omap_serial_init(); omap_serial_init();
omap_register_i2c_bus(1, 100, NULL, 0); omap_register_i2c_bus(1, 100, NULL, 0);
omap1_usb_init(&sx1_usb_config); omap1_usb_init(&sx1_usb_config);
@ -406,6 +394,8 @@ static void __init omap_sx1_init(void)
gpio_direction_output(1, 1); /*A_IRDA_OFF = 1 */ gpio_direction_output(1, 1); /*A_IRDA_OFF = 1 */
gpio_direction_output(11, 0); /*A_SWITCH = 0 */ gpio_direction_output(11, 0); /*A_SWITCH = 0 */
gpio_direction_output(15, 0); /*A_USB_ON = 0 */ gpio_direction_output(15, 0); /*A_USB_ON = 0 */
omapfb_set_lcd_config(&sx1_lcd_config);
} }
MACHINE_START(SX1, "OMAP310 based Siemens SX1") MACHINE_START(SX1, "OMAP310 based Siemens SX1")

View File

@ -21,7 +21,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/omapfb.h>
#include <asm/tlb.h> #include <asm/tlb.h>

View File

@ -15,7 +15,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/omapfb.h>
#include <plat/common.h> #include <plat/common.h>
#include <plat/board.h> #include <plat/board.h>
@ -65,7 +64,6 @@ const void *__init omap_get_var_config(u16 tag, size_t *len)
void __init omap_reserve(void) void __init omap_reserve(void)
{ {
omapfb_reserve_sdram_memblock();
omap_vram_reserve_sdram_memblock(); omap_vram_reserve_sdram_memblock();
omap_dsp_reserve_sdram_memblock(); omap_dsp_reserve_sdram_memblock();
omap_secure_ram_reserve_memblock(); omap_secure_ram_reserve_memblock();

View File

@ -34,15 +34,11 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <plat/board.h> #include <plat/board.h>
#include <plat/sram.h>
#include "fb.h"
#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE) #if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)
static bool omapfb_lcd_configured;
static struct omapfb_platform_data omapfb_config; static struct omapfb_platform_data omapfb_config;
static int config_invalid;
static int configured_regions;
static u64 omap_fb_dma_mask = ~(u32)0; static u64 omap_fb_dma_mask = ~(u32)0;
@ -57,301 +53,20 @@ static struct platform_device omap_fb_device = {
.num_resources = 0, .num_resources = 0,
}; };
void omapfb_set_platform_data(struct omapfb_platform_data *data) void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
{ {
} omapfb_config.lcd = *config;
omapfb_lcd_configured = true;
static inline int ranges_overlap(unsigned long start1, unsigned long size1,
unsigned long start2, unsigned long size2)
{
return (start1 >= start2 && start1 < start2 + size2) ||
(start2 >= start1 && start2 < start1 + size1);
}
static inline int range_included(unsigned long start1, unsigned long size1,
unsigned long start2, unsigned long size2)
{
return start1 >= start2 && start1 + size1 <= start2 + size2;
}
/* Check if there is an overlapping region. */
static int fbmem_region_reserved(unsigned long start, size_t size)
{
struct omapfb_mem_region *rg;
int i;
rg = &omapfb_config.mem_desc.region[0];
for (i = 0; i < OMAPFB_PLANE_NUM; i++, rg++) {
if (!rg->paddr)
/* Empty slot. */
continue;
if (ranges_overlap(start, size, rg->paddr, rg->size))
return 1;
}
return 0;
}
/*
* Get the region_idx`th region from board config/ATAG and convert it to
* our internal format.
*/
static int __init get_fbmem_region(int region_idx, struct omapfb_mem_region *rg)
{
const struct omap_fbmem_config *conf;
u32 paddr;
conf = omap_get_nr_config(OMAP_TAG_FBMEM,
struct omap_fbmem_config, region_idx);
if (conf == NULL)
return -ENOENT;
paddr = conf->start;
/*
* Low bits encode the page allocation mode, if high bits
* are zero. Otherwise we need a page aligned fixed
* address.
*/
memset(rg, 0, sizeof(*rg));
rg->type = paddr & ~PAGE_MASK;
rg->paddr = paddr & PAGE_MASK;
rg->size = PAGE_ALIGN(conf->size);
return 0;
}
static int set_fbmem_region_type(struct omapfb_mem_region *rg, int mem_type,
unsigned long mem_start,
unsigned long mem_size)
{
/*
* Check if the configuration specifies the type explicitly.
* type = 0 && paddr = 0, a default don't care case maps to
* the SDRAM type.
*/
if (rg->type || !rg->paddr)
return 0;
if (ranges_overlap(rg->paddr, rg->size, mem_start, mem_size)) {
rg->type = mem_type;
return 0;
}
/* Can't determine it. */
return -1;
}
static int check_fbmem_region(int region_idx, struct omapfb_mem_region *rg,
unsigned long start_avail, unsigned size_avail)
{
unsigned long paddr = rg->paddr;
size_t size = rg->size;
if (rg->type > OMAPFB_MEMTYPE_MAX) {
printk(KERN_ERR
"Invalid start address for FB region %d\n", region_idx);
return -EINVAL;
}
if (!rg->size) {
printk(KERN_ERR "Zero size for FB region %d\n", region_idx);
return -EINVAL;
}
if (!paddr)
/* Allocate this dynamically, leave paddr 0 for now. */
return 0;
/*
* Fixed region for the given RAM range. Check if it's already
* reserved by the FB code or someone else.
*/
if (fbmem_region_reserved(paddr, size) ||
!range_included(paddr, size, start_avail, size_avail)) {
printk(KERN_ERR "Trying to use reserved memory "
"for FB region %d\n", region_idx);
return -EINVAL;
}
return 0;
}
static int valid_sdram(unsigned long addr, unsigned long size)
{
return memblock_is_region_memory(addr, size);
}
static int reserve_sdram(unsigned long addr, unsigned long size)
{
if (memblock_is_region_reserved(addr, size))
return -EBUSY;
if (memblock_reserve(addr, size))
return -ENOMEM;
return 0;
}
/*
* Called from map_io. We need to call to this early enough so that we
* can reserve the fixed SDRAM regions before VM could get hold of them.
*/
void __init omapfb_reserve_sdram_memblock(void)
{
unsigned long reserved = 0;
int i;
if (config_invalid)
return;
for (i = 0; ; i++) {
struct omapfb_mem_region rg;
if (get_fbmem_region(i, &rg) < 0)
break;
if (i == OMAPFB_PLANE_NUM) {
pr_err("Extraneous FB mem configuration entries\n");
config_invalid = 1;
return;
}
/* Check if it's our memory type. */
if (rg.type != OMAPFB_MEMTYPE_SDRAM)
continue;
/* Check if the region falls within SDRAM */
if (rg.paddr && !valid_sdram(rg.paddr, rg.size))
continue;
if (rg.size == 0) {
pr_err("Zero size for FB region %d\n", i);
config_invalid = 1;
return;
}
if (rg.paddr) {
if (reserve_sdram(rg.paddr, rg.size)) {
pr_err("Trying to use reserved memory for FB region %d\n",
i);
config_invalid = 1;
return;
}
reserved += rg.size;
}
if (omapfb_config.mem_desc.region[i].size) {
pr_err("FB region %d already set\n", i);
config_invalid = 1;
return;
}
omapfb_config.mem_desc.region[i] = rg;
configured_regions++;
}
omapfb_config.mem_desc.region_cnt = i;
if (reserved)
pr_info("Reserving %lu bytes SDRAM for frame buffer\n",
reserved);
}
/*
* Called at sram init time, before anything is pushed to the SRAM stack.
* Because of the stack scheme, we will allocate everything from the
* start of the lowest address region to the end of SRAM. This will also
* include padding for page alignment and possible holes between regions.
*
* As opposed to the SDRAM case, we'll also do any dynamic allocations at
* this point, since the driver built as a module would have problem with
* freeing / reallocating the regions.
*/
unsigned long __init omapfb_reserve_sram(unsigned long sram_pstart,
unsigned long sram_vstart,
unsigned long sram_size,
unsigned long pstart_avail,
unsigned long size_avail)
{
struct omapfb_mem_region rg;
unsigned long pend_avail;
unsigned long reserved;
int i;
if (config_invalid)
return 0;
reserved = 0;
pend_avail = pstart_avail + size_avail;
for (i = 0; ; i++) {
if (get_fbmem_region(i, &rg) < 0)
break;
if (i == OMAPFB_PLANE_NUM) {
printk(KERN_ERR
"Extraneous FB mem configuration entries\n");
config_invalid = 1;
return 0;
}
/* Check if it's our memory type. */
if (set_fbmem_region_type(&rg, OMAPFB_MEMTYPE_SRAM,
sram_pstart, sram_size) < 0 ||
(rg.type != OMAPFB_MEMTYPE_SRAM))
continue;
BUG_ON(omapfb_config.mem_desc.region[i].size);
if (check_fbmem_region(i, &rg, pstart_avail, size_avail) < 0) {
config_invalid = 1;
return 0;
}
if (!rg.paddr) {
/* Dynamic allocation */
if ((size_avail & PAGE_MASK) < rg.size) {
printk("Not enough SRAM for FB region %d\n",
i);
config_invalid = 1;
return 0;
}
size_avail = (size_avail - rg.size) & PAGE_MASK;
rg.paddr = pstart_avail + size_avail;
}
/* Reserve everything above the start of the region. */
if (pend_avail - rg.paddr > reserved)
reserved = pend_avail - rg.paddr;
size_avail = pend_avail - reserved - pstart_avail;
/*
* We have a kernel mapping for this already, so the
* driver won't have to make one.
*/
rg.vaddr = (void *)(sram_vstart + rg.paddr - sram_pstart);
omapfb_config.mem_desc.region[i] = rg;
configured_regions++;
}
omapfb_config.mem_desc.region_cnt = i;
if (reserved)
pr_info("Reserving %lu bytes SRAM for frame buffer\n",
reserved);
return reserved;
}
void omapfb_set_ctrl_platform_data(void *data)
{
omapfb_config.ctrl_platform_data = data;
} }
static int __init omap_init_fb(void) static int __init omap_init_fb(void)
{ {
const struct omap_lcd_config *conf; /*
* If the board file has not set the lcd config with
if (config_invalid) * omapfb_set_lcd_config(), don't bother registering the omapfb device
*/
if (!omapfb_lcd_configured)
return 0; return 0;
if (configured_regions != omapfb_config.mem_desc.region_cnt) {
printk(KERN_ERR "Invalid FB mem configuration entries\n");
return 0;
}
conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
if (conf == NULL) {
if (configured_regions)
/* FB mem config, but no LCD config? */
printk(KERN_ERR "Missing LCD configuration\n");
return 0;
}
omapfb_config.lcd = *conf;
return platform_device_register(&omap_fb_device); return platform_device_register(&omap_fb_device);
} }
@ -374,11 +89,6 @@ static struct platform_device omap_fb_device = {
.num_resources = 0, .num_resources = 0,
}; };
void omapfb_set_platform_data(struct omapfb_platform_data *data)
{
omapfb_config = *data;
}
static int __init omap_init_fb(void) static int __init omap_init_fb(void)
{ {
return platform_device_register(&omap_fb_device); return platform_device_register(&omap_fb_device);
@ -386,36 +96,10 @@ static int __init omap_init_fb(void)
arch_initcall(omap_init_fb); arch_initcall(omap_init_fb);
void omapfb_reserve_sdram_memblock(void)
{
}
unsigned long __init omapfb_reserve_sram(unsigned long sram_pstart,
unsigned long sram_vstart,
unsigned long sram_size,
unsigned long start_avail,
unsigned long size_avail)
{
return 0;
}
#else #else
void omapfb_set_platform_data(struct omapfb_platform_data *data) void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
{ {
} }
void omapfb_reserve_sdram_memblock(void)
{
}
unsigned long __init omapfb_reserve_sram(unsigned long sram_pstart,
unsigned long sram_vstart,
unsigned long sram_size,
unsigned long start_avail,
unsigned long size_avail)
{
return 0;
}
#endif #endif

View File

@ -1,10 +0,0 @@
#ifndef __PLAT_OMAP_FB_H__
#define __PLAT_OMAP_FB_H__
extern unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
unsigned long sram_vstart,
unsigned long sram_size,
unsigned long pstart_avail,
unsigned long size_avail);
#endif /* __PLAT_OMAP_FB_H__ */

View File

@ -1,12 +0,0 @@
#ifndef _BLIZZARD_H
#define _BLIZZARD_H
struct blizzard_platform_data {
void (*power_up)(struct device *dev);
void (*power_down)(struct device *dev);
unsigned long (*get_clock_rate)(struct device *dev);
unsigned te_connected:1;
};
#endif

View File

@ -28,9 +28,7 @@ enum {
/* Different peripheral ids */ /* Different peripheral ids */
#define OMAP_TAG_CLOCK 0x4f01 #define OMAP_TAG_CLOCK 0x4f01
#define OMAP_TAG_LCD 0x4f05
#define OMAP_TAG_GPIO_SWITCH 0x4f06 #define OMAP_TAG_GPIO_SWITCH 0x4f06
#define OMAP_TAG_FBMEM 0x4f08
#define OMAP_TAG_STI_CONSOLE 0x4f09 #define OMAP_TAG_STI_CONSOLE 0x4f09
#define OMAP_TAG_CAMERA_SENSOR 0x4f0a #define OMAP_TAG_CAMERA_SENSOR 0x4f0a

View File

@ -1,8 +0,0 @@
#ifndef _HWA742_H
#define _HWA742_H
struct hwa742_platform_data {
unsigned te_connected:1;
};
#endif

View File

@ -23,40 +23,21 @@
#include <linux/types.h> #include <linux/types.h>
#define OMAP_VRAM_MEMTYPE_SDRAM 0
#define OMAP_VRAM_MEMTYPE_SRAM 1
#define OMAP_VRAM_MEMTYPE_MAX 1
extern int omap_vram_add_region(unsigned long paddr, size_t size); extern int omap_vram_add_region(unsigned long paddr, size_t size);
extern int omap_vram_free(unsigned long paddr, size_t size); extern int omap_vram_free(unsigned long paddr, size_t size);
extern int omap_vram_alloc(int mtype, size_t size, unsigned long *paddr); extern int omap_vram_alloc(size_t size, unsigned long *paddr);
extern int omap_vram_reserve(unsigned long paddr, size_t size); extern int omap_vram_reserve(unsigned long paddr, size_t size);
extern void omap_vram_get_info(unsigned long *vram, unsigned long *free_vram, extern void omap_vram_get_info(unsigned long *vram, unsigned long *free_vram,
unsigned long *largest_free_block); unsigned long *largest_free_block);
#ifdef CONFIG_OMAP2_VRAM #ifdef CONFIG_OMAP2_VRAM
extern void omap_vram_set_sdram_vram(u32 size, u32 start); extern void omap_vram_set_sdram_vram(u32 size, u32 start);
extern void omap_vram_set_sram_vram(u32 size, u32 start);
extern void omap_vram_reserve_sdram_memblock(void); extern void omap_vram_reserve_sdram_memblock(void);
extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart,
unsigned long sram_vstart,
unsigned long sram_size,
unsigned long pstart_avail,
unsigned long size_avail);
#else #else
static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { } static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { }
static inline void omap_vram_set_sram_vram(u32 size, u32 start) { }
static inline void omap_vram_reserve_sdram_memblock(void) { } static inline void omap_vram_reserve_sdram_memblock(void) { }
static inline unsigned long omap_vram_reserve_sram(unsigned long sram_pstart,
unsigned long sram_vstart,
unsigned long sram_size,
unsigned long pstart_avail,
unsigned long size_avail)
{
return 0;
}
#endif #endif
#endif #endif

View File

@ -1,11 +1,10 @@
config FB_OMAP config FB_OMAP
tristate "OMAP frame buffer support (EXPERIMENTAL)" tristate "OMAP frame buffer support (EXPERIMENTAL)"
depends on FB && (OMAP2_DSS = "n") depends on FB
depends on ARCH_OMAP1 || ARCH_OMAP2 || ARCH_OMAP3 depends on ARCH_OMAP1
select FB_CFB_FILLRECT select FB_CFB_FILLRECT
select FB_CFB_COPYAREA select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT select FB_CFB_IMAGEBLIT
select TWL4030_CORE if MACH_OMAP_2430SDP
help help
Frame buffer driver for OMAP based boards. Frame buffer driver for OMAP based boards.
@ -23,13 +22,6 @@ config FB_OMAP_LCDC_HWA742
Say Y here if you want to have support for the external Say Y here if you want to have support for the external
Epson HWA742 LCD controller. Epson HWA742 LCD controller.
config FB_OMAP_LCDC_BLIZZARD
bool "Epson Blizzard LCD controller support"
depends on FB_OMAP && FB_OMAP_LCDC_EXTERNAL
help
Say Y here if you want to have support for the external
Epson Blizzard LCD controller.
config FB_OMAP_MANUAL_UPDATE config FB_OMAP_MANUAL_UPDATE
bool "Default to manual update mode" bool "Default to manual update mode"
depends on FB_OMAP && FB_OMAP_LCDC_EXTERNAL depends on FB_OMAP && FB_OMAP_LCDC_EXTERNAL
@ -49,7 +41,7 @@ config FB_OMAP_LCD_MIPID
config FB_OMAP_BOOTLOADER_INIT config FB_OMAP_BOOTLOADER_INIT
bool "Check bootloader initialization" bool "Check bootloader initialization"
depends on FB_OMAP || FB_OMAP2 depends on FB_OMAP
help help
Say Y here if you want to enable checking if the bootloader has Say Y here if you want to enable checking if the bootloader has
already initialized the display controller. In this case the already initialized the display controller. In this case the
@ -68,7 +60,7 @@ config FB_OMAP_CONSISTENT_DMA_SIZE
config FB_OMAP_DMA_TUNE config FB_OMAP_DMA_TUNE
bool "Set DMA SDRAM access priority high" bool "Set DMA SDRAM access priority high"
depends on FB_OMAP && ARCH_OMAP1 depends on FB_OMAP
help help
On systems in which video memory is in system memory On systems in which video memory is in system memory
(SDRAM) this will speed up graphics DMA operations. (SDRAM) this will speed up graphics DMA operations.

View File

@ -1,20 +1,14 @@
# #
# Makefile for the new OMAP framebuffer device driver # Makefile for the OMAP1 framebuffer device driver
# #
obj-$(CONFIG_FB_OMAP) += omapfb.o obj-$(CONFIG_FB_OMAP) += omapfb.o
objs-yy := omapfb_main.o objs-yy := omapfb_main.o lcdc.o
objs-y$(CONFIG_ARCH_OMAP1) += lcdc.o objs-y$(CONFIG_FB_OMAP_LCDC_EXTERNAL) += sossi.o
objs-y$(CONFIG_ARCH_OMAP2) += dispc.o
objs-y$(CONFIG_ARCH_OMAP3) += dispc.o
objs-$(CONFIG_ARCH_OMAP1)$(CONFIG_FB_OMAP_LCDC_EXTERNAL) += sossi.o
objs-$(CONFIG_ARCH_OMAP2)$(CONFIG_FB_OMAP_LCDC_EXTERNAL) += rfbi.o
objs-y$(CONFIG_FB_OMAP_LCDC_HWA742) += hwa742.o objs-y$(CONFIG_FB_OMAP_LCDC_HWA742) += hwa742.o
objs-y$(CONFIG_FB_OMAP_LCDC_BLIZZARD) += blizzard.o
objs-y$(CONFIG_MACH_AMS_DELTA) += lcd_ams_delta.o objs-y$(CONFIG_MACH_AMS_DELTA) += lcd_ams_delta.o
objs-y$(CONFIG_MACH_OMAP_H3) += lcd_h3.o objs-y$(CONFIG_MACH_OMAP_H3) += lcd_h3.o

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,46 +0,0 @@
#ifndef _DISPC_H
#define _DISPC_H
#include <linux/interrupt.h>
#define DISPC_PLANE_GFX 0
#define DISPC_PLANE_VID1 1
#define DISPC_PLANE_VID2 2
#define DISPC_RGB_1_BPP 0x00
#define DISPC_RGB_2_BPP 0x01
#define DISPC_RGB_4_BPP 0x02
#define DISPC_RGB_8_BPP 0x03
#define DISPC_RGB_12_BPP 0x04
#define DISPC_RGB_16_BPP 0x06
#define DISPC_RGB_24_BPP 0x08
#define DISPC_RGB_24_BPP_UNPACK_32 0x09
#define DISPC_YUV2_422 0x0a
#define DISPC_UYVY_422 0x0b
#define DISPC_BURST_4x32 0
#define DISPC_BURST_8x32 1
#define DISPC_BURST_16x32 2
#define DISPC_LOAD_CLUT_AND_FRAME 0x00
#define DISPC_LOAD_CLUT_ONLY 0x01
#define DISPC_LOAD_FRAME_ONLY 0x02
#define DISPC_LOAD_CLUT_ONCE_FRAME 0x03
#define DISPC_TFT_DATA_LINES_12 0
#define DISPC_TFT_DATA_LINES_16 1
#define DISPC_TFT_DATA_LINES_18 2
#define DISPC_TFT_DATA_LINES_24 3
extern void omap_dispc_set_lcd_size(int width, int height);
extern void omap_dispc_enable_lcd_out(int enable);
extern void omap_dispc_enable_digit_out(int enable);
extern int omap_dispc_request_irq(unsigned long irq_mask,
void (*callback)(void *data), void *data);
extern void omap_dispc_free_irq(unsigned long irq_mask,
void (*callback)(void *data), void *data);
extern const struct lcd_ctrl omap2_int_ctrl;
#endif

View File

@ -28,7 +28,6 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <plat/dma.h> #include <plat/dma.h>
#include <plat/hwa742.h>
#include "omapfb.h" #include "omapfb.h"
#define HWA742_REV_CODE_REG 0x0 #define HWA742_REV_CODE_REG 0x0
@ -942,7 +941,6 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
unsigned long sys_clk, pix_clk; unsigned long sys_clk, pix_clk;
int extif_mem_div; int extif_mem_div;
struct omapfb_platform_data *omapfb_conf; struct omapfb_platform_data *omapfb_conf;
struct hwa742_platform_data *ctrl_conf;
BUG_ON(!fbdev->ext_if || !fbdev->int_ctrl); BUG_ON(!fbdev->ext_if || !fbdev->int_ctrl);
@ -951,13 +949,6 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
hwa742.int_ctrl = fbdev->int_ctrl; hwa742.int_ctrl = fbdev->int_ctrl;
omapfb_conf = fbdev->dev->platform_data; omapfb_conf = fbdev->dev->platform_data;
ctrl_conf = omapfb_conf->ctrl_platform_data;
if (ctrl_conf == NULL) {
dev_err(fbdev->dev, "HWA742: missing platform data\n");
r = -ENOENT;
goto err1;
}
hwa742.sys_ck = clk_get(NULL, "hwa_sys_ck"); hwa742.sys_ck = clk_get(NULL, "hwa_sys_ck");
@ -995,14 +986,12 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
goto err4; goto err4;
} }
if (ctrl_conf->te_connected) {
if ((r = setup_tearsync(pix_clk, extif_mem_div)) < 0) { if ((r = setup_tearsync(pix_clk, extif_mem_div)) < 0) {
dev_err(hwa742.fbdev->dev, dev_err(hwa742.fbdev->dev,
"HWA742: can't setup tearing synchronization\n"); "HWA742: can't setup tearing synchronization\n");
goto err4; goto err4;
} }
hwa742.te_connected = 1; hwa742.te_connected = 1;
}
hwa742.max_transmit_size = hwa742.extif->max_transmit_size; hwa742.max_transmit_size = hwa742.extif->max_transmit_size;

View File

@ -47,6 +47,27 @@
struct omapfb_device; struct omapfb_device;
#define OMAPFB_PLANE_NUM 1
struct omapfb_mem_region {
u32 paddr;
void __iomem *vaddr;
unsigned long size;
u8 type; /* OMAPFB_PLANE_MEM_* */
enum omapfb_color_format format;/* OMAPFB_COLOR_* */
unsigned format_used:1; /* Must be set when format is set.
* Needed b/c of the badly chosen 0
* base for OMAPFB_COLOR_* values
*/
unsigned alloc:1; /* allocated by the driver */
unsigned map:1; /* kernel mapped by the driver */
};
struct omapfb_mem_desc {
int region_cnt;
struct omapfb_mem_region region[OMAPFB_PLANE_NUM];
};
struct lcd_panel { struct lcd_panel {
const char *name; const char *name;
int config; /* TFT/STN, signal inversion */ int config; /* TFT/STN, signal inversion */
@ -207,11 +228,7 @@ struct omapfb_device {
struct platform_device *dssdev; /* dummy dev for clocks */ struct platform_device *dssdev; /* dummy dev for clocks */
}; };
#ifdef CONFIG_ARCH_OMAP1
extern struct lcd_ctrl omap1_lcd_ctrl; extern struct lcd_ctrl omap1_lcd_ctrl;
#else
extern struct lcd_ctrl omap2_disp_ctrl;
#endif
extern void omapfb_register_panel(struct lcd_panel *panel); extern void omapfb_register_panel(struct lcd_panel *panel);
extern void omapfb_write_first_pixel(struct omapfb_device *fbdev, u16 pixval); extern void omapfb_write_first_pixel(struct omapfb_device *fbdev, u16 pixval);

View File

@ -34,7 +34,6 @@
#include "omapfb.h" #include "omapfb.h"
#include "lcdc.h" #include "lcdc.h"
#include "dispc.h"
#define MODULE_NAME "omapfb" #define MODULE_NAME "omapfb"
@ -104,29 +103,17 @@ static struct platform_device omapdss_device = {
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
*/ */
extern struct lcd_ctrl hwa742_ctrl; extern struct lcd_ctrl hwa742_ctrl;
extern struct lcd_ctrl blizzard_ctrl;
static const struct lcd_ctrl *ctrls[] = { static const struct lcd_ctrl *ctrls[] = {
#ifdef CONFIG_ARCH_OMAP1
&omap1_int_ctrl, &omap1_int_ctrl,
#else
&omap2_int_ctrl,
#endif
#ifdef CONFIG_FB_OMAP_LCDC_HWA742 #ifdef CONFIG_FB_OMAP_LCDC_HWA742
&hwa742_ctrl, &hwa742_ctrl,
#endif #endif
#ifdef CONFIG_FB_OMAP_LCDC_BLIZZARD
&blizzard_ctrl,
#endif
}; };
#ifdef CONFIG_FB_OMAP_LCDC_EXTERNAL #ifdef CONFIG_FB_OMAP_LCDC_EXTERNAL
#ifdef CONFIG_ARCH_OMAP1
extern struct lcd_ctrl_extif omap1_ext_if; extern struct lcd_ctrl_extif omap1_ext_if;
#else
extern struct lcd_ctrl_extif omap2_ext_if;
#endif
#endif #endif
static void omapfb_rqueue_lock(struct omapfb_device *fbdev) static void omapfb_rqueue_lock(struct omapfb_device *fbdev)
@ -170,11 +157,6 @@ static int ctrl_init(struct omapfb_device *fbdev)
fbdev->mem_desc.region[i].size = fbdev->mem_desc.region[i].size =
PAGE_ALIGN(def_vram[i]); PAGE_ALIGN(def_vram[i]);
fbdev->mem_desc.region_cnt = i; fbdev->mem_desc.region_cnt = i;
} else {
struct omapfb_platform_data *conf;
conf = fbdev->dev->platform_data;
fbdev->mem_desc = conf->mem_desc;
} }
if (!fbdev->mem_desc.region_cnt) { if (!fbdev->mem_desc.region_cnt) {
@ -880,7 +862,7 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi)
if (fbdev->ctrl->setup_mem == NULL) if (fbdev->ctrl->setup_mem == NULL)
return -ENODEV; return -ENODEV;
if (mi->type > OMAPFB_MEMTYPE_MAX) if (mi->type != OMAPFB_MEMTYPE_SDRAM)
return -EINVAL; return -EINVAL;
size = PAGE_ALIGN(mi->size); size = PAGE_ALIGN(mi->size);
@ -1721,16 +1703,9 @@ static int omapfb_do_probe(struct platform_device *pdev,
mutex_init(&fbdev->rqueue_mutex); mutex_init(&fbdev->rqueue_mutex);
#ifdef CONFIG_ARCH_OMAP1
fbdev->int_ctrl = &omap1_int_ctrl; fbdev->int_ctrl = &omap1_int_ctrl;
#ifdef CONFIG_FB_OMAP_LCDC_EXTERNAL #ifdef CONFIG_FB_OMAP_LCDC_EXTERNAL
fbdev->ext_if = &omap1_ext_if; fbdev->ext_if = &omap1_ext_if;
#endif
#else /* OMAP2 */
fbdev->int_ctrl = &omap2_int_ctrl;
#ifdef CONFIG_FB_OMAP_LCDC_EXTERNAL
fbdev->ext_if = &omap2_ext_if;
#endif
#endif #endif
if (omapfb_find_ctrl(fbdev) < 0) { if (omapfb_find_ctrl(fbdev) < 0) {
dev_err(fbdev->dev, dev_err(fbdev->dev,
@ -1766,7 +1741,6 @@ static int omapfb_do_probe(struct platform_device *pdev,
#ifdef CONFIG_FB_OMAP_DMA_TUNE #ifdef CONFIG_FB_OMAP_DMA_TUNE
/* Set DMA priority for EMIFF access to highest */ /* Set DMA priority for EMIFF access to highest */
if (cpu_class_is_omap1())
omap_set_dma_priority(0, OMAP_DMA_PORT_EMIFF, 15); omap_set_dma_priority(0, OMAP_DMA_PORT_EMIFF, 15);
#endif #endif

View File

@ -1,598 +0,0 @@
/*
* OMAP2 Remote Frame Buffer Interface support
*
* Copyright (C) 2005 Nokia Corporation
* Author: Juha Yrjölä <juha.yrjola@nokia.com>
* Imre Deak <imre.deak@nokia.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include "omapfb.h"
#include "dispc.h"
/* To work around an RFBI transfer rate limitation */
#define OMAP_RFBI_RATE_LIMIT 1
#define RFBI_BASE 0x48050800
#define RFBI_REVISION 0x0000
#define RFBI_SYSCONFIG 0x0010
#define RFBI_SYSSTATUS 0x0014
#define RFBI_CONTROL 0x0040
#define RFBI_PIXEL_CNT 0x0044
#define RFBI_LINE_NUMBER 0x0048
#define RFBI_CMD 0x004c
#define RFBI_PARAM 0x0050
#define RFBI_DATA 0x0054
#define RFBI_READ 0x0058
#define RFBI_STATUS 0x005c
#define RFBI_CONFIG0 0x0060
#define RFBI_ONOFF_TIME0 0x0064
#define RFBI_CYCLE_TIME0 0x0068
#define RFBI_DATA_CYCLE1_0 0x006c
#define RFBI_DATA_CYCLE2_0 0x0070
#define RFBI_DATA_CYCLE3_0 0x0074
#define RFBI_VSYNC_WIDTH 0x0090
#define RFBI_HSYNC_WIDTH 0x0094
#define DISPC_BASE 0x48050400
#define DISPC_CONTROL 0x0040
#define DISPC_IRQ_FRAMEMASK 0x0001
static struct {
void __iomem *base;
void (*lcdc_callback)(void *data);
void *lcdc_callback_data;
unsigned long l4_khz;
int bits_per_cycle;
struct omapfb_device *fbdev;
struct clk *dss_ick;
struct clk *dss1_fck;
unsigned tearsync_pin_cnt;
unsigned tearsync_mode;
} rfbi;
static inline void rfbi_write_reg(int idx, u32 val)
{
__raw_writel(val, rfbi.base + idx);
}
static inline u32 rfbi_read_reg(int idx)
{
return __raw_readl(rfbi.base + idx);
}
static int rfbi_get_clocks(void)
{
rfbi.dss_ick = clk_get(&rfbi.fbdev->dssdev->dev, "ick");
if (IS_ERR(rfbi.dss_ick)) {
dev_err(rfbi.fbdev->dev, "can't get ick\n");
return PTR_ERR(rfbi.dss_ick);
}
rfbi.dss1_fck = clk_get(&rfbi.fbdev->dssdev->dev, "fck");
if (IS_ERR(rfbi.dss1_fck)) {
dev_err(rfbi.fbdev->dev, "can't get dss1_fck\n");
clk_put(rfbi.dss_ick);
return PTR_ERR(rfbi.dss1_fck);
}
return 0;
}
static void rfbi_put_clocks(void)
{
clk_put(rfbi.dss1_fck);
clk_put(rfbi.dss_ick);
}
static void rfbi_enable_clocks(int enable)
{
if (enable) {
clk_enable(rfbi.dss_ick);
clk_enable(rfbi.dss1_fck);
} else {
clk_disable(rfbi.dss1_fck);
clk_disable(rfbi.dss_ick);
}
}
#ifdef VERBOSE
static void rfbi_print_timings(void)
{
u32 l;
u32 time;
l = rfbi_read_reg(RFBI_CONFIG0);
time = 1000000000 / rfbi.l4_khz;
if (l & (1 << 4))
time *= 2;
dev_dbg(rfbi.fbdev->dev, "Tick time %u ps\n", time);
l = rfbi_read_reg(RFBI_ONOFF_TIME0);
dev_dbg(rfbi.fbdev->dev,
"CSONTIME %d, CSOFFTIME %d, WEONTIME %d, WEOFFTIME %d, "
"REONTIME %d, REOFFTIME %d\n",
l & 0x0f, (l >> 4) & 0x3f, (l >> 10) & 0x0f, (l >> 14) & 0x3f,
(l >> 20) & 0x0f, (l >> 24) & 0x3f);
l = rfbi_read_reg(RFBI_CYCLE_TIME0);
dev_dbg(rfbi.fbdev->dev,
"WECYCLETIME %d, RECYCLETIME %d, CSPULSEWIDTH %d, "
"ACCESSTIME %d\n",
(l & 0x3f), (l >> 6) & 0x3f, (l >> 12) & 0x3f,
(l >> 22) & 0x3f);
}
#else
static void rfbi_print_timings(void) {}
#endif
static void rfbi_set_timings(const struct extif_timings *t)
{
u32 l;
BUG_ON(!t->converted);
rfbi_enable_clocks(1);
rfbi_write_reg(RFBI_ONOFF_TIME0, t->tim[0]);
rfbi_write_reg(RFBI_CYCLE_TIME0, t->tim[1]);
l = rfbi_read_reg(RFBI_CONFIG0);
l &= ~(1 << 4);
l |= (t->tim[2] ? 1 : 0) << 4;
rfbi_write_reg(RFBI_CONFIG0, l);
rfbi_print_timings();
rfbi_enable_clocks(0);
}
static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div)
{
*clk_period = 1000000000 / rfbi.l4_khz;
*max_clk_div = 2;
}
static int ps_to_rfbi_ticks(int time, int div)
{
unsigned long tick_ps;
int ret;
/* Calculate in picosecs to yield more exact results */
tick_ps = 1000000000 / (rfbi.l4_khz) * div;
ret = (time + tick_ps - 1) / tick_ps;
return ret;
}
#ifdef OMAP_RFBI_RATE_LIMIT
static unsigned long rfbi_get_max_tx_rate(void)
{
unsigned long l4_rate, dss1_rate;
int min_l4_ticks = 0;
int i;
/* According to TI this can't be calculated so make the
* adjustments for a couple of known frequencies and warn for
* others.
*/
static const struct {
unsigned long l4_clk; /* HZ */
unsigned long dss1_clk; /* HZ */
unsigned long min_l4_ticks;
} ftab[] = {
{ 55, 132, 7, }, /* 7.86 MPix/s */
{ 110, 110, 12, }, /* 9.16 MPix/s */
{ 110, 132, 10, }, /* 11 Mpix/s */
{ 120, 120, 10, }, /* 12 Mpix/s */
{ 133, 133, 10, }, /* 13.3 Mpix/s */
};
l4_rate = rfbi.l4_khz / 1000;
dss1_rate = clk_get_rate(rfbi.dss1_fck) / 1000000;
for (i = 0; i < ARRAY_SIZE(ftab); i++) {
/* Use a window instead of an exact match, to account
* for different DPLL multiplier / divider pairs.
*/
if (abs(ftab[i].l4_clk - l4_rate) < 3 &&
abs(ftab[i].dss1_clk - dss1_rate) < 3) {
min_l4_ticks = ftab[i].min_l4_ticks;
break;
}
}
if (i == ARRAY_SIZE(ftab)) {
/* Can't be sure, return anyway the maximum not
* rate-limited. This might cause a problem only for the
* tearing synchronisation.
*/
dev_err(rfbi.fbdev->dev,
"can't determine maximum RFBI transfer rate\n");
return rfbi.l4_khz * 1000;
}
return rfbi.l4_khz * 1000 / min_l4_ticks;
}
#else
static int rfbi_get_max_tx_rate(void)
{
return rfbi.l4_khz * 1000;
}
#endif
static int rfbi_convert_timings(struct extif_timings *t)
{
u32 l;
int reon, reoff, weon, weoff, cson, csoff, cs_pulse;
int actim, recyc, wecyc;
int div = t->clk_div;
if (div <= 0 || div > 2)
return -1;
/* Make sure that after conversion it still holds that:
* weoff > weon, reoff > reon, recyc >= reoff, wecyc >= weoff,
* csoff > cson, csoff >= max(weoff, reoff), actim > reon
*/
weon = ps_to_rfbi_ticks(t->we_on_time, div);
weoff = ps_to_rfbi_ticks(t->we_off_time, div);
if (weoff <= weon)
weoff = weon + 1;
if (weon > 0x0f)
return -1;
if (weoff > 0x3f)
return -1;
reon = ps_to_rfbi_ticks(t->re_on_time, div);
reoff = ps_to_rfbi_ticks(t->re_off_time, div);
if (reoff <= reon)
reoff = reon + 1;
if (reon > 0x0f)
return -1;
if (reoff > 0x3f)
return -1;
cson = ps_to_rfbi_ticks(t->cs_on_time, div);
csoff = ps_to_rfbi_ticks(t->cs_off_time, div);
if (csoff <= cson)
csoff = cson + 1;
if (csoff < max(weoff, reoff))
csoff = max(weoff, reoff);
if (cson > 0x0f)
return -1;
if (csoff > 0x3f)
return -1;
l = cson;
l |= csoff << 4;
l |= weon << 10;
l |= weoff << 14;
l |= reon << 20;
l |= reoff << 24;
t->tim[0] = l;
actim = ps_to_rfbi_ticks(t->access_time, div);
if (actim <= reon)
actim = reon + 1;
if (actim > 0x3f)
return -1;
wecyc = ps_to_rfbi_ticks(t->we_cycle_time, div);
if (wecyc < weoff)
wecyc = weoff;
if (wecyc > 0x3f)
return -1;
recyc = ps_to_rfbi_ticks(t->re_cycle_time, div);
if (recyc < reoff)
recyc = reoff;
if (recyc > 0x3f)
return -1;
cs_pulse = ps_to_rfbi_ticks(t->cs_pulse_width, div);
if (cs_pulse > 0x3f)
return -1;
l = wecyc;
l |= recyc << 6;
l |= cs_pulse << 12;
l |= actim << 22;
t->tim[1] = l;
t->tim[2] = div - 1;
t->converted = 1;
return 0;
}
static int rfbi_setup_tearsync(unsigned pin_cnt,
unsigned hs_pulse_time, unsigned vs_pulse_time,
int hs_pol_inv, int vs_pol_inv, int extif_div)
{
int hs, vs;
int min;
u32 l;
if (pin_cnt != 1 && pin_cnt != 2)
return -EINVAL;
hs = ps_to_rfbi_ticks(hs_pulse_time, 1);
vs = ps_to_rfbi_ticks(vs_pulse_time, 1);
if (hs < 2)
return -EDOM;
if (pin_cnt == 2)
min = 2;
else
min = 4;
if (vs < min)
return -EDOM;
if (vs == hs)
return -EINVAL;
rfbi.tearsync_pin_cnt = pin_cnt;
dev_dbg(rfbi.fbdev->dev,
"setup_tearsync: pins %d hs %d vs %d hs_inv %d vs_inv %d\n",
pin_cnt, hs, vs, hs_pol_inv, vs_pol_inv);
rfbi_enable_clocks(1);
rfbi_write_reg(RFBI_HSYNC_WIDTH, hs);
rfbi_write_reg(RFBI_VSYNC_WIDTH, vs);
l = rfbi_read_reg(RFBI_CONFIG0);
if (hs_pol_inv)
l &= ~(1 << 21);
else
l |= 1 << 21;
if (vs_pol_inv)
l &= ~(1 << 20);
else
l |= 1 << 20;
rfbi_enable_clocks(0);
return 0;
}
static int rfbi_enable_tearsync(int enable, unsigned line)
{
u32 l;
dev_dbg(rfbi.fbdev->dev, "tearsync %d line %d mode %d\n",
enable, line, rfbi.tearsync_mode);
if (line > (1 << 11) - 1)
return -EINVAL;
rfbi_enable_clocks(1);
l = rfbi_read_reg(RFBI_CONFIG0);
l &= ~(0x3 << 2);
if (enable) {
rfbi.tearsync_mode = rfbi.tearsync_pin_cnt;
l |= rfbi.tearsync_mode << 2;
} else
rfbi.tearsync_mode = 0;
rfbi_write_reg(RFBI_CONFIG0, l);
rfbi_write_reg(RFBI_LINE_NUMBER, line);
rfbi_enable_clocks(0);
return 0;
}
static void rfbi_write_command(const void *buf, unsigned int len)
{
rfbi_enable_clocks(1);
if (rfbi.bits_per_cycle == 16) {
const u16 *w = buf;
BUG_ON(len & 1);
for (; len; len -= 2)
rfbi_write_reg(RFBI_CMD, *w++);
} else {
const u8 *b = buf;
BUG_ON(rfbi.bits_per_cycle != 8);
for (; len; len--)
rfbi_write_reg(RFBI_CMD, *b++);
}
rfbi_enable_clocks(0);
}
static void rfbi_read_data(void *buf, unsigned int len)
{
rfbi_enable_clocks(1);
if (rfbi.bits_per_cycle == 16) {
u16 *w = buf;
BUG_ON(len & ~1);
for (; len; len -= 2) {
rfbi_write_reg(RFBI_READ, 0);
*w++ = rfbi_read_reg(RFBI_READ);
}
} else {
u8 *b = buf;
BUG_ON(rfbi.bits_per_cycle != 8);
for (; len; len--) {
rfbi_write_reg(RFBI_READ, 0);
*b++ = rfbi_read_reg(RFBI_READ);
}
}
rfbi_enable_clocks(0);
}
static void rfbi_write_data(const void *buf, unsigned int len)
{
rfbi_enable_clocks(1);
if (rfbi.bits_per_cycle == 16) {
const u16 *w = buf;
BUG_ON(len & 1);
for (; len; len -= 2)
rfbi_write_reg(RFBI_PARAM, *w++);
} else {
const u8 *b = buf;
BUG_ON(rfbi.bits_per_cycle != 8);
for (; len; len--)
rfbi_write_reg(RFBI_PARAM, *b++);
}
rfbi_enable_clocks(0);
}
static void rfbi_transfer_area(int width, int height,
void (callback)(void * data), void *data)
{
u32 w;
BUG_ON(callback == NULL);
rfbi_enable_clocks(1);
omap_dispc_set_lcd_size(width, height);
rfbi.lcdc_callback = callback;
rfbi.lcdc_callback_data = data;
rfbi_write_reg(RFBI_PIXEL_CNT, width * height);
w = rfbi_read_reg(RFBI_CONTROL);
w |= 1; /* enable */
if (!rfbi.tearsync_mode)
w |= 1 << 4; /* internal trigger, reset by HW */
rfbi_write_reg(RFBI_CONTROL, w);
omap_dispc_enable_lcd_out(1);
}
static inline void _stop_transfer(void)
{
u32 w;
w = rfbi_read_reg(RFBI_CONTROL);
rfbi_write_reg(RFBI_CONTROL, w & ~(1 << 0));
rfbi_enable_clocks(0);
}
static void rfbi_dma_callback(void *data)
{
_stop_transfer();
rfbi.lcdc_callback(rfbi.lcdc_callback_data);
}
static void rfbi_set_bits_per_cycle(int bpc)
{
u32 l;
rfbi_enable_clocks(1);
l = rfbi_read_reg(RFBI_CONFIG0);
l &= ~(0x03 << 0);
switch (bpc) {
case 8:
break;
case 16:
l |= 3;
break;
default:
BUG();
}
rfbi_write_reg(RFBI_CONFIG0, l);
rfbi.bits_per_cycle = bpc;
rfbi_enable_clocks(0);
}
static int rfbi_init(struct omapfb_device *fbdev)
{
u32 l;
int r;
rfbi.fbdev = fbdev;
rfbi.base = ioremap(RFBI_BASE, SZ_1K);
if (!rfbi.base) {
dev_err(fbdev->dev, "can't ioremap RFBI\n");
return -ENOMEM;
}
if ((r = rfbi_get_clocks()) < 0)
return r;
rfbi_enable_clocks(1);
rfbi.l4_khz = clk_get_rate(rfbi.dss_ick) / 1000;
/* Reset */
rfbi_write_reg(RFBI_SYSCONFIG, 1 << 1);
while (!(rfbi_read_reg(RFBI_SYSSTATUS) & (1 << 0)));
l = rfbi_read_reg(RFBI_SYSCONFIG);
/* Enable autoidle and smart-idle */
l |= (1 << 0) | (2 << 3);
rfbi_write_reg(RFBI_SYSCONFIG, l);
/* 16-bit interface, ITE trigger mode, 16-bit data */
l = (0x03 << 0) | (0x00 << 2) | (0x01 << 5) | (0x02 << 7);
l |= (0 << 9) | (1 << 20) | (1 << 21);
rfbi_write_reg(RFBI_CONFIG0, l);
rfbi_write_reg(RFBI_DATA_CYCLE1_0, 0x00000010);
l = rfbi_read_reg(RFBI_CONTROL);
/* Select CS0, clear bypass mode */
l = (0x01 << 2);
rfbi_write_reg(RFBI_CONTROL, l);
r = omap_dispc_request_irq(DISPC_IRQ_FRAMEMASK, rfbi_dma_callback,
NULL);
if (r < 0) {
dev_err(fbdev->dev, "can't get DISPC irq\n");
rfbi_enable_clocks(0);
return r;
}
l = rfbi_read_reg(RFBI_REVISION);
pr_info("omapfb: RFBI version %d.%d initialized\n",
(l >> 4) & 0x0f, l & 0x0f);
rfbi_enable_clocks(0);
return 0;
}
static void rfbi_cleanup(void)
{
omap_dispc_free_irq(DISPC_IRQ_FRAMEMASK, rfbi_dma_callback, NULL);
rfbi_put_clocks();
iounmap(rfbi.base);
}
const struct lcd_ctrl_extif omap2_ext_if = {
.init = rfbi_init,
.cleanup = rfbi_cleanup,
.get_clk_info = rfbi_get_clk_info,
.get_max_tx_rate = rfbi_get_max_tx_rate,
.set_bits_per_cycle = rfbi_set_bits_per_cycle,
.convert_timings = rfbi_convert_timings,
.set_timings = rfbi_set_timings,
.write_command = rfbi_write_command,
.read_data = rfbi_read_data,
.write_data = rfbi_write_data,
.transfer_area = rfbi_transfer_area,
.setup_tearsync = rfbi_setup_tearsync,
.enable_tearsync = rfbi_enable_tearsync,
.max_transmit_size = (u32) ~0,
};

View File

@ -363,6 +363,29 @@ static struct panel_config generic_dpi_panels[] = {
.name = "ortustech_com43h4m10xtc", .name = "ortustech_com43h4m10xtc",
}, },
/* Innolux AT080TN52 */
{
{
.x_res = 800,
.y_res = 600,
.pixel_clock = 41142,
.hsw = 20,
.hfp = 210,
.hbp = 46,
.vsw = 10,
.vfp = 12,
.vbp = 23,
},
.acb = 0x0,
.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IEO,
.name = "innolux_at080tn52",
},
}; };
struct panel_drv_data { struct panel_drv_data {

View File

@ -47,16 +47,20 @@
TPO_R03_EN_PRE_CHARGE | TPO_R03_SOFTWARE_CTL) TPO_R03_EN_PRE_CHARGE | TPO_R03_SOFTWARE_CTL)
static const u16 tpo_td043_def_gamma[12] = { static const u16 tpo_td043_def_gamma[12] = {
106, 200, 289, 375, 460, 543, 625, 705, 785, 864, 942, 1020 105, 315, 381, 431, 490, 537, 579, 686, 780, 837, 880, 1023
}; };
struct tpo_td043_device { struct tpo_td043_device {
struct spi_device *spi; struct spi_device *spi;
struct regulator *vcc_reg; struct regulator *vcc_reg;
int nreset_gpio;
u16 gamma[12]; u16 gamma[12];
u32 mode; u32 mode;
u32 hmirror:1; u32 hmirror:1;
u32 vmirror:1; u32 vmirror:1;
u32 powered_on:1;
u32 spi_suspended:1;
u32 power_on_resume:1;
}; };
static int tpo_td043_write(struct spi_device *spi, u8 addr, u8 data) static int tpo_td043_write(struct spi_device *spi, u8 addr, u8 data)
@ -265,28 +269,16 @@ static const struct omap_video_timings tpo_td043_timings = {
.vbp = 34, .vbp = 34,
}; };
static int tpo_td043_power_on(struct omap_dss_device *dssdev) static int tpo_td043_power_on(struct tpo_td043_device *tpo_td043)
{ {
struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); int nreset_gpio = tpo_td043->nreset_gpio;
int nreset_gpio = dssdev->reset_gpio;
int r;
if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) if (tpo_td043->powered_on)
return 0; return 0;
r = omapdss_dpi_display_enable(dssdev);
if (r)
goto err0;
if (dssdev->platform_enable) {
r = dssdev->platform_enable(dssdev);
if (r)
goto err1;
}
regulator_enable(tpo_td043->vcc_reg); regulator_enable(tpo_td043->vcc_reg);
/* wait for power up */ /* wait for regulator to stabilize */
msleep(160); msleep(160);
if (gpio_is_valid(nreset_gpio)) if (gpio_is_valid(nreset_gpio))
@ -301,19 +293,15 @@ static int tpo_td043_power_on(struct omap_dss_device *dssdev)
tpo_td043->vmirror); tpo_td043->vmirror);
tpo_td043_write_gamma(tpo_td043->spi, tpo_td043->gamma); tpo_td043_write_gamma(tpo_td043->spi, tpo_td043->gamma);
tpo_td043->powered_on = 1;
return 0; return 0;
err1:
omapdss_dpi_display_disable(dssdev);
err0:
return r;
} }
static void tpo_td043_power_off(struct omap_dss_device *dssdev) static void tpo_td043_power_off(struct tpo_td043_device *tpo_td043)
{ {
struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); int nreset_gpio = tpo_td043->nreset_gpio;
int nreset_gpio = dssdev->reset_gpio;
if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) if (!tpo_td043->powered_on)
return; return;
tpo_td043_write(tpo_td043->spi, 3, tpo_td043_write(tpo_td043->spi, 3,
@ -329,54 +317,94 @@ static void tpo_td043_power_off(struct omap_dss_device *dssdev)
regulator_disable(tpo_td043->vcc_reg); regulator_disable(tpo_td043->vcc_reg);
if (dssdev->platform_disable) tpo_td043->powered_on = 0;
dssdev->platform_disable(dssdev);
omapdss_dpi_display_disable(dssdev);
} }
static int tpo_td043_enable(struct omap_dss_device *dssdev) static int tpo_td043_enable_dss(struct omap_dss_device *dssdev)
{ {
int ret; struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev);
int r;
dev_dbg(&dssdev->dev, "enable\n"); if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
return 0;
ret = tpo_td043_power_on(dssdev); r = omapdss_dpi_display_enable(dssdev);
if (ret) if (r)
return ret; goto err0;
if (dssdev->platform_enable) {
r = dssdev->platform_enable(dssdev);
if (r)
goto err1;
}
/*
* If we are resuming from system suspend, SPI clocks might not be
* enabled yet, so we'll program the LCD from SPI PM resume callback.
*/
if (!tpo_td043->spi_suspended) {
r = tpo_td043_power_on(tpo_td043);
if (r)
goto err1;
}
dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
return 0; return 0;
err1:
omapdss_dpi_display_disable(dssdev);
err0:
return r;
}
static void tpo_td043_disable_dss(struct omap_dss_device *dssdev)
{
struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev);
if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
return;
if (dssdev->platform_disable)
dssdev->platform_disable(dssdev);
omapdss_dpi_display_disable(dssdev);
if (!tpo_td043->spi_suspended)
tpo_td043_power_off(tpo_td043);
}
static int tpo_td043_enable(struct omap_dss_device *dssdev)
{
dev_dbg(&dssdev->dev, "enable\n");
return tpo_td043_enable_dss(dssdev);
} }
static void tpo_td043_disable(struct omap_dss_device *dssdev) static void tpo_td043_disable(struct omap_dss_device *dssdev)
{ {
dev_dbg(&dssdev->dev, "disable\n"); dev_dbg(&dssdev->dev, "disable\n");
tpo_td043_power_off(dssdev); tpo_td043_disable_dss(dssdev);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED; dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
} }
static int tpo_td043_suspend(struct omap_dss_device *dssdev) static int tpo_td043_suspend(struct omap_dss_device *dssdev)
{ {
tpo_td043_power_off(dssdev); dev_dbg(&dssdev->dev, "suspend\n");
tpo_td043_disable_dss(dssdev);
dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
return 0; return 0;
} }
static int tpo_td043_resume(struct omap_dss_device *dssdev) static int tpo_td043_resume(struct omap_dss_device *dssdev)
{ {
int r = 0; dev_dbg(&dssdev->dev, "resume\n");
r = tpo_td043_power_on(dssdev); return tpo_td043_enable_dss(dssdev);
if (r)
return r;
dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
return 0;
} }
static int tpo_td043_probe(struct omap_dss_device *dssdev) static int tpo_td043_probe(struct omap_dss_device *dssdev)
@ -484,6 +512,7 @@ static int tpo_td043_spi_probe(struct spi_device *spi)
return -ENOMEM; return -ENOMEM;
tpo_td043->spi = spi; tpo_td043->spi = spi;
tpo_td043->nreset_gpio = dssdev->reset_gpio;
dev_set_drvdata(&spi->dev, tpo_td043); dev_set_drvdata(&spi->dev, tpo_td043);
dev_set_drvdata(&dssdev->dev, tpo_td043); dev_set_drvdata(&dssdev->dev, tpo_td043);
@ -502,10 +531,46 @@ static int __devexit tpo_td043_spi_remove(struct spi_device *spi)
return 0; return 0;
} }
#ifdef CONFIG_PM_SLEEP
static int tpo_td043_spi_suspend(struct device *dev)
{
struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev);
dev_dbg(dev, "tpo_td043_spi_suspend, tpo %p\n", tpo_td043);
tpo_td043->power_on_resume = tpo_td043->powered_on;
tpo_td043_power_off(tpo_td043);
tpo_td043->spi_suspended = 1;
return 0;
}
static int tpo_td043_spi_resume(struct device *dev)
{
struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev);
int ret;
dev_dbg(dev, "tpo_td043_spi_resume\n");
if (tpo_td043->power_on_resume) {
ret = tpo_td043_power_on(tpo_td043);
if (ret)
return ret;
}
tpo_td043->spi_suspended = 0;
return 0;
}
#endif
static SIMPLE_DEV_PM_OPS(tpo_td043_spi_pm,
tpo_td043_spi_suspend, tpo_td043_spi_resume);
static struct spi_driver tpo_td043_spi_driver = { static struct spi_driver tpo_td043_spi_driver = {
.driver = { .driver = {
.name = "tpo_td043mtea1_panel_spi", .name = "tpo_td043mtea1_panel_spi",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = &tpo_td043_spi_pm,
}, },
.probe = tpo_td043_spi_probe, .probe = tpo_td043_spi_probe,
.remove = __devexit_p(tpo_td043_spi_remove), .remove = __devexit_p(tpo_td043_spi_remove),

View File

@ -105,6 +105,9 @@ static struct {
struct ovl_priv_data ovl_priv_data_array[MAX_DSS_OVERLAYS]; struct ovl_priv_data ovl_priv_data_array[MAX_DSS_OVERLAYS];
struct mgr_priv_data mgr_priv_data_array[MAX_DSS_MANAGERS]; struct mgr_priv_data mgr_priv_data_array[MAX_DSS_MANAGERS];
bool fifo_merge_dirty;
bool fifo_merge;
bool irq_enabled; bool irq_enabled;
} dss_data; } dss_data;
@ -351,6 +354,7 @@ static void wait_pending_extra_info_updates(void)
bool updating; bool updating;
unsigned long flags; unsigned long flags;
unsigned long t; unsigned long t;
int r;
spin_lock_irqsave(&data_lock, flags); spin_lock_irqsave(&data_lock, flags);
@ -366,11 +370,11 @@ static void wait_pending_extra_info_updates(void)
spin_unlock_irqrestore(&data_lock, flags); spin_unlock_irqrestore(&data_lock, flags);
t = msecs_to_jiffies(500); t = msecs_to_jiffies(500);
wait_for_completion_timeout(&extra_updated_completion, t); r = wait_for_completion_timeout(&extra_updated_completion, t);
if (r == 0)
updating = extra_info_update_ongoing(); DSSWARN("timeout in wait_pending_extra_info_updates\n");
else if (r < 0)
WARN_ON(updating); DSSERR("wait_pending_extra_info_updates failed: %d\n", r);
} }
int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr) int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr)
@ -388,6 +392,10 @@ int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr)
if (mgr_manual_update(mgr)) if (mgr_manual_update(mgr))
return 0; return 0;
r = dispc_runtime_get();
if (r)
return r;
irq = dispc_mgr_get_vsync_irq(mgr->id); irq = dispc_mgr_get_vsync_irq(mgr->id);
mp = get_mgr_priv(mgr); mp = get_mgr_priv(mgr);
@ -428,6 +436,8 @@ int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr)
} }
} }
dispc_runtime_put();
return r; return r;
} }
@ -451,6 +461,10 @@ int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl)
if (ovl_manual_update(ovl)) if (ovl_manual_update(ovl))
return 0; return 0;
r = dispc_runtime_get();
if (r)
return r;
irq = dispc_mgr_get_vsync_irq(ovl->manager->id); irq = dispc_mgr_get_vsync_irq(ovl->manager->id);
op = get_ovl_priv(ovl); op = get_ovl_priv(ovl);
@ -491,6 +505,8 @@ int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl)
} }
} }
dispc_runtime_put();
return r; return r;
} }
@ -585,11 +601,40 @@ static void dss_mgr_write_regs(struct omap_overlay_manager *mgr)
} }
} }
static void dss_write_regs_common(void)
{
const int num_mgrs = omap_dss_get_num_overlay_managers();
int i;
if (!dss_data.fifo_merge_dirty)
return;
for (i = 0; i < num_mgrs; ++i) {
struct omap_overlay_manager *mgr;
struct mgr_priv_data *mp;
mgr = omap_dss_get_overlay_manager(i);
mp = get_mgr_priv(mgr);
if (mp->enabled) {
if (dss_data.fifo_merge_dirty) {
dispc_enable_fifomerge(dss_data.fifo_merge);
dss_data.fifo_merge_dirty = false;
}
if (mp->updating)
mp->shadow_info_dirty = true;
}
}
}
static void dss_write_regs(void) static void dss_write_regs(void)
{ {
const int num_mgrs = omap_dss_get_num_overlay_managers(); const int num_mgrs = omap_dss_get_num_overlay_managers();
int i; int i;
dss_write_regs_common();
for (i = 0; i < num_mgrs; ++i) { for (i = 0; i < num_mgrs; ++i) {
struct omap_overlay_manager *mgr; struct omap_overlay_manager *mgr;
struct mgr_priv_data *mp; struct mgr_priv_data *mp;
@ -640,6 +685,22 @@ static void dss_set_go_bits(void)
} }
static void mgr_clear_shadow_dirty(struct omap_overlay_manager *mgr)
{
struct omap_overlay *ovl;
struct mgr_priv_data *mp;
struct ovl_priv_data *op;
mp = get_mgr_priv(mgr);
mp->shadow_info_dirty = false;
list_for_each_entry(ovl, &mgr->overlays, list) {
op = get_ovl_priv(ovl);
op->shadow_info_dirty = false;
op->shadow_extra_info_dirty = false;
}
}
void dss_mgr_start_update(struct omap_overlay_manager *mgr) void dss_mgr_start_update(struct omap_overlay_manager *mgr)
{ {
struct mgr_priv_data *mp = get_mgr_priv(mgr); struct mgr_priv_data *mp = get_mgr_priv(mgr);
@ -659,6 +720,8 @@ void dss_mgr_start_update(struct omap_overlay_manager *mgr)
dss_mgr_write_regs(mgr); dss_mgr_write_regs(mgr);
dss_write_regs_common();
mp->updating = true; mp->updating = true;
if (!dss_data.irq_enabled && need_isr()) if (!dss_data.irq_enabled && need_isr())
@ -666,6 +729,8 @@ void dss_mgr_start_update(struct omap_overlay_manager *mgr)
dispc_mgr_enable(mgr->id, true); dispc_mgr_enable(mgr->id, true);
mgr_clear_shadow_dirty(mgr);
spin_unlock_irqrestore(&data_lock, flags); spin_unlock_irqrestore(&data_lock, flags);
} }
@ -709,22 +774,6 @@ static void dss_unregister_vsync_isr(void)
dss_data.irq_enabled = false; dss_data.irq_enabled = false;
} }
static void mgr_clear_shadow_dirty(struct omap_overlay_manager *mgr)
{
struct omap_overlay *ovl;
struct mgr_priv_data *mp;
struct ovl_priv_data *op;
mp = get_mgr_priv(mgr);
mp->shadow_info_dirty = false;
list_for_each_entry(ovl, &mgr->overlays, list) {
op = get_ovl_priv(ovl);
op->shadow_info_dirty = false;
op->shadow_extra_info_dirty = false;
}
}
static void dss_apply_irq_handler(void *data, u32 mask) static void dss_apply_irq_handler(void *data, u32 mask)
{ {
const int num_mgrs = dss_feat_get_num_mgrs(); const int num_mgrs = dss_feat_get_num_mgrs();
@ -754,9 +803,6 @@ static void dss_apply_irq_handler(void *data, u32 mask)
if (was_busy && !mp->busy) if (was_busy && !mp->busy)
mgr_clear_shadow_dirty(mgr); mgr_clear_shadow_dirty(mgr);
} else {
if (was_updating && !mp->updating)
mgr_clear_shadow_dirty(mgr);
} }
} }
@ -859,11 +905,20 @@ static void dss_apply_ovl_fifo_thresholds(struct omap_overlay *ovl,
op->extra_info_dirty = true; op->extra_info_dirty = true;
} }
static void dss_ovl_setup_fifo(struct omap_overlay *ovl) static void dss_apply_fifo_merge(bool use_fifo_merge)
{
if (dss_data.fifo_merge == use_fifo_merge)
return;
dss_data.fifo_merge = use_fifo_merge;
dss_data.fifo_merge_dirty = true;
}
static void dss_ovl_setup_fifo(struct omap_overlay *ovl,
bool use_fifo_merge)
{ {
struct ovl_priv_data *op = get_ovl_priv(ovl); struct ovl_priv_data *op = get_ovl_priv(ovl);
struct omap_dss_device *dssdev; struct omap_dss_device *dssdev;
u32 size, burst_size;
u32 fifo_low, fifo_high; u32 fifo_low, fifo_high;
if (!op->enabled && !op->enabling) if (!op->enabled && !op->enabling)
@ -871,33 +926,14 @@ static void dss_ovl_setup_fifo(struct omap_overlay *ovl)
dssdev = ovl->manager->device; dssdev = ovl->manager->device;
size = dispc_ovl_get_fifo_size(ovl->id); dispc_ovl_compute_fifo_thresholds(ovl->id, &fifo_low, &fifo_high,
use_fifo_merge);
burst_size = dispc_ovl_get_burst_size(ovl->id);
switch (dssdev->type) {
case OMAP_DISPLAY_TYPE_DPI:
case OMAP_DISPLAY_TYPE_DBI:
case OMAP_DISPLAY_TYPE_SDI:
case OMAP_DISPLAY_TYPE_VENC:
case OMAP_DISPLAY_TYPE_HDMI:
default_get_overlay_fifo_thresholds(ovl->id, size,
burst_size, &fifo_low, &fifo_high);
break;
#ifdef CONFIG_OMAP2_DSS_DSI
case OMAP_DISPLAY_TYPE_DSI:
dsi_get_overlay_fifo_thresholds(ovl->id, size,
burst_size, &fifo_low, &fifo_high);
break;
#endif
default:
BUG();
}
dss_apply_ovl_fifo_thresholds(ovl, fifo_low, fifo_high); dss_apply_ovl_fifo_thresholds(ovl, fifo_low, fifo_high);
} }
static void dss_mgr_setup_fifos(struct omap_overlay_manager *mgr) static void dss_mgr_setup_fifos(struct omap_overlay_manager *mgr,
bool use_fifo_merge)
{ {
struct omap_overlay *ovl; struct omap_overlay *ovl;
struct mgr_priv_data *mp; struct mgr_priv_data *mp;
@ -908,10 +944,10 @@ static void dss_mgr_setup_fifos(struct omap_overlay_manager *mgr)
return; return;
list_for_each_entry(ovl, &mgr->overlays, list) list_for_each_entry(ovl, &mgr->overlays, list)
dss_ovl_setup_fifo(ovl); dss_ovl_setup_fifo(ovl, use_fifo_merge);
} }
static void dss_setup_fifos(void) static void dss_setup_fifos(bool use_fifo_merge)
{ {
const int num_mgrs = omap_dss_get_num_overlay_managers(); const int num_mgrs = omap_dss_get_num_overlay_managers();
struct omap_overlay_manager *mgr; struct omap_overlay_manager *mgr;
@ -919,15 +955,91 @@ static void dss_setup_fifos(void)
for (i = 0; i < num_mgrs; ++i) { for (i = 0; i < num_mgrs; ++i) {
mgr = omap_dss_get_overlay_manager(i); mgr = omap_dss_get_overlay_manager(i);
dss_mgr_setup_fifos(mgr); dss_mgr_setup_fifos(mgr, use_fifo_merge);
} }
} }
static int get_num_used_managers(void)
{
const int num_mgrs = omap_dss_get_num_overlay_managers();
struct omap_overlay_manager *mgr;
struct mgr_priv_data *mp;
int i;
int enabled_mgrs;
enabled_mgrs = 0;
for (i = 0; i < num_mgrs; ++i) {
mgr = omap_dss_get_overlay_manager(i);
mp = get_mgr_priv(mgr);
if (!mp->enabled)
continue;
enabled_mgrs++;
}
return enabled_mgrs;
}
static int get_num_used_overlays(void)
{
const int num_ovls = omap_dss_get_num_overlays();
struct omap_overlay *ovl;
struct ovl_priv_data *op;
struct mgr_priv_data *mp;
int i;
int enabled_ovls;
enabled_ovls = 0;
for (i = 0; i < num_ovls; ++i) {
ovl = omap_dss_get_overlay(i);
op = get_ovl_priv(ovl);
if (!op->enabled && !op->enabling)
continue;
mp = get_mgr_priv(ovl->manager);
if (!mp->enabled)
continue;
enabled_ovls++;
}
return enabled_ovls;
}
static bool get_use_fifo_merge(void)
{
int enabled_mgrs = get_num_used_managers();
int enabled_ovls = get_num_used_overlays();
if (!dss_has_feature(FEAT_FIFO_MERGE))
return false;
/*
* In theory the only requirement for fifomerge is enabled_ovls <= 1.
* However, if we have two managers enabled and set/unset the fifomerge,
* we need to set the GO bits in particular sequence for the managers,
* and wait in between.
*
* This is rather difficult as new apply calls can happen at any time,
* so we simplify the problem by requiring also that enabled_mgrs <= 1.
* In practice this shouldn't matter, because when only one overlay is
* enabled, most likely only one output is enabled.
*/
return enabled_mgrs <= 1 && enabled_ovls <= 1;
}
int dss_mgr_enable(struct omap_overlay_manager *mgr) int dss_mgr_enable(struct omap_overlay_manager *mgr)
{ {
struct mgr_priv_data *mp = get_mgr_priv(mgr); struct mgr_priv_data *mp = get_mgr_priv(mgr);
unsigned long flags; unsigned long flags;
int r; int r;
bool fifo_merge;
mutex_lock(&apply_lock); mutex_lock(&apply_lock);
@ -945,11 +1057,23 @@ int dss_mgr_enable(struct omap_overlay_manager *mgr)
goto err; goto err;
} }
dss_setup_fifos(); /* step 1: setup fifos/fifomerge before enabling the manager */
fifo_merge = get_use_fifo_merge();
dss_setup_fifos(fifo_merge);
dss_apply_fifo_merge(fifo_merge);
dss_write_regs(); dss_write_regs();
dss_set_go_bits(); dss_set_go_bits();
spin_unlock_irqrestore(&data_lock, flags);
/* wait until fifo config is in */
wait_pending_extra_info_updates();
/* step 2: enable the manager */
spin_lock_irqsave(&data_lock, flags);
if (!mgr_manual_update(mgr)) if (!mgr_manual_update(mgr))
mp->updating = true; mp->updating = true;
@ -974,6 +1098,7 @@ void dss_mgr_disable(struct omap_overlay_manager *mgr)
{ {
struct mgr_priv_data *mp = get_mgr_priv(mgr); struct mgr_priv_data *mp = get_mgr_priv(mgr);
unsigned long flags; unsigned long flags;
bool fifo_merge;
mutex_lock(&apply_lock); mutex_lock(&apply_lock);
@ -988,8 +1113,16 @@ void dss_mgr_disable(struct omap_overlay_manager *mgr)
mp->updating = false; mp->updating = false;
mp->enabled = false; mp->enabled = false;
fifo_merge = get_use_fifo_merge();
dss_setup_fifos(fifo_merge);
dss_apply_fifo_merge(fifo_merge);
dss_write_regs();
dss_set_go_bits();
spin_unlock_irqrestore(&data_lock, flags); spin_unlock_irqrestore(&data_lock, flags);
wait_pending_extra_info_updates();
out: out:
mutex_unlock(&apply_lock); mutex_unlock(&apply_lock);
} }
@ -1241,6 +1374,7 @@ int dss_ovl_enable(struct omap_overlay *ovl)
{ {
struct ovl_priv_data *op = get_ovl_priv(ovl); struct ovl_priv_data *op = get_ovl_priv(ovl);
unsigned long flags; unsigned long flags;
bool fifo_merge;
int r; int r;
mutex_lock(&apply_lock); mutex_lock(&apply_lock);
@ -1266,7 +1400,22 @@ int dss_ovl_enable(struct omap_overlay *ovl)
goto err2; goto err2;
} }
dss_setup_fifos(); /* step 1: configure fifos/fifomerge for currently enabled ovls */
fifo_merge = get_use_fifo_merge();
dss_setup_fifos(fifo_merge);
dss_apply_fifo_merge(fifo_merge);
dss_write_regs();
dss_set_go_bits();
spin_unlock_irqrestore(&data_lock, flags);
/* wait for fifo configs to go in */
wait_pending_extra_info_updates();
/* step 2: enable the overlay */
spin_lock_irqsave(&data_lock, flags);
op->enabling = false; op->enabling = false;
dss_apply_ovl_enable(ovl, true); dss_apply_ovl_enable(ovl, true);
@ -1294,6 +1443,7 @@ int dss_ovl_disable(struct omap_overlay *ovl)
{ {
struct ovl_priv_data *op = get_ovl_priv(ovl); struct ovl_priv_data *op = get_ovl_priv(ovl);
unsigned long flags; unsigned long flags;
bool fifo_merge;
int r; int r;
mutex_lock(&apply_lock); mutex_lock(&apply_lock);
@ -1308,9 +1458,11 @@ int dss_ovl_disable(struct omap_overlay *ovl)
goto err; goto err;
} }
/* step 1: disable the overlay */
spin_lock_irqsave(&data_lock, flags); spin_lock_irqsave(&data_lock, flags);
dss_apply_ovl_enable(ovl, false); dss_apply_ovl_enable(ovl, false);
dss_write_regs(); dss_write_regs();
dss_set_go_bits(); dss_set_go_bits();
@ -1319,6 +1471,21 @@ int dss_ovl_disable(struct omap_overlay *ovl)
/* wait for the overlay to be disabled */ /* wait for the overlay to be disabled */
wait_pending_extra_info_updates(); wait_pending_extra_info_updates();
/* step 2: configure fifos/fifomerge */
spin_lock_irqsave(&data_lock, flags);
fifo_merge = get_use_fifo_merge();
dss_setup_fifos(fifo_merge);
dss_apply_fifo_merge(fifo_merge);
dss_write_regs();
dss_set_go_bits();
spin_unlock_irqrestore(&data_lock, flags);
/* wait for fifo config to go in */
wait_pending_extra_info_updates();
mutex_unlock(&apply_lock); mutex_unlock(&apply_lock);
return 0; return 0;

View File

@ -37,7 +37,6 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <plat/sram.h>
#include <plat/clock.h> #include <plat/clock.h>
#include <video/omapdss.h> #include <video/omapdss.h>
@ -736,11 +735,11 @@ static void dispc_ovl_set_color_mode(enum omap_plane plane,
switch (color_mode) { switch (color_mode) {
case OMAP_DSS_COLOR_NV12: case OMAP_DSS_COLOR_NV12:
m = 0x0; break; m = 0x0; break;
case OMAP_DSS_COLOR_RGB12U: case OMAP_DSS_COLOR_RGBX16:
m = 0x1; break; m = 0x1; break;
case OMAP_DSS_COLOR_RGBA16: case OMAP_DSS_COLOR_RGBA16:
m = 0x2; break; m = 0x2; break;
case OMAP_DSS_COLOR_RGBX16: case OMAP_DSS_COLOR_RGB12U:
m = 0x4; break; m = 0x4; break;
case OMAP_DSS_COLOR_ARGB16: case OMAP_DSS_COLOR_ARGB16:
m = 0x5; break; m = 0x5; break;
@ -789,9 +788,9 @@ static void dispc_ovl_set_color_mode(enum omap_plane plane,
m = 0x8; break; m = 0x8; break;
case OMAP_DSS_COLOR_RGB24P: case OMAP_DSS_COLOR_RGB24P:
m = 0x9; break; m = 0x9; break;
case OMAP_DSS_COLOR_YUV2: case OMAP_DSS_COLOR_RGBX16:
m = 0xa; break; m = 0xa; break;
case OMAP_DSS_COLOR_UYVY: case OMAP_DSS_COLOR_RGBA16:
m = 0xb; break; m = 0xb; break;
case OMAP_DSS_COLOR_ARGB32: case OMAP_DSS_COLOR_ARGB32:
m = 0xc; break; m = 0xc; break;
@ -909,7 +908,7 @@ static void dispc_configure_burst_sizes(void)
dispc_ovl_set_burst_size(i, burst_size); dispc_ovl_set_burst_size(i, burst_size);
} }
u32 dispc_ovl_get_burst_size(enum omap_plane plane) static u32 dispc_ovl_get_burst_size(enum omap_plane plane)
{ {
unsigned unit = dss_feat_get_burst_size_unit(); unsigned unit = dss_feat_get_burst_size_unit();
/* burst multiplier is always x8 (see dispc_configure_burst_sizes()) */ /* burst multiplier is always x8 (see dispc_configure_burst_sizes()) */
@ -1018,7 +1017,7 @@ static void dispc_read_plane_fifo_sizes(void)
} }
} }
u32 dispc_ovl_get_fifo_size(enum omap_plane plane) static u32 dispc_ovl_get_fifo_size(enum omap_plane plane)
{ {
return dispc.fifo_size[plane]; return dispc.fifo_size[plane];
} }
@ -1039,13 +1038,13 @@ void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high)
dss_feat_get_reg_field(FEAT_REG_FIFOHIGHTHRESHOLD, &hi_start, &hi_end); dss_feat_get_reg_field(FEAT_REG_FIFOHIGHTHRESHOLD, &hi_start, &hi_end);
dss_feat_get_reg_field(FEAT_REG_FIFOLOWTHRESHOLD, &lo_start, &lo_end); dss_feat_get_reg_field(FEAT_REG_FIFOLOWTHRESHOLD, &lo_start, &lo_end);
DSSDBG("fifo(%d) low/high old %u/%u, new %u/%u\n", DSSDBG("fifo(%d) threshold (bytes), old %u/%u, new %u/%u\n",
plane, plane,
REG_GET(DISPC_OVL_FIFO_THRESHOLD(plane), REG_GET(DISPC_OVL_FIFO_THRESHOLD(plane),
lo_start, lo_end), lo_start, lo_end) * unit,
REG_GET(DISPC_OVL_FIFO_THRESHOLD(plane), REG_GET(DISPC_OVL_FIFO_THRESHOLD(plane),
hi_start, hi_end), hi_start, hi_end) * unit,
low, high); low * unit, high * unit);
dispc_write_reg(DISPC_OVL_FIFO_THRESHOLD(plane), dispc_write_reg(DISPC_OVL_FIFO_THRESHOLD(plane),
FLD_VAL(high, hi_start, hi_end) | FLD_VAL(high, hi_start, hi_end) |
@ -1054,10 +1053,53 @@ void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high)
void dispc_enable_fifomerge(bool enable) void dispc_enable_fifomerge(bool enable)
{ {
if (!dss_has_feature(FEAT_FIFO_MERGE)) {
WARN_ON(enable);
return;
}
DSSDBG("FIFO merge %s\n", enable ? "enabled" : "disabled"); DSSDBG("FIFO merge %s\n", enable ? "enabled" : "disabled");
REG_FLD_MOD(DISPC_CONFIG, enable ? 1 : 0, 14, 14); REG_FLD_MOD(DISPC_CONFIG, enable ? 1 : 0, 14, 14);
} }
void dispc_ovl_compute_fifo_thresholds(enum omap_plane plane,
u32 *fifo_low, u32 *fifo_high, bool use_fifomerge)
{
/*
* All sizes are in bytes. Both the buffer and burst are made of
* buffer_units, and the fifo thresholds must be buffer_unit aligned.
*/
unsigned buf_unit = dss_feat_get_buffer_size_unit();
unsigned ovl_fifo_size, total_fifo_size, burst_size;
int i;
burst_size = dispc_ovl_get_burst_size(plane);
ovl_fifo_size = dispc_ovl_get_fifo_size(plane);
if (use_fifomerge) {
total_fifo_size = 0;
for (i = 0; i < omap_dss_get_num_overlays(); ++i)
total_fifo_size += dispc_ovl_get_fifo_size(i);
} else {
total_fifo_size = ovl_fifo_size;
}
/*
* We use the same low threshold for both fifomerge and non-fifomerge
* cases, but for fifomerge we calculate the high threshold using the
* combined fifo size
*/
if (dss_has_feature(FEAT_OMAP3_DSI_FIFO_BUG)) {
*fifo_low = ovl_fifo_size - burst_size * 2;
*fifo_high = total_fifo_size - burst_size;
} else {
*fifo_low = ovl_fifo_size - burst_size;
*fifo_high = total_fifo_size - buf_unit;
}
}
static void dispc_ovl_set_fir(enum omap_plane plane, static void dispc_ovl_set_fir(enum omap_plane plane,
int hinc, int vinc, int hinc, int vinc,
enum omap_color_component color_comp) enum omap_color_component color_comp)
@ -1651,6 +1693,7 @@ static unsigned long calc_fclk(enum omap_channel channel, u16 width,
u16 height, u16 out_width, u16 out_height) u16 height, u16 out_width, u16 out_height)
{ {
unsigned int hf, vf; unsigned int hf, vf;
unsigned long pclk = dispc_mgr_pclk_rate(channel);
/* /*
* FIXME how to determine the 'A' factor * FIXME how to determine the 'A' factor
@ -1673,13 +1716,16 @@ static unsigned long calc_fclk(enum omap_channel channel, u16 width,
if (cpu_is_omap24xx()) { if (cpu_is_omap24xx()) {
if (vf > 1 && hf > 1) if (vf > 1 && hf > 1)
return dispc_mgr_pclk_rate(channel) * 4; return pclk * 4;
else else
return dispc_mgr_pclk_rate(channel) * 2; return pclk * 2;
} else if (cpu_is_omap34xx()) { } else if (cpu_is_omap34xx()) {
return dispc_mgr_pclk_rate(channel) * vf * hf; return pclk * vf * hf;
} else { } else {
return dispc_mgr_pclk_rate(channel) * hf; if (hf > 1)
return DIV_ROUND_UP(pclk, out_width) * width;
else
return pclk;
} }
} }
@ -3298,15 +3344,6 @@ static int omap_dispchw_probe(struct platform_device *pdev)
dispc.pdev = pdev; dispc.pdev = pdev;
clk = clk_get(&pdev->dev, "fck");
if (IS_ERR(clk)) {
DSSERR("can't get fck\n");
r = PTR_ERR(clk);
goto err_get_clk;
}
dispc.dss_clk = clk;
spin_lock_init(&dispc.irq_lock); spin_lock_init(&dispc.irq_lock);
#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
@ -3319,29 +3356,38 @@ static int omap_dispchw_probe(struct platform_device *pdev)
dispc_mem = platform_get_resource(dispc.pdev, IORESOURCE_MEM, 0); dispc_mem = platform_get_resource(dispc.pdev, IORESOURCE_MEM, 0);
if (!dispc_mem) { if (!dispc_mem) {
DSSERR("can't get IORESOURCE_MEM DISPC\n"); DSSERR("can't get IORESOURCE_MEM DISPC\n");
r = -EINVAL; return -EINVAL;
goto err_ioremap;
} }
dispc.base = ioremap(dispc_mem->start, resource_size(dispc_mem));
dispc.base = devm_ioremap(&pdev->dev, dispc_mem->start,
resource_size(dispc_mem));
if (!dispc.base) { if (!dispc.base) {
DSSERR("can't ioremap DISPC\n"); DSSERR("can't ioremap DISPC\n");
r = -ENOMEM; return -ENOMEM;
goto err_ioremap;
} }
dispc.irq = platform_get_irq(dispc.pdev, 0); dispc.irq = platform_get_irq(dispc.pdev, 0);
if (dispc.irq < 0) { if (dispc.irq < 0) {
DSSERR("platform_get_irq failed\n"); DSSERR("platform_get_irq failed\n");
r = -ENODEV; return -ENODEV;
goto err_irq;
} }
r = request_irq(dispc.irq, omap_dispc_irq_handler, IRQF_SHARED, r = devm_request_irq(&pdev->dev, dispc.irq, omap_dispc_irq_handler,
"OMAP DISPC", dispc.pdev); IRQF_SHARED, "OMAP DISPC", dispc.pdev);
if (r < 0) { if (r < 0) {
DSSERR("request_irq failed\n"); DSSERR("request_irq failed\n");
goto err_irq; return r;
} }
clk = clk_get(&pdev->dev, "fck");
if (IS_ERR(clk)) {
DSSERR("can't get fck\n");
r = PTR_ERR(clk);
return r;
}
dispc.dss_clk = clk;
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
r = dispc_runtime_get(); r = dispc_runtime_get();
@ -3362,12 +3408,7 @@ static int omap_dispchw_probe(struct platform_device *pdev)
err_runtime_get: err_runtime_get:
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
free_irq(dispc.irq, dispc.pdev);
err_irq:
iounmap(dispc.base);
err_ioremap:
clk_put(dispc.dss_clk); clk_put(dispc.dss_clk);
err_get_clk:
return r; return r;
} }
@ -3377,8 +3418,6 @@ static int omap_dispchw_remove(struct platform_device *pdev)
clk_put(dispc.dss_clk); clk_put(dispc.dss_clk);
free_irq(dispc.irq, dispc.pdev);
iounmap(dispc.base);
return 0; return 0;
} }

View File

@ -19,14 +19,13 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <video/omapdss.h> #include <video/omapdss.h>
#include "dispc.h"
#define ARRAY_LEN(array) (sizeof(array) / sizeof(array[0])) #include "dispc.h"
static const struct dispc_coef coef3_M8[8] = { static const struct dispc_coef coef3_M8[8] = {
{ 0, 0, 128, 0, 0 }, { 0, 0, 128, 0, 0 },
{ 0, -4, 123, 9, 0 }, { 0, -4, 123, 9, 0 },
{ 0, -4, 108, 87, 0 }, { 0, -4, 108, 24, 0 },
{ 0, -2, 87, 43, 0 }, { 0, -2, 87, 43, 0 },
{ 0, 64, 64, 0, 0 }, { 0, 64, 64, 0, 0 },
{ 0, 43, 87, -2, 0 }, { 0, 43, 87, -2, 0 },
@ -168,7 +167,7 @@ static const struct dispc_coef coef5_M8[8] = {
static const struct dispc_coef coef5_M9[8] = { static const struct dispc_coef coef5_M9[8] = {
{ -3, 10, 114, 10, -3 }, { -3, 10, 114, 10, -3 },
{ -6, 24, 110, 0, -1 }, { -6, 24, 111, 0, -1 },
{ -8, 40, 103, -7, 0 }, { -8, 40, 103, -7, 0 },
{ -11, 58, 91, -11, 1 }, { -11, 58, 91, -11, 1 },
{ 0, -12, 76, 76, -12 }, { 0, -12, 76, 76, -12 },
@ -319,7 +318,7 @@ const struct dispc_coef *dispc_ovl_get_scale_coef(int inc, int five_taps)
}; };
inc /= 128; inc /= 128;
for (i = 0; i < ARRAY_LEN(coefs); ++i) for (i = 0; i < ARRAY_SIZE(coefs); ++i)
if (inc >= coefs[i].Mmin && inc <= coefs[i].Mmax) if (inc >= coefs[i].Mmin && inc <= coefs[i].Mmax)
return five_taps ? coefs[i].coef_5 : coefs[i].coef_3; return five_taps ? coefs[i].coef_5 : coefs[i].coef_3;
return NULL; return NULL;

View File

@ -279,16 +279,6 @@ void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
} }
EXPORT_SYMBOL(omapdss_default_get_resolution); EXPORT_SYMBOL(omapdss_default_get_resolution);
void default_get_overlay_fifo_thresholds(enum omap_plane plane,
u32 fifo_size, u32 burst_size,
u32 *fifo_low, u32 *fifo_high)
{
unsigned buf_unit = dss_feat_get_buffer_size_unit();
*fifo_high = fifo_size - buf_unit;
*fifo_low = fifo_size - burst_size;
}
int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev) int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev)
{ {
switch (dssdev->type) { switch (dssdev->type) {

View File

@ -4524,14 +4524,6 @@ int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
} }
EXPORT_SYMBOL(omapdss_dsi_enable_te); EXPORT_SYMBOL(omapdss_dsi_enable_te);
void dsi_get_overlay_fifo_thresholds(enum omap_plane plane,
u32 fifo_size, u32 burst_size,
u32 *fifo_low, u32 *fifo_high)
{
*fifo_high = fifo_size - burst_size;
*fifo_low = fifo_size - burst_size * 2;
}
int dsi_init_display(struct omap_dss_device *dssdev) int dsi_init_display(struct omap_dss_device *dssdev)
{ {
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@ -4695,11 +4687,9 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
struct resource *dsi_mem; struct resource *dsi_mem;
struct dsi_data *dsi; struct dsi_data *dsi;
dsi = kzalloc(sizeof(*dsi), GFP_KERNEL); dsi = devm_kzalloc(&dsidev->dev, sizeof(*dsi), GFP_KERNEL);
if (!dsi) { if (!dsi)
r = -ENOMEM; return -ENOMEM;
goto err_alloc;
}
dsi->pdev = dsidev; dsi->pdev = dsidev;
dsi_pdev_map[dsi_module] = dsidev; dsi_pdev_map[dsi_module] = dsidev;
@ -4722,12 +4712,6 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
mutex_init(&dsi->lock); mutex_init(&dsi->lock);
sema_init(&dsi->bus_lock, 1); sema_init(&dsi->bus_lock, 1);
r = dsi_get_clocks(dsidev);
if (r)
goto err_get_clk;
pm_runtime_enable(&dsidev->dev);
INIT_DELAYED_WORK_DEFERRABLE(&dsi->framedone_timeout_work, INIT_DELAYED_WORK_DEFERRABLE(&dsi->framedone_timeout_work,
dsi_framedone_timeout_work_callback); dsi_framedone_timeout_work_callback);
@ -4739,27 +4723,27 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
dsi_mem = platform_get_resource(dsi->pdev, IORESOURCE_MEM, 0); dsi_mem = platform_get_resource(dsi->pdev, IORESOURCE_MEM, 0);
if (!dsi_mem) { if (!dsi_mem) {
DSSERR("can't get IORESOURCE_MEM DSI\n"); DSSERR("can't get IORESOURCE_MEM DSI\n");
r = -EINVAL; return -EINVAL;
goto err_ioremap;
} }
dsi->base = ioremap(dsi_mem->start, resource_size(dsi_mem));
dsi->base = devm_ioremap(&dsidev->dev, dsi_mem->start,
resource_size(dsi_mem));
if (!dsi->base) { if (!dsi->base) {
DSSERR("can't ioremap DSI\n"); DSSERR("can't ioremap DSI\n");
r = -ENOMEM; return -ENOMEM;
goto err_ioremap;
} }
dsi->irq = platform_get_irq(dsi->pdev, 0); dsi->irq = platform_get_irq(dsi->pdev, 0);
if (dsi->irq < 0) { if (dsi->irq < 0) {
DSSERR("platform_get_irq failed\n"); DSSERR("platform_get_irq failed\n");
r = -ENODEV; return -ENODEV;
goto err_get_irq;
} }
r = request_irq(dsi->irq, omap_dsi_irq_handler, IRQF_SHARED, r = devm_request_irq(&dsidev->dev, dsi->irq, omap_dsi_irq_handler,
dev_name(&dsidev->dev), dsi->pdev); IRQF_SHARED, dev_name(&dsidev->dev), dsi->pdev);
if (r < 0) { if (r < 0) {
DSSERR("request_irq failed\n"); DSSERR("request_irq failed\n");
goto err_get_irq; return r;
} }
/* DSI VCs initialization */ /* DSI VCs initialization */
@ -4771,9 +4755,15 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
dsi_calc_clock_param_ranges(dsidev); dsi_calc_clock_param_ranges(dsidev);
r = dsi_get_clocks(dsidev);
if (r)
return r;
pm_runtime_enable(&dsidev->dev);
r = dsi_runtime_get(dsidev); r = dsi_runtime_get(dsidev);
if (r) if (r)
goto err_get_dsi; goto err_runtime_get;
rev = dsi_read_reg(dsidev, DSI_REVISION); rev = dsi_read_reg(dsidev, DSI_REVISION);
dev_dbg(&dsidev->dev, "OMAP DSI rev %d.%d\n", dev_dbg(&dsidev->dev, "OMAP DSI rev %d.%d\n",
@ -4791,15 +4781,9 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
return 0; return 0;
err_get_dsi: err_runtime_get:
free_irq(dsi->irq, dsi->pdev);
err_get_irq:
iounmap(dsi->base);
err_ioremap:
pm_runtime_disable(&dsidev->dev); pm_runtime_disable(&dsidev->dev);
err_get_clk: dsi_put_clocks(dsidev);
kfree(dsi);
err_alloc:
return r; return r;
} }
@ -4823,11 +4807,6 @@ static int omap_dsihw_remove(struct platform_device *dsidev)
dsi->vdds_dsi_reg = NULL; dsi->vdds_dsi_reg = NULL;
} }
free_irq(dsi->irq, dsi->pdev);
iounmap(dsi->base);
kfree(dsi);
return 0; return 0;
} }

View File

@ -748,19 +748,19 @@ static int omap_dsshw_probe(struct platform_device *pdev)
dss_mem = platform_get_resource(dss.pdev, IORESOURCE_MEM, 0); dss_mem = platform_get_resource(dss.pdev, IORESOURCE_MEM, 0);
if (!dss_mem) { if (!dss_mem) {
DSSERR("can't get IORESOURCE_MEM DSS\n"); DSSERR("can't get IORESOURCE_MEM DSS\n");
r = -EINVAL; return -EINVAL;
goto err_ioremap;
} }
dss.base = ioremap(dss_mem->start, resource_size(dss_mem));
dss.base = devm_ioremap(&pdev->dev, dss_mem->start,
resource_size(dss_mem));
if (!dss.base) { if (!dss.base) {
DSSERR("can't ioremap DSS\n"); DSSERR("can't ioremap DSS\n");
r = -ENOMEM; return -ENOMEM;
goto err_ioremap;
} }
r = dss_get_clocks(); r = dss_get_clocks();
if (r) if (r)
goto err_clocks; return r;
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
@ -808,9 +808,6 @@ err_dpi:
err_runtime_get: err_runtime_get:
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
dss_put_clocks(); dss_put_clocks();
err_clocks:
iounmap(dss.base);
err_ioremap:
return r; return r;
} }
@ -819,8 +816,6 @@ static int omap_dsshw_remove(struct platform_device *pdev)
dpi_exit(); dpi_exit();
sdi_exit(); sdi_exit();
iounmap(dss.base);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
dss_put_clocks(); dss_put_clocks();

View File

@ -202,9 +202,6 @@ void dss_uninit_device(struct platform_device *pdev,
struct omap_dss_device *dssdev); struct omap_dss_device *dssdev);
bool dss_use_replication(struct omap_dss_device *dssdev, bool dss_use_replication(struct omap_dss_device *dssdev,
enum omap_color_mode mode); enum omap_color_mode mode);
void default_get_overlay_fifo_thresholds(enum omap_plane plane,
u32 fifo_size, u32 burst_size,
u32 *fifo_low, u32 *fifo_high);
/* manager */ /* manager */
int dss_init_overlay_managers(struct platform_device *pdev); int dss_init_overlay_managers(struct platform_device *pdev);
@ -313,9 +310,6 @@ int dsi_pll_calc_clock_div_pck(struct platform_device *dsidev, bool is_tft,
int dsi_pll_init(struct platform_device *dsidev, bool enable_hsclk, int dsi_pll_init(struct platform_device *dsidev, bool enable_hsclk,
bool enable_hsdiv); bool enable_hsdiv);
void dsi_pll_uninit(struct platform_device *dsidev, bool disconnect_lanes); void dsi_pll_uninit(struct platform_device *dsidev, bool disconnect_lanes);
void dsi_get_overlay_fifo_thresholds(enum omap_plane plane,
u32 fifo_size, u32 burst_size,
u32 *fifo_low, u32 *fifo_high);
void dsi_wait_pll_hsdiv_dispc_active(struct platform_device *dsidev); void dsi_wait_pll_hsdiv_dispc_active(struct platform_device *dsidev);
void dsi_wait_pll_hsdiv_dsi_active(struct platform_device *dsidev); void dsi_wait_pll_hsdiv_dsi_active(struct platform_device *dsidev);
struct platform_device *dsi_get_dsidev_from_id(int module); struct platform_device *dsi_get_dsidev_from_id(int module);
@ -429,8 +423,8 @@ int dispc_calc_clock_rates(unsigned long dispc_fclk_rate,
void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high); void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high);
u32 dispc_ovl_get_fifo_size(enum omap_plane plane); void dispc_ovl_compute_fifo_thresholds(enum omap_plane plane,
u32 dispc_ovl_get_burst_size(enum omap_plane plane); u32 *fifo_low, u32 *fifo_high, bool use_fifomerge);
int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi, int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi,
bool ilace, bool replication); bool ilace, bool replication);
int dispc_ovl_enable(enum omap_plane plane, bool enable); int dispc_ovl_enable(enum omap_plane plane, bool enable);

View File

@ -41,7 +41,8 @@ struct omap_dss_features {
const struct dss_reg_field *reg_fields; const struct dss_reg_field *reg_fields;
const int num_reg_fields; const int num_reg_fields;
const u32 has_feature; const enum dss_feat_id *features;
const int num_features;
const int num_mgrs; const int num_mgrs;
const int num_ovls; const int num_ovls;
@ -189,7 +190,8 @@ static const enum omap_color_mode omap4_dss_supported_color_modes[] = {
OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32 | OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32 |
OMAP_DSS_COLOR_ARGB16_1555, OMAP_DSS_COLOR_ARGB16_1555 | OMAP_DSS_COLOR_RGBX16 |
OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_XRGB16_1555,
/* OMAP_DSS_VIDEO1 */ /* OMAP_DSS_VIDEO1 */
OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
@ -337,15 +339,110 @@ static const struct dss_param_range omap4_dss_param_range[] = {
[FEAT_PARAM_LINEWIDTH] = { 1, 2048 }, [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
}; };
static const enum dss_feat_id omap2_dss_feat_list[] = {
FEAT_LCDENABLEPOL,
FEAT_LCDENABLESIGNAL,
FEAT_PCKFREEENABLE,
FEAT_FUNCGATED,
FEAT_ROWREPEATENABLE,
FEAT_RESIZECONF,
};
static const enum dss_feat_id omap3430_dss_feat_list[] = {
FEAT_LCDENABLEPOL,
FEAT_LCDENABLESIGNAL,
FEAT_PCKFREEENABLE,
FEAT_FUNCGATED,
FEAT_LINEBUFFERSPLIT,
FEAT_ROWREPEATENABLE,
FEAT_RESIZECONF,
FEAT_DSI_PLL_FREQSEL,
FEAT_DSI_REVERSE_TXCLKESC,
FEAT_VENC_REQUIRES_TV_DAC_CLK,
FEAT_CPR,
FEAT_PRELOAD,
FEAT_FIR_COEF_V,
FEAT_ALPHA_FIXED_ZORDER,
FEAT_FIFO_MERGE,
FEAT_OMAP3_DSI_FIFO_BUG,
};
static const enum dss_feat_id omap3630_dss_feat_list[] = {
FEAT_LCDENABLEPOL,
FEAT_LCDENABLESIGNAL,
FEAT_PCKFREEENABLE,
FEAT_FUNCGATED,
FEAT_LINEBUFFERSPLIT,
FEAT_ROWREPEATENABLE,
FEAT_RESIZECONF,
FEAT_DSI_PLL_PWR_BUG,
FEAT_DSI_PLL_FREQSEL,
FEAT_CPR,
FEAT_PRELOAD,
FEAT_FIR_COEF_V,
FEAT_ALPHA_FIXED_ZORDER,
FEAT_FIFO_MERGE,
FEAT_OMAP3_DSI_FIFO_BUG,
};
static const enum dss_feat_id omap4430_es1_0_dss_feat_list[] = {
FEAT_MGR_LCD2,
FEAT_CORE_CLK_DIV,
FEAT_LCD_CLK_SRC,
FEAT_DSI_DCS_CMD_CONFIG_VC,
FEAT_DSI_VC_OCP_WIDTH,
FEAT_DSI_GNQ,
FEAT_HANDLE_UV_SEPARATE,
FEAT_ATTR2,
FEAT_CPR,
FEAT_PRELOAD,
FEAT_FIR_COEF_V,
FEAT_ALPHA_FREE_ZORDER,
FEAT_FIFO_MERGE,
};
static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = {
FEAT_MGR_LCD2,
FEAT_CORE_CLK_DIV,
FEAT_LCD_CLK_SRC,
FEAT_DSI_DCS_CMD_CONFIG_VC,
FEAT_DSI_VC_OCP_WIDTH,
FEAT_DSI_GNQ,
FEAT_HDMI_CTS_SWMODE,
FEAT_HANDLE_UV_SEPARATE,
FEAT_ATTR2,
FEAT_CPR,
FEAT_PRELOAD,
FEAT_FIR_COEF_V,
FEAT_ALPHA_FREE_ZORDER,
FEAT_FIFO_MERGE,
};
static const enum dss_feat_id omap4_dss_feat_list[] = {
FEAT_MGR_LCD2,
FEAT_CORE_CLK_DIV,
FEAT_LCD_CLK_SRC,
FEAT_DSI_DCS_CMD_CONFIG_VC,
FEAT_DSI_VC_OCP_WIDTH,
FEAT_DSI_GNQ,
FEAT_HDMI_CTS_SWMODE,
FEAT_HDMI_AUDIO_USE_MCLK,
FEAT_HANDLE_UV_SEPARATE,
FEAT_ATTR2,
FEAT_CPR,
FEAT_PRELOAD,
FEAT_FIR_COEF_V,
FEAT_ALPHA_FREE_ZORDER,
FEAT_FIFO_MERGE,
};
/* OMAP2 DSS Features */ /* OMAP2 DSS Features */
static const struct omap_dss_features omap2_dss_features = { static const struct omap_dss_features omap2_dss_features = {
.reg_fields = omap2_dss_reg_fields, .reg_fields = omap2_dss_reg_fields,
.num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields), .num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields),
.has_feature = .features = omap2_dss_feat_list,
FEAT_LCDENABLEPOL | FEAT_LCDENABLESIGNAL | .num_features = ARRAY_SIZE(omap2_dss_feat_list),
FEAT_PCKFREEENABLE | FEAT_FUNCGATED |
FEAT_ROWREPEATENABLE | FEAT_RESIZECONF,
.num_mgrs = 2, .num_mgrs = 2,
.num_ovls = 3, .num_ovls = 3,
@ -363,14 +460,8 @@ static const struct omap_dss_features omap3430_dss_features = {
.reg_fields = omap3_dss_reg_fields, .reg_fields = omap3_dss_reg_fields,
.num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields), .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
.has_feature = .features = omap3430_dss_feat_list,
FEAT_LCDENABLEPOL | .num_features = ARRAY_SIZE(omap3430_dss_feat_list),
FEAT_LCDENABLESIGNAL | FEAT_PCKFREEENABLE |
FEAT_FUNCGATED | FEAT_ROWREPEATENABLE |
FEAT_LINEBUFFERSPLIT | FEAT_RESIZECONF |
FEAT_DSI_PLL_FREQSEL | FEAT_DSI_REVERSE_TXCLKESC |
FEAT_VENC_REQUIRES_TV_DAC_CLK | FEAT_CPR | FEAT_PRELOAD |
FEAT_FIR_COEF_V | FEAT_ALPHA_FIXED_ZORDER,
.num_mgrs = 2, .num_mgrs = 2,
.num_ovls = 3, .num_ovls = 3,
@ -387,14 +478,8 @@ static const struct omap_dss_features omap3630_dss_features = {
.reg_fields = omap3_dss_reg_fields, .reg_fields = omap3_dss_reg_fields,
.num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields), .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
.has_feature = .features = omap3630_dss_feat_list,
FEAT_LCDENABLEPOL | .num_features = ARRAY_SIZE(omap3630_dss_feat_list),
FEAT_LCDENABLESIGNAL | FEAT_PCKFREEENABLE |
FEAT_FUNCGATED |
FEAT_ROWREPEATENABLE | FEAT_LINEBUFFERSPLIT |
FEAT_RESIZECONF | FEAT_DSI_PLL_PWR_BUG |
FEAT_DSI_PLL_FREQSEL | FEAT_CPR | FEAT_PRELOAD |
FEAT_FIR_COEF_V | FEAT_ALPHA_FIXED_ZORDER,
.num_mgrs = 2, .num_mgrs = 2,
.num_ovls = 3, .num_ovls = 3,
@ -413,13 +498,27 @@ static const struct omap_dss_features omap4430_es1_0_dss_features = {
.reg_fields = omap4_dss_reg_fields, .reg_fields = omap4_dss_reg_fields,
.num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields), .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
.has_feature = .features = omap4430_es1_0_dss_feat_list,
FEAT_MGR_LCD2 | .num_features = ARRAY_SIZE(omap4430_es1_0_dss_feat_list),
FEAT_CORE_CLK_DIV | FEAT_LCD_CLK_SRC |
FEAT_DSI_DCS_CMD_CONFIG_VC | FEAT_DSI_VC_OCP_WIDTH | .num_mgrs = 3,
FEAT_DSI_GNQ | FEAT_HANDLE_UV_SEPARATE | FEAT_ATTR2 | .num_ovls = 4,
FEAT_CPR | FEAT_PRELOAD | FEAT_FIR_COEF_V | .supported_displays = omap4_dss_supported_displays,
FEAT_ALPHA_FREE_ZORDER, .supported_color_modes = omap4_dss_supported_color_modes,
.overlay_caps = omap4_dss_overlay_caps,
.clksrc_names = omap4_dss_clk_source_names,
.dss_params = omap4_dss_param_range,
.buffer_size_unit = 16,
.burst_size_unit = 16,
};
/* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */
static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = {
.reg_fields = omap4_dss_reg_fields,
.num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
.features = omap4430_es2_0_1_2_dss_feat_list,
.num_features = ARRAY_SIZE(omap4430_es2_0_1_2_dss_feat_list),
.num_mgrs = 3, .num_mgrs = 3,
.num_ovls = 4, .num_ovls = 4,
@ -437,13 +536,8 @@ static const struct omap_dss_features omap4_dss_features = {
.reg_fields = omap4_dss_reg_fields, .reg_fields = omap4_dss_reg_fields,
.num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields), .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
.has_feature = .features = omap4_dss_feat_list,
FEAT_MGR_LCD2 | .num_features = ARRAY_SIZE(omap4_dss_feat_list),
FEAT_CORE_CLK_DIV | FEAT_LCD_CLK_SRC |
FEAT_DSI_DCS_CMD_CONFIG_VC | FEAT_DSI_VC_OCP_WIDTH |
FEAT_DSI_GNQ | FEAT_HDMI_CTS_SWMODE |
FEAT_HANDLE_UV_SEPARATE | FEAT_ATTR2 | FEAT_CPR |
FEAT_PRELOAD | FEAT_FIR_COEF_V | FEAT_ALPHA_FREE_ZORDER,
.num_mgrs = 3, .num_mgrs = 3,
.num_ovls = 4, .num_ovls = 4,
@ -547,7 +641,16 @@ u32 dss_feat_get_burst_size_unit(void)
/* DSS has_feature check */ /* DSS has_feature check */
bool dss_has_feature(enum dss_feat_id id) bool dss_has_feature(enum dss_feat_id id)
{ {
return omap_current_dss_features->has_feature & id; int i;
const enum dss_feat_id *features = omap_current_dss_features->features;
const int num_features = omap_current_dss_features->num_features;
for (i = 0; i < num_features; i++) {
if (features[i] == id)
return true;
}
return false;
} }
void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end) void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
@ -569,6 +672,10 @@ void dss_features_init(void)
omap_current_dss_features = &omap3430_dss_features; omap_current_dss_features = &omap3430_dss_features;
else if (omap_rev() == OMAP4430_REV_ES1_0) else if (omap_rev() == OMAP4430_REV_ES1_0)
omap_current_dss_features = &omap4430_es1_0_dss_features; omap_current_dss_features = &omap4430_es1_0_dss_features;
else if (omap_rev() == OMAP4430_REV_ES2_0 ||
omap_rev() == OMAP4430_REV_ES2_1 ||
omap_rev() == OMAP4430_REV_ES2_2)
omap_current_dss_features = &omap4430_es2_0_1_2_dss_features;
else if (cpu_is_omap44xx()) else if (cpu_is_omap44xx())
omap_current_dss_features = &omap4_dss_features; omap_current_dss_features = &omap4_dss_features;
else else

View File

@ -31,33 +31,37 @@
/* DSS has feature id */ /* DSS has feature id */
enum dss_feat_id { enum dss_feat_id {
FEAT_LCDENABLEPOL = 1 << 3, FEAT_LCDENABLEPOL,
FEAT_LCDENABLESIGNAL = 1 << 4, FEAT_LCDENABLESIGNAL,
FEAT_PCKFREEENABLE = 1 << 5, FEAT_PCKFREEENABLE,
FEAT_FUNCGATED = 1 << 6, FEAT_FUNCGATED,
FEAT_MGR_LCD2 = 1 << 7, FEAT_MGR_LCD2,
FEAT_LINEBUFFERSPLIT = 1 << 8, FEAT_LINEBUFFERSPLIT,
FEAT_ROWREPEATENABLE = 1 << 9, FEAT_ROWREPEATENABLE,
FEAT_RESIZECONF = 1 << 10, FEAT_RESIZECONF,
/* Independent core clk divider */ /* Independent core clk divider */
FEAT_CORE_CLK_DIV = 1 << 11, FEAT_CORE_CLK_DIV,
FEAT_LCD_CLK_SRC = 1 << 12, FEAT_LCD_CLK_SRC,
/* DSI-PLL power command 0x3 is not working */ /* DSI-PLL power command 0x3 is not working */
FEAT_DSI_PLL_PWR_BUG = 1 << 13, FEAT_DSI_PLL_PWR_BUG,
FEAT_DSI_PLL_FREQSEL = 1 << 14, FEAT_DSI_PLL_FREQSEL,
FEAT_DSI_DCS_CMD_CONFIG_VC = 1 << 15, FEAT_DSI_DCS_CMD_CONFIG_VC,
FEAT_DSI_VC_OCP_WIDTH = 1 << 16, FEAT_DSI_VC_OCP_WIDTH,
FEAT_DSI_REVERSE_TXCLKESC = 1 << 17, FEAT_DSI_REVERSE_TXCLKESC,
FEAT_DSI_GNQ = 1 << 18, FEAT_DSI_GNQ,
FEAT_HDMI_CTS_SWMODE = 1 << 19, FEAT_HDMI_CTS_SWMODE,
FEAT_HANDLE_UV_SEPARATE = 1 << 20, FEAT_HDMI_AUDIO_USE_MCLK,
FEAT_ATTR2 = 1 << 21, FEAT_HANDLE_UV_SEPARATE,
FEAT_VENC_REQUIRES_TV_DAC_CLK = 1 << 22, FEAT_ATTR2,
FEAT_CPR = 1 << 23, FEAT_VENC_REQUIRES_TV_DAC_CLK,
FEAT_PRELOAD = 1 << 24, FEAT_CPR,
FEAT_FIR_COEF_V = 1 << 25, FEAT_PRELOAD,
FEAT_ALPHA_FIXED_ZORDER = 1 << 26, FEAT_FIR_COEF_V,
FEAT_ALPHA_FREE_ZORDER = 1 << 27, FEAT_ALPHA_FIXED_ZORDER,
FEAT_ALPHA_FREE_ZORDER,
FEAT_FIFO_MERGE,
/* An unknown HW bug causing the normal FIFO thresholds not to work */
FEAT_OMAP3_DSI_FIFO_BUG,
}; };
/* DSS register field id */ /* DSS register field id */

View File

@ -58,8 +58,6 @@
#define EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR 4 #define EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR 4
#define EDID_SIZE_BLOCK1_TIMING_DESCRIPTOR 4 #define EDID_SIZE_BLOCK1_TIMING_DESCRIPTOR 4
#define OMAP_HDMI_TIMINGS_NB 34
#define HDMI_DEFAULT_REGN 16 #define HDMI_DEFAULT_REGN 16
#define HDMI_DEFAULT_REGM2 1 #define HDMI_DEFAULT_REGM2 1
@ -68,8 +66,6 @@ static struct {
struct omap_display_platform_data *pdata; struct omap_display_platform_data *pdata;
struct platform_device *pdev; struct platform_device *pdev;
struct hdmi_ip_data ip_data; struct hdmi_ip_data ip_data;
int code;
int mode;
struct clk *sys_clk; struct clk *sys_clk;
} hdmi; } hdmi;
@ -88,77 +84,46 @@ static struct {
* map it to corresponding CEA or VESA index. * map it to corresponding CEA or VESA index.
*/ */
static const struct hdmi_timings cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = { static const struct hdmi_config cea_timings[] = {
{ {640, 480, 25200, 96, 16, 48, 2, 10, 33} , 0 , 0}, { {640, 480, 25200, 96, 16, 48, 2, 10, 33, 0, 0, 0}, {1, HDMI_HDMI} },
{ {1280, 720, 74250, 40, 440, 220, 5, 5, 20}, 1, 1}, { {720, 480, 27027, 62, 16, 60, 6, 9, 30, 0, 0, 0}, {2, HDMI_HDMI} },
{ {1280, 720, 74250, 40, 110, 220, 5, 5, 20}, 1, 1}, { {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {4, HDMI_HDMI} },
{ {720, 480, 27027, 62, 16, 60, 6, 9, 30}, 0, 0}, { {1920, 540, 74250, 44, 88, 148, 5, 2, 15, 1, 1, 1}, {5, HDMI_HDMI} },
{ {2880, 576, 108000, 256, 48, 272, 5, 5, 39}, 0, 0}, { {1440, 240, 27027, 124, 38, 114, 3, 4, 15, 0, 0, 1}, {6, HDMI_HDMI} },
{ {1440, 240, 27027, 124, 38, 114, 3, 4, 15}, 0, 0}, { {1920, 1080, 148500, 44, 88, 148, 5, 4, 36, 1, 1, 0}, {16, HDMI_HDMI} },
{ {1440, 288, 27000, 126, 24, 138, 3, 2, 19}, 0, 0}, { {720, 576, 27000, 64, 12, 68, 5, 5, 39, 0, 0, 0}, {17, HDMI_HDMI} },
{ {1920, 540, 74250, 44, 528, 148, 5, 2, 15}, 1, 1}, { {1280, 720, 74250, 40, 440, 220, 5, 5, 20, 1, 1, 0}, {19, HDMI_HDMI} },
{ {1920, 540, 74250, 44, 88, 148, 5, 2, 15}, 1, 1}, { {1920, 540, 74250, 44, 528, 148, 5, 2, 15, 1, 1, 1}, {20, HDMI_HDMI} },
{ {1920, 1080, 148500, 44, 88, 148, 5, 4, 36}, 1, 1}, { {1440, 288, 27000, 126, 24, 138, 3, 2, 19, 0, 0, 1}, {21, HDMI_HDMI} },
{ {720, 576, 27000, 64, 12, 68, 5, 5, 39}, 0, 0}, { {1440, 576, 54000, 128, 24, 136, 5, 5, 39, 0, 0, 0}, {29, HDMI_HDMI} },
{ {1440, 576, 54000, 128, 24, 136, 5, 5, 39}, 0, 0}, { {1920, 1080, 148500, 44, 528, 148, 5, 4, 36, 1, 1, 0}, {31, HDMI_HDMI} },
{ {1920, 1080, 148500, 44, 528, 148, 5, 4, 36}, 1, 1}, { {1920, 1080, 74250, 44, 638, 148, 5, 4, 36, 1, 1, 0}, {32, HDMI_HDMI} },
{ {2880, 480, 108108, 248, 64, 240, 6, 9, 30}, 0, 0}, { {2880, 480, 108108, 248, 64, 240, 6, 9, 30, 0, 0, 0}, {35, HDMI_HDMI} },
{ {1920, 1080, 74250, 44, 638, 148, 5, 4, 36}, 1, 1}, { {2880, 576, 108000, 256, 48, 272, 5, 5, 39, 0, 0, 0}, {37, HDMI_HDMI} },
};
static const struct hdmi_config vesa_timings[] = {
/* VESA From Here */ /* VESA From Here */
{ {640, 480, 25175, 96, 16, 48, 2 , 11, 31}, 0, 0}, { {640, 480, 25175, 96, 16, 48, 2 , 11, 31, 0, 0, 0}, {4, HDMI_DVI} },
{ {800, 600, 40000, 128, 40, 88, 4 , 1, 23}, 1, 1}, { {800, 600, 40000, 128, 40, 88, 4 , 1, 23, 1, 1, 0}, {9, HDMI_DVI} },
{ {848, 480, 33750, 112, 16, 112, 8 , 6, 23}, 1, 1}, { {848, 480, 33750, 112, 16, 112, 8 , 6, 23, 1, 1, 0}, {0xE, HDMI_DVI} },
{ {1280, 768, 79500, 128, 64, 192, 7 , 3, 20}, 1, 0}, { {1280, 768, 79500, 128, 64, 192, 7 , 3, 20, 1, 0, 0}, {0x17, HDMI_DVI} },
{ {1280, 800, 83500, 128, 72, 200, 6 , 3, 22}, 1, 0}, { {1280, 800, 83500, 128, 72, 200, 6 , 3, 22, 1, 0, 0}, {0x1C, HDMI_DVI} },
{ {1360, 768, 85500, 112, 64, 256, 6 , 3, 18}, 1, 1}, { {1360, 768, 85500, 112, 64, 256, 6 , 3, 18, 1, 1, 0}, {0x27, HDMI_DVI} },
{ {1280, 960, 108000, 112, 96, 312, 3 , 1, 36}, 1, 1}, { {1280, 960, 108000, 112, 96, 312, 3 , 1, 36, 1, 1, 0}, {0x20, HDMI_DVI} },
{ {1280, 1024, 108000, 112, 48, 248, 3 , 1, 38}, 1, 1}, { {1280, 1024, 108000, 112, 48, 248, 3 , 1, 38, 1, 1, 0}, {0x23, HDMI_DVI} },
{ {1024, 768, 65000, 136, 24, 160, 6, 3, 29}, 0, 0}, { {1024, 768, 65000, 136, 24, 160, 6, 3, 29, 0, 0, 0}, {0x10, HDMI_DVI} },
{ {1400, 1050, 121750, 144, 88, 232, 4, 3, 32}, 1, 0}, { {1400, 1050, 121750, 144, 88, 232, 4, 3, 32, 1, 0, 0}, {0x2A, HDMI_DVI} },
{ {1440, 900, 106500, 152, 80, 232, 6, 3, 25}, 1, 0}, { {1440, 900, 106500, 152, 80, 232, 6, 3, 25, 1, 0, 0}, {0x2F, HDMI_DVI} },
{ {1680, 1050, 146250, 176 , 104, 280, 6, 3, 30}, 1, 0}, { {1680, 1050, 146250, 176 , 104, 280, 6, 3, 30, 1, 0, 0}, {0x3A, HDMI_DVI} },
{ {1366, 768, 85500, 143, 70, 213, 3, 3, 24}, 1, 1}, { {1366, 768, 85500, 143, 70, 213, 3, 3, 24, 1, 1, 0}, {0x51, HDMI_DVI} },
{ {1920, 1080, 148500, 44, 148, 80, 5, 4, 36}, 1, 1}, { {1920, 1080, 148500, 44, 148, 80, 5, 4, 36, 1, 1, 0}, {0x52, HDMI_DVI} },
{ {1280, 768, 68250, 32, 48, 80, 7, 3, 12}, 0, 1}, { {1280, 768, 68250, 32, 48, 80, 7, 3, 12, 0, 1, 0}, {0x16, HDMI_DVI} },
{ {1400, 1050, 101000, 32, 48, 80, 4, 3, 23}, 0, 1}, { {1400, 1050, 101000, 32, 48, 80, 4, 3, 23, 0, 1, 0}, {0x29, HDMI_DVI} },
{ {1680, 1050, 119000, 32, 48, 80, 6, 3, 21}, 0, 1}, { {1680, 1050, 119000, 32, 48, 80, 6, 3, 21, 0, 1, 0}, {0x39, HDMI_DVI} },
{ {1280, 800, 79500, 32, 48, 80, 6, 3, 14}, 0, 1}, { {1280, 800, 79500, 32, 48, 80, 6, 3, 14, 0, 1, 0}, {0x1B, HDMI_DVI} },
{ {1280, 720, 74250, 40, 110, 220, 5, 5, 20}, 1, 1} { {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {0x55, HDMI_DVI} }
}; };
/*
* This is a static mapping array which maps the timing values
* with corresponding CEA / VESA code
*/
static const int code_index[OMAP_HDMI_TIMINGS_NB] = {
1, 19, 4, 2, 37, 6, 21, 20, 5, 16, 17, 29, 31, 35, 32,
/* <--15 CEA 17--> vesa*/
4, 9, 0xE, 0x17, 0x1C, 0x27, 0x20, 0x23, 0x10, 0x2A,
0X2F, 0x3A, 0X51, 0X52, 0x16, 0x29, 0x39, 0x1B
};
/*
* This is reverse static mapping which maps the CEA / VESA code
* to the corresponding timing values
*/
static const int code_cea[39] = {
-1, 0, 3, 3, 2, 8, 5, 5, -1, -1,
-1, -1, -1, -1, -1, -1, 9, 10, 10, 1,
7, 6, 6, -1, -1, -1, -1, -1, -1, 11,
11, 12, 14, -1, -1, 13, 13, 4, 4
};
static const int code_vesa[85] = {
-1, -1, -1, -1, 15, -1, -1, -1, -1, 16,
-1, -1, -1, -1, 17, -1, 23, -1, -1, -1,
-1, -1, 29, 18, -1, -1, -1, 32, 19, -1,
-1, -1, 21, -1, -1, 22, -1, -1, -1, 20,
-1, 30, 24, -1, -1, -1, -1, 25, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 31, 26, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 27, 28, -1, 33};
static int hdmi_runtime_get(void) static int hdmi_runtime_get(void)
{ {
int r; int r;
@ -210,88 +175,89 @@ int hdmi_init_display(struct omap_dss_device *dssdev)
return 0; return 0;
} }
static int get_timings_index(void) static const struct hdmi_config *hdmi_find_timing(
const struct hdmi_config *timings_arr,
int len)
{ {
int code; int i;
if (hdmi.mode == 0) for (i = 0; i < len; i++) {
code = code_vesa[hdmi.code]; if (timings_arr[i].cm.code == hdmi.ip_data.cfg.cm.code)
else return &timings_arr[i];
code = code_cea[hdmi.code];
if (code == -1) {
/* HDMI code 4 corresponds to 640 * 480 VGA */
hdmi.code = 4;
/* DVI mode 1 corresponds to HDMI 0 to DVI */
hdmi.mode = HDMI_DVI;
code = code_vesa[hdmi.code];
} }
return code; return NULL;
}
static const struct hdmi_config *hdmi_get_timings(void)
{
const struct hdmi_config *arr;
int len;
if (hdmi.ip_data.cfg.cm.mode == HDMI_DVI) {
arr = vesa_timings;
len = ARRAY_SIZE(vesa_timings);
} else {
arr = cea_timings;
len = ARRAY_SIZE(cea_timings);
}
return hdmi_find_timing(arr, len);
}
static bool hdmi_timings_compare(struct omap_video_timings *timing1,
const struct hdmi_video_timings *timing2)
{
int timing1_vsync, timing1_hsync, timing2_vsync, timing2_hsync;
if ((timing2->pixel_clock == timing1->pixel_clock) &&
(timing2->x_res == timing1->x_res) &&
(timing2->y_res == timing1->y_res)) {
timing2_hsync = timing2->hfp + timing2->hsw + timing2->hbp;
timing1_hsync = timing1->hfp + timing1->hsw + timing1->hbp;
timing2_vsync = timing2->vfp + timing2->vsw + timing2->vbp;
timing1_vsync = timing2->vfp + timing2->vsw + timing2->vbp;
DSSDBG("timing1_hsync = %d timing1_vsync = %d"\
"timing2_hsync = %d timing2_vsync = %d\n",
timing1_hsync, timing1_vsync,
timing2_hsync, timing2_vsync);
if ((timing1_hsync == timing2_hsync) &&
(timing1_vsync == timing2_vsync)) {
return true;
}
}
return false;
} }
static struct hdmi_cm hdmi_get_code(struct omap_video_timings *timing) static struct hdmi_cm hdmi_get_code(struct omap_video_timings *timing)
{ {
int i = 0, code = -1, temp_vsync = 0, temp_hsync = 0; int i;
int timing_vsync = 0, timing_hsync = 0;
struct hdmi_video_timings temp;
struct hdmi_cm cm = {-1}; struct hdmi_cm cm = {-1};
DSSDBG("hdmi_get_code\n"); DSSDBG("hdmi_get_code\n");
for (i = 0; i < OMAP_HDMI_TIMINGS_NB; i++) { for (i = 0; i < ARRAY_SIZE(cea_timings); i++) {
temp = cea_vesa_timings[i].timings; if (hdmi_timings_compare(timing, &cea_timings[i].timings)) {
if ((temp.pixel_clock == timing->pixel_clock) && cm = cea_timings[i].cm;
(temp.x_res == timing->x_res) && goto end;
(temp.y_res == timing->y_res)) {
temp_hsync = temp.hfp + temp.hsw + temp.hbp;
timing_hsync = timing->hfp + timing->hsw + timing->hbp;
temp_vsync = temp.vfp + temp.vsw + temp.vbp;
timing_vsync = timing->vfp + timing->vsw + timing->vbp;
DSSDBG("temp_hsync = %d , temp_vsync = %d"
"timing_hsync = %d, timing_vsync = %d\n",
temp_hsync, temp_hsync,
timing_hsync, timing_vsync);
if ((temp_hsync == timing_hsync) &&
(temp_vsync == timing_vsync)) {
code = i;
cm.code = code_index[i];
if (code < 14)
cm.mode = HDMI_HDMI;
else
cm.mode = HDMI_DVI;
DSSDBG("Hdmi_code = %d mode = %d\n",
cm.code, cm.mode);
break;
} }
} }
for (i = 0; i < ARRAY_SIZE(vesa_timings); i++) {
if (hdmi_timings_compare(timing, &vesa_timings[i].timings)) {
cm = vesa_timings[i].cm;
goto end;
}
} }
return cm; end: return cm;
}
static void update_hdmi_timings(struct hdmi_config *cfg,
struct omap_video_timings *timings, int code)
{
cfg->timings.timings.x_res = timings->x_res;
cfg->timings.timings.y_res = timings->y_res;
cfg->timings.timings.hbp = timings->hbp;
cfg->timings.timings.hfp = timings->hfp;
cfg->timings.timings.hsw = timings->hsw;
cfg->timings.timings.vbp = timings->vbp;
cfg->timings.timings.vfp = timings->vfp;
cfg->timings.timings.vsw = timings->vsw;
cfg->timings.timings.pixel_clock = timings->pixel_clock;
cfg->timings.vsync_pol = cea_vesa_timings[code].vsync_pol;
cfg->timings.hsync_pol = cea_vesa_timings[code].hsync_pol;
} }
unsigned long hdmi_get_pixel_clock(void) unsigned long hdmi_get_pixel_clock(void)
{ {
/* HDMI Pixel Clock in Mhz */ /* HDMI Pixel Clock in Mhz */
return hdmi.ip_data.cfg.timings.timings.pixel_clock * 1000; return hdmi.ip_data.cfg.timings.pixel_clock * 1000;
} }
static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy,
@ -312,24 +278,24 @@ static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy,
refclk = clkin / pi->regn; refclk = clkin / pi->regn;
/*
* multiplier is pixel_clk/ref_clk
* Multiplying by 100 to avoid fractional part removal
*/
pi->regm = (phy * 100 / (refclk)) / 100;
if (dssdev->clocks.hdmi.regm2 == 0) if (dssdev->clocks.hdmi.regm2 == 0)
pi->regm2 = HDMI_DEFAULT_REGM2; pi->regm2 = HDMI_DEFAULT_REGM2;
else else
pi->regm2 = dssdev->clocks.hdmi.regm2; pi->regm2 = dssdev->clocks.hdmi.regm2;
/*
* multiplier is pixel_clk/ref_clk
* Multiplying by 100 to avoid fractional part removal
*/
pi->regm = phy * pi->regm2 / refclk;
/* /*
* fractional multiplier is remainder of the difference between * fractional multiplier is remainder of the difference between
* multiplier and actual phy(required pixel clock thus should be * multiplier and actual phy(required pixel clock thus should be
* multiplied by 2^18(262144) divided by the reference clock * multiplied by 2^18(262144) divided by the reference clock
*/ */
mf = (phy - pi->regm * refclk) * 262144; mf = (phy - pi->regm / pi->regm2 * refclk) * 262144;
pi->regmf = mf / (refclk); pi->regmf = pi->regm2 * mf / refclk;
/* /*
* Dcofreq should be set to 1 if required pixel clock * Dcofreq should be set to 1 if required pixel clock
@ -347,7 +313,8 @@ static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy,
static int hdmi_power_on(struct omap_dss_device *dssdev) static int hdmi_power_on(struct omap_dss_device *dssdev)
{ {
int r, code = 0; int r;
const struct hdmi_config *timing;
struct omap_video_timings *p; struct omap_video_timings *p;
unsigned long phy; unsigned long phy;
@ -363,9 +330,16 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
dssdev->panel.timings.x_res, dssdev->panel.timings.x_res,
dssdev->panel.timings.y_res); dssdev->panel.timings.y_res);
code = get_timings_index(); timing = hdmi_get_timings();
update_hdmi_timings(&hdmi.ip_data.cfg, p, code); if (timing == NULL) {
/* HDMI code 4 corresponds to 640 * 480 VGA */
hdmi.ip_data.cfg.cm.code = 4;
/* DVI mode 1 corresponds to HDMI 0 to DVI */
hdmi.ip_data.cfg.cm.mode = HDMI_DVI;
hdmi.ip_data.cfg = vesa_timings[0];
} else {
hdmi.ip_data.cfg = *timing;
}
phy = p->pixel_clock; phy = p->pixel_clock;
hdmi_compute_pll(dssdev, phy, &hdmi.ip_data.pll_data); hdmi_compute_pll(dssdev, phy, &hdmi.ip_data.pll_data);
@ -385,8 +359,6 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
goto err; goto err;
} }
hdmi.ip_data.cfg.cm.mode = hdmi.mode;
hdmi.ip_data.cfg.cm.code = hdmi.code;
hdmi.ip_data.ops->video_configure(&hdmi.ip_data); hdmi.ip_data.ops->video_configure(&hdmi.ip_data);
/* Make selection of HDMI in DSS */ /* Make selection of HDMI in DSS */
@ -453,8 +425,8 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev)
struct hdmi_cm cm; struct hdmi_cm cm;
cm = hdmi_get_code(&dssdev->panel.timings); cm = hdmi_get_code(&dssdev->panel.timings);
hdmi.code = cm.code; hdmi.ip_data.cfg.cm.code = cm.code;
hdmi.mode = cm.mode; hdmi.ip_data.cfg.cm.mode = cm.mode;
if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) {
int r; int r;
@ -717,13 +689,15 @@ static int hdmi_audio_hw_params(struct snd_pcm_substream *substream,
if (dss_has_feature(FEAT_HDMI_CTS_SWMODE)) { if (dss_has_feature(FEAT_HDMI_CTS_SWMODE)) {
core_cfg.aud_par_busclk = 0; core_cfg.aud_par_busclk = 0;
core_cfg.cts_mode = HDMI_AUDIO_CTS_MODE_SW; core_cfg.cts_mode = HDMI_AUDIO_CTS_MODE_SW;
core_cfg.use_mclk = false; core_cfg.use_mclk = dss_has_feature(FEAT_HDMI_AUDIO_USE_MCLK);
} else { } else {
core_cfg.aud_par_busclk = (((128 * 31) - 1) << 8); core_cfg.aud_par_busclk = (((128 * 31) - 1) << 8);
core_cfg.cts_mode = HDMI_AUDIO_CTS_MODE_HW; core_cfg.cts_mode = HDMI_AUDIO_CTS_MODE_HW;
core_cfg.use_mclk = true; core_cfg.use_mclk = true;
core_cfg.mclk_mode = HDMI_AUDIO_MCLK_128FS;
} }
if (core_cfg.use_mclk)
core_cfg.mclk_mode = HDMI_AUDIO_MCLK_128FS;
core_cfg.layout = HDMI_AUDIO_LAYOUT_2CH; core_cfg.layout = HDMI_AUDIO_LAYOUT_2CH;
core_cfg.en_spdif = false; core_cfg.en_spdif = false;
/* Use sample frequency from channel status word */ /* Use sample frequency from channel status word */
@ -756,7 +730,7 @@ static int hdmi_audio_hw_params(struct snd_pcm_substream *substream,
static int hdmi_audio_startup(struct snd_pcm_substream *substream, static int hdmi_audio_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
if (!hdmi.mode) { if (!hdmi.ip_data.cfg.cm.mode) {
pr_err("Current video settings do not support audio.\n"); pr_err("Current video settings do not support audio.\n");
return -EIO; return -EIO;
} }

View File

@ -494,6 +494,11 @@ static int dss_mgr_wait_for_vsync(struct omap_overlay_manager *mgr)
{ {
unsigned long timeout = msecs_to_jiffies(500); unsigned long timeout = msecs_to_jiffies(500);
u32 irq; u32 irq;
int r;
r = dispc_runtime_get();
if (r)
return r;
if (mgr->device->type == OMAP_DISPLAY_TYPE_VENC) { if (mgr->device->type == OMAP_DISPLAY_TYPE_VENC) {
irq = DISPC_IRQ_EVSYNC_ODD; irq = DISPC_IRQ_EVSYNC_ODD;
@ -505,7 +510,12 @@ static int dss_mgr_wait_for_vsync(struct omap_overlay_manager *mgr)
else else
irq = DISPC_IRQ_VSYNC2; irq = DISPC_IRQ_VSYNC2;
} }
return omap_dispc_wait_for_irq_interruptible_timeout(irq, timeout);
r = omap_dispc_wait_for_irq_interruptible_timeout(irq, timeout);
dispc_runtime_put();
return r;
} }
int dss_init_overlay_managers(struct platform_device *pdev) int dss_init_overlay_managers(struct platform_device *pdev)

View File

@ -922,35 +922,34 @@ static int omap_rfbihw_probe(struct platform_device *pdev)
rfbi_mem = platform_get_resource(rfbi.pdev, IORESOURCE_MEM, 0); rfbi_mem = platform_get_resource(rfbi.pdev, IORESOURCE_MEM, 0);
if (!rfbi_mem) { if (!rfbi_mem) {
DSSERR("can't get IORESOURCE_MEM RFBI\n"); DSSERR("can't get IORESOURCE_MEM RFBI\n");
r = -EINVAL; return -EINVAL;
goto err_ioremap;
} }
rfbi.base = ioremap(rfbi_mem->start, resource_size(rfbi_mem));
rfbi.base = devm_ioremap(&pdev->dev, rfbi_mem->start,
resource_size(rfbi_mem));
if (!rfbi.base) { if (!rfbi.base) {
DSSERR("can't ioremap RFBI\n"); DSSERR("can't ioremap RFBI\n");
r = -ENOMEM; return -ENOMEM;
goto err_ioremap;
} }
pm_runtime_enable(&pdev->dev);
r = rfbi_runtime_get();
if (r)
goto err_get_rfbi;
msleep(10);
clk = clk_get(&pdev->dev, "ick"); clk = clk_get(&pdev->dev, "ick");
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
DSSERR("can't get ick\n"); DSSERR("can't get ick\n");
r = PTR_ERR(clk); return PTR_ERR(clk);
goto err_get_ick;
} }
rfbi.l4_khz = clk_get_rate(clk) / 1000; rfbi.l4_khz = clk_get_rate(clk) / 1000;
clk_put(clk); clk_put(clk);
pm_runtime_enable(&pdev->dev);
r = rfbi_runtime_get();
if (r)
goto err_runtime_get;
msleep(10);
rev = rfbi_read_reg(RFBI_REVISION); rev = rfbi_read_reg(RFBI_REVISION);
dev_dbg(&pdev->dev, "OMAP RFBI rev %d.%d\n", dev_dbg(&pdev->dev, "OMAP RFBI rev %d.%d\n",
FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0)); FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0));
@ -959,19 +958,14 @@ static int omap_rfbihw_probe(struct platform_device *pdev)
return 0; return 0;
err_get_ick: err_runtime_get:
rfbi_runtime_put();
err_get_rfbi:
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
iounmap(rfbi.base);
err_ioremap:
return r; return r;
} }
static int omap_rfbihw_remove(struct platform_device *pdev) static int omap_rfbihw_remove(struct platform_device *pdev)
{ {
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
iounmap(rfbi.base);
return 0; return 0;
} }

View File

@ -42,6 +42,7 @@ enum hdmi_clk_refsel {
HDMI_REFSEL_SYSCLK = 3 HDMI_REFSEL_SYSCLK = 3
}; };
/* HDMI timing structure */
struct hdmi_video_timings { struct hdmi_video_timings {
u16 x_res; u16 x_res;
u16 y_res; u16 y_res;
@ -53,13 +54,9 @@ struct hdmi_video_timings {
u16 vsw; u16 vsw;
u16 vfp; u16 vfp;
u16 vbp; u16 vbp;
}; bool vsync_pol;
bool hsync_pol;
/* HDMI timing structure */ bool interlace;
struct hdmi_timings {
struct hdmi_video_timings timings;
int vsync_pol;
int hsync_pol;
}; };
struct hdmi_cm { struct hdmi_cm {
@ -68,8 +65,7 @@ struct hdmi_cm {
}; };
struct hdmi_config { struct hdmi_config {
struct hdmi_timings timings; struct hdmi_video_timings timings;
u16 interlace;
struct hdmi_cm cm; struct hdmi_cm cm;
}; };
@ -117,6 +113,47 @@ struct ti_hdmi_ip_ops {
}; };
/*
* Refer to section 8.2 in HDMI 1.3 specification for
* details about infoframe databytes
*/
struct hdmi_core_infoframe_avi {
/* Y0, Y1 rgb,yCbCr */
u8 db1_format;
/* A0 Active information Present */
u8 db1_active_info;
/* B0, B1 Bar info data valid */
u8 db1_bar_info_dv;
/* S0, S1 scan information */
u8 db1_scan_info;
/* C0, C1 colorimetry */
u8 db2_colorimetry;
/* M0, M1 Aspect ratio (4:3, 16:9) */
u8 db2_aspect_ratio;
/* R0...R3 Active format aspect ratio */
u8 db2_active_fmt_ar;
/* ITC IT content. */
u8 db3_itc;
/* EC0, EC1, EC2 Extended colorimetry */
u8 db3_ec;
/* Q1, Q0 Quantization range */
u8 db3_q_range;
/* SC1, SC0 Non-uniform picture scaling */
u8 db3_nup_scaling;
/* VIC0..6 Video format identification */
u8 db4_videocode;
/* PR0..PR3 Pixel repetition factor */
u8 db5_pixel_repeat;
/* Line number end of top bar */
u16 db6_7_line_eoftop;
/* Line number start of bottom bar */
u16 db8_9_line_sofbottom;
/* Pixel number end of left bar */
u16 db10_11_pixel_eofleft;
/* Pixel number start of right bar */
u16 db12_13_pixel_sofright;
};
struct hdmi_ip_data { struct hdmi_ip_data {
void __iomem *base_wp; /* HDMI wrapper */ void __iomem *base_wp; /* HDMI wrapper */
unsigned long core_sys_offset; unsigned long core_sys_offset;
@ -126,6 +163,7 @@ struct hdmi_ip_data {
const struct ti_hdmi_ip_ops *ops; const struct ti_hdmi_ip_ops *ops;
struct hdmi_config cfg; struct hdmi_config cfg;
struct hdmi_pll_info pll_data; struct hdmi_pll_info pll_data;
struct hdmi_core_infoframe_avi avi_cfg;
/* ti_hdmi_4xxx_ip private data. These should be in a separate struct */ /* ti_hdmi_4xxx_ip private data. These should be in a separate struct */
int hpd_gpio; int hpd_gpio;

View File

@ -587,12 +587,12 @@ static void hdmi_core_video_config(struct hdmi_ip_data *ip_data,
HDMI_CORE_SYS_TMDS_CTRL, cfg->tclk_sel_clkmult, 6, 5); HDMI_CORE_SYS_TMDS_CTRL, cfg->tclk_sel_clkmult, 6, 5);
} }
static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data, static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data)
struct hdmi_core_infoframe_avi info_avi)
{ {
u32 val; u32 val;
char sum = 0, checksum = 0; char sum = 0, checksum = 0;
void __iomem *av_base = hdmi_av_base(ip_data); void __iomem *av_base = hdmi_av_base(ip_data);
struct hdmi_core_infoframe_avi info_avi = ip_data->avi_cfg;
sum += 0x82 + 0x002 + 0x00D; sum += 0x82 + 0x002 + 0x00D;
hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_TYPE, 0x082); hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_TYPE, 0x082);
@ -682,8 +682,7 @@ static void hdmi_core_av_packet_config(struct hdmi_ip_data *ip_data,
} }
static void hdmi_wp_init(struct omap_video_timings *timings, static void hdmi_wp_init(struct omap_video_timings *timings,
struct hdmi_video_format *video_fmt, struct hdmi_video_format *video_fmt)
struct hdmi_video_interface *video_int)
{ {
pr_debug("Enter hdmi_wp_init\n"); pr_debug("Enter hdmi_wp_init\n");
@ -698,12 +697,6 @@ static void hdmi_wp_init(struct omap_video_timings *timings,
video_fmt->y_res = 0; video_fmt->y_res = 0;
video_fmt->x_res = 0; video_fmt->x_res = 0;
video_int->vsp = 0;
video_int->hsp = 0;
video_int->interlacing = 0;
video_int->tm = 0; /* HDMI_TIMING_SLAVE */
} }
void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data, bool start) void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data, bool start)
@ -716,15 +709,15 @@ static void hdmi_wp_video_init_format(struct hdmi_video_format *video_fmt,
{ {
pr_debug("Enter hdmi_wp_video_init_format\n"); pr_debug("Enter hdmi_wp_video_init_format\n");
video_fmt->y_res = param->timings.timings.y_res; video_fmt->y_res = param->timings.y_res;
video_fmt->x_res = param->timings.timings.x_res; video_fmt->x_res = param->timings.x_res;
timings->hbp = param->timings.timings.hbp; timings->hbp = param->timings.hbp;
timings->hfp = param->timings.timings.hfp; timings->hfp = param->timings.hfp;
timings->hsw = param->timings.timings.hsw; timings->hsw = param->timings.hsw;
timings->vbp = param->timings.timings.vbp; timings->vbp = param->timings.vbp;
timings->vfp = param->timings.timings.vfp; timings->vfp = param->timings.vfp;
timings->vsw = param->timings.timings.vsw; timings->vsw = param->timings.vsw;
} }
static void hdmi_wp_video_config_format(struct hdmi_ip_data *ip_data, static void hdmi_wp_video_config_format(struct hdmi_ip_data *ip_data,
@ -740,17 +733,16 @@ static void hdmi_wp_video_config_format(struct hdmi_ip_data *ip_data,
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_SIZE, l); hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_SIZE, l);
} }
static void hdmi_wp_video_config_interface(struct hdmi_ip_data *ip_data, static void hdmi_wp_video_config_interface(struct hdmi_ip_data *ip_data)
struct hdmi_video_interface *video_int)
{ {
u32 r; u32 r;
pr_debug("Enter hdmi_wp_video_config_interface\n"); pr_debug("Enter hdmi_wp_video_config_interface\n");
r = hdmi_read_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG); r = hdmi_read_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG);
r = FLD_MOD(r, video_int->vsp, 7, 7); r = FLD_MOD(r, ip_data->cfg.timings.vsync_pol, 7, 7);
r = FLD_MOD(r, video_int->hsp, 6, 6); r = FLD_MOD(r, ip_data->cfg.timings.hsync_pol, 6, 6);
r = FLD_MOD(r, video_int->interlacing, 3, 3); r = FLD_MOD(r, ip_data->cfg.timings.interlace, 3, 3);
r = FLD_MOD(r, video_int->tm, 1, 0); r = FLD_MOD(r, 1, 1, 0); /* HDMI_TIMING_MASTER_24BIT */
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG, r); hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG, r);
} }
@ -778,15 +770,13 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data)
/* HDMI */ /* HDMI */
struct omap_video_timings video_timing; struct omap_video_timings video_timing;
struct hdmi_video_format video_format; struct hdmi_video_format video_format;
struct hdmi_video_interface video_interface;
/* HDMI core */ /* HDMI core */
struct hdmi_core_infoframe_avi avi_cfg; struct hdmi_core_infoframe_avi avi_cfg = ip_data->avi_cfg;
struct hdmi_core_video_config v_core_cfg; struct hdmi_core_video_config v_core_cfg;
struct hdmi_core_packet_enable_repeat repeat_cfg; struct hdmi_core_packet_enable_repeat repeat_cfg;
struct hdmi_config *cfg = &ip_data->cfg; struct hdmi_config *cfg = &ip_data->cfg;
hdmi_wp_init(&video_timing, &video_format, hdmi_wp_init(&video_timing, &video_format);
&video_interface);
hdmi_core_init(&v_core_cfg, hdmi_core_init(&v_core_cfg,
&avi_cfg, &avi_cfg,
@ -801,12 +791,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data)
hdmi_wp_video_config_format(ip_data, &video_format); hdmi_wp_video_config_format(ip_data, &video_format);
video_interface.vsp = cfg->timings.vsync_pol; hdmi_wp_video_config_interface(ip_data);
video_interface.hsp = cfg->timings.hsync_pol;
video_interface.interlacing = cfg->interlace;
video_interface.tm = 1 ; /* HDMI_TIMING_MASTER_24BIT */
hdmi_wp_video_config_interface(ip_data, &video_interface);
/* /*
* configure core video part * configure core video part
@ -848,7 +833,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data)
avi_cfg.db10_11_pixel_eofleft = 0; avi_cfg.db10_11_pixel_eofleft = 0;
avi_cfg.db12_13_pixel_sofright = 0; avi_cfg.db12_13_pixel_sofright = 0;
hdmi_core_aux_infoframe_avi_config(ip_data, avi_cfg); hdmi_core_aux_infoframe_avi_config(ip_data);
/* enable/repeat the infoframe */ /* enable/repeat the infoframe */
repeat_cfg.avi_infoframe = HDMI_PACKETENABLE; repeat_cfg.avi_infoframe = HDMI_PACKETENABLE;
@ -1076,13 +1061,9 @@ void hdmi_core_audio_config(struct hdmi_ip_data *ip_data,
u32 r; u32 r;
void __iomem *av_base = hdmi_av_base(ip_data); void __iomem *av_base = hdmi_av_base(ip_data);
/* audio clock recovery parameters */ /*
r = hdmi_read_reg(av_base, HDMI_CORE_AV_ACR_CTRL); * Parameters for generation of Audio Clock Recovery packets
r = FLD_MOD(r, cfg->use_mclk, 2, 2); */
r = FLD_MOD(r, cfg->en_acr_pkt, 1, 1);
r = FLD_MOD(r, cfg->cts_mode, 0, 0);
hdmi_write_reg(av_base, HDMI_CORE_AV_ACR_CTRL, r);
REG_FLD_MOD(av_base, HDMI_CORE_AV_N_SVAL1, cfg->n, 7, 0); REG_FLD_MOD(av_base, HDMI_CORE_AV_N_SVAL1, cfg->n, 7, 0);
REG_FLD_MOD(av_base, HDMI_CORE_AV_N_SVAL2, cfg->n >> 8, 7, 0); REG_FLD_MOD(av_base, HDMI_CORE_AV_N_SVAL2, cfg->n >> 8, 7, 0);
REG_FLD_MOD(av_base, HDMI_CORE_AV_N_SVAL3, cfg->n >> 16, 7, 0); REG_FLD_MOD(av_base, HDMI_CORE_AV_N_SVAL3, cfg->n >> 16, 7, 0);
@ -1094,14 +1075,6 @@ void hdmi_core_audio_config(struct hdmi_ip_data *ip_data,
REG_FLD_MOD(av_base, REG_FLD_MOD(av_base,
HDMI_CORE_AV_CTS_SVAL3, cfg->cts >> 16, 7, 0); HDMI_CORE_AV_CTS_SVAL3, cfg->cts >> 16, 7, 0);
} else { } else {
/*
* HDMI IP uses this configuration to divide the MCLK to
* update CTS value.
*/
REG_FLD_MOD(av_base,
HDMI_CORE_AV_FREQ_SVAL, cfg->mclk_mode, 2, 0);
/* Configure clock for audio packets */
REG_FLD_MOD(av_base, HDMI_CORE_AV_AUD_PAR_BUSCLK_1, REG_FLD_MOD(av_base, HDMI_CORE_AV_AUD_PAR_BUSCLK_1,
cfg->aud_par_busclk, 7, 0); cfg->aud_par_busclk, 7, 0);
REG_FLD_MOD(av_base, HDMI_CORE_AV_AUD_PAR_BUSCLK_2, REG_FLD_MOD(av_base, HDMI_CORE_AV_AUD_PAR_BUSCLK_2,
@ -1110,6 +1083,25 @@ void hdmi_core_audio_config(struct hdmi_ip_data *ip_data,
(cfg->aud_par_busclk >> 16), 7, 0); (cfg->aud_par_busclk >> 16), 7, 0);
} }
/* Set ACR clock divisor */
REG_FLD_MOD(av_base,
HDMI_CORE_AV_FREQ_SVAL, cfg->mclk_mode, 2, 0);
r = hdmi_read_reg(av_base, HDMI_CORE_AV_ACR_CTRL);
/*
* Use TMDS clock for ACR packets. For devices that use
* the MCLK, this is the first part of the MCLK initialization.
*/
r = FLD_MOD(r, 0, 2, 2);
r = FLD_MOD(r, cfg->en_acr_pkt, 1, 1);
r = FLD_MOD(r, cfg->cts_mode, 0, 0);
hdmi_write_reg(av_base, HDMI_CORE_AV_ACR_CTRL, r);
/* For devices using MCLK, this completes its initialization. */
if (cfg->use_mclk)
REG_FLD_MOD(av_base, HDMI_CORE_AV_ACR_CTRL, 1, 2, 2);
/* Override of SPDIF sample frequency with value in I2S_CHST4 */ /* Override of SPDIF sample frequency with value in I2S_CHST4 */
REG_FLD_MOD(av_base, HDMI_CORE_AV_SPDIF_CTRL, REG_FLD_MOD(av_base, HDMI_CORE_AV_SPDIF_CTRL,
cfg->fs_override, 1, 1); cfg->fs_override, 1, 1);
@ -1205,7 +1197,7 @@ int hdmi_config_audio_acr(struct hdmi_ip_data *ip_data,
{ {
u32 r; u32 r;
u32 deep_color = 0; u32 deep_color = 0;
u32 pclk = ip_data->cfg.timings.timings.pixel_clock; u32 pclk = ip_data->cfg.timings.pixel_clock;
if (n == NULL || cts == NULL) if (n == NULL || cts == NULL)
return -EINVAL; return -EINVAL;

View File

@ -446,46 +446,6 @@ struct hdmi_core_video_config {
enum hdmi_core_tclkselclkmult tclk_sel_clkmult; enum hdmi_core_tclkselclkmult tclk_sel_clkmult;
}; };
/*
* Refer to section 8.2 in HDMI 1.3 specification for
* details about infoframe databytes
*/
struct hdmi_core_infoframe_avi {
/* Y0, Y1 rgb,yCbCr */
u8 db1_format;
/* A0 Active information Present */
u8 db1_active_info;
/* B0, B1 Bar info data valid */
u8 db1_bar_info_dv;
/* S0, S1 scan information */
u8 db1_scan_info;
/* C0, C1 colorimetry */
u8 db2_colorimetry;
/* M0, M1 Aspect ratio (4:3, 16:9) */
u8 db2_aspect_ratio;
/* R0...R3 Active format aspect ratio */
u8 db2_active_fmt_ar;
/* ITC IT content. */
u8 db3_itc;
/* EC0, EC1, EC2 Extended colorimetry */
u8 db3_ec;
/* Q1, Q0 Quantization range */
u8 db3_q_range;
/* SC1, SC0 Non-uniform picture scaling */
u8 db3_nup_scaling;
/* VIC0..6 Video format identification */
u8 db4_videocode;
/* PR0..PR3 Pixel repetition factor */
u8 db5_pixel_repeat;
/* Line number end of top bar */
u16 db6_7_line_eoftop;
/* Line number start of bottom bar */
u16 db8_9_line_sofbottom;
/* Pixel number end of left bar */
u16 db10_11_pixel_eofleft;
/* Pixel number start of right bar */
u16 db12_13_pixel_sofright;
};
/* /*
* Refer to section 8.2 in HDMI 1.3 specification for * Refer to section 8.2 in HDMI 1.3 specification for
* details about infoframe databytes * details about infoframe databytes
@ -517,13 +477,6 @@ struct hdmi_video_format {
u32 x_res; /* pixel per line */ u32 x_res; /* pixel per line */
}; };
struct hdmi_video_interface {
int vsp; /* Vsync polarity */
int hsp; /* Hsync polarity */
int interlacing;
int tm; /* Timing mode */
};
struct hdmi_audio_format { struct hdmi_audio_format {
enum hdmi_stereo_channels stereo_channels; enum hdmi_stereo_channels stereo_channels;
u8 active_chnnls_msk; u8 active_chnnls_msk;

View File

@ -699,6 +699,11 @@ void venc_dump_regs(struct seq_file *s)
{ {
#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, venc_read_reg(r)) #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, venc_read_reg(r))
if (cpu_is_omap44xx()) {
seq_printf(s, "VENC currently disabled on OMAP44xx\n");
return;
}
if (venc_runtime_get()) if (venc_runtime_get())
return; return;
@ -790,39 +795,41 @@ static int omap_venchw_probe(struct platform_device *pdev)
venc_mem = platform_get_resource(venc.pdev, IORESOURCE_MEM, 0); venc_mem = platform_get_resource(venc.pdev, IORESOURCE_MEM, 0);
if (!venc_mem) { if (!venc_mem) {
DSSERR("can't get IORESOURCE_MEM VENC\n"); DSSERR("can't get IORESOURCE_MEM VENC\n");
r = -EINVAL; return -EINVAL;
goto err_ioremap;
} }
venc.base = ioremap(venc_mem->start, resource_size(venc_mem));
venc.base = devm_ioremap(&pdev->dev, venc_mem->start,
resource_size(venc_mem));
if (!venc.base) { if (!venc.base) {
DSSERR("can't ioremap VENC\n"); DSSERR("can't ioremap VENC\n");
r = -ENOMEM; return -ENOMEM;
goto err_ioremap;
} }
r = venc_get_clocks(pdev); r = venc_get_clocks(pdev);
if (r) if (r)
goto err_get_clk; return r;
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
r = venc_runtime_get(); r = venc_runtime_get();
if (r) if (r)
goto err_get_venc; goto err_runtime_get;
rev_id = (u8)(venc_read_reg(VENC_REV_ID) & 0xff); rev_id = (u8)(venc_read_reg(VENC_REV_ID) & 0xff);
dev_dbg(&pdev->dev, "OMAP VENC rev %d\n", rev_id); dev_dbg(&pdev->dev, "OMAP VENC rev %d\n", rev_id);
venc_runtime_put(); venc_runtime_put();
return omap_dss_register_driver(&venc_driver); r = omap_dss_register_driver(&venc_driver);
if (r)
goto err_reg_panel_driver;
err_get_venc: return 0;
err_reg_panel_driver:
err_runtime_get:
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
venc_put_clocks(); venc_put_clocks();
err_get_clk:
iounmap(venc.base);
err_ioremap:
return r; return r;
} }
@ -837,7 +844,6 @@ static int omap_venchw_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
venc_put_clocks(); venc_put_clocks();
iounmap(venc.base);
return 0; return 0;
} }

View File

@ -215,7 +215,7 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi)
int r = 0, i; int r = 0, i;
size_t size; size_t size;
if (mi->type > OMAPFB_MEMTYPE_MAX) if (mi->type != OMAPFB_MEMTYPE_SDRAM)
return -EINVAL; return -EINVAL;
size = PAGE_ALIGN(mi->size); size = PAGE_ALIGN(mi->size);

View File

@ -1399,7 +1399,7 @@ static int omapfb_alloc_fbmem(struct fb_info *fbi, unsigned long size,
if (!paddr) { if (!paddr) {
DBG("allocating %lu bytes for fb %d\n", size, ofbi->id); DBG("allocating %lu bytes for fb %d\n", size, ofbi->id);
r = omap_vram_alloc(OMAP_VRAM_MEMTYPE_SDRAM, size, &paddr); r = omap_vram_alloc(size, &paddr);
} else { } else {
DBG("reserving %lu bytes at %lx for fb %d\n", size, paddr, DBG("reserving %lu bytes at %lx for fb %d\n", size, paddr,
ofbi->id); ofbi->id);
@ -1487,60 +1487,6 @@ static int omapfb_alloc_fbmem_display(struct fb_info *fbi, unsigned long size,
return omapfb_alloc_fbmem(fbi, size, paddr); return omapfb_alloc_fbmem(fbi, size, paddr);
} }
static enum omap_color_mode fb_format_to_dss_mode(enum omapfb_color_format fmt)
{
enum omap_color_mode mode;
switch (fmt) {
case OMAPFB_COLOR_RGB565:
mode = OMAP_DSS_COLOR_RGB16;
break;
case OMAPFB_COLOR_YUV422:
mode = OMAP_DSS_COLOR_YUV2;
break;
case OMAPFB_COLOR_CLUT_8BPP:
mode = OMAP_DSS_COLOR_CLUT8;
break;
case OMAPFB_COLOR_CLUT_4BPP:
mode = OMAP_DSS_COLOR_CLUT4;
break;
case OMAPFB_COLOR_CLUT_2BPP:
mode = OMAP_DSS_COLOR_CLUT2;
break;
case OMAPFB_COLOR_CLUT_1BPP:
mode = OMAP_DSS_COLOR_CLUT1;
break;
case OMAPFB_COLOR_RGB444:
mode = OMAP_DSS_COLOR_RGB12U;
break;
case OMAPFB_COLOR_YUY422:
mode = OMAP_DSS_COLOR_UYVY;
break;
case OMAPFB_COLOR_ARGB16:
mode = OMAP_DSS_COLOR_ARGB16;
break;
case OMAPFB_COLOR_RGB24U:
mode = OMAP_DSS_COLOR_RGB24U;
break;
case OMAPFB_COLOR_RGB24P:
mode = OMAP_DSS_COLOR_RGB24P;
break;
case OMAPFB_COLOR_ARGB32:
mode = OMAP_DSS_COLOR_ARGB32;
break;
case OMAPFB_COLOR_RGBA32:
mode = OMAP_DSS_COLOR_RGBA32;
break;
case OMAPFB_COLOR_RGBX32:
mode = OMAP_DSS_COLOR_RGBX32;
break;
default:
mode = -EINVAL;
}
return mode;
}
static int omapfb_parse_vram_param(const char *param, int max_entries, static int omapfb_parse_vram_param(const char *param, int max_entries,
unsigned long *sizes, unsigned long *paddrs) unsigned long *sizes, unsigned long *paddrs)
{ {
@ -1614,23 +1560,6 @@ static int omapfb_allocate_all_fbs(struct omapfb2_device *fbdev)
memset(&vram_paddrs, 0, sizeof(vram_paddrs)); memset(&vram_paddrs, 0, sizeof(vram_paddrs));
} }
if (fbdev->dev->platform_data) {
struct omapfb_platform_data *opd;
opd = fbdev->dev->platform_data;
for (i = 0; i < opd->mem_desc.region_cnt; ++i) {
if (!vram_sizes[i]) {
unsigned long size;
unsigned long paddr;
size = opd->mem_desc.region[i].size;
paddr = opd->mem_desc.region[i].paddr;
vram_sizes[i] = size;
vram_paddrs[i] = paddr;
}
}
}
for (i = 0; i < fbdev->num_fbs; i++) { for (i = 0; i < fbdev->num_fbs; i++) {
/* allocate memory automatically only for fb0, or if /* allocate memory automatically only for fb0, or if
* excplicitly defined with vram or plat data option */ * excplicitly defined with vram or plat data option */
@ -1669,7 +1598,7 @@ int omapfb_realloc_fbmem(struct fb_info *fbi, unsigned long size, int type)
int old_type = rg->type; int old_type = rg->type;
int r; int r;
if (type > OMAPFB_MEMTYPE_MAX) if (type != OMAPFB_MEMTYPE_SDRAM)
return -EINVAL; return -EINVAL;
size = PAGE_ALIGN(size); size = PAGE_ALIGN(size);
@ -1828,32 +1757,6 @@ static int omapfb_fb_init(struct omapfb2_device *fbdev, struct fb_info *fbi)
var->rotate = def_rotate; var->rotate = def_rotate;
/*
* Check if there is a default color format set in the board file,
* and use this format instead the default deducted from the
* display bpp.
*/
if (fbdev->dev->platform_data) {
struct omapfb_platform_data *opd;
int id = ofbi->id;
opd = fbdev->dev->platform_data;
if (opd->mem_desc.region[id].format_used) {
enum omap_color_mode mode;
enum omapfb_color_format format;
format = opd->mem_desc.region[id].format;
mode = fb_format_to_dss_mode(format);
if (mode < 0) {
r = mode;
goto err;
}
r = dss_mode_to_fb_mode(mode, var);
if (r < 0)
goto err;
}
}
if (display) { if (display) {
u16 w, h; u16 w, h;
int rotation = (var->rotate + ofbi->rotation[0]) % 4; int rotation = (var->rotate + ofbi->rotation[0]) % 4;

View File

@ -33,7 +33,6 @@
#include <asm/setup.h> #include <asm/setup.h>
#include <plat/sram.h>
#include <plat/vram.h> #include <plat/vram.h>
#include <plat/dma.h> #include <plat/dma.h>
@ -43,10 +42,6 @@
#define DBG(format, ...) #define DBG(format, ...)
#endif #endif
#define OMAP2_SRAM_START 0x40200000
/* Maximum size, in reality this is smaller if SRAM is partially locked. */
#define OMAP2_SRAM_SIZE 0xa0000 /* 640k */
/* postponed regions are used to temporarily store region information at boot /* postponed regions are used to temporarily store region information at boot
* time when we cannot yet allocate the region list */ * time when we cannot yet allocate the region list */
#define MAX_POSTPONED_REGIONS 10 #define MAX_POSTPONED_REGIONS 10
@ -74,15 +69,6 @@ struct vram_region {
static DEFINE_MUTEX(region_mutex); static DEFINE_MUTEX(region_mutex);
static LIST_HEAD(region_list); static LIST_HEAD(region_list);
static inline int region_mem_type(unsigned long paddr)
{
if (paddr >= OMAP2_SRAM_START &&
paddr < OMAP2_SRAM_START + OMAP2_SRAM_SIZE)
return OMAP_VRAM_MEMTYPE_SRAM;
else
return OMAP_VRAM_MEMTYPE_SDRAM;
}
static struct vram_region *omap_vram_create_region(unsigned long paddr, static struct vram_region *omap_vram_create_region(unsigned long paddr,
unsigned pages) unsigned pages)
{ {
@ -212,9 +198,6 @@ static int _omap_vram_reserve(unsigned long paddr, unsigned pages)
DBG("checking region %lx %d\n", rm->paddr, rm->pages); DBG("checking region %lx %d\n", rm->paddr, rm->pages);
if (region_mem_type(rm->paddr) != region_mem_type(paddr))
continue;
start = rm->paddr; start = rm->paddr;
end = start + (rm->pages << PAGE_SHIFT) - 1; end = start + (rm->pages << PAGE_SHIFT) - 1;
if (start > paddr || end < paddr + size - 1) if (start > paddr || end < paddr + size - 1)
@ -320,7 +303,7 @@ err:
return r; return r;
} }
static int _omap_vram_alloc(int mtype, unsigned pages, unsigned long *paddr) static int _omap_vram_alloc(unsigned pages, unsigned long *paddr)
{ {
struct vram_region *rm; struct vram_region *rm;
struct vram_alloc *alloc; struct vram_alloc *alloc;
@ -330,9 +313,6 @@ static int _omap_vram_alloc(int mtype, unsigned pages, unsigned long *paddr)
DBG("checking region %lx %d\n", rm->paddr, rm->pages); DBG("checking region %lx %d\n", rm->paddr, rm->pages);
if (region_mem_type(rm->paddr) != mtype)
continue;
start = rm->paddr; start = rm->paddr;
list_for_each_entry(alloc, &rm->alloc_list, list) { list_for_each_entry(alloc, &rm->alloc_list, list) {
@ -365,21 +345,21 @@ found:
return -ENOMEM; return -ENOMEM;
} }
int omap_vram_alloc(int mtype, size_t size, unsigned long *paddr) int omap_vram_alloc(size_t size, unsigned long *paddr)
{ {
unsigned pages; unsigned pages;
int r; int r;
BUG_ON(mtype > OMAP_VRAM_MEMTYPE_MAX || !size); BUG_ON(!size);
DBG("alloc mem type %d size %d\n", mtype, size); DBG("alloc mem size %d\n", size);
size = PAGE_ALIGN(size); size = PAGE_ALIGN(size);
pages = size >> PAGE_SHIFT; pages = size >> PAGE_SHIFT;
mutex_lock(&region_mutex); mutex_lock(&region_mutex);
r = _omap_vram_alloc(mtype, pages, paddr); r = _omap_vram_alloc(pages, paddr);
mutex_unlock(&region_mutex); mutex_unlock(&region_mutex);
@ -500,10 +480,6 @@ arch_initcall(omap_vram_init);
/* boottime vram alloc stuff */ /* boottime vram alloc stuff */
/* set from board file */
static u32 omap_vram_sram_start __initdata;
static u32 omap_vram_sram_size __initdata;
/* set from board file */ /* set from board file */
static u32 omap_vram_sdram_start __initdata; static u32 omap_vram_sdram_start __initdata;
static u32 omap_vram_sdram_size __initdata; static u32 omap_vram_sdram_size __initdata;
@ -587,73 +563,8 @@ void __init omap_vram_reserve_sdram_memblock(void)
pr_info("Reserving %u bytes SDRAM for VRAM\n", size); pr_info("Reserving %u bytes SDRAM for VRAM\n", size);
} }
/*
* Called at sram init time, before anything is pushed to the SRAM stack.
* Because of the stack scheme, we will allocate everything from the
* start of the lowest address region to the end of SRAM. This will also
* include padding for page alignment and possible holes between regions.
*
* As opposed to the SDRAM case, we'll also do any dynamic allocations at
* this point, since the driver built as a module would have problem with
* freeing / reallocating the regions.
*/
unsigned long __init omap_vram_reserve_sram(unsigned long sram_pstart,
unsigned long sram_vstart,
unsigned long sram_size,
unsigned long pstart_avail,
unsigned long size_avail)
{
unsigned long pend_avail;
unsigned long reserved;
u32 paddr;
u32 size;
paddr = omap_vram_sram_start;
size = omap_vram_sram_size;
if (!size)
return 0;
reserved = 0;
pend_avail = pstart_avail + size_avail;
if (!paddr) {
/* Dynamic allocation */
if ((size_avail & PAGE_MASK) < size) {
pr_err("Not enough SRAM for VRAM\n");
return 0;
}
size_avail = (size_avail - size) & PAGE_MASK;
paddr = pstart_avail + size_avail;
}
if (paddr < sram_pstart ||
paddr + size > sram_pstart + sram_size) {
pr_err("Illegal SRAM region for VRAM\n");
return 0;
}
/* Reserve everything above the start of the region. */
if (pend_avail - paddr > reserved)
reserved = pend_avail - paddr;
size_avail = pend_avail - reserved - pstart_avail;
omap_vram_add_region(paddr, size);
if (reserved)
pr_info("Reserving %lu bytes SRAM for VRAM\n", reserved);
return reserved;
}
void __init omap_vram_set_sdram_vram(u32 size, u32 start) void __init omap_vram_set_sdram_vram(u32 size, u32 start)
{ {
omap_vram_sdram_start = start; omap_vram_sdram_start = start;
omap_vram_sdram_size = size; omap_vram_sdram_size = size;
} }
void __init omap_vram_set_sram_vram(u32 size, u32 start)
{
omap_vram_sram_start = start;
omap_vram_sram_size = size;
}

View File

@ -222,41 +222,11 @@ struct omapfb_display_info {
#include <plat/board.h> #include <plat/board.h>
#ifdef CONFIG_ARCH_OMAP1
#define OMAPFB_PLANE_NUM 1
#else
#define OMAPFB_PLANE_NUM 3
#endif
struct omapfb_mem_region {
u32 paddr;
void __iomem *vaddr;
unsigned long size;
u8 type; /* OMAPFB_PLANE_MEM_* */
enum omapfb_color_format format;/* OMAPFB_COLOR_* */
unsigned format_used:1; /* Must be set when format is set.
* Needed b/c of the badly chosen 0
* base for OMAPFB_COLOR_* values
*/
unsigned alloc:1; /* allocated by the driver */
unsigned map:1; /* kernel mapped by the driver */
};
struct omapfb_mem_desc {
int region_cnt;
struct omapfb_mem_region region[OMAPFB_PLANE_NUM];
};
struct omapfb_platform_data { struct omapfb_platform_data {
struct omap_lcd_config lcd; struct omap_lcd_config lcd;
struct omapfb_mem_desc mem_desc;
void *ctrl_platform_data;
}; };
/* in arch/arm/plat-omap/fb.c */ void __init omapfb_set_lcd_config(const struct omap_lcd_config *config);
extern void omapfb_set_platform_data(struct omapfb_platform_data *data);
extern void omapfb_set_ctrl_platform_data(void *pdata);
extern void omapfb_reserve_sdram_memblock(void);
#endif #endif