blob: d09ca3c1b958b302d3aa635a26fa30dc2b093d6d [file] [log] [blame]
Sachin Bhayareeeb88892018-01-02 16:36:01 +05301/* Copyright (c) 2010-2016, 2018, The Linux Foundation. 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 __MDSS_HDMI_TX_H__
14#define __MDSS_HDMI_TX_H__
15
Sachin Bhayare3d3767e2018-01-02 21:10:57 +053016#include <linux/extcon.h>
Sachin Bhayareeeb88892018-01-02 16:36:01 +053017#include "mdss_hdmi_util.h"
18#include "mdss_hdmi_panel.h"
19#include "mdss_cec_core.h"
20#include "mdss_hdmi_audio.h"
21
22#define MAX_SWITCH_NAME_SIZE 5
23
24enum hdmi_tx_io_type {
25 HDMI_TX_CORE_IO,
26 HDMI_TX_QFPROM_IO,
27 HDMI_TX_HDCP_IO,
28 HDMI_TX_MAX_IO
29};
30
31enum hdmi_tx_power_module_type {
32 HDMI_TX_HPD_PM,
33 HDMI_TX_DDC_PM,
34 HDMI_TX_CORE_PM,
35 HDMI_TX_CEC_PM,
36 HDMI_TX_MAX_PM
37};
38
39/* Data filled from device tree */
40struct hdmi_tx_platform_data {
41 bool primary;
42 bool cont_splash_enabled;
43 bool cond_power_on;
44 struct dss_io_data io[HDMI_TX_MAX_IO];
45 struct dss_module_power power_data[HDMI_TX_MAX_PM];
46 struct reg_bus_client *reg_bus_clt[HDMI_TX_MAX_PM];
47 /* bitfield representing each module's pin state */
48 u64 pin_states;
49 bool pluggable;
50};
51
52struct hdmi_tx_pinctrl {
53 struct pinctrl *pinctrl;
54 struct pinctrl_state *state_active;
55 struct pinctrl_state *state_hpd_active;
56 struct pinctrl_state *state_cec_active;
57 struct pinctrl_state *state_ddc_active;
58 struct pinctrl_state *state_suspend;
59};
60
61struct hdmi_tx_ctrl;
62typedef int (*hdmi_tx_evt_handler) (struct hdmi_tx_ctrl *);
63
64struct hdmi_tx_ctrl {
65 struct platform_device *pdev;
66 struct hdmi_tx_platform_data pdata;
67 struct mdss_panel_data panel_data;
68 struct mdss_util_intf *mdss_util;
69 struct msm_hdmi_mode_timing_info timing;
70 struct hdmi_tx_pinctrl pin_res;
71 struct mutex mutex;
72 struct mutex tx_lock;
73 struct list_head cable_notify_handlers;
74 struct kobject *kobj;
Sachin Bhayare3d3767e2018-01-02 21:10:57 +053075 struct extcon_dev sdev;
Sachin Bhayareeeb88892018-01-02 16:36:01 +053076 struct workqueue_struct *workq;
77 struct hdmi_util_ds_data ds_data;
78 struct completion hpd_int_done;
79 struct work_struct hpd_int_work;
80 struct delayed_work hdcp_cb_work;
81 struct work_struct cable_notify_work;
82 struct hdmi_tx_ddc_ctrl ddc_ctrl;
83 struct hdmi_hdcp_ops *hdcp_ops;
84 struct cec_ops hdmi_cec_ops;
85 struct cec_cbs hdmi_cec_cbs;
86 struct hdmi_audio_ops audio_ops;
87 struct msm_hdmi_audio_setup_params audio_params;
88 struct hdmi_panel_data panel;
89 struct hdmi_panel_ops panel_ops;
90 struct work_struct fps_work;
91
92 spinlock_t hpd_state_lock;
93
94 u32 panel_power_on;
95 u32 panel_suspend;
96 u32 vic;
97 u32 hdmi_tx_ver;
98 u32 max_pclk_khz;
99 u32 hpd_state;
100 u32 hpd_off_pending;
101 u32 hpd_feature_on;
102 u32 hpd_initialized;
103 u32 vote_hdmi_core_on;
104 u32 dynamic_fps;
105 u32 hdcp14_present;
106 u32 enc_lvl;
107 u32 edid_buf_size;
108 u32 s3d_mode;
109
110 u8 timing_gen_on;
111 u8 mhl_hpd_on;
112 u8 hdcp_status;
113 u8 spd_vendor_name[9];
114 u8 spd_product_description[17];
115
116 bool hdcp_feature_on;
117 bool hpd_disabled;
118 bool ds_registered;
119 bool scrambler_enabled;
120 bool hdcp1_use_sw_keys;
121 bool hdcp14_sw_keys;
122 bool auth_state;
123 bool custom_edid;
124 bool sim_mode;
125 bool hdcp22_present;
126 bool power_data_enable[HDMI_TX_MAX_PM];
127
128 void (*hdmi_tx_hpd_done)(void *data);
129 void *downstream_data;
130 void *audio_data;
131 void *feature_data[hweight8(HDMI_TX_FEAT_MAX)];
132 void *hdcp_data;
133 void *evt_arg;
134 u8 *edid_buf;
135
136 char disp_switch_name[MAX_SWITCH_NAME_SIZE];
137
138 hdmi_tx_evt_handler evt_handler[MDSS_EVENT_MAX - 1];
139};
140
141#endif /* __MDSS_HDMI_TX_H__ */