0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef __HDMI_CODEC_H__
0011 #define __HDMI_CODEC_H__
0012
0013 #include <linux/of_graph.h>
0014 #include <linux/hdmi.h>
0015 #include <drm/drm_edid.h>
0016 #include <sound/asoundef.h>
0017 #include <sound/soc.h>
0018 #include <uapi/sound/asound.h>
0019
0020
0021
0022
0023 struct hdmi_codec_daifmt {
0024 enum {
0025 HDMI_I2S,
0026 HDMI_RIGHT_J,
0027 HDMI_LEFT_J,
0028 HDMI_DSP_A,
0029 HDMI_DSP_B,
0030 HDMI_AC97,
0031 HDMI_SPDIF,
0032 } fmt;
0033 unsigned int bit_clk_inv:1;
0034 unsigned int frame_clk_inv:1;
0035 unsigned int bit_clk_provider:1;
0036 unsigned int frame_clk_provider:1;
0037
0038
0039
0040
0041 snd_pcm_format_t bit_fmt;
0042 };
0043
0044
0045
0046
0047 struct hdmi_codec_params {
0048 struct hdmi_audio_infoframe cea;
0049 struct snd_aes_iec958 iec;
0050 int sample_rate;
0051 int sample_width;
0052 int channels;
0053 };
0054
0055 typedef void (*hdmi_codec_plugged_cb)(struct device *dev,
0056 bool plugged);
0057
0058 struct hdmi_codec_pdata;
0059 struct hdmi_codec_ops {
0060
0061
0062
0063
0064 int (*audio_startup)(struct device *dev, void *data);
0065
0066
0067
0068
0069
0070 int (*hw_params)(struct device *dev, void *data,
0071 struct hdmi_codec_daifmt *fmt,
0072 struct hdmi_codec_params *hparms);
0073
0074
0075
0076
0077
0078
0079
0080 int (*prepare)(struct device *dev, void *data,
0081 struct hdmi_codec_daifmt *fmt,
0082 struct hdmi_codec_params *hparms);
0083
0084
0085
0086
0087
0088 void (*audio_shutdown)(struct device *dev, void *data);
0089
0090
0091
0092
0093
0094 int (*mute_stream)(struct device *dev, void *data,
0095 bool enable, int direction);
0096
0097
0098
0099
0100
0101 int (*get_eld)(struct device *dev, void *data,
0102 uint8_t *buf, size_t len);
0103
0104
0105
0106
0107
0108 int (*get_dai_id)(struct snd_soc_component *comment,
0109 struct device_node *endpoint);
0110
0111
0112
0113
0114
0115 int (*hook_plugged_cb)(struct device *dev, void *data,
0116 hdmi_codec_plugged_cb fn,
0117 struct device *codec_dev);
0118
0119
0120 unsigned int no_capture_mute:1;
0121 };
0122
0123
0124 struct hdmi_codec_pdata {
0125 const struct hdmi_codec_ops *ops;
0126 uint i2s:1;
0127 uint spdif:1;
0128 int max_i2s_channels;
0129 void *data;
0130 };
0131
0132 struct snd_soc_component;
0133 struct snd_soc_jack;
0134
0135 #define HDMI_CODEC_DRV_NAME "hdmi-audio-codec"
0136
0137 #endif