From a3ce4038441cf66aa3e5d2cfbfe58ff4320229ca Mon Sep 17 00:00:00 2001 From: Tatenda Chipeperekwa Date: Tue, 26 Jul 2016 18:11:55 -0700 Subject: msm: mdss: add external display class helper Implement the external display class helper as a utility to manage display interface and audio codec interactions associated with the cable connect/disconnect events of the display interfaces. The helper class is responsible for routing operations called by the audio codec to a particular display, updating the hdmi switch node, and updating the audio switch node. CRs-Fixed: 1009284 Change-Id: Ie8d1006d3f11091a861733485cb67939ad47fdfe Signed-off-by: Tatenda Chipeperekwa --- include/linux/msm_ext_display.h | 96 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 91 insertions(+), 5 deletions(-) (limited to 'include/linux') diff --git a/include/linux/msm_ext_display.h b/include/linux/msm_ext_display.h index c0a506fa66ec..81a95657a719 100644 --- a/include/linux/msm_ext_display.h +++ b/include/linux/msm_ext_display.h @@ -17,11 +17,15 @@ #include #include -/* - * External display cable notify handler structure. - * link A link for the linked list - * status Current status of HDMI/DP cable connection - * hpd_notify Callback function to provide cable status +#define AUDIO_ACK_SET_ENABLE BIT(5) +#define AUDIO_ACK_ENABLE BIT(4) +#define AUDIO_ACK_CONNECT BIT(0) + +/** + * struct ext_disp_cable_notify - cable notify handler structure + * @link: a link for the linked list + * @status: current status of HDMI/DP cable connection + * @hpd_notify: callback function to provide cable status */ struct ext_disp_cable_notify { struct list_head link; @@ -45,14 +49,96 @@ struct msm_ext_disp_audio_setup_params { u32 sample_present; }; +/** + * External Display identifier for use to determine which interface + * the audio driver is interacting with. + */ +enum msm_ext_disp_type { + EXT_DISPLAY_TYPE_HDMI, + EXT_DISPLAY_TYPE_DP, + EXT_DISPLAY_TYPE_MAX +}; + +/** + * External Display cable state used by display interface to indicate + * connect/disconnect of interface. + */ +enum msm_ext_disp_cable_state { + EXT_DISPLAY_CABLE_DISCONNECT, + EXT_DISPLAY_CABLE_CONNECT, + EXT_DISPLAY_CABLE_STATE_MAX +}; + +/** + * External Display power state used by display interface to indicate + * power on/off of the interface. + */ +enum msm_ext_disp_power_state { + EXT_DISPLAY_POWER_OFF, + EXT_DISPLAY_POWER_ON, + EXT_DISPLAY_POWER_MAX +}; + +/** + * struct msm_ext_disp_intf_ops - operations exposed to display interface + * @hpd: updates external display interface state + * @notify: updates audio framework with interface state + */ +struct msm_ext_disp_intf_ops { + int (*hpd)(struct platform_device *pdev, + enum msm_ext_disp_type type, + enum msm_ext_disp_cable_state state); + int (*notify)(struct platform_device *pdev, + enum msm_ext_disp_cable_state state); + int (*ack)(struct platform_device *pdev, + u32 ack); +}; + +/** + * struct msm_ext_disp_audio_codec_ops - operations exposed to audio codec + * @audio_info_setup: configure audio on interface + * @get_audio_edid_blk: retrieve audio edid block + * @cable_status: cable connected/disconnected + * @get_intf_id: id of connected interface + */ struct msm_ext_disp_audio_codec_ops { int (*audio_info_setup)(struct platform_device *pdev, struct msm_ext_disp_audio_setup_params *params); int (*get_audio_edid_blk)(struct platform_device *pdev, struct msm_ext_disp_audio_edid_blk *blk); int (*cable_status)(struct platform_device *pdev, u32 vote); + int (*get_intf_id)(struct platform_device *pdev); +}; + +/* + * struct msm_ext_disp_init_data - data needed to register the display interface + * @disp: external display type + * @intf_ops: external display interface operations + * @codec_ops: audio codec operations + */ +struct msm_ext_disp_init_data { + enum msm_ext_disp_type type; + struct kobject *kobj; + struct msm_ext_disp_intf_ops intf_ops; + struct msm_ext_disp_audio_codec_ops codec_ops; }; +/* + * msm_ext_disp_register_audio_codec() - audio codec registration + * @pdev: platform device pointer + * @codec_ops: audio codec operations + */ +int msm_ext_disp_register_audio_codec(struct platform_device *pdev, + struct msm_ext_disp_audio_codec_ops *ops); + +/* + * msm_ext_disp_register_intf() - display interface registration + * @init_data: data needed to register the display interface + */ +int msm_ext_disp_register_intf(struct platform_device *pdev, + struct msm_ext_disp_init_data *init_data); + +/* TODO: remove all the display specific functions below */ #ifdef CONFIG_FB_MSM_MDSS_DP_PANEL int msm_dp_register_audio_codec(struct platform_device *pdev, struct msm_ext_disp_audio_codec_ops *ops); -- cgit v1.2.3