#include <linux/module.h>
#include <linux/of_platform.h>
#include <sound/jack.h>
#include <sound/pcm_params.h>
#include <sound/hdmi-codec.h>
#include "fsl_sai.h"
struct cpu_priv { … };
struct imx_hdmi_data { … };
static int imx_hdmi_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{ … }
static const struct snd_soc_ops imx_hdmi_ops = …;
static const struct snd_soc_dapm_widget imx_hdmi_widgets[] = …;
static int imx_hdmi_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
struct snd_soc_component *component = codec_dai->component;
struct imx_hdmi_data *data = snd_soc_card_get_drvdata(card);
int ret;
data->hdmi_jack_pin.pin = "HDMI Jack";
data->hdmi_jack_pin.mask = SND_JACK_LINEOUT;
ret = snd_soc_card_jack_new_pins(card, "HDMI Jack", SND_JACK_LINEOUT,
&data->hdmi_jack,
&data->hdmi_jack_pin, 1);
if (ret) {
dev_err(card->dev, "Can't new HDMI Jack %d\n", ret);
return ret;
}
ret = snd_soc_component_set_jack(component, &data->hdmi_jack, NULL);
if (ret && ret != -ENOTSUPP) {
dev_err(card->dev, "Can't set HDMI Jack %d\n", ret);
return ret;
}
return 0;
};
static int imx_hdmi_probe(struct platform_device *pdev)
{ … }
static const struct of_device_id imx_hdmi_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, imx_hdmi_dt_ids);
static struct platform_driver imx_hdmi_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;