Skip to content

Commit

Permalink
qsd8k: Port video drivers from 2.6.38
Browse files Browse the repository at this point in the history
  • Loading branch information
maniacx committed Feb 27, 2016
1 parent ea0c1b2 commit f749d39
Show file tree
Hide file tree
Showing 342 changed files with 11,465 additions and 173,523 deletions.
5 changes: 5 additions & 0 deletions arch/arm/mach-msm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ config MSM_REMOTE_SPINLOCK_SFPB
config MSM_ADM3
bool

config MSM_MDP31
bool
depends on ARCH_QSD8X50
default y

config PERFLOCK
depends on CPU_FREQ
depends on ARCH_MSM8960 || ARCH_MSM8X60 || ARCH_QSD8X50 || ARCH_MSM7X30 || ARCH_MSM7X00A || ARCH_MSM7X27A || ARCH_MSM7X25
Expand Down
219 changes: 187 additions & 32 deletions arch/arm/mach-msm/include/mach/msm_fb.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,31 @@
#define _MSM_FB_H_

#include <linux/device.h>
#include <linux/msm_mdp.h>
#include <linux/wakelock.h>
#include <linux/hrtimer.h>
#include <linux/earlysuspend.h>

struct mddi_info;

/* output interface format */
#define MSM_MDP_OUT_IF_FMT_RGB565 0
#define MSM_MDP_OUT_IF_FMT_RGB666 1
#define MSM_MDP_OUT_IF_FMT_RGB888 2

/* mdp override operations */
#define MSM_MDP_PANEL_IGNORE_PIXEL_DATA (1 << 0)
#define MSM_MDP_PANEL_FLIP_UD (1 << 1)
#define MSM_MDP_PANEL_FLIP_LR (1 << 2)
#define MSM_MDP4_MDDI_DMA_SWITCH (1 << 3)
#define MSM_MDP_DMA_PACK_ALIGN_LSB (1 << 4)
#define MSM_MDP_RGB_PANEL_SELF_REFRESH (1 << 5)

/* mddi type */
#define MSM_MDP_MDDI_TYPE_I 0
#define MSM_MDP_MDDI_TYPE_II 1

/* lcdc override operations */
#define MSM_MDP_LCDC_DMA_PACK_ALIGN_LSB (1 << 0)

struct msm_fb_data {
int xres; /* x resolution in pixels */
Expand All @@ -43,11 +61,29 @@ enum {
MSM_MDDI_EMDH_INTERFACE,
MSM_EBI2_INTERFACE,
MSM_LCDC_INTERFACE,
MSM_TV_INTERFACE,

MSM_MDP_NUM_INTERFACES = MSM_LCDC_INTERFACE + 1,
MSM_MDP_NUM_INTERFACES = MSM_TV_INTERFACE + 1
};

#define MSMFB_CAP_PARTIAL_UPDATES (1 << 0)
#define MSMFB_CAP_CABC (1 << 1)

struct msm_lcdc_timing {
unsigned int clk_rate; /* dclk freq */
unsigned int hsync_pulse_width; /* in dclks */
unsigned int hsync_back_porch; /* in dclks */
unsigned int hsync_front_porch; /* in dclks */
unsigned int hsync_skew; /* in dclks */
unsigned int vsync_pulse_width; /* in lines */
unsigned int vsync_back_porch; /* in lines */
unsigned int vsync_front_porch; /* in lines */

/* control signal polarity */
unsigned int vsync_act_low:1;
unsigned int hsync_act_low:1;
unsigned int den_act_low:1;
};

struct msm_panel_data {
/* turns off the fb memory */
Expand All @@ -58,16 +94,49 @@ struct msm_panel_data {
int (*blank)(struct msm_panel_data *);
/* turns on the panel */
int (*unblank)(struct msm_panel_data *);
/* for msmfb shutdown() */
int (*shutdown)(struct msm_panel_data *);
void (*wait_vsync)(struct msm_panel_data *);
void (*request_vsync)(struct msm_panel_data *, struct msmfb_callback *);
void (*clear_vsync)(struct msm_panel_data *);
void (*dump_vsync)(void);
/* change timing on the fly */
int (*adjust_timing)(struct msm_panel_data *, struct msm_lcdc_timing *,
u32 xres, u32 yres);
/* from the enum above */
unsigned interface_type;
/* data to be passed to the fb driver */
struct msm_fb_data *fb_data;

/* capabilities supported by the panel */
uint32_t caps;
/*
* For samsung driver IC, we always need to indicate where
* to draw. So we pass update_into to mddi client.
*
*/
struct {
int left;
int top;
int eright; /* exclusive */
int ebottom; /* exclusive */
} update_info;
};

enum {
MDP_DMA_P = 0,
MDP_DMA_S,
};

struct msm_mdp_platform_data {
/* from the enum above */
int dma_channel;
unsigned overrides;
unsigned color_format;
int tearing_check;
unsigned sync_config;
unsigned sync_thresh;
unsigned sync_start_pos;
};

struct msm_mddi_client_data {
Expand All @@ -76,6 +145,8 @@ struct msm_mddi_client_data {
void (*activate_link)(struct msm_mddi_client_data *);
void (*remote_write)(struct msm_mddi_client_data *, uint32_t val,
uint32_t reg);
void (*remote_write_vals)(struct msm_mddi_client_data *, uint8_t * val,
uint32_t reg, unsigned int nr_bytes);
uint32_t (*remote_read)(struct msm_mddi_client_data *, uint32_t reg);
void (*auto_hibernate)(struct msm_mddi_client_data *, int);
/* custom data that needs to be passed from the board file to a
Expand All @@ -94,10 +165,11 @@ struct msm_mddi_platform_data {
void (*fixup)(uint16_t *mfr_name, uint16_t *product_id);

int vsync_irq;

struct resource *fb_resource; /*optional*/
/* number of clients in the list that follows */
int num_clients;
unsigned type;
/* array of client information of clients */
struct {
unsigned product_id; /* mfr id in top 16 bits, product id
Expand All @@ -120,27 +192,12 @@ struct msm_mddi_platform_data {
} client_platform_data[];
};

struct msm_lcdc_timing {
unsigned int clk_rate; /* dclk freq */
unsigned int hsync_pulse_width; /* in dclks */
unsigned int hsync_back_porch; /* in dclks */
unsigned int hsync_front_porch; /* in dclks */
unsigned int hsync_skew; /* in dclks */
unsigned int vsync_pulse_width; /* in lines */
unsigned int vsync_back_porch; /* in lines */
unsigned int vsync_front_porch; /* in lines */

/* control signal polarity */
unsigned int vsync_act_low:1;
unsigned int hsync_act_low:1;
unsigned int den_act_low:1;
};

struct msm_lcdc_panel_ops {
int (*init)(struct msm_lcdc_panel_ops *);
int (*uninit)(struct msm_lcdc_panel_ops *);
int (*blank)(struct msm_lcdc_panel_ops *);
int (*unblank)(struct msm_lcdc_panel_ops *);
int (*shutdown)(struct msm_lcdc_panel_ops *);
};

struct msm_lcdc_platform_data {
Expand All @@ -149,10 +206,21 @@ struct msm_lcdc_platform_data {
int fb_id;
struct msm_fb_data *fb_data;
struct resource *fb_resource;
unsigned overrides;
};

struct msm_tvenc_platform_data {
struct msm_tvenc_panel_ops *panel_ops;
int fb_id;
struct msm_fb_data *fb_data;
struct resource *fb_resource;
int (*video_relay)(int on_off);
};

struct mdp_blit_req;
struct fb_info;
struct mdp_overlay;
struct msmfb_overlay_data;
struct mdp_device {
struct device dev;
void (*dma)(struct mdp_device *mdp, uint32_t addr,
Expand All @@ -161,16 +229,85 @@ struct mdp_device {
void (*dma_wait)(struct mdp_device *mdp, int interface);
int (*blit)(struct mdp_device *mdp, struct fb_info *fb,
struct mdp_blit_req *req);
#ifdef CONFIG_FB_MSM_OVERLAY
int (*overlay_get)(struct mdp_device *mdp, struct fb_info *fb,
struct mdp_overlay *req);
int (*overlay_set)(struct mdp_device *mdp, struct fb_info *fb,
struct mdp_overlay *req);
int (*overlay_unset)(struct mdp_device *mdp, struct fb_info *fb,
int ndx);
int (*overlay_play)(struct mdp_device *mdp, struct fb_info *fb,
struct msmfb_overlay_data *req, struct file **p_src_file);
#endif
void (*set_grp_disp)(struct mdp_device *mdp, uint32_t disp_id);
void (*configure_dma)(struct mdp_device *mdp);
int (*check_output_format)(struct mdp_device *mdp, int bpp);
int (*set_output_format)(struct mdp_device *mdp, int bpp);
void (*set_panel_size)(struct mdp_device *mdp, int width, int height);
unsigned color_format;
unsigned overrides;
uint32_t width; /*panel width*/
uint32_t height; /*panel height*/
};

struct msmfb_info {
struct fb_info *fb;
struct msm_panel_data *panel;
int xres;
int yres;
unsigned output_format;
unsigned yoffset;
unsigned frame_requested;
unsigned frame_done;
int sleeping;
unsigned update_frame;
struct {
int left;
int top;
int eright; /* exclusive */
int ebottom; /* exclusive */
} update_info;
char *black;
struct early_suspend earlier_suspend;
struct early_suspend early_suspend;
struct wake_lock idle_lock;
spinlock_t update_lock;
struct mutex panel_init_lock;
wait_queue_head_t frame_wq;
struct workqueue_struct *resume_workqueue;
struct work_struct resume_work;
struct work_struct msmfb_resume_work;
struct msmfb_callback dma_callback;
struct msmfb_callback vsync_callback;
struct hrtimer fake_vsync;
ktime_t vsync_request_time;
unsigned fb_resumed;
struct ion_client *iclient;
};

struct class_interface;
int register_mdp_client(struct class_interface *class_intf);

/**** private client data structs go below this line ***/

/*
* Panel private data, include backlight stuff
* 9/28 09', Jay
* */
struct panel_data {
int panel_id;
u32 caps;
int shrink;
/* backlight data */
u8 *pwm;
int min_level;
/* default_br used in turn on backlight, must sync with setting in user space */
int default_br;
int (*shrink_br)(int brightness);
int (*change_cabcmode)(struct msm_mddi_client_data *client_data,
int mode, u8 dimming);
};

struct msm_mddi_bridge_platform_data {
/* from board file */
int (*init)(struct msm_mddi_bridge_platform_data *,
Expand All @@ -182,22 +319,27 @@ struct msm_mddi_bridge_platform_data {
struct msm_mddi_client_data *);
int (*unblank)(struct msm_mddi_bridge_platform_data *,
struct msm_mddi_client_data *);
int (*shutdown)(struct msm_mddi_bridge_platform_data *,
struct msm_mddi_client_data *);
struct msm_fb_data fb_data;

/* board file will identify what capabilities the panel supports */
uint32_t panel_caps;
struct panel_data panel_conf;
/* for those MDDI client which need to re-position display region
after each update or static electricity strike. It should be
implemented in board-xxx-panel due to the function itself need to
send the screen dimensional info of screen to MDDI client.
*/
void (*adjust)(struct msm_mddi_client_data *);
#define SAMSUNG_D 0
#define SAMSUNG_S6 1
int bridge_type;
int panel_type;
uint32_t caps;
/* backlight data */
u8 *pwm;
};


struct mdp_v4l2_req;
int msm_fb_v4l2_enable(struct mdp_overlay *req, bool enable, void **par);
int msm_fb_v4l2_update(void *par,
unsigned long srcp0_addr, unsigned long srcp0_size,
unsigned long srcp1_addr, unsigned long srcp1_size,
unsigned long srcp2_addr, unsigned long srcp2_size);

/*
* This is used to communicate event between msm_fb, mddi, mddi_client,
* This is used to communicate event between msm_fb, mddi, mddi_client,
* and board.
* It's mainly used to reset the display system.
* Also, it is used for battery power policy.
Expand All @@ -209,11 +351,24 @@ int msm_fb_v4l2_update(void *par,

extern int register_display_notifier(struct notifier_block *nb);
extern int display_notifier_call_chain(unsigned long val, void *data);

#define display_notifier(fn, pri) { \
static struct notifier_block fn##_nb = \
{ .notifier_call = fn, .priority = pri }; \
register_display_notifier(&fn##_nb); \
}

#if (defined(CONFIG_USB_FUNCTION_PROJECTOR) || defined(CONFIG_USB_ANDROID_PROJECTOR))
/* For USB Projector to quick access the frame buffer info */
struct msm_fb_info {
unsigned char *fb_addr;
int msmfb_area;
int xres;
int yres;
};

extern int msmfb_get_var(struct msm_fb_info *tmp);
extern int msmfb_get_fb_area(void);
#endif

#endif
31 changes: 1 addition & 30 deletions drivers/video/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2380,36 +2380,7 @@ config FB_PUV3_UNIGFX
Choose this option if you want to use the Unigfx device as a
framebuffer device. Without the support of PCI & AGP.

if ARCH_MSM8X60
# source "drivers/video/msm_8x60/Kconfig"
endif

if ARCH_MSM7X30 && !FB_MSM_NEW
source "drivers/video/msm_7x30/Kconfig"
endif

if FB_MSM_NEW
source "drivers/video/msm/Kconfig"
endif

if (ARCH_MSM8960 || ARCH_MSM7X27A)
# source "drivers/video/msm/Kconfig"
endif

config FB_MSM_NEW
bool
prompt "Use new CAF msm_fb stuff"
depends on ARCH_MSM7X30
default n

config FB_MSM_OVERLAY_LEGACY
bool
prompt "A small hack for ioctl backward compatible before ICS"
depends on FB_MSM_OVERLAY
default n if ARCH_MSM8960
default n if ARCH_MSM8X60
default n if ARCH_MSM7X30

source "drivers/video/msm/Kconfig"

source "drivers/video/omap/Kconfig"
source "drivers/video/omap2/Kconfig"
Expand Down
Loading

0 comments on commit f749d39

Please sign in to comment.