blob: 807444b7c7dbfa9de3bad01484d3b5dca90a6deb [file] [log] [blame]
Ajay Singh Parmar3dc92a22017-08-05 00:09:35 -07001/*
2 * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14
15#ifndef _DP_AUDIO_H_
16#define _DP_AUDIO_H_
17
18#include <linux/platform_device.h>
19
20#include "dp_panel.h"
21#include "dp_catalog.h"
22
23/**
24 * struct dp_audio
25 * @lane_count: number of lanes configured in current session
26 * @bw_code: link rate's bandwidth code for current session
27 */
28struct dp_audio {
29 u32 lane_count;
30 u32 bw_code;
31
Ajay Singh Parmardb147892017-10-18 15:42:41 -070032 struct mutex ops_lock;
33
Ajay Singh Parmar3dc92a22017-08-05 00:09:35 -070034 /**
35 * on()
36 *
37 * Enables the audio by notifying the user module.
38 *
39 * @dp_audio: an instance of struct dp_audio.
40 *
41 * Returns the error code in case of failure, 0 in success case.
42 */
43 int (*on)(struct dp_audio *dp_audio);
44
45 /**
46 * off()
47 *
48 * Disables the audio by notifying the user module.
49 *
50 * @dp_audio: an instance of struct dp_audio.
51 *
52 * Returns the error code in case of failure, 0 in success case.
53 */
54 int (*off)(struct dp_audio *dp_audio);
55};
56
57/**
58 * dp_audio_get()
59 *
60 * Creates and instance of dp audio.
61 *
62 * @pdev: caller's platform device instance.
63 * @panel: an instance of dp_panel module.
64 * @catalog: an instance of dp_catalog_audio module.
65 *
66 * Returns the error code in case of failure, otherwize
67 * an instance of newly created dp_module.
68 */
69struct dp_audio *dp_audio_get(struct platform_device *pdev,
70 struct dp_panel *panel,
71 struct dp_catalog_audio *catalog);
72
73/**
74 * dp_audio_put()
75 *
76 * Cleans the dp_audio instance.
77 *
78 * @dp_audio: an instance of dp_audio.
79 */
80void dp_audio_put(struct dp_audio *dp_audio);
81#endif /* _DP_AUDIO_H_ */
82
83