hdmi-codec.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * hdmi-codec.h - HDMI Codec driver API
  3. *
  4. * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
  5. *
  6. * Author: Jyri Sarha <jsarha@ti.com>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * version 2 as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. */
  17. #ifndef __HDMI_CODEC_H__
  18. #define __HDMI_CODEC_H__
  19. #include <linux/hdmi.h>
  20. #include <drm/drm_edid.h>
  21. #include <sound/asoundef.h>
  22. #include <uapi/sound/asound.h>
  23. /*
  24. * Protocol between ASoC cpu-dai and HDMI-encoder
  25. */
  26. struct hdmi_codec_daifmt {
  27. enum {
  28. HDMI_I2S,
  29. HDMI_RIGHT_J,
  30. HDMI_LEFT_J,
  31. HDMI_DSP_A,
  32. HDMI_DSP_B,
  33. HDMI_AC97,
  34. HDMI_SPDIF,
  35. } fmt;
  36. unsigned int bit_clk_inv:1;
  37. unsigned int frame_clk_inv:1;
  38. unsigned int bit_clk_master:1;
  39. unsigned int frame_clk_master:1;
  40. };
  41. /*
  42. * HDMI audio parameters
  43. */
  44. struct hdmi_codec_params {
  45. struct hdmi_audio_infoframe cea;
  46. struct snd_aes_iec958 iec;
  47. int sample_rate;
  48. int sample_width;
  49. int channels;
  50. };
  51. struct hdmi_codec_pdata;
  52. struct hdmi_codec_ops {
  53. /*
  54. * Called when ASoC starts an audio stream setup.
  55. * Optional
  56. */
  57. int (*audio_startup)(struct device *dev, void *data);
  58. /*
  59. * Configures HDMI-encoder for audio stream.
  60. * Mandatory
  61. */
  62. int (*hw_params)(struct device *dev, void *data,
  63. struct hdmi_codec_daifmt *fmt,
  64. struct hdmi_codec_params *hparms);
  65. /*
  66. * Shuts down the audio stream.
  67. * Mandatory
  68. */
  69. void (*audio_shutdown)(struct device *dev, void *data);
  70. /*
  71. * Mute/unmute HDMI audio stream.
  72. * Optional
  73. */
  74. int (*digital_mute)(struct device *dev, void *data, bool enable);
  75. /*
  76. * Provides EDID-Like-Data from connected HDMI device.
  77. * Optional
  78. */
  79. int (*get_eld)(struct device *dev, void *data,
  80. uint8_t *buf, size_t len);
  81. };
  82. /* HDMI codec initalization data */
  83. struct hdmi_codec_pdata {
  84. const struct hdmi_codec_ops *ops;
  85. uint i2s:1;
  86. uint spdif:1;
  87. int max_i2s_channels;
  88. void *data;
  89. };
  90. #define HDMI_CODEC_DRV_NAME "hdmi-audio-codec"
  91. #endif /* __HDMI_CODEC_H__ */