Commit 420e73d5 authored by Imre Deak's avatar Imre Deak Committed by Juha Yrjola

ARM: OMAP: A whopping FB driver update

- Support for the Philips LPH8923 LCD panel
- Support for the Epson HWA742 LCD controller

- Support for frame buffer located in SRAM and/or SDRAM
- Support for boot loader initialized LCD controller / frame buffer
  content.

- LCD panels will now register a device in the relevant board-* files
  instead of specifying the LCD type as an OMAP_TAG_LCD. The controller
  type is still specified in OMAP_TAG_LCD.
- A new ATAG OMAP_TAG_FBMEM is used to describe the frame buffer memory
  configuration (SRAM and SDRAM regions)

- Changed the OMAP1 LCD controller driver to export its functions
  through the lcd_ctrl object.
- OMAP1 pixel clock divider will now round up in lcdc.c
- Changed the OMAP1 SoSSI driver to export its functions through the
  lcd_ctrl_extif object.
- OMAP1 SoSSI clock calculation goes through all possible clock
  dividers. Rounding of clock tick values now takes places at each
  timing parameter.

- OMAP2 RFBI clock calculation goes through all possible clock
  dividers. Rounding of clock tick values now takes places at each
  timing parameter.
- OMAP2 pixel clock divider will now round up in dispc.c
Signed-off-by: default avatarImre Deak <imre.deak@nokia.com>
Signed-off-by: default avatarJuha Yrjl <juha.yrjola@nokia.com>
parent ab7ad9fe
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.16-rc2-omap1
# Wed Feb 8 18:52:38 2006
# Wed Feb 8 19:07:23 2006
#
CONFIG_ARM=y
CONFIG_MMU=y
......@@ -814,10 +814,12 @@ CONFIG_FB=y
# CONFIG_FB_TILEBLITTING is not set
# CONFIG_FB_S1D13XXX is not set
CONFIG_FB_OMAP=y
# CONFIG_FB_OMAP_LCDC_INTERNAL is not set
CONFIG_FB_OMAP_LCDC_EXTERNAL=y
CONFIG_FB_OMAP_LCDC_HWA742=y
CONFIG_FB_OMAP_MANUAL_UPDATE=y
CONFIG_FB_OMAP_DMA_TUNE=y
CONFIG_FB_OMAP_LCD_LPH8923=y
# CONFIG_FB_OMAP_BOOTLOADER_INIT is not set
# CONFIG_FB_OMAP_DMA_TUNE is not set
# CONFIG_FB_VIRTUAL is not set
#
......
......@@ -271,12 +271,18 @@ static struct platform_device h2_irda_device = {
.resource = h2_irda_resources,
};
static struct platform_device h2_lcd_device = {
.name = "lcd_h2",
.id = -1,
};
static struct platform_device *h2_devices[] __initdata = {
&h2_nor_device,
&h2_nand_device,
&h2_smc91x_device,
&h2_irda_device,
&h2_kp_device,
&h2_lcd_device,
};
static void __init h2_init_smc91x(void)
......@@ -325,7 +331,6 @@ static struct omap_uart_config h2_uart_config __initdata = {
};
static struct omap_lcd_config h2_lcd_config __initdata = {
.panel_name = "h2",
.ctrl_name = "internal",
};
......
......@@ -349,6 +349,11 @@ static struct platform_device h3_irda_device = {
.resource = h3_irda_resources,
};
static struct platform_device h3_lcd_device = {
.name = "lcd_h3",
.id = -1,
};
static struct platform_device *devices[] __initdata = {
&nor_device,
&nand_device,
......@@ -356,6 +361,7 @@ static struct platform_device *devices[] __initdata = {
&intlat_device,
&h3_irda_device,
&h3_kp_device,
&h3_lcd_device,
};
static struct omap_usb_config h3_usb_config __initdata = {
......@@ -385,7 +391,6 @@ static struct omap_uart_config h3_uart_config __initdata = {
};
static struct omap_lcd_config h3_lcd_config __initdata = {
.panel_name = "h3",
.ctrl_name = "internal",
};
......
......@@ -169,10 +169,16 @@ static struct platform_device innovator1510_smc91x_device = {
.resource = innovator1510_smc91x_resources,
};
static struct platform_device innovator1510_lcd_device = {
.name = "lcd_inn1510",
.id = -1,
};
static struct platform_device *innovator1510_devices[] __initdata = {
&innovator_flash_device,
&innovator1510_smc91x_device,
&innovator_kp_device,
&innovator1510_lcd_device,
};
#endif /* CONFIG_ARCH_OMAP15XX */
......@@ -199,10 +205,16 @@ static struct platform_device innovator1610_smc91x_device = {
.resource = innovator1610_smc91x_resources,
};
static struct platform_device innovator1610_lcd_device = {
.name = "inn1610_lcd",
.id = -1,
};
static struct platform_device *innovator1610_devices[] __initdata = {
&innovator_flash_device,
&innovator1610_smc91x_device,
&innovator_kp_device,
&innovator1610_lcd_device,
};
#endif /* CONFIG_ARCH_OMAP16XX */
......@@ -248,7 +260,6 @@ static struct omap_usb_config innovator1510_usb_config __initdata = {
};
static struct omap_lcd_config innovator1510_lcd_config __initdata = {
.panel_name = "inn1510",
.ctrl_name = "internal",
};
#endif
......@@ -270,7 +281,6 @@ static struct omap_usb_config h2_usb_config __initdata = {
};
static struct omap_lcd_config innovator1610_lcd_config __initdata = {
.panel_name = "inn1610",
.ctrl_name = "internal",
};
#endif
......
......@@ -30,6 +30,15 @@ static void __init omap_nokia770_init_irq(void)
omap_init_irq();
}
static struct spi_board_info nokia770_spi_board_info[] __initdata = {
[0] = {
.modalias = "lcd_lph8923",
.bus_num = 2,
.chip_select = 3,
.max_speed_hz = 12000000,
},
};
static struct platform_device *nokia770_devices[] __initdata = {
};
......@@ -70,6 +79,8 @@ static void __init omap_nokia770_init(void)
nokia770_config[0].data = &nokia770_usb_config;
platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices));
spi_register_board_info(nokia770_spi_board_info,
ARRAY_SIZE(nokia770_spi_board_info));
omap_board_config = nokia770_config;
omap_board_config_size = ARRAY_SIZE(nokia770_config);
omap_serial_init();
......
......@@ -178,12 +178,18 @@ static struct platform_device osk5912_kp_device = {
.resource = osk5912_kp_resources,
};
static struct platform_device osk5912_lcd_device = {
.name = "lcd_osk",
.id = -1,
};
static struct platform_device *osk5912_devices[] __initdata = {
&osk5912_flash_device,
&osk5912_smc91x_device,
&osk5912_cf_device,
&osk5912_mcbsp1_device,
&osk5912_kp_device,
&osk5912_lcd_device,
};
static void __init osk_init_smc91x(void)
......@@ -238,7 +244,6 @@ static struct omap_uart_config osk_uart_config __initdata = {
};
static struct omap_lcd_config osk_lcd_config __initdata = {
.panel_name = "osk",
.ctrl_name = "internal",
};
......
......@@ -38,6 +38,15 @@ static void __init omap_generic_init_irq(void)
omap_init_irq();
}
static struct platform_device palmte_lcd_device = {
.name = "lcd_palmte",
.id = -1,
};
static struct platform_device *devices[] __initdata = {
&palmte_lcd_device,
};
static struct omap_usb_config palmte_usb_config __initdata = {
.register_dev = 1,
.hmc_mode = 0,
......@@ -55,7 +64,6 @@ static struct omap_mmc_config palmte_mmc_config __initdata = {
};
static struct omap_lcd_config palmte_lcd_config __initdata = {
.panel_name = "palmte",
.ctrl_name = "internal",
};
......@@ -69,6 +77,8 @@ static void __init omap_generic_init(void)
{
omap_board_config = palmte_config;
omap_board_config_size = ARRAY_SIZE(palmte_config);
platform_add_devices(devices, ARRAY_SIZE(devices));
}
static void __init omap_generic_map_io(void)
......
......@@ -186,11 +186,17 @@ static struct platform_device kp_device = {
.resource = kp_resources,
};
static struct platform_device lcd_device = {
.name = "lcd_p2",
.id = -1,
};
static struct platform_device *devices[] __initdata = {
&nor_device,
&nand_device,
&smc91x_device,
&kp_device,
&lcd_device,
};
#define P2_NAND_RB_GPIO_PIN 62
......@@ -205,7 +211,6 @@ static struct omap_uart_config perseus2_uart_config __initdata = {
};
static struct omap_lcd_config perseus2_lcd_config __initdata = {
.panel_name = "p2",
.ctrl_name = "internal",
};
......
......@@ -18,6 +18,7 @@
#include <asm/io.h>
#include <asm/arch/mux.h>
#include <asm/arch/tc.h>
#include <asm/arch/omapfb.h>
extern int omap1_clk_init(void);
extern void omap_check_revision(void);
......@@ -121,6 +122,7 @@ void __init omap1_map_common_io(void)
#endif
omap_sram_init();
omapfb_reserve_mem();
}
/*
......
......@@ -120,9 +120,15 @@ static struct platform_device apollon_smc91x_device = {
.resource = apollon_smc91x_resources,
};
static struct platform_device apollon_lcd_device = {
.name = "apollon_lcd",
.id = -1,
};
static struct platform_device *apollon_devices[] __initdata = {
&apollon_onenand_device,
&apollon_smc91x_device,
&apollon_lcd_device,
};
static inline void __init apollon_init_smc91x(void)
......@@ -169,7 +175,6 @@ static struct omap_mmc_config apollon_mmc_config __initdata = {
};
static struct omap_lcd_config apollon_lcd_config __initdata = {
.panel_name = "apollon",
.ctrl_name = "internal",
};
......
......@@ -250,11 +250,17 @@ static struct platform_device h4_kp_device = {
},
};
static struct platform_device h4_lcd_device = {
.name = "lcd_h4",
.id = -1,
};
static struct platform_device *h4_devices[] __initdata = {
&h4_smc91x_device,
&h4_flash_device,
&h4_irda_device,
&h4_kp_device,
&h4_lcd_device,
};
static inline void __init h4_init_smc91x(void)
......@@ -301,7 +307,6 @@ static struct omap_mmc_config h4_mmc_config __initdata = {
};
static struct omap_lcd_config h4_lcd_config __initdata = {
.panel_name = "h4",
.ctrl_name = "internal",
};
......
......@@ -22,6 +22,7 @@
#include <asm/mach/map.h>
#include <asm/arch/mux.h>
#include <asm/arch/omapfb.h>
extern void omap_sram_init(void);
extern int omap2_clk_init(void);
......@@ -59,6 +60,7 @@ void __init omap2_map_common_io(void)
omap2_check_revision();
omap_sram_init();
omapfb_reserve_mem();
}
void __init omap2_init_common_hw(void)
......
......@@ -3,7 +3,7 @@
#
# Common support
obj-y := common.o sram.o sram-fn.o clock.o devices.o dma.o mux.o gpio.o mcbsp.o usb.o
obj-y := common.o sram.o sram-fn.o clock.o devices.o dma.o mux.o gpio.o mcbsp.o usb.o fb.o
obj-m :=
obj-n :=
obj- :=
......
......@@ -416,40 +416,6 @@ static void omap_init_rng(void)
static inline void omap_init_rng(void) {}
#endif
#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)
static struct omap_lcd_config omap_fb_conf;
static u64 omap_fb_dma_mask = ~(u32)0;
static struct platform_device omap_fb_device = {
.name = "omapfb",
.id = -1,
.dev = {
.release = omap_nop_release,
.dma_mask = &omap_fb_dma_mask,
.coherent_dma_mask = ~(u32)0,
.platform_data = &omap_fb_conf,
},
.num_resources = 0,
};
static inline void omap_init_fb(void)
{
const struct omap_lcd_config *conf;
conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
if (conf != NULL)
omap_fb_conf = *conf;
platform_device_register(&omap_fb_device);
}
#else
static inline void omap_init_fb(void) {}
#endif
/*
* This gets called after board-specific INIT_MACHINE, and initializes most
* on-chip peripherals accessible on this board (except for few like USB):
......@@ -475,7 +441,6 @@ static int __init omap_init_devices(void)
/* please keep these calls, and their implementations above,
* in alphabetical order so they're easier to sort through.
*/
omap_init_fb();
omap_init_i2c();
omap_init_kp();
omap_init_mmc();
......
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/bootmem.h>
#include <asm/hardware.h>
#include <asm/io.h>
#include <asm/mach-types.h>
#include <asm/mach/map.h>
#include <asm/arch/board.h>
#include <asm/arch/sram.h>
#include <asm/arch/omapfb.h>
#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)
static struct omapfb_platform_data omapfb_config;
static u64 omap_fb_dma_mask = ~(u32)0;
/* in devices.c */
extern void omap_nop_release(struct device *dev);
static struct platform_device omap_fb_device = {
.name = "omapfb",
.id = -1,
.dev = {
.release = omap_nop_release,
.dma_mask = &omap_fb_dma_mask,
.coherent_dma_mask = ~(u32)0,
.platform_data = &omapfb_config,
},
.num_resources = 0,
};
/* called from map_io */
void omapfb_reserve_mem(void)
{
const struct omap_fbmem_config *fbmem_conf;
omapfb_config.fbmem.fb_sram_start = omap_fb_sram_start;
omapfb_config.fbmem.fb_sram_size = omap_fb_sram_size;
fbmem_conf = omap_get_config(OMAP_TAG_FBMEM, struct omap_fbmem_config);
if (fbmem_conf != NULL) {
/* indicate that the bootloader already initialized the
* fb device, so we'll skip that part in the fb driver
*/
omapfb_config.fbmem.fb_sdram_start = fbmem_conf->fb_sdram_start;
omapfb_config.fbmem.fb_sdram_size = fbmem_conf->fb_sdram_size;
if (fbmem_conf->fb_sdram_size) {
pr_info("Reserving %u bytes SDRAM for frame buffer\n",
fbmem_conf->fb_sdram_size);
reserve_bootmem(fbmem_conf->fb_sdram_start,
fbmem_conf->fb_sdram_size);
}
}
}
static inline int omap_init_fb(void)
{
const struct omap_lcd_config *conf;
conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
if (conf == NULL)
return 0;
omapfb_config.lcd = *conf;
return platform_device_register(&omap_fb_device);
}
arch_initcall(omap_init_fb);
#else
void omapfb_reserve_mem(void) {}
#endif
......@@ -23,6 +23,7 @@
#include <asm/mach/map.h>
#include <asm/arch/sram.h>
#include <asm/arch/board.h>
#define OMAP1_SRAM_PA 0x20000000
#define OMAP1_SRAM_VA 0xd0000000
......@@ -50,6 +51,9 @@ static unsigned long omap_sram_base;
static unsigned long omap_sram_size;
static unsigned long omap_sram_ceil;
unsigned long omap_fb_sram_start;
unsigned long omap_fb_sram_size;
/* Depending on the target RAMFS firewall setup, the public usable amount of
* SRAM varies. The default accessable size for all device types is 2k. A GP
* device allows ARM11 but not other initators for full size. This
......@@ -74,6 +78,32 @@ static int is_sram_locked(void)
return 1; /* assume locked with no PPA or security driver */
}
void get_fb_sram_conf(unsigned long start_avail, unsigned size_avail,
unsigned long *start, unsigned long *size)
{
const struct omap_fbmem_config *fbmem_conf;
fbmem_conf = omap_get_config(OMAP_TAG_FBMEM, struct omap_fbmem_config);
if (fbmem_conf != NULL) {
*start = fbmem_conf->fb_sram_start;
*size = fbmem_conf->fb_sram_size;
} else {
*size = 0;
*start = 0;
}
if (*size && (
*start < start_avail ||
*start + *size > start_avail + size_avail)) {
printk(KERN_ERR "invalid FB SRAM configuration\n");
*start = start_avail;
*size = size_avail;
}
if (*size)
pr_info("Reserving %lu bytes SRAM for frame buffer\n", *size);
}
/*
* The amount of SRAM depends on the core type.
* Note that we cannot try to test for SRAM here because writes
......@@ -82,12 +112,16 @@ static int is_sram_locked(void)
*/
void __init omap_detect_sram(void)
{
unsigned long sram_start;
if (cpu_is_omap24xx()) {
if (is_sram_locked()) {
omap_sram_base = OMAP2_SRAM_PUB_VA;
sram_start = OMAP2_SRAM_PUB_PA;
omap_sram_size = 0x800; /* 2K */
} else {
omap_sram_base = OMAP2_SRAM_VA;
sram_start = OMAP2_SRAM_PA;
if (cpu_is_omap242x())
omap_sram_size = 0xa0000; /* 640K */
else if (cpu_is_omap243x())
......@@ -95,6 +129,7 @@ void __init omap_detect_sram(void)
}
} else {
omap_sram_base = OMAP1_SRAM_VA;
sram_start = OMAP1_SRAM_PA;
if (cpu_is_omap730())
omap_sram_size = 0x32000; /* 200K */
......@@ -110,6 +145,12 @@ void __init omap_detect_sram(void)
omap_sram_size = 0x4000;
}
}
get_fb_sram_conf(sram_start + SRAM_BOOTLOADER_SZ,
omap_sram_size - SRAM_BOOTLOADER_SZ,
&omap_fb_sram_start, &omap_fb_sram_size);
if (omap_fb_sram_size)
omap_sram_size -= sram_start + omap_sram_size -
omap_fb_sram_start;
omap_sram_ceil = omap_sram_base + omap_sram_size;
}
......
......@@ -4,13 +4,6 @@ config FB_OMAP
help
Frame buffer driver for OMAP based boards.
config FB_OMAP_LCDC_INTERNAL
bool "Internal LCD controller support"
depends on FB_OMAP
help
Say Y here, if you want to have support for the internal OMAP
LCD controller. If unsure, say Y.
config FB_OMAP_LCDC_EXTERNAL
bool "External LCD controller support"
depends on FB_OMAP
......@@ -18,6 +11,13 @@ config FB_OMAP_LCDC_EXTERNAL
Say Y here, if you want to have support for boards with an
external LCD controller connected to the SoSSI/RFBI interface.
config FB_OMAP_LCDC_HWA742
bool "Epson HWA742 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 HWA742 LCD controller.
config FB_OMAP_MANUAL_UPDATE
bool "Default to manual update mode"
depends on FB_OMAP && FB_OMAP_LCDC_EXTERNAL
......@@ -27,6 +27,21 @@ config FB_OMAP_MANUAL_UPDATE
the frame buffer content and thus a reload of the image data to
the external frame buffer is required. If unsure, say N.
config FB_OMAP_LCD_LPH8923
bool "Philips LPH8923 LCD support"
depends on FB_OMAP
help
Say Y here if you want to have support for the Philips
LPH8923 LCD.
config FB_OMAP_BOOTLOADER_INIT
bool "Check bootloader initializaion"
depends on FB_OMAP
help
Say Y here if you want to enable checking if the bootloader has
already initialized the display controller. In this case the
driver will skip the initialization.
config FB_OMAP_DMA_TUNE
bool "Set DMA SDRAM access priority high"
depends on FB_OMAP && ARCH_OMAP1
......@@ -37,3 +52,4 @@ config FB_OMAP_DMA_TUNE
answer yes. Answer no if you have a dedicated video
memory, or don't use any of the accelerated features.
......@@ -6,13 +6,14 @@ obj-$(CONFIG_FB_OMAP) += omapfb.o
objs-yy := omapfb_main.o
objs-y$(CONFIG_ARCH_OMAP1) += lcdc.o
objs-y$(CONFIG_ARCH_OMAP2) += dispc.o
objs-$(CONFIG_ARCH_OMAP1)$(CONFIG_FB_OMAP_LCDC_INTERNAL) += lcdc.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_MACH_OMAP_H4) += lcd_h4.o
objs-y$(CONFIG_MACH_OMAP_H3) += lcd_h3.o
objs-y$(CONFIG_MACH_OMAP_H2) += lcd_h2.o
......@@ -23,5 +24,7 @@ objs-y$(CONFIG_MACH_OMAP_OSK) += lcd_osk.o
objs-y$(CONFIG_MACH_OMAP_PERSEUS2) += lcd_p2.o
objs-y$(CONFIG_MACH_OMAP_APOLLON) += lcd_apollon.o
objs-y$(CONFIG_FB_OMAP_LCD_LPH8923) += lcd_lph8923.o
omapfb-objs := $(objs-yy)
......@@ -24,8 +24,6 @@
#ifndef __OMAPFB_DEBUG_H
#define __OMAPFB_DEBUG_H
#include <asm/io.h>
#ifdef OMAPFB_DBG
#define DBGPRINT(level, fmt, ...) if (level <= OMAPFB_DBG) do { \
......@@ -35,37 +33,11 @@
#define DBGENTER(level) DBGPRINT(level, "Enter\n")
#define DBGLEAVE(level) DBGPRINT(level, "Leave\n")
static inline void dump_dma_regs(int lch)
{
#ifdef CONFIG_ARCH_OMAP1
#define _R(x) __REG16(OMAP_DMA_##x(lch))
DBGPRINT(4, "\nCSDP :%#06x CCR :%#06x CSSA_U :%#06x "
"\nCDSA_L:%#06x CDSA_U :%#06x CEN :%#06x "
"\nCFN :%#06x CSFI :%#06x CSEI :%#06x "
"\nCSAC :%#06x CICR :%#06x CSR :%04x "
"\nCSSA_L:%#06x CDAC :%#06x CDEI :%#06x "
"\nCDFI :%#06x COLOR_L :%#06x COLOR_U :%#06x "
"\nCCR2 :%#06x CLNK_CTRL:%#06x LCH_CTRL:%#06x\n",
_R(CSDP), _R(CCR), _R(CSSA_U),
_R(CDSA_L), _R(CDSA_U), _R(CEN),
_R(CFN), _R(CSFI), _R(CSEI),
_R(CSAC), _R(CICR), 0, /* _R(CSR), */
_R(CSSA_L), _R(CDAC), _R(CDEI),
_R(CDFI), _R(COLOR_L), _R(COLOR_U),
_R(CCR2), _R(CLNK_CTRL), _R(LCH_CTRL));
#undef _R
#endif
}
#define DUMP_DMA_REGS(lch) dump_dma_regs(lch)
#else /* OMAPFB_DBG */
#define DBGPRINT(level, format, ...)
#define DBGENTER(level)
#define DBGLEAVE(level)
#define DUMP_DMA_REGS(lch)
#endif /* OMAPFB_DBG */
......
This diff is collapsed.
This diff is collapsed.
#ifndef __HWA742_H
#define __HWA742_H
#include <linux/fb.h>
#include <asm/arch/omapfb.h>
#define HWA742_EVENT_READY 1
#define HWA742_EVENT_DISABLED 2
struct hwa742_notifier_block {
struct notifier_block nb;
void *data;
};
typedef int (*hwa742_notifier_callback_t)(struct hwa742_notifier_block *,
unsigned long event,
struct omapfb_device *fbdev);
extern void hwa742_read_id(int *rev_code, int *config);
extern int hwa742_register_client(struct hwa742_notifier_block *hwa742_nb,
hwa742_notifier_callback_t callback,
void *callback_data);
extern int hwa742_unregister_client(struct hwa742_notifier_block *hwa742_nb);
extern int hwa742_update_window_async(struct omapfb_update_window *win,
void (*complete_callback)(void *arg),
void *complete_callback_data);
#endif
......@@ -22,6 +22,7 @@
*/
#include <linux/module.h>
#include <linux/platform_device.h>
#include <asm/arch/mux.h>
#include <asm/arch/omapfb.h>
......@@ -131,3 +132,52 @@ struct lcd_panel h2_panel = {
.get_caps = h2_panel_get_caps,
};
static int h2_panel_probe(struct platform_device *pdev)
{
DBGENTER(1);
omapfb_register_panel(&h2_panel);
return 0;
}
static int h2_panel_remove(struct platform_device *pdev)
{
DBGENTER(1);
return 0;
}
static int h2_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
{
DBGENTER(1);
return 0;
}
static int h2_panel_resume(struct platform_device *pdev)
{
DBGENTER(1);
return 0;
}
struct platform_driver h2_panel_driver = {
.probe = h2_panel_probe,
.remove = h2_panel_remove,
.suspend = h2_panel_suspend,
.resume = h2_panel_resume,
.driver = {
.name = "lcd_h2",
.owner = THIS_MODULE,
},
};
static int h2_panel_drv_init(void)
{
return platform_driver_register(&h2_panel_driver);
}
static void h2_panel_drv_cleanup(void)
{
platform_driver_unregister(&h2_panel_driver);
}
module_init(h2_panel_drv_init);
module_exit(h2_panel_drv_cleanup);
......@@ -22,6 +22,7 @@
*/
#include <linux/module.h>
#include <linux/platform_device.h>
#include <asm/arch/gpio.h>
#include <asm/arch/tps65010.h>
......@@ -110,3 +111,52 @@ struct lcd_panel h3_panel = {
.get_caps = h3_panel_get_caps,
};
static int h3_panel_probe(struct platform_device *pdev)
{
DBGENTER(1);
omapfb_register_panel(&h3_panel);
return 0;
}
static int h3_panel_remove(struct platform_device *pdev)
{
DBGENTER(1);
return 0;
}
static int h3_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
{
DBGENTER(1);
return 0;
}
static int h3_panel_resume(struct platform_device *pdev)
{
DBGENTER(1);
return 0;
}
struct platform_driver h3_panel_driver = {
.probe = h3_panel_probe,
.remove = h3_panel_remove,
.suspend = h3_panel_suspend,
.resume = h3_panel_resume,
.driver = {
.name = "lcd_h3",
.owner = THIS_MODULE,
},
};
static int h3_panel_drv_init(void)
{
return platform_driver_register(&h3_panel_driver);
}
static void h3_panel_drv_cleanup(void)
{
platform_driver_unregister(&h3_panel_driver);
}
module_init(h3_panel_drv_init);
module_exit(h3_panel_drv_cleanup);
......@@ -22,6 +22,7 @@
*/
#include <linux/module.h>
#include <linux/platform_device.h>
#include <asm/arch/omapfb.h>
......@@ -84,3 +85,52 @@ struct lcd_panel h4_panel = {
.get_caps = h4_panel_get_caps,
};
static int h4_panel_probe(struct platform_device *pdev)
{
DBGENTER(1);
omapfb_register_panel(&h4_panel);
return 0;
}
static int h4_panel_remove(struct platform_device *pdev)
{
DBGENTER(1);
return 0;
}
static int h4_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
{
DBGENTER(1);
return 0;
}
static int h4_panel_resume(struct platform_device *pdev)
{
DBGENTER(1);
return 0;
}
struct platform_driver h4_panel_driver = {
.probe = h4_panel_probe,
.remove = h4_panel_remove,
.suspend = h4_panel_suspend,
.resume = h4_panel_resume,
.driver = {
.name = "lcd_h4",
.owner = THIS_MODULE,
},
};
static int h4_panel_drv_init(void)
{
return platform_driver_register(&h4_panel_driver);
}
static void h4_panel_drv_cleanup(void)
{
platform_driver_unregister(&h4_panel_driver);
}
module_init(h4_panel_drv_init);
module_exit(h4_panel_drv_cleanup);
......@@ -22,6 +22,7 @@
*/
#include <linux/module.h>
#include <linux/platform_device.h>
#include <asm/io.h>
......@@ -93,3 +94,52 @@ struct lcd_panel innovator1510_panel = {
.get_caps = innovator1510_panel_get_caps,
};
static int innovator1510_panel_probe(struct platform_device *pdev)
{
DBGENTER(1);
omapfb_register_panel(&innovator1510_panel);
return 0;
}
static int innovator1510_panel_remove(struct platform_device *pdev)
{
DBGENTER(1);
return 0;
}
static int innovator1510_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
{
DBGENTER(1);
return 0;
}
static int innovator1510_panel_resume(struct platform_device *pdev)
{
DBGENTER(1);
return 0;
}
struct platform_driver innovator1510_panel_driver = {
.probe = innovator1510_panel_probe,
.remove = innovator1510_panel_remove,
.suspend = innovator1510_panel_suspend,
.resume = innovator1510_panel_resume,
.driver = {
.name = "lcd_inn1510",
.owner = THIS_MODULE,
},
};
static int innovator1510_panel_drv_init(void)
{
return platform_driver_register(&innovator1510_panel_driver);
}
static void innovator1510_panel_drv_cleanup(void)
{
platform_driver_unregister(&innovator1510_panel_driver);
}
module_init(innovator1510_panel_drv_init);
module_exit(innovator1510_panel_drv_cleanup);
......@@ -121,3 +121,52 @@ struct lcd_panel innovator1610_panel = {
.get_caps = innovator1610_panel_get_caps,
};
static int innovator1610_panel_probe(struct platform_device *pdev)
{
DBGENTER(1);
omapfb_register_panel(&innovator1610_panel);
return 0;
}
static int innovator1610_panel_remove(struct platform_device *pdev)
{
DBGENTER(1);
return 0;
}
static int innovator1610_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
{
DBGENTER(1);
return 0;
}
static int innovator1610_panel_resume(struct platform_device *pdev)
{
DBGENTER(1);
return 0;
}
struct platform_driver innovator1610_panel_driver = {
.probe = innovator1610_panel_probe,
.remove = innovator1610_panel_remove,
.suspend = innovator1610_panel_suspend,
.resume = innovator1610_panel_resume,
.driver = {
.name = "lcd_inn1610",
.owner = THIS_MODULE,
},
};
static int innovator1610_panel_drv_init(void)
{
return platform_driver_register(&innovator1610_panel_driver);
}
static void innovator1610_panel_drv_cleanup(void)
{
platform_driver_unregister(&innovator1610_panel_driver);
}
module_init(innovator1610_panel_drv_init);
module_exit(innovator1610_panel_drv_cleanup);
This diff is collapsed.
......@@ -23,6 +23,7 @@
*/
#include <linux/module.h>
#include <linux/platform_device.h>
#include <asm/arch/gpio.h>
#include <asm/arch/mux.h>
......@@ -113,3 +114,52 @@ struct lcd_panel osk_panel = {
.get_caps = osk_panel_get_caps,
};
static int osk_panel_probe(struct platform_device *pdev)
{
DBGENTER(1);
omapfb_register_panel(&osk_panel);
return 0;
}
static int osk_panel_remove(struct platform_device *pdev)
{
DBGENTER(1);
return 0;
}
static int osk_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
{
DBGENTER(1);
return 0;
}
static int osk_panel_resume(struct platform_device *pdev)
{
DBGENTER(1);
return 0;
}
struct platform_driver osk_panel_driver = {
.probe = osk_panel_probe,
.remove = osk_panel_remove,
.suspend = osk_panel_suspend,
.resume = osk_panel_resume,
.driver = {
.name = "lcd_osk",
.owner = THIS_MODULE,
},
};
static int osk_panel_drv_init(void)
{
return platform_driver_register(&osk_panel_driver);
}
static void osk_panel_drv_cleanup(void)
{
platform_driver_unregister(&osk_panel_driver);
}
module_init(osk_panel_drv_init);
module_exit(osk_panel_drv_cleanup);
......@@ -25,6 +25,7 @@
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <asm/arch/mux.h>
#include <asm/arch/gpio.h>
......@@ -305,3 +306,52 @@ struct lcd_panel p2_panel = {
.get_caps = p2_panel_get_caps,
};
static int p2_panel_probe(struct platform_device *pdev)
{
DBGENTER(1);
omapfb_register_panel(&p2_panel);
return 0;
}
static int p2_panel_remove(struct platform_device *pdev)
{
DBGENTER(1);
return 0;
}
static int p2_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
{
DBGENTER(1);
return 0;
}
static int p2_panel_resume(struct platform_device *pdev)
{
DBGENTER(1);
return 0;
}
struct platform_driver p2_panel_driver = {
.probe = p2_panel_probe,
.remove = p2_panel_remove,
.suspend = p2_panel_suspend,
.resume = p2_panel_resume,
.driver = {
.name = "lcd_p2",
.owner = THIS_MODULE,
},
};
static int p2_panel_drv_init(void)
{
return platform_driver_register(&p2_panel_driver);
}
static void p2_panel_drv_cleanup(void)
{
platform_driver_unregister(&p2_panel_driver);
}
module_init(p2_panel_drv_init);
module_exit(p2_panel_drv_cleanup);
......@@ -22,6 +22,7 @@
*/
#include <linux/module.h>
#include <linux/platform_device.h>
#include <asm/io.h>
......@@ -89,3 +90,52 @@ struct lcd_panel palmte_panel = {
.get_caps = palmte_panel_get_caps,
};
static int palmte_panel_probe(struct platform_device *pdev)
{
DBGENTER(1);
omapfb_register_panel(&palmte_panel);
return 0;
}
static int palmte_panel_remove(struct platform_device *pdev)
{
DBGENTER(1);
return 0;
}
static int palmte_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
{
DBGENTER(1);
return 0;
}
static int palmte_panel_resume(struct platform_device *pdev)
{
DBGENTER(1);
return 0;
}
struct platform_driver palmte_panel_driver = {
.probe = palmte_panel_probe,
.remove = palmte_panel_remove,
.suspend = palmte_panel_suspend,
.resume = palmte_panel_resume,
.driver = {
.name = "lcd_palmte",
.owner = THIS_MODULE,
},
};
static int palmte_panel_drv_init(void)
{
return platform_driver_register(&palmte_panel_driver);
}
static void palmte_panel_drv_cleanup(void)
{
platform_driver_unregister(&palmte_panel_driver);
}
module_init(palmte_panel_drv_init);
module_exit(palmte_panel_drv_cleanup);
This diff is collapsed.
#ifndef LCDC_H
#define LCDC_H
int omap_lcdc_set_dma_callback(void (*callback)(void *data), void *data);
void omap_lcdc_free_dma_callback(void);
#endif
......@@ -80,64 +80,20 @@ static struct caps_table_struct {
* LCD panel
* ---------------------------------------------------------------------------
*/
extern struct lcd_panel h4_panel;
extern struct lcd_panel h3_panel;
extern struct lcd_panel h2_panel;
extern struct lcd_panel p2_panel;
extern struct lcd_panel osk_panel;
extern struct lcd_panel palmte_panel;
extern struct lcd_panel innovator1610_panel;
extern struct lcd_panel innovator1510_panel;
extern struct lcd_panel lph8923_panel;
extern struct lcd_panel apollon_panel;
static struct lcd_panel *panels[] = {
#ifdef CONFIG_MACH_OMAP_H2
&h2_panel,
#endif
#ifdef CONFIG_MACH_OMAP_H3
&h3_panel,
#endif
#ifdef CONFIG_MACH_OMAP_H4
&h4_panel,
#endif
#ifdef CONFIG_MACH_OMAP_PERSEUS2
&p2_panel,
#endif
#ifdef CONFIG_MACH_OMAP_OSK
&osk_panel,
#endif
#ifdef CONFIG_MACH_OMAP_PALMTE
&palmte_panel,
#endif
#ifdef CONFIG_MACH_OMAP_INNOVATOR
#ifdef CONFIG_ARCH_OMAP15XX
&innovator1510_panel,
#endif
#ifdef CONFIG_ARCH_OMAP16XX
&innovator1610_panel,
#endif
#endif
#ifdef CONFIG_MACH_OMAP_APOLLON
&apollon_panel,
#endif
};
extern struct lcd_ctrl omap1_int_ctrl;
extern struct lcd_ctrl omap2_int_ctrl;
extern struct lcd_ctrl hwa742_ctrl;
extern struct lcd_ctrl blizzard_ctrl;
static struct lcd_ctrl *ctrls[] = {
#ifdef CONFIG_FB_OMAP_LCDC_INTERNAL
#ifdef CONFIG_ARCH_OMAP1
&omap1_int_ctrl,
#else
&omap2_int_ctrl,
#endif
#ifdef CONFIG_FB_OMAP_LCDC_HWA742
&hwa742_ctrl,
#endif
};
......@@ -192,7 +148,6 @@ static int ctrl_init(struct omapfb_device *fbdev)
fbdev->ctrl->get_vram_layout(&fbdev->vram_size, &fbdev->vram_virt_base,
&fbdev->vram_phys_base);
memset((void *)fbdev->vram_virt_base, 0, fbdev->vram_size);
DBGPRINT(1, "vram_phys %08x vram_virt %p vram_size=%lu\n",
fbdev->vram_phys_base, fbdev->vram_virt_base,
......@@ -339,12 +294,24 @@ static int omapfb_setcmap(struct fb_cmap *cmap, struct fb_info *info)
return 0;
}
static int omapfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
struct omapfb_device *fbdev = info->par;
int r;
omapfb_rqueue_lock(fbdev);
r = fbdev->ctrl->mmap(vma);
omapfb_rqueue_unlock(fbdev);
return r;
}
static void omapfb_update_full_screen(struct omapfb_device *fbdev);
static int omapfb_blank(int blank, struct fb_info *fbi)
{
struct omapfb_device *fbdev = (struct omapfb_device *)fbi->par;
int do_update = 0;
int r = 0;
DBGENTER(1);
......@@ -359,7 +326,7 @@ static int omapfb_blank(int blank, struct fb_info *fbi)
fbdev->state = OMAPFB_ACTIVE;
if (fbdev->ctrl->get_update_mode() ==
OMAPFB_MANUAL_UPDATE)
omapfb_update_full_screen(fbdev);
do_update = 1;
}
break;
case VESA_POWERDOWN:
......@@ -375,6 +342,9 @@ static int omapfb_blank(int blank, struct fb_info *fbi)
}
omapfb_rqueue_unlock(fbdev);
if (do_update)
omapfb_update_full_screen(fbdev);
DBGLEAVE(1);
return r;
}
......@@ -763,8 +733,6 @@ static int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd,
} p;
int r = 0;
DBGENTER(2);
BUG_ON(!ops);
DBGPRINT(2, "cmd=%010x\n", cmd);
switch (cmd)
......@@ -792,6 +760,15 @@ static int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd,
(enum omapfb_update_mode __user *)arg))
r = -EFAULT;
break;
case OMAPFB_UPDATE_WINDOW_OLD:
if (copy_from_user(&p.update_window, (void __user *)arg,
sizeof(struct omapfb_update_window_old)))
r = -EFAULT;
else {
p.update_window.format = 0;
r = omapfb_update_win(fbdev, &p.update_window);
}
break;
case OMAPFB_UPDATE_WINDOW:
if (copy_from_user(&p.update_window, (void __user *)arg,
sizeof(p.update_window)))
......@@ -1134,45 +1111,21 @@ static void omapfb_free_resources(struct omapfb_device *fbdev, int state)
}
}
static int omapfb_find_panel(struct omapfb_device *fbdev)
{
const struct omap_lcd_config *conf;
char name[17];
int i;
conf = (struct omap_lcd_config *)fbdev->dev->platform_data;
fbdev->panel = NULL;
if (conf == NULL)
return -1;
strncpy(name, conf->panel_name, sizeof(name) - 1);
name[sizeof(name) - 1] = 0;
for (i = 0; i < ARRAY_SIZE(panels); i++) {
if (strcmp(panels[i]->name, name) == 0) {
fbdev->panel = panels[i];
break;
}
}
if (fbdev->panel == NULL)
return -1;
return 0;
}
static int omapfb_find_ctrl(struct omapfb_device *fbdev)
{
struct omap_lcd_config *conf;
struct omapfb_platform_data *conf;
char name[17];
int i;
conf = (struct omap_lcd_config *)fbdev->dev->platform_data;
conf = (struct omapfb_platform_data *)fbdev->dev->platform_data;
fbdev->ctrl = NULL;
if (conf == NULL)
if (conf == NULL) {
DBGPRINT(1, "omap_lcd_config not found\n");
return -1;
}
strncpy(name, conf->ctrl_name, sizeof(name) - 1);
strncpy(name, conf->lcd.ctrl_name, sizeof(name) - 1);
name[sizeof(name) - 1] = '\0';
if (strcmp(name, "internal") == 0) {
......@@ -1181,14 +1134,17 @@ static int omapfb_find_ctrl(struct omapfb_device *fbdev)
}
for (i = 0; i < ARRAY_SIZE(ctrls); i++) {
DBGPRINT(1, "ctrl %s\n", ctrls[i]->name);
if (strcmp(ctrls[i]->name, name) == 0) {
fbdev->ctrl = ctrls[i];
break;
}
}
if (fbdev->ctrl == NULL)
if (fbdev->ctrl == NULL) {
DBGPRINT(1, "ctrl %s not supported\n", name);
return -1;
}
return 0;
}
......@@ -1218,13 +1174,12 @@ static void check_required_callbacks(struct omapfb_device *fbdev)
* start LCD frame transfer
* 7. register system fb_info structure
*/
static int omapfb_probe(struct platform_device *pdev)
static int omapfb_do_probe(struct platform_device *pdev, struct lcd_panel *panel)
{
struct omapfb_device *fbdev = NULL;
struct fb_info *fbi;
int init_state;
unsigned long phz, hhz, vhz;
struct lcd_panel *panel;
int r = 0;
DBGENTER(1);
......@@ -1248,14 +1203,13 @@ static int omapfb_probe(struct platform_device *pdev)
fbdev = (struct omapfb_device *)fbi->par;
fbdev->fb_info = fbi;
fbdev->dev = &pdev->dev;
fbdev->panel = panel;
platform_set_drvdata(pdev, fbdev);
init_MUTEX(&fbdev->rqueue_sema);
#ifdef CONFIG_ARCH_OMAP1
#ifdef CONFIG_FB_OMAP_LCDC_INTERNAL
fbdev->int_ctrl = &omap1_int_ctrl;
#endif
#ifdef CONFIG_FB_OMAP_LCDC_EXTERNAL
fbdev->ext_if = &sossi_extif;
#endif
......@@ -1271,15 +1225,6 @@ static int omapfb_probe(struct platform_device *pdev)
goto cleanup;
}
if (omapfb_find_panel(fbdev) < 0) {
pr_err("LCD panel not found, board not supported\n");
r = -ENODEV;
goto cleanup;
}
check_required_callbacks(fbdev);
pr_info(MODULE_NAME ": configured for panel %s\n", fbdev->panel->name);
r = fbdev->panel->init(fbdev);
......@@ -1292,6 +1237,14 @@ static int omapfb_probe(struct platform_device *pdev)
goto cleanup;
init_state++;
/* We depend on doing this after ctrl_init, since it can redefine
* member functions.
*/
if (fbdev->ctrl->mmap)
omapfb_ops.fb_mmap = omapfb_mmap;
check_required_callbacks(fbdev);
r = fbinfo_init(fbdev);
if (r)
goto cleanup;
......@@ -1308,7 +1261,8 @@ static int omapfb_probe(struct platform_device *pdev)
goto cleanup;
}
omapfb_enable_plane(fbdev, 0, 1);
if (!manual_update)
omapfb_enable_plane(fbdev, OMAPFB_PLANE_GFX, 1);
omapfb_set_update_mode(fbdev, manual_update ?
OMAPFB_MANUAL_UPDATE : OMAPFB_AUTO_UPDATE);
......@@ -1352,6 +1306,30 @@ cleanup:
return r;
}
static struct platform_device *fbdev_pdev;
static struct lcd_panel *fbdev_panel;
static int omapfb_probe(struct platform_device *pdev)
{
BUG_ON(fbdev_pdev != NULL);
DBGENTER(1);
fbdev_pdev = pdev;
if (fbdev_panel != NULL)
omapfb_do_probe(fbdev_pdev, fbdev_panel);
return 0;
}
void omapfb_register_panel(struct lcd_panel *panel)
{
BUG_ON(fbdev_panel != NULL);
DBGENTER(1);
fbdev_panel = panel;
if (fbdev_pdev != NULL)
omapfb_do_probe(fbdev_pdev, fbdev_panel);
}
/* Called when the device is being detached from the driver */
static int omapfb_remove(struct platform_device *pdev)
{
......
......@@ -35,6 +35,10 @@
#include "dispc.h"
/* #define OMAPFB_DBG 1 */
#include "debug.h"
#define MODULE_NAME "omapfb-rfbi"
#define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args)
......@@ -68,8 +72,11 @@ static struct {
void (*lcdc_callback)(void *data);
void *lcdc_callback_data;
unsigned long l4_khz;
int bits_per_cycle;
} rfbi;
struct lcd_ctrl_extif rfbi_extif;
static inline void rfbi_write_reg(int idx, u32 val)
{
__raw_writel(val, rfbi.base + idx);
......@@ -80,25 +87,18 @@ static inline u32 rfbi_read_reg(int idx)
return __raw_readl(rfbi.base + idx);
}
static int ns_to_l4_ticks(int time)
{
unsigned long tick_ps;
int ret;
/* Calculate in picosecs to yield more exact results */
tick_ps = 1000000000 / (rfbi.l4_khz);
ret = (time * 1000 + tick_ps - 1) / tick_ps;
return ret * 2;
}
#ifdef OMAPFB_DBG
static void print_timings(void)
static void rfbi_print_timings(void)
{
u32 l;
u32 time;
DBGPRINT(1, "Tick time %lu ps\n", 1000000000 / rfbi.l4_khz);
l = rfbi_read_reg(RFBI_CONFIG0);
time = 1000000000 / rfbi.l4_khz;
if (l & (1 << 4))
time *= 2;
DBGPRINT(1, "Tick time %u ps\n", time);
l = rfbi_read_reg(RFBI_ONOFF_TIME0);
DBGPRINT(1, "CSONTIME %d, CSOFFTIME %d, WEONTIME %d, WEOFFTIME %d, "
"REONTIME %d, REOFFTIME %d\n",
......@@ -109,55 +109,181 @@ static void print_timings(void)
"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;
int on, off;
on = ns_to_l4_ticks(t->cs_on_time) & 0x0f;
l = on;
off = ns_to_l4_ticks(t->cs_off_time) & 0x3f;
if (off <= on)
off = on + 2;
l |= off << 4;
on = ns_to_l4_ticks(t->we_on_time) & 0x0f;
l |= on << 10;
off = ns_to_l4_ticks(t->we_off_time) & 0x3f;
if (off <= on)
off = on + 2;
l |= off << 14;
l |= (ns_to_l4_ticks(t->re_on_time) & 0x0f) << 20;
l |= (ns_to_l4_ticks(t->re_off_time) & 0x3f) << 24;
rfbi_write_reg(RFBI_ONOFF_TIME0, l);
l = ns_to_l4_ticks(t->we_cycle_time) & 0x3f;
l |= (ns_to_l4_ticks(t->re_cycle_time) & 0x3f) << 6;
l |= (ns_to_l4_ticks(t->cs_pulse_width) & 0x3f) << 12;
l |= (ns_to_l4_ticks(t->access_time) & 0x3f) << 22;
rfbi_write_reg(RFBI_CYCLE_TIME0, l);
BUG_ON(!t->converted);
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();
}
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;
}
static void rfbi_write_command(u32 cmd)
static int rfbi_convert_timings(struct extif_timings *t)
{
rfbi_write_reg(RFBI_CMD, cmd);
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 u32 rfbi_read_data(void)
static void rfbi_write_command(const void *buf, unsigned int len)
{
u32 val;
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_write_reg(RFBI_READ, 0);
val = rfbi_read_reg(RFBI_READ);
return val;
static void rfbi_read_data(void *buf, unsigned int len)
{
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);
}
}
}
static void rfbi_write_data(u32 val)
static void rfbi_write_data(const void *buf, unsigned int len)
{
rfbi_write_reg(RFBI_PARAM, val);
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++);
}
}
static void rfbi_transfer_area(int width, int height,
......@@ -195,13 +321,32 @@ static void rfbi_dma_callback(void *data)
rfbi.lcdc_callback(rfbi.lcdc_callback_data);
}
static void rfbi_set_bits_per_cycle(int bpc)
{
u32 l;
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;
}
static int rfbi_init(void)
{
u32 l;
int r;
struct clk *dss_ick;
memset(&rfbi, 0, sizeof(rfbi));
rfbi.base = io_p2v(RFBI_BASE);
l = rfbi_read_reg(RFBI_REVISION);
......@@ -212,6 +357,7 @@ static int rfbi_init(void)
pr_err("can't get dss_ick\n");
return PTR_ERR(dss_ick);
}
rfbi.l4_khz = clk_get_rate(dss_ick) / 1000;
clk_put(dss_ick);
......@@ -229,13 +375,10 @@ static int rfbi_init(void)
l |= (0 << 9) | (1 << 20) | (1 << 21);
rfbi_write_reg(RFBI_CONFIG0, l);
l = 0x10;
rfbi_write_reg(RFBI_DATA_CYCLE1_0, l);
rfbi_write_reg(RFBI_DATA_CYCLE2_0, l);
rfbi_write_reg(RFBI_DATA_CYCLE3_0, l);
rfbi_write_reg(RFBI_DATA_CYCLE1_0, 0x00000010);
l = rfbi_read_reg(RFBI_CONTROL);
/* Select CS0 */
/* Select CS0, clear bypass mode */
l = (0x01 << 2);
rfbi_write_reg(RFBI_CONTROL, l);
......@@ -255,10 +398,14 @@ static void rfbi_cleanup(void)
struct lcd_ctrl_extif rfbi_extif = {
.init = rfbi_init,
.cleanup = rfbi_cleanup,
.get_clk_info = rfbi_get_clk_info,
.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,
.max_transmit_size = (u32)~0,
};
This diff is collapsed.
#ifndef DRIVERS_VIDEO_OMAP_SOSSI_H
#define DRIVERS_VIDEO_OMAP_SOSSI_H
#define SOSSI_FLAG_HS_INVERTED 0x01
#define SOSSI_FLAG_VS_INVERTED 0x02
extern int sossi_init(void);
extern void sossi_set_xfer_params(int bus_pick_count, int bus_pick_width);
extern void sossi_set_timings(int tick_ns, int tw0_ns, int tw1_ns);
extern void sossi_start_transfer(void);
extern void sossi_stop_transfer(void);
extern void sossi_send_cmd(const void *data, unsigned int len);
extern void sossi_send_data(const void *data, unsigned int len);
extern void sossi_send_data_const32(u32 data, unsigned int count);
extern void sossi_prepare_dma_transfer(unsigned int count);
extern void sossi_read_data(void *data, unsigned int len);
extern void sossi_set_tearing(int mode, int hs_counter, int detect_limit,
int vs_counter, int vs_detect_limit, int flags);
#endif
......@@ -21,6 +21,7 @@
#define OMAP_TAG_LCD 0x4f05
#define OMAP_TAG_GPIO_SWITCH 0x4f06
#define OMAP_TAG_UART 0x4f07
#define OMAP_TAG_FBMEM 0x4f08
#define OMAP_TAG_STI_CONSOLE 0x4f09
#define OMAP_TAG_BOOT_REASON 0x4f80
......@@ -94,6 +95,13 @@ struct omap_lcd_config {
char ctrl_name[16];
};
struct omap_fbmem_config {
u32 fb_sram_start;
u32 fb_sram_size;
u32 fb_sdram_start;
u32 fb_sdram_size;
};
/* Cover:
* high -> closed
* low -> open
......
#ifndef __LCD_LPH8923_H
#define __LCD_LPH8923_H
enum lcd_lph8923_test_num {
LCD_LPH8923_TEST_RGB_LINES,
};
enum lcd_lph8923_test_result {
LCD_LPH8923_TEST_SUCCESS,
LCD_LPH8923_TEST_INVALID,
LCD_LPH8923_TEST_FAILED,
};
#endif
This diff is collapsed.
......@@ -20,6 +20,8 @@ extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
u32 mem_type);
extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
extern unsigned long omap_fb_sram_start;
extern unsigned long omap_fb_sram_size;
/* Do not use these */
extern void sram_reprogram_clock(u32 ckctl, u32 dpllctl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment