hdmi-codec.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. int bit_clk_inv:1;
  37. int frame_clk_inv:1;
  38. int bit_clk_master:1;
  39. 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_ops {
  52. /*
  53. * Called when ASoC starts an audio stream setup.
  54. * Optional
  55. */
  56. int (*audio_startup)(struct device *dev);
  57. /*
  58. * Configures HDMI-encoder for audio stream.
  59. * Mandatory
  60. */
  61. int (*hw_params)(struct device *dev,
  62. struct hdmi_codec_daifmt *fmt,
  63. struct hdmi_codec_params *hparms);
  64. /*
  65. * Shuts down the audio stream.
  66. * Mandatory
  67. */
  68. void (*audio_shutdown)(struct device *dev);
  69. /*
  70. * Mute/unmute HDMI audio stream.
  71. * Optional
  72. */
  73. int (*digital_mute)(struct device *dev, bool enable);
  74. /*
  75. * Provides EDID-Like-Data from connected HDMI device.
  76. * Optional
  77. */
  78. int (*get_eld)(struct device *dev, uint8_t *buf, size_t len);
  79. };
  80. /* HDMI codec initalization data */
  81. struct hdmi_codec_pdata {
  82. const struct hdmi_codec_ops *ops;
  83. uint i2s:1;
  84. uint spdif:1;
  85. int max_i2s_channels;
  86. };
  87. #define HDMI_CODEC_DRV_NAME "hdmi-audio-codec"
  88. #endif /* __HDMI_CODEC_H__ */