xref: /linux/drivers/gpu/drm/msm/dp/dp_audio.h (revision 2c1ed907520c50326b8f604907a8478b27881a2e)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
4  */
5 
6 #ifndef _DP_AUDIO_H_
7 #define _DP_AUDIO_H_
8 
9 #include <linux/platform_device.h>
10 
11 #include "dp_catalog.h"
12 #include <sound/hdmi-codec.h>
13 
14 /**
15  * struct msm_dp_audio
16  * @lane_count: number of lanes configured in current session
17  * @bw_code: link rate's bandwidth code for current session
18  */
19 struct msm_dp_audio {
20 	u32 lane_count;
21 	u32 bw_code;
22 };
23 
24 /**
25  * msm_dp_audio_get()
26  *
27  * Creates and instance of dp audio.
28  *
29  * @pdev: caller's platform device instance.
30  * @catalog: an instance of msm_dp_catalog module.
31  *
32  * Returns the error code in case of failure, otherwize
33  * an instance of newly created msm_dp_module.
34  */
35 struct msm_dp_audio *msm_dp_audio_get(struct platform_device *pdev,
36 			struct msm_dp_catalog *catalog);
37 
38 /**
39  * msm_dp_register_audio_driver()
40  *
41  * Registers DP device with hdmi_codec interface.
42  *
43  * @dev: DP device instance.
44  * @msm_dp_audio: an instance of msm_dp_audio module.
45  *
46  *
47  * Returns the error code in case of failure, otherwise
48  * zero on success.
49  */
50 int msm_dp_register_audio_driver(struct device *dev,
51 		struct msm_dp_audio *msm_dp_audio);
52 
53 void msm_dp_unregister_audio_driver(struct device *dev, struct msm_dp_audio *msm_dp_audio);
54 
55 /**
56  * msm_dp_audio_put()
57  *
58  * Cleans the msm_dp_audio instance.
59  *
60  * @msm_dp_audio: an instance of msm_dp_audio.
61  */
62 void msm_dp_audio_put(struct msm_dp_audio *msm_dp_audio);
63 
64 int msm_dp_audio_hw_params(struct device *dev,
65 	void *data,
66 	struct hdmi_codec_daifmt *daifmt,
67 	struct hdmi_codec_params *params);
68 
69 #endif /* _DP_AUDIO_H_ */
70 
71 
72