blob: 6d19d1577e857f2e4c9da419965349e40ad0c176 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef __HDMI_MSM_H__
14#define __HDMI_MSM_H__
15
16#include <mach/msm_iomap.h>
17#include "external_common.h"
18/* #define PORT_DEBUG */
19
20#ifdef PORT_DEBUG
21const char *hdmi_msm_name(uint32 offset);
22void hdmi_outp(uint32 offset, uint32 value);
23uint32 hdmi_inp(uint32 offset);
24
25#define HDMI_OUTP_ND(offset, value) outpdw(MSM_HDMI_BASE+(offset), (value))
26#define HDMI_OUTP(offset, value) hdmi_outp((offset), (value))
27#define HDMI_INP_ND(offset) inpdw(MSM_HDMI_BASE+(offset))
28#define HDMI_INP(offset) hdmi_inp((offset))
29#else
30#define HDMI_OUTP_ND(offset, value) outpdw(MSM_HDMI_BASE+(offset), (value))
31#define HDMI_OUTP(offset, value) outpdw(MSM_HDMI_BASE+(offset), (value))
32#define HDMI_INP_ND(offset) inpdw(MSM_HDMI_BASE+(offset))
33#define HDMI_INP(offset) inpdw(MSM_HDMI_BASE+(offset))
34#endif
35
Manoj Raoa2c27672011-08-30 17:19:39 -070036
37/*
38 * Ref. HDMI 1.4a
39 * Supplement-1 CEC Section 6, 7
40 */
41struct hdmi_msm_cec_msg {
42 uint8 sender_id;
43 uint8 recvr_id;
44 uint8 opcode;
45 uint8 operand[15];
46 uint8 frame_size;
47 uint8 retransmit;
48};
49
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050#define QFPROM_BASE ((uint32)hdmi_msm_state->qfprom_io)
Manoj Raoa2c27672011-08-30 17:19:39 -070051#define HDMI_BASE ((uint32)hdmi_msm_state->hdmi_io)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052
53struct hdmi_msm_state_type {
54 boolean panel_power_on;
55 boolean hpd_initialized;
56#ifdef CONFIG_SUSPEND
57 boolean pm_suspended;
58#endif
59 int hpd_stable;
60 boolean hpd_prev_state;
61 boolean hpd_cable_chg_detected;
62 boolean full_auth_done;
63 boolean hpd_during_auth;
64 struct work_struct hpd_state_work, hpd_read_work;
65 struct timer_list hpd_state_timer;
66 struct completion ddc_sw_done;
67
68#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL_HDCP_SUPPORT
69 boolean hdcp_activating;
70 boolean reauth ;
71 struct work_struct hdcp_reauth_work, hdcp_work;
72 struct completion hdcp_success_done;
73 struct timer_list hdcp_timer;
74#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL_HDCP_SUPPORT */
75
Manoj Raoa2c27672011-08-30 17:19:39 -070076#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL_CEC_SUPPORT
77 boolean cec_enabled;
78 int cec_logical_addr;
79 struct completion cec_frame_wr_done;
80#define CEC_STATUS_WR_ERROR 0x0001
81#define CEC_STATUS_WR_DONE 0x0002
82#define CEC_STATUS_WR_TMOUT 0x0004
83 uint32 cec_frame_wr_status;
84
85 struct hdmi_msm_cec_msg *cec_queue_start;
86 struct hdmi_msm_cec_msg *cec_queue_wr;
87 struct hdmi_msm_cec_msg *cec_queue_rd;
88 boolean cec_queue_full;
89#define CEC_QUEUE_SIZE 16
90#define CEC_QUEUE_END (hdmi_msm_state->cec_queue_start + CEC_QUEUE_SIZE)
91#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL_CEC_SUPPORT */
92
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093 int irq;
94 struct msm_hdmi_platform_data *pd;
95 struct clk *hdmi_app_clk;
96 struct clk *hdmi_m_pclk;
97 struct clk *hdmi_s_pclk;
98 void __iomem *qfprom_io;
99 void __iomem *hdmi_io;
100
101 struct external_common_state_type common;
102};
103
104extern struct hdmi_msm_state_type *hdmi_msm_state;
105
106uint32 hdmi_msm_get_io_base(void);
107
108#ifdef CONFIG_FB_MSM_HDMI_COMMON
Ravishangar Kalyanam49a83b22011-07-20 15:28:44 -0700109void hdmi_msm_set_mode(boolean power_on);
110int hdmi_msm_clk(int on);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700111void hdmi_phy_reset(void);
Ravishangar Kalyanam49a83b22011-07-20 15:28:44 -0700112void hdmi_msm_reset_core(void);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700113void hdmi_msm_init_phy(int video_format);
114void hdmi_msm_powerdown_phy(void);
115void hdmi_frame_ctrl_cfg(const struct hdmi_disp_mode_timing_type *timing);
116void hdmi_msm_phy_status_poll(void);
117#endif
118
Manoj Raoa2c27672011-08-30 17:19:39 -0700119#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL_CEC_SUPPORT
120void hdmi_msm_cec_init(void);
121void hdmi_msm_cec_write_logical_addr(int addr);
122void hdmi_msm_cec_msg_recv(void);
123void hdmi_msm_cec_one_touch_play(void);
124void hdmi_msm_cec_msg_send(struct hdmi_msm_cec_msg *msg);
125#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL_CEC_SUPPORT */
126
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700127#endif /* __HDMI_MSM_H__ */