Sachin Bhayare | eeb8889 | 2018-01-02 16:36:01 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2016, 2018,The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #ifndef __MDSS_HDMI_AUDIO_H__ |
| 14 | #define __MDSS_HDMI_AUDIO_H__ |
| 15 | |
| 16 | #include <linux/mdss_io_util.h> |
| 17 | #include <linux/msm_hdmi.h> |
| 18 | |
| 19 | #define AUDIO_ACK_SET_ENABLE BIT(5) |
| 20 | #define AUDIO_ACK_ENABLE BIT(4) |
| 21 | #define AUDIO_ACK_CONNECT BIT(0) |
| 22 | |
| 23 | /** |
| 24 | * struct hdmi_audio_status - hdmi audio current status info |
| 25 | * @ack_pending: notification acknowledgment status |
| 26 | * @ack_enabled: acknowledgment feature is enabled or disabled |
| 27 | * @switched: audio notification status for routing |
| 28 | * |
| 29 | * Data for client to query about the current status of audio |
| 30 | */ |
| 31 | struct hdmi_audio_status { |
| 32 | bool ack_pending; |
| 33 | bool ack_enabled; |
| 34 | bool switched; |
| 35 | }; |
| 36 | |
| 37 | /** |
| 38 | * struct hdmi_audio_ops - audio operations for clients to call |
| 39 | * @on: function pointer to enable audio |
| 40 | * @reset: function pointer to reset the audio current status to default |
| 41 | * @status: function pointer to get the current status of audio |
| 42 | * @notify: function pointer to notify other modules for audio routing |
| 43 | * @ack: function pointer to acknowledge audio routing change |
| 44 | * |
| 45 | * Provides client operations for audio functionalities |
| 46 | */ |
| 47 | struct hdmi_audio_ops { |
| 48 | int (*on)(void *ctx, u32 pclk, |
| 49 | struct msm_hdmi_audio_setup_params *params); |
| 50 | void (*off)(void *ctx); |
| 51 | void (*reset)(void *ctx); |
| 52 | void (*status)(void *ctx, struct hdmi_audio_status *status); |
| 53 | void (*notify)(void *ctx, int val); |
| 54 | void (*ack)(void *ctx, u32 ack, u32 hpd); |
| 55 | }; |
| 56 | |
| 57 | /** |
| 58 | * struct hdmi_audio_init_data - data needed for initializing audio module |
| 59 | * @io: pointer to register access related data |
| 60 | * @ops: pointer to populate operation functions. |
| 61 | * |
| 62 | * Defines the data needed to be provided while initializing audio module |
| 63 | */ |
| 64 | struct hdmi_audio_init_data { |
| 65 | struct dss_io_data *io; |
| 66 | struct hdmi_audio_ops *ops; |
| 67 | }; |
| 68 | |
| 69 | void *hdmi_audio_register(struct hdmi_audio_init_data *data); |
| 70 | void hdmi_audio_unregister(void *data); |
| 71 | |
| 72 | #endif /* __MDSS_HDMI_AUDIO_H__ */ |