diff options
-rw-r--r-- | include/sound/hdmi-codec.h | 7 | ||||
-rw-r--r-- | sound/soc/codecs/hdmi-codec.c | 14 |
2 files changed, 21 insertions, 0 deletions
diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h index 83b17682e01c..5272aa17fe03 100644 --- a/include/sound/hdmi-codec.h +++ b/include/sound/hdmi-codec.h @@ -59,6 +59,13 @@ struct hdmi_codec_ops { int (*audio_startup)(struct device *dev, void *data); /* + * Set the bit clock ratio, as needed for some HDMI bridges. + * Optional. + */ + int (*set_bclk_ratio)(struct device *dev, void *data, + unsigned int bclk_ratio); + + /* * Configures HDMI-encoder for audio stream. * Mandatory */ diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index f005751da2cc..ec0468cae0f0 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -491,6 +491,19 @@ static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, cf, &hp); } +static int hdmi_codec_set_bclk_ratio(struct snd_soc_dai *dai, + unsigned int ratio) +{ + struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); + int ret = -EOPNOTSUPP; + + if (hcp->hcd.ops->set_bclk_ratio) + ret = hcp->hcd.ops->set_bclk_ratio(dai->dev->parent, + hcp->hcd.data, ratio); + + return ret; +} + static int hdmi_codec_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { @@ -573,6 +586,7 @@ static const struct snd_soc_dai_ops hdmi_codec_i2s_dai_ops = { .startup = hdmi_codec_startup, .shutdown = hdmi_codec_shutdown, .hw_params = hdmi_codec_hw_params, + .set_bclk_ratio = hdmi_codec_set_bclk_ratio, .set_fmt = hdmi_codec_i2s_set_fmt, .digital_mute = hdmi_codec_digital_mute, }; |