2010-12-20 14:58:15 +08:00
|
|
|
/* include/linux/hdmi.h
|
|
|
|
|
*
|
|
|
|
|
* 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_HDMI_CORE_H
|
|
|
|
|
#define __LINUX_HDMI_CORE_H
|
|
|
|
|
|
|
|
|
|
#include <linux/device.h>
|
|
|
|
|
#include <linux/workqueue.h>
|
|
|
|
|
#include <linux/i2c.h>
|
2010-12-29 12:33:30 +08:00
|
|
|
#include <linux/completion.h>
|
2011-07-21 09:29:37 +08:00
|
|
|
#include <linux/wakelock.h>
|
2010-12-29 12:33:30 +08:00
|
|
|
|
2011-07-21 09:29:37 +08:00
|
|
|
extern int debug_en;
|
2010-12-29 12:33:30 +08:00
|
|
|
|
2010-12-20 14:58:15 +08:00
|
|
|
#define hdmi_dbg(dev, format, arg...) \
|
2011-07-21 09:29:37 +08:00
|
|
|
do{\
|
|
|
|
|
if(debug_en == 1) \
|
|
|
|
|
dev_printk(KERN_INFO , dev , format , ## arg);\
|
|
|
|
|
}while(0)
|
2010-12-20 14:58:15 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef int BOOL;
|
|
|
|
|
|
|
|
|
|
#define TRUE 1
|
|
|
|
|
#define FALSE 0
|
2011-07-21 09:29:37 +08:00
|
|
|
#define HDMI_DISABLE 0
|
|
|
|
|
#define HDMI_ENABLE 1
|
|
|
|
|
|
|
|
|
|
#define MIN_SCALE 80
|
|
|
|
|
/* mouse event */
|
|
|
|
|
#define MOUSE_NONE 0x00
|
|
|
|
|
#define MOUSE_LEFT_PRESS 0x01
|
|
|
|
|
#define MOUSE_RIGHT_PRESS 0x02
|
|
|
|
|
#define MOUSE_MIDDLE_PRESS 0x04
|
|
|
|
|
#define HDMI_MOUSE_EVENT MOUSE_NONE
|
|
|
|
|
/* mode */
|
|
|
|
|
#define DISP_ON_LCD 0
|
|
|
|
|
#define DISP_ON_HDMI 1
|
|
|
|
|
#define DISP_ON_LCD_AND_HDMI 2
|
|
|
|
|
/* dual display */
|
|
|
|
|
#ifdef CONFIG_HDMI_DUAL_DISP
|
|
|
|
|
#define DUAL_DISP_CAP HDMI_ENABLE
|
|
|
|
|
#define HDMI_DEFAULT_MODE DISP_ON_LCD_AND_HDMI
|
|
|
|
|
#else
|
|
|
|
|
#define DUAL_DISP_CAP HDMI_DISABLE
|
|
|
|
|
#define HDMI_DEFAULT_MODE DISP_ON_HDMI
|
|
|
|
|
#endif
|
2010-12-29 12:33:30 +08:00
|
|
|
/* resolution */
|
2011-07-21 09:29:37 +08:00
|
|
|
#define HDMI_1920x1080p_50Hz 0
|
|
|
|
|
#define HDMI_1920x1080p_60Hz 1
|
|
|
|
|
#define HDMI_1280x720p_50Hz 2
|
|
|
|
|
#define HDMI_1280x720p_60Hz 3
|
|
|
|
|
#define HDMI_720x576p_50Hz_4x3 4
|
|
|
|
|
#define HDMI_720x576p_50Hz_16x9 5
|
|
|
|
|
#define HDMI_720x480p_60Hz_4x3 6
|
|
|
|
|
#define HDMI_720x480p_60Hz_16x9 7
|
|
|
|
|
|
2010-12-29 12:33:30 +08:00
|
|
|
/* HDMI default resolution */
|
2012-03-27 20:09:59 -07:00
|
|
|
#define HDMI_DEFAULT_RESOLUTION HDMI_1920x1080p_50Hz
|
2010-12-29 12:33:30 +08:00
|
|
|
/* I2S Fs */
|
|
|
|
|
#define HDMI_I2S_Fs_44100 0
|
|
|
|
|
#define HDMI_I2S_Fs_48000 2
|
|
|
|
|
/* I2S default sample rate */
|
|
|
|
|
#define HDMI_I2S_DEFAULT_Fs HDMI_I2S_Fs_44100
|
2010-12-20 20:47:31 +08:00
|
|
|
|
2010-12-20 14:58:15 +08:00
|
|
|
|
|
|
|
|
#define HDMI_MAX_ID 32
|
2011-07-21 09:29:37 +08:00
|
|
|
struct hdmi;
|
|
|
|
|
struct hdmi_ops{
|
|
|
|
|
int (*set_param)(struct hdmi *);
|
|
|
|
|
int (*hdmi_precent)(struct hdmi *);
|
|
|
|
|
int (*insert)(struct hdmi *);
|
|
|
|
|
int (*remove)(struct hdmi *);
|
|
|
|
|
int (*init)(struct hdmi*);
|
|
|
|
|
};
|
2010-12-20 14:58:15 +08:00
|
|
|
struct hdmi {
|
|
|
|
|
int id;
|
2010-12-29 12:33:30 +08:00
|
|
|
int wait;
|
2010-12-20 14:58:15 +08:00
|
|
|
BOOL display_on;
|
|
|
|
|
BOOL plug;
|
|
|
|
|
BOOL hdcp_on;
|
|
|
|
|
BOOL param_conf;
|
|
|
|
|
|
|
|
|
|
u8 resolution;
|
2011-07-21 09:29:37 +08:00
|
|
|
u8 scale;
|
|
|
|
|
u8 scale_set;
|
2010-12-20 14:58:15 +08:00
|
|
|
u8 audio_fs;
|
2011-07-21 09:29:37 +08:00
|
|
|
int mode;
|
|
|
|
|
int dual_disp;
|
|
|
|
|
struct timer_list timer;
|
|
|
|
|
struct mutex lock;
|
|
|
|
|
struct device *dev;
|
|
|
|
|
struct delayed_work work;
|
2010-12-29 12:33:30 +08:00
|
|
|
struct completion complete;
|
2011-07-21 09:29:37 +08:00
|
|
|
const struct hdmi_ops *ops;
|
2010-12-29 12:33:30 +08:00
|
|
|
|
2011-07-21 09:29:37 +08:00
|
|
|
unsigned long priv[0] ____cacheline_aligned;
|
2010-12-20 14:58:15 +08:00
|
|
|
};
|
2011-07-21 09:29:37 +08:00
|
|
|
extern int hdmi_is_insert(void);
|
|
|
|
|
extern void *hdmi_priv(struct hdmi *hdmi);
|
|
|
|
|
extern struct hdmi *hdmi_register(int extra, struct device *parent);
|
2010-12-20 14:58:15 +08:00
|
|
|
extern void hdmi_unregister(struct hdmi *hdmi);
|
2011-07-21 09:29:37 +08:00
|
|
|
extern void hdmi_changed(struct hdmi *hdmi, int msec);
|
2010-12-20 14:58:15 +08:00
|
|
|
|
2010-12-29 12:33:30 +08:00
|
|
|
extern int hdmi_switch_fb(struct hdmi *hdmi, int type);
|
2011-07-21 09:29:37 +08:00
|
|
|
extern void hdmi_suspend(struct hdmi *hdmi);
|
|
|
|
|
extern void hdmi_resume(struct hdmi *hdmi);
|
2010-12-24 10:12:35 +08:00
|
|
|
extern struct hdmi *get_hdmi_struct(int nr);
|
2010-12-20 14:58:15 +08:00
|
|
|
|
2011-07-21 09:29:37 +08:00
|
|
|
extern void hdmi_set_spk(int on);
|
|
|
|
|
extern void hdmi_set_backlight(int on);
|
|
|
|
|
extern int hdmi_get_scale(void);
|
|
|
|
|
extern int hdmi_set_scale(int event, char *data, int len);
|
|
|
|
|
extern int fb_get_video_mode(void);
|
|
|
|
|
extern int display_on_hdmi(void);
|
2011-12-05 16:42:45 +08:00
|
|
|
extern int hdmi_get_data(void);
|
|
|
|
|
extern int hdmi_set_data(int data);
|
2010-12-20 14:58:15 +08:00
|
|
|
#endif
|