1 /* include/linux/msm_ext_display.h
3 * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 and
7 * only version 2 as published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 #ifndef _MSM_EXT_DISPLAY_H_
15 #define _MSM_EXT_DISPLAY_H_
17 #include <linux/device.h>
18 #include <linux/platform_device.h>
20 #define AUDIO_ACK_SET_ENABLE BIT(5)
21 #define AUDIO_ACK_ENABLE BIT(4)
22 #define AUDIO_ACK_CONNECT BIT(0)
25 * Flags to be used with the HPD operation of the external display
27 * MSM_EXT_DISP_HPD_AUDIO: audio will be routed to external display
28 * MSM_EXT_DISP_HPD_VIDEO: video will be routed to external display
29 * MSM_EXT_DISP_HPD_ASYNC_AUDIO: don't wait audio notification once wake it up
30 * MSM_EXT_DISP_HPD_ASYNC_VIDEO: don't wait video notification once wake it up
32 #define MSM_EXT_DISP_HPD_AUDIO BIT(0)
33 #define MSM_EXT_DISP_HPD_VIDEO BIT(1)
34 #define MSM_EXT_DISP_HPD_ASYNC_AUDIO BIT(2)
35 #define MSM_EXT_DISP_HPD_ASYNC_VIDEO BIT(3)
38 * struct ext_disp_cable_notify - cable notify handler structure
39 * @link: a link for the linked list
40 * @status: current status of HDMI/DP cable connection
41 * @hpd_notify: callback function to provide cable status
43 struct ext_disp_cable_notify {
44 struct list_head link;
46 void (*hpd_notify)(struct ext_disp_cable_notify *h);
49 struct msm_ext_disp_audio_edid_blk {
51 unsigned int audio_data_blk_size; /* in bytes */
52 u8 *spk_alloc_data_blk;
53 unsigned int spk_alloc_data_blk_size; /* in bytes */
56 struct msm_ext_disp_audio_setup_params {
59 u32 channel_allocation;
66 * External Display identifier for use to determine which interface
67 * the audio driver is interacting with.
69 enum msm_ext_disp_type {
70 EXT_DISPLAY_TYPE_HDMI,
76 * External Display cable state used by display interface to indicate
77 * connect/disconnect of interface.
79 enum msm_ext_disp_cable_state {
80 EXT_DISPLAY_CABLE_DISCONNECT,
81 EXT_DISPLAY_CABLE_CONNECT,
82 EXT_DISPLAY_CABLE_STATE_MAX
86 * External Display power state used by display interface to indicate
87 * power on/off of the interface.
89 enum msm_ext_disp_power_state {
90 EXT_DISPLAY_POWER_OFF,
96 * struct msm_ext_disp_intf_ops - operations exposed to display interface
97 * @hpd: updates external display interface state
98 * @notify: acknowledgment to power on or off
100 struct msm_ext_disp_intf_ops {
101 int (*hpd)(struct platform_device *pdev,
102 enum msm_ext_disp_type type,
103 enum msm_ext_disp_cable_state state,
105 int (*notify)(struct platform_device *pdev,
106 enum msm_ext_disp_cable_state state);
107 int (*ack)(struct platform_device *pdev, u32 ack);
111 * struct msm_ext_disp_audio_codec_ops - operations exposed to audio codec
112 * @audio_info_setup: configure audio on interface
113 * @get_audio_edid_blk: retrieve audio edid block
114 * @cable_status: cable connected/disconnected
115 * @get_intf_id: id of connected interface
116 * @acknowledge: acknowledge audio status
117 * @codec_ready: notify when codec is ready
119 struct msm_ext_disp_audio_codec_ops {
120 int (*audio_info_setup)(struct platform_device *pdev,
121 struct msm_ext_disp_audio_setup_params *params);
122 int (*get_audio_edid_blk)(struct platform_device *pdev,
123 struct msm_ext_disp_audio_edid_blk *blk);
124 int (*cable_status)(struct platform_device *pdev, u32 vote);
125 int (*get_intf_id)(struct platform_device *pdev);
126 void (*teardown_done)(struct platform_device *pdev);
127 int (*acknowledge)(struct platform_device *pdev, u32 ack);
128 void (*codec_ready)(struct platform_device *pdev);
132 * struct msm_ext_disp_init_data - data needed to register the display interface
133 * @disp: external display type
134 * @intf_ops: external display interface operations
135 * @codec_ops: audio codec operations
137 struct msm_ext_disp_init_data {
138 enum msm_ext_disp_type type;
139 struct kobject *kobj;
140 struct msm_ext_disp_intf_ops intf_ops;
141 struct msm_ext_disp_audio_codec_ops codec_ops;
142 struct platform_device *pdev;
146 * msm_ext_disp_register_audio_codec() - audio codec registration
147 * @pdev: platform device pointer
148 * @codec_ops: audio codec operations
150 int msm_ext_disp_register_audio_codec(struct platform_device *pdev,
151 struct msm_ext_disp_audio_codec_ops *ops);
154 * msm_hdmi_register_audio_codec() - wrapper for hdmi audio codec registration
155 * @pdev: platform device pointer
156 * @codec_ops: audio codec operations
158 int msm_hdmi_register_audio_codec(struct platform_device *pdev,
159 struct msm_ext_disp_audio_codec_ops *ops);
161 * msm_ext_disp_register_intf() - display interface registration
162 * @init_data: data needed to register the display interface
164 int msm_ext_disp_register_intf(struct platform_device *pdev,
165 struct msm_ext_disp_init_data *init_data);
167 #endif /*_MSM_EXT_DISPLAY_H_*/