forked from Minki/linux
video: auo_k190x: add code shared by controller drivers
The AUO-K190X controllers share a very similar set of commands and can therefore also share most of the driver code. Signed-off-by: Heiko Stübner <heiko@sntech.de> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
This commit is contained in:
parent
1f45f9dbb3
commit
2c8304d312
@ -2382,6 +2382,23 @@ config FB_BROADSHEET
|
||||
and could also have been called by other names when coupled with
|
||||
a bridge adapter.
|
||||
|
||||
config FB_AUO_K190X
|
||||
tristate "AUO-K190X EPD controller support"
|
||||
depends on FB
|
||||
select FB_SYS_FILLRECT
|
||||
select FB_SYS_COPYAREA
|
||||
select FB_SYS_IMAGEBLIT
|
||||
select FB_SYS_FOPS
|
||||
select FB_DEFERRED_IO
|
||||
help
|
||||
Provides support for epaper controllers from the K190X series
|
||||
of AUO. These controllers can be used to drive epaper displays
|
||||
from Sipix.
|
||||
|
||||
This option enables the common support, shared by the individual
|
||||
controller drivers. You will also have to enable the driver
|
||||
for the controller type used in your device.
|
||||
|
||||
config FB_JZ4740
|
||||
tristate "JZ4740 LCD framebuffer support"
|
||||
depends on FB && MACH_JZ4740
|
||||
|
@ -118,6 +118,7 @@ obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o
|
||||
obj-$(CONFIG_FB_MAXINE) += maxinefb.o
|
||||
obj-$(CONFIG_FB_METRONOME) += metronomefb.o
|
||||
obj-$(CONFIG_FB_BROADSHEET) += broadsheetfb.o
|
||||
obj-$(CONFIG_FB_AUO_K190X) += auo_k190x.o
|
||||
obj-$(CONFIG_FB_S1D13XXX) += s1d13xxxfb.o
|
||||
obj-$(CONFIG_FB_SH7760) += sh7760fb.o
|
||||
obj-$(CONFIG_FB_IMX) += imxfb.o
|
||||
|
1046
drivers/video/auo_k190x.c
Normal file
1046
drivers/video/auo_k190x.c
Normal file
File diff suppressed because it is too large
Load Diff
129
drivers/video/auo_k190x.h
Normal file
129
drivers/video/auo_k190x.h
Normal file
@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Private common definitions for AUO-K190X framebuffer drivers
|
||||
*
|
||||
* Copyright (C) 2012 Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
/*
|
||||
* I80 interface specific defines
|
||||
*/
|
||||
|
||||
#define AUOK190X_I80_CS 0x01
|
||||
#define AUOK190X_I80_DC 0x02
|
||||
#define AUOK190X_I80_WR 0x03
|
||||
#define AUOK190X_I80_OE 0x04
|
||||
|
||||
/*
|
||||
* AUOK190x commands, common to both controllers
|
||||
*/
|
||||
|
||||
#define AUOK190X_CMD_INIT 0x0000
|
||||
#define AUOK190X_CMD_STANDBY 0x0001
|
||||
#define AUOK190X_CMD_WAKEUP 0x0002
|
||||
#define AUOK190X_CMD_TCON_RESET 0x0003
|
||||
#define AUOK190X_CMD_DATA_STOP 0x1002
|
||||
#define AUOK190X_CMD_LUT_START 0x1003
|
||||
#define AUOK190X_CMD_DISP_REFRESH 0x1004
|
||||
#define AUOK190X_CMD_DISP_RESET 0x1005
|
||||
#define AUOK190X_CMD_PRE_DISPLAY_START 0x100D
|
||||
#define AUOK190X_CMD_PRE_DISPLAY_STOP 0x100F
|
||||
#define AUOK190X_CMD_FLASH_W 0x2000
|
||||
#define AUOK190X_CMD_FLASH_E 0x2001
|
||||
#define AUOK190X_CMD_FLASH_STS 0x2002
|
||||
#define AUOK190X_CMD_FRAMERATE 0x3000
|
||||
#define AUOK190X_CMD_READ_VERSION 0x4000
|
||||
#define AUOK190X_CMD_READ_STATUS 0x4001
|
||||
#define AUOK190X_CMD_READ_LUT 0x4003
|
||||
#define AUOK190X_CMD_DRIVERTIMING 0x5000
|
||||
#define AUOK190X_CMD_LBALANCE 0x5001
|
||||
#define AUOK190X_CMD_AGINGMODE 0x6000
|
||||
#define AUOK190X_CMD_AGINGEXIT 0x6001
|
||||
|
||||
/*
|
||||
* Common settings for AUOK190X_CMD_INIT
|
||||
*/
|
||||
|
||||
#define AUOK190X_INIT_DATA_FILTER (0 << 12)
|
||||
#define AUOK190X_INIT_DATA_BYPASS (1 << 12)
|
||||
#define AUOK190X_INIT_INVERSE_WHITE (0 << 9)
|
||||
#define AUOK190X_INIT_INVERSE_BLACK (1 << 9)
|
||||
#define AUOK190X_INIT_SCAN_DOWN (0 << 1)
|
||||
#define AUOK190X_INIT_SCAN_UP (1 << 1)
|
||||
#define AUOK190X_INIT_SHIFT_LEFT (0 << 0)
|
||||
#define AUOK190X_INIT_SHIFT_RIGHT (1 << 0)
|
||||
|
||||
/* Common bits to pixels
|
||||
* Mode 15-12 11-8 7-4 3-0
|
||||
* format0 4 3 2 1
|
||||
* format1 3 4 1 2
|
||||
*/
|
||||
|
||||
#define AUOK190X_INIT_FORMAT0 0
|
||||
#define AUOK190X_INIT_FORMAT1 (1 << 6)
|
||||
|
||||
/*
|
||||
* settings for AUOK190X_CMD_RESET
|
||||
*/
|
||||
|
||||
#define AUOK190X_RESET_TCON (0 << 0)
|
||||
#define AUOK190X_RESET_NORMAL (1 << 0)
|
||||
#define AUOK190X_RESET_PON (1 << 1)
|
||||
|
||||
/*
|
||||
* AUOK190X_CMD_VERSION
|
||||
*/
|
||||
|
||||
#define AUOK190X_VERSION_TEMP_MASK (0x1ff)
|
||||
#define AUOK190X_VERSION_EPD_MASK (0xff)
|
||||
#define AUOK190X_VERSION_SIZE_INT(_val) ((_val & 0xfc00) >> 10)
|
||||
#define AUOK190X_VERSION_SIZE_FLOAT(_val) ((_val & 0x3c0) >> 6)
|
||||
#define AUOK190X_VERSION_MODEL(_val) (_val & 0x3f)
|
||||
#define AUOK190X_VERSION_LUT(_val) (_val & 0xff)
|
||||
#define AUOK190X_VERSION_TCON(_val) ((_val & 0xff00) >> 8)
|
||||
|
||||
/*
|
||||
* update modes for CMD_PARTIALDISP on K1900 and CMD_DDMA on K1901
|
||||
*/
|
||||
|
||||
#define AUOK190X_UPDATE_MODE(_res) ((_res & 0x7) << 12)
|
||||
#define AUOK190X_UPDATE_NONFLASH (1 << 15)
|
||||
|
||||
/*
|
||||
* track panel specific parameters for common init
|
||||
*/
|
||||
|
||||
struct auok190x_init_data {
|
||||
char *id;
|
||||
struct auok190x_board *board;
|
||||
|
||||
void (*update_partial)(struct auok190xfb_par *par, u16 y1, u16 y2);
|
||||
void (*update_all)(struct auok190xfb_par *par);
|
||||
bool (*need_refresh)(struct auok190xfb_par *par);
|
||||
void (*init)(struct auok190xfb_par *par);
|
||||
};
|
||||
|
||||
|
||||
extern void auok190x_send_command_nowait(struct auok190xfb_par *par, u16 data);
|
||||
extern int auok190x_send_command(struct auok190xfb_par *par, u16 data);
|
||||
extern void auok190x_send_cmdargs_nowait(struct auok190xfb_par *par, u16 cmd,
|
||||
int argc, u16 *argv);
|
||||
extern int auok190x_send_cmdargs(struct auok190xfb_par *par, u16 cmd,
|
||||
int argc, u16 *argv);
|
||||
extern void auok190x_send_cmdargs_pixels_nowait(struct auok190xfb_par *par,
|
||||
u16 cmd, int argc, u16 *argv,
|
||||
int size, u16 *data);
|
||||
extern int auok190x_send_cmdargs_pixels(struct auok190xfb_par *par, u16 cmd,
|
||||
int argc, u16 *argv, int size,
|
||||
u16 *data);
|
||||
extern int auok190x_read_cmdargs(struct auok190xfb_par *par, u16 cmd,
|
||||
int argc, u16 *argv);
|
||||
|
||||
extern int auok190x_common_probe(struct platform_device *pdev,
|
||||
struct auok190x_init_data *init);
|
||||
extern int auok190x_common_remove(struct platform_device *pdev);
|
||||
|
||||
extern const struct dev_pm_ops auok190x_pm;
|
106
include/video/auo_k190xfb.h
Normal file
106
include/video/auo_k190xfb.h
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Definitions for AUO-K190X framebuffer drivers
|
||||
*
|
||||
* Copyright (C) 2012 Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_VIDEO_AUO_K190XFB_H_
|
||||
#define _LINUX_VIDEO_AUO_K190XFB_H_
|
||||
|
||||
/* Controller standby command needs a param */
|
||||
#define AUOK190X_QUIRK_STANDBYPARAM (1 << 0)
|
||||
|
||||
/* Controller standby is completely broken */
|
||||
#define AUOK190X_QUIRK_STANDBYBROKEN (1 << 1)
|
||||
|
||||
/*
|
||||
* Resolutions for the displays
|
||||
*/
|
||||
#define AUOK190X_RESOLUTION_800_600 0
|
||||
#define AUOK190X_RESOLUTION_1024_768 1
|
||||
|
||||
/*
|
||||
* struct used by auok190x. board specific stuff comes from *board
|
||||
*/
|
||||
struct auok190xfb_par {
|
||||
struct fb_info *info;
|
||||
struct auok190x_board *board;
|
||||
|
||||
struct regulator *regulator;
|
||||
|
||||
struct mutex io_lock;
|
||||
struct delayed_work work;
|
||||
wait_queue_head_t waitq;
|
||||
int resolution;
|
||||
int rotation;
|
||||
int consecutive_threshold;
|
||||
int update_cnt;
|
||||
|
||||
/* panel and controller informations */
|
||||
int epd_type;
|
||||
int panel_size_int;
|
||||
int panel_size_float;
|
||||
int panel_model;
|
||||
int tcon_version;
|
||||
int lut_version;
|
||||
|
||||
/* individual controller callbacks */
|
||||
void (*update_partial)(struct auok190xfb_par *par, u16 y1, u16 y2);
|
||||
void (*update_all)(struct auok190xfb_par *par);
|
||||
bool (*need_refresh)(struct auok190xfb_par *par);
|
||||
void (*init)(struct auok190xfb_par *par);
|
||||
void (*recover)(struct auok190xfb_par *par);
|
||||
|
||||
int update_mode; /* mode to use for updates */
|
||||
int last_mode; /* update mode last used */
|
||||
int flash;
|
||||
|
||||
/* power management */
|
||||
int autosuspend_delay;
|
||||
bool standby;
|
||||
bool manual_standby;
|
||||
};
|
||||
|
||||
/**
|
||||
* Board specific platform-data
|
||||
* @init: initialize the controller interface
|
||||
* @cleanup: cleanup the controller interface
|
||||
* @wait_for_rdy: wait until the controller is not busy anymore
|
||||
* @set_ctl: change an interface control
|
||||
* @set_hdb: write a value to the data register
|
||||
* @get_hdb: read a value from the data register
|
||||
* @setup_irq: method to setup the irq handling on the busy gpio
|
||||
* @gpio_nsleep: sleep gpio
|
||||
* @gpio_nrst: reset gpio
|
||||
* @gpio_nbusy: busy gpio
|
||||
* @resolution: one of the AUOK190X_RESOLUTION constants
|
||||
* @rotation: rotation of the framebuffer
|
||||
* @quirks: controller quirks to honor
|
||||
* @fps: frames per second for defio
|
||||
*/
|
||||
struct auok190x_board {
|
||||
int (*init)(struct auok190xfb_par *);
|
||||
void (*cleanup)(struct auok190xfb_par *);
|
||||
int (*wait_for_rdy)(struct auok190xfb_par *);
|
||||
|
||||
void (*set_ctl)(struct auok190xfb_par *, unsigned char, u8);
|
||||
void (*set_hdb)(struct auok190xfb_par *, u16);
|
||||
u16 (*get_hdb)(struct auok190xfb_par *);
|
||||
|
||||
int (*setup_irq)(struct fb_info *);
|
||||
|
||||
int gpio_nsleep;
|
||||
int gpio_nrst;
|
||||
int gpio_nbusy;
|
||||
|
||||
int resolution;
|
||||
int rotation;
|
||||
int quirks;
|
||||
int fps;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user