blob: d5a545710aece4cc9050a6328e1b03a5c250867f [file] [log] [blame]
Sachin Bhayareeeb88892018-01-02 16:36:01 +05301/* include/linux/msm_hdmi.h
2 *
Sachin Bhayareeeb88892018-01-02 16:36:01 +05303 * Copyright (c) 2014-2015, 2018, The Linux Foundation. All rights reserved.
Sachin Bhayareeeb88892018-01-02 16:36:01 +05304 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
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.
13 */
14#ifndef _MSM_HDMI_H_
15#define _MSM_HDMI_H_
16
17#include <linux/device.h>
18#include <linux/platform_device.h>
19
20/*
21 * HDMI cable notify handler structure.
22 * link A link for the linked list
23 * status Current status of HDMI cable connection
24 * hpd_notify Callback function to provide cable status
25 */
26struct hdmi_cable_notify {
27 struct list_head link;
28 int status;
29 void (*hpd_notify)(struct hdmi_cable_notify *h);
30};
31
32struct msm_hdmi_audio_edid_blk {
33 u8 *audio_data_blk;
34 unsigned int audio_data_blk_size; /* in bytes */
35 u8 *spk_alloc_data_blk;
36 unsigned int spk_alloc_data_blk_size; /* in bytes */
37};
38
39struct msm_hdmi_audio_setup_params {
40 u32 sample_rate_hz;
41 u32 num_of_channels;
42 u32 channel_allocation;
43 u32 level_shift;
44 bool down_mix;
45 u32 sample_present;
46};
47
48struct msm_hdmi_audio_codec_ops {
49 int (*audio_info_setup)(struct platform_device *pdev,
50 struct msm_hdmi_audio_setup_params *params);
51 int (*get_audio_edid_blk)(struct platform_device *pdev,
52 struct msm_hdmi_audio_edid_blk *blk);
53 int (*hdmi_cable_status)(struct platform_device *pdev, u32 vote);
54};
55
56#ifdef CONFIG_FB_MSM_MDSS_HDMI_PANEL
57/*
58 * Register for HDMI cable connect or disconnect notification.
59 * @param handler callback handler for notification
60 * @return negative value as error otherwise current status of cable
61 */
62int register_hdmi_cable_notification(
63 struct hdmi_cable_notify *handler);
64
65/*
66 * Un-register for HDMI cable connect or disconnect notification.
67 * @param handler callback handler for notification
68 * @return negative value as error
69 */
70int unregister_hdmi_cable_notification(
71 struct hdmi_cable_notify *handler);
72
73int msm_hdmi_register_audio_codec(struct platform_device *pdev,
74 struct msm_hdmi_audio_codec_ops *ops);
75
76#else
77static inline int register_hdmi_cable_notification(
78 struct hdmi_cable_notify *handler) {
79 return 0;
80}
81
82static inline int unregister_hdmi_cable_notification(
83 struct hdmi_cable_notify *handler) {
84 return 0;
85}
86
87static inline int msm_hdmi_register_audio_codec(struct platform_device *pdev,
88 struct msm_hdmi_audio_codec_ops *ops) {
89 return 0;
90}
91#endif /* CONFIG_FB_MSM_MDSS_HDMI_PANEL */
92
93#endif /*_MSM_HDMI_H_*/