linux/drivers/video/fbdev/sh_mobile_lcdcfb.c

/*
 * SuperH Mobile LCDC Framebuffer
 *
 * Copyright (c) 2008 Magnus Damm
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 */

#include <linux/atomic.h>
#include <linux/backlight.h>
#include <linux/clk.h>
#include <linux/console.h>
#include <linux/ctype.h>
#include <linux/dma-mapping.h>
#include <linux/delay.h>
#include <linux/fbcon.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/ioctl.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/videodev2.h>
#include <linux/vmalloc.h>

#include <video/sh_mobile_lcdc.h>

#include "sh_mobile_lcdcfb.h"

/* ----------------------------------------------------------------------------
 * Overlay register definitions
 */

#define LDBCR
#define LDBCR_UPC(n)
#define LDBCR_UPF(n)
#define LDBCR_UPD(n)
#define LDBnBSIFR(n)
#define LDBBSIFR_EN
#define LDBBSIFR_VS
#define LDBBSIFR_BRSEL
#define LDBBSIFR_MX
#define LDBBSIFR_MY
#define LDBBSIFR_CV3
#define LDBBSIFR_CV2
#define LDBBSIFR_CV1
#define LDBBSIFR_CV0
#define LDBBSIFR_CV_MASK
#define LDBBSIFR_LAY_MASK
#define LDBBSIFR_LAY_SHIFT
#define LDBBSIFR_ROP3_MASK
#define LDBBSIFR_ROP3_SHIFT
#define LDBBSIFR_AL_PL8
#define LDBBSIFR_AL_PL1
#define LDBBSIFR_AL_PK
#define LDBBSIFR_AL_1
#define LDBBSIFR_AL_MASK
#define LDBBSIFR_SWPL
#define LDBBSIFR_SWPW
#define LDBBSIFR_SWPB
#define LDBBSIFR_RY
#define LDBBSIFR_CHRR_420
#define LDBBSIFR_CHRR_422
#define LDBBSIFR_CHRR_444
#define LDBBSIFR_RPKF_ARGB32
#define LDBBSIFR_RPKF_RGB16
#define LDBBSIFR_RPKF_RGB24
#define LDBBSIFR_RPKF_MASK
#define LDBnBSSZR(n)
#define LDBBSSZR_BVSS_MASK
#define LDBBSSZR_BVSS_SHIFT
#define LDBBSSZR_BHSS_MASK
#define LDBBSSZR_BHSS_SHIFT
#define LDBnBLOCR(n)
#define LDBBLOCR_CVLC_MASK
#define LDBBLOCR_CVLC_SHIFT
#define LDBBLOCR_CHLC_MASK
#define LDBBLOCR_CHLC_SHIFT
#define LDBnBSMWR(n)
#define LDBBSMWR_BSMWA_MASK
#define LDBBSMWR_BSMWA_SHIFT
#define LDBBSMWR_BSMW_MASK
#define LDBBSMWR_BSMW_SHIFT
#define LDBnBSAYR(n)
#define LDBBSAYR_FG1A_MASK
#define LDBBSAYR_FG1A_SHIFT
#define LDBBSAYR_FG1R_MASK
#define LDBBSAYR_FG1R_SHIFT
#define LDBBSAYR_FG1G_MASK
#define LDBBSAYR_FG1G_SHIFT
#define LDBBSAYR_FG1B_MASK
#define LDBBSAYR_FG1B_SHIFT
#define LDBnBSACR(n)
#define LDBBSACR_FG2A_MASK
#define LDBBSACR_FG2A_SHIFT
#define LDBBSACR_FG2R_MASK
#define LDBBSACR_FG2R_SHIFT
#define LDBBSACR_FG2G_MASK
#define LDBBSACR_FG2G_SHIFT
#define LDBBSACR_FG2B_MASK
#define LDBBSACR_FG2B_SHIFT
#define LDBnBSAAR(n)
#define LDBBSAAR_AP_MASK
#define LDBBSAAR_AP_SHIFT
#define LDBBSAAR_R_MASK
#define LDBBSAAR_R_SHIFT
#define LDBBSAAR_GY_MASK
#define LDBBSAAR_GY_SHIFT
#define LDBBSAAR_B_MASK
#define LDBBSAAR_B_SHIFT
#define LDBnBPPCR(n)
#define LDBBPPCR_AP_MASK
#define LDBBPPCR_AP_SHIFT
#define LDBBPPCR_R_MASK
#define LDBBPPCR_R_SHIFT
#define LDBBPPCR_GY_MASK
#define LDBBPPCR_GY_SHIFT
#define LDBBPPCR_B_MASK
#define LDBBPPCR_B_SHIFT
#define LDBnBBGCL(n)
#define LDBBBGCL_BGA_MASK
#define LDBBBGCL_BGA_SHIFT
#define LDBBBGCL_BGR_MASK
#define LDBBBGCL_BGR_SHIFT
#define LDBBBGCL_BGG_MASK
#define LDBBBGCL_BGG_SHIFT
#define LDBBBGCL_BGB_MASK
#define LDBBBGCL_BGB_SHIFT

#define SIDE_B_OFFSET
#define MIRROR_OFFSET

#define MAX_XRES
#define MAX_YRES

enum sh_mobile_lcdc_overlay_mode {};

/*
 * struct sh_mobile_lcdc_overlay - LCDC display overlay
 *
 * @channel: LCDC channel this overlay belongs to
 * @cfg: Overlay configuration
 * @info: Frame buffer device
 * @index: Overlay index (0-3)
 * @base: Overlay registers base address
 * @enabled: True if the overlay is enabled
 * @mode: Overlay blending mode (alpha blend or ROP3)
 * @alpha: Global alpha blending value (0-255, for alpha blending mode)
 * @rop3: Raster operation (for ROP3 mode)
 * @fb_mem: Frame buffer virtual memory address
 * @fb_size: Frame buffer size in bytes
 * @dma_handle: Frame buffer DMA address
 * @base_addr_y: Overlay base address (RGB or luma component)
 * @base_addr_c: Overlay base address (chroma component)
 * @pan_y_offset: Panning linear offset in bytes (luma component)
 * @format: Current pixelf format
 * @xres: Horizontal visible resolution
 * @xres_virtual: Horizontal total resolution
 * @yres: Vertical visible resolution
 * @yres_virtual: Vertical total resolution
 * @pitch: Overlay line pitch
 * @pos_x: Horizontal overlay position
 * @pos_y: Vertical overlay position
 */
struct sh_mobile_lcdc_overlay {};

struct sh_mobile_lcdc_priv {};

/* -----------------------------------------------------------------------------
 * Registers access
 */

static unsigned long lcdc_offs_mainlcd[NR_CH_REGS] =;

static unsigned long lcdc_offs_sublcd[NR_CH_REGS] =;

static bool banked(int reg_nr)
{}

static int lcdc_chan_is_sublcd(struct sh_mobile_lcdc_chan *chan)
{}

static void lcdc_write_chan(struct sh_mobile_lcdc_chan *chan,
			    int reg_nr, unsigned long data)
{}

static void lcdc_write_chan_mirror(struct sh_mobile_lcdc_chan *chan,
			    int reg_nr, unsigned long data)
{}

static unsigned long lcdc_read_chan(struct sh_mobile_lcdc_chan *chan,
				    int reg_nr)
{}

static void lcdc_write_overlay(struct sh_mobile_lcdc_overlay *ovl,
			       int reg, unsigned long data)
{}

static void lcdc_write(struct sh_mobile_lcdc_priv *priv,
		       unsigned long reg_offs, unsigned long data)
{}

static unsigned long lcdc_read(struct sh_mobile_lcdc_priv *priv,
			       unsigned long reg_offs)
{}

static void lcdc_wait_bit(struct sh_mobile_lcdc_priv *priv,
			  unsigned long reg_offs,
			  unsigned long mask, unsigned long until)
{}

/* -----------------------------------------------------------------------------
 * Clock management
 */

static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
{}

static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
{}

static int sh_mobile_lcdc_setup_clocks(struct sh_mobile_lcdc_priv *priv,
				       int clock_source)
{}

/* -----------------------------------------------------------------------------
 * Display, panel and deferred I/O
 */

static void lcdc_sys_write_index(void *handle, unsigned long data)
{}

static void lcdc_sys_write_data(void *handle, unsigned long data)
{}

static unsigned long lcdc_sys_read_data(void *handle)
{}

static struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops =;

static int sh_mobile_lcdc_sginit(struct fb_info *info, struct list_head *pagereflist)
{}

static void sh_mobile_lcdc_deferred_io(struct fb_info *info, struct list_head *pagereflist)
{}

static void sh_mobile_lcdc_deferred_io_touch(struct fb_info *info)
{}

static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
{}

static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch)
{}

/* -----------------------------------------------------------------------------
 * Format helpers
 */

struct sh_mobile_lcdc_format_info {};

static const struct sh_mobile_lcdc_format_info sh_mobile_format_infos[] =;

static const struct sh_mobile_lcdc_format_info *
sh_mobile_format_info(u32 fourcc)
{}

static int sh_mobile_format_fourcc(const struct fb_var_screeninfo *var)
{}

static int sh_mobile_format_is_fourcc(const struct fb_var_screeninfo *var)
{}

/* -----------------------------------------------------------------------------
 * Start, stop and IRQ
 */

static irqreturn_t sh_mobile_lcdc_irq(int irq, void *data)
{}

static int sh_mobile_lcdc_wait_for_vsync(struct sh_mobile_lcdc_chan *ch)
{}

static void sh_mobile_lcdc_start_stop(struct sh_mobile_lcdc_priv *priv,
				      int start)
{}

static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch)
{}

static void sh_mobile_lcdc_overlay_setup(struct sh_mobile_lcdc_overlay *ovl)
{}

/*
 * __sh_mobile_lcdc_start - Configure and start the LCDC
 * @priv: LCDC device
 *
 * Configure all enabled channels and start the LCDC device. All external
 * devices (clocks, MERAM, panels, ...) are not touched by this function.
 */
static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
{}

static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
{}

static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
{}

static int __sh_mobile_lcdc_check_var(struct fb_var_screeninfo *var,
				      struct fb_info *info)
{}

/* -----------------------------------------------------------------------------
 * Frame buffer operations - Overlays
 */

static ssize_t
overlay_alpha_show(struct device *dev, struct device_attribute *attr, char *buf)
{}

static ssize_t
overlay_alpha_store(struct device *dev, struct device_attribute *attr,
		    const char *buf, size_t count)
{}

static ssize_t
overlay_mode_show(struct device *dev, struct device_attribute *attr, char *buf)
{}

static ssize_t
overlay_mode_store(struct device *dev, struct device_attribute *attr,
		   const char *buf, size_t count)
{}

static ssize_t
overlay_position_show(struct device *dev, struct device_attribute *attr,
		      char *buf)
{}

static ssize_t
overlay_position_store(struct device *dev, struct device_attribute *attr,
		       const char *buf, size_t count)
{}

static ssize_t
overlay_rop3_show(struct device *dev, struct device_attribute *attr, char *buf)
{}

static ssize_t
overlay_rop3_store(struct device *dev, struct device_attribute *attr,
		    const char *buf, size_t count)
{}

static const struct device_attribute overlay_sysfs_attrs[] =;

static const struct fb_fix_screeninfo sh_mobile_lcdc_overlay_fix  =;

static int sh_mobile_lcdc_overlay_pan(struct fb_var_screeninfo *var,
				    struct fb_info *info)
{}

static int sh_mobile_lcdc_overlay_ioctl(struct fb_info *info, unsigned int cmd,
				      unsigned long arg)
{}

static int sh_mobile_lcdc_overlay_check_var(struct fb_var_screeninfo *var,
					  struct fb_info *info)
{}

static int sh_mobile_lcdc_overlay_set_par(struct fb_info *info)
{}

/* Overlay blanking. Disable the overlay when blanked. */
static int sh_mobile_lcdc_overlay_blank(int blank, struct fb_info *info)
{}

static int
sh_mobile_lcdc_overlay_mmap(struct fb_info *info, struct vm_area_struct *vma)
{}

static const struct fb_ops sh_mobile_lcdc_overlay_ops =;

static void
sh_mobile_lcdc_overlay_fb_unregister(struct sh_mobile_lcdc_overlay *ovl)
{}

static int
sh_mobile_lcdc_overlay_fb_register(struct sh_mobile_lcdc_overlay *ovl)
{}

static void
sh_mobile_lcdc_overlay_fb_cleanup(struct sh_mobile_lcdc_overlay *ovl)
{}

static int
sh_mobile_lcdc_overlay_fb_init(struct sh_mobile_lcdc_overlay *ovl)
{}

/* -----------------------------------------------------------------------------
 * Frame buffer operations - main frame buffer
 */

static int sh_mobile_lcdc_setcolreg(u_int regno,
				    u_int red, u_int green, u_int blue,
				    u_int transp, struct fb_info *info)
{}

static const struct fb_fix_screeninfo sh_mobile_lcdc_fix  =;

static void sh_mobile_lcdc_fillrect(struct fb_info *info,
				    const struct fb_fillrect *rect)
{}

static void sh_mobile_lcdc_copyarea(struct fb_info *info,
				    const struct fb_copyarea *area)
{}

static void sh_mobile_lcdc_imageblit(struct fb_info *info,
				     const struct fb_image *image)
{}

static int sh_mobile_lcdc_pan(struct fb_var_screeninfo *var,
			      struct fb_info *info)
{}

static int sh_mobile_lcdc_ioctl(struct fb_info *info, unsigned int cmd,
				unsigned long arg)
{}

static void sh_mobile_fb_reconfig(struct fb_info *info)
{}

/*
 * Locking: both .fb_release() and .fb_open() are called with info->lock held if
 * user == 1, or with console sem held, if user == 0.
 */
static int sh_mobile_lcdc_release(struct fb_info *info, int user)
{}

static int sh_mobile_lcdc_open(struct fb_info *info, int user)
{}

static int sh_mobile_lcdc_check_var(struct fb_var_screeninfo *var,
				    struct fb_info *info)
{}

static int sh_mobile_lcdc_set_par(struct fb_info *info)
{}

/*
 * Screen blanking. Behavior is as follows:
 * FB_BLANK_UNBLANK: screen unblanked, clocks enabled
 * FB_BLANK_NORMAL: screen blanked, clocks enabled
 * FB_BLANK_VSYNC,
 * FB_BLANK_HSYNC,
 * FB_BLANK_POWEROFF: screen blanked, clocks disabled
 */
static int sh_mobile_lcdc_blank(int blank, struct fb_info *info)
{}

static int
sh_mobile_lcdc_mmap(struct fb_info *info, struct vm_area_struct *vma)
{}

static const struct fb_ops sh_mobile_lcdc_ops =;

static void
sh_mobile_lcdc_channel_fb_unregister(struct sh_mobile_lcdc_chan *ch)
{}

static int
sh_mobile_lcdc_channel_fb_register(struct sh_mobile_lcdc_chan *ch)
{}

static void
sh_mobile_lcdc_channel_fb_cleanup(struct sh_mobile_lcdc_chan *ch)
{}

static int
sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
			       const struct fb_videomode *modes,
			       unsigned int num_modes)
{}

/* -----------------------------------------------------------------------------
 * Backlight
 */

static int sh_mobile_lcdc_update_bl(struct backlight_device *bdev)
{}

static int sh_mobile_lcdc_get_brightness(struct backlight_device *bdev)
{}

static const struct backlight_ops sh_mobile_lcdc_bl_ops =;

static struct backlight_device *sh_mobile_lcdc_bl_probe(struct device *parent,
					       struct sh_mobile_lcdc_chan *ch)
{}

static void sh_mobile_lcdc_bl_remove(struct backlight_device *bdev)
{}

/* -----------------------------------------------------------------------------
 * Power management
 */

static int sh_mobile_lcdc_suspend(struct device *dev)
{}

static int sh_mobile_lcdc_resume(struct device *dev)
{}

static int sh_mobile_lcdc_runtime_suspend(struct device *dev)
{}

static int sh_mobile_lcdc_runtime_resume(struct device *dev)
{}

static const struct dev_pm_ops sh_mobile_lcdc_dev_pm_ops =;

/* -----------------------------------------------------------------------------
 * Framebuffer notifier
 */

/* -----------------------------------------------------------------------------
 * Probe/remove and driver init/exit
 */

static const struct fb_videomode default_720p =;

static void sh_mobile_lcdc_remove(struct platform_device *pdev)
{}

static int sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch)
{}

static int
sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_overlay *ovl)
{}

static int
sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch)
{}

static int sh_mobile_lcdc_probe(struct platform_device *pdev)
{}

static struct platform_driver sh_mobile_lcdc_driver =;

module_platform_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();