diff options
| author | Dave Airlie <airlied@redhat.com> | 2016-07-04 19:43:02 -0400 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2016-07-04 19:57:23 -0400 |
| commit | 5dd0775e502b26b44e5bcb5f504a977a565f2f3e (patch) | |
| tree | 11d17e1e3e6f25ac84c9c9b165df21d6965d4b32 | |
| parent | dac2c48ca5ac9bb2d6339aaa733c60d5b801ee86 (diff) | |
| parent | efc9194bcff84666832c6493bafa92029ac6634c (diff) | |
Merge tag 'asoc-hdmi-codec-pdata' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into drm-next
ASoC: Add private data for HDMI CODEC callbacks
Allow the HDMI CODECs to get private data passed in in callbacks.
[airlied:
Add STI/mediatek patches from Arnd for drivers merged later in drm tree.]
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
* tag 'asoc-hdmi-codec-pdata' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound:
ASoC: hdmi-codec: callback function will be called with private data
| -rw-r--r-- | drivers/gpu/drm/mediatek/mtk_hdmi.c | 10 | ||||
| -rw-r--r-- | drivers/gpu/drm/sti/sti_hdmi.c | 7 | ||||
| -rw-r--r-- | include/sound/hdmi-codec.h | 13 | ||||
| -rw-r--r-- | sound/soc/codecs/hdmi-codec.c | 15 |
4 files changed, 25 insertions, 20 deletions
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index ba812ef2c9d1..334562d06731 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c | |||
| @@ -1535,7 +1535,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, | |||
| 1535 | * HDMI audio codec callbacks | 1535 | * HDMI audio codec callbacks |
| 1536 | */ | 1536 | */ |
| 1537 | 1537 | ||
| 1538 | static int mtk_hdmi_audio_hw_params(struct device *dev, | 1538 | static int mtk_hdmi_audio_hw_params(struct device *dev, void *data, |
| 1539 | struct hdmi_codec_daifmt *daifmt, | 1539 | struct hdmi_codec_daifmt *daifmt, |
| 1540 | struct hdmi_codec_params *params) | 1540 | struct hdmi_codec_params *params) |
| 1541 | { | 1541 | { |
| @@ -1604,7 +1604,7 @@ static int mtk_hdmi_audio_hw_params(struct device *dev, | |||
| 1604 | return 0; | 1604 | return 0; |
| 1605 | } | 1605 | } |
| 1606 | 1606 | ||
| 1607 | static int mtk_hdmi_audio_startup(struct device *dev) | 1607 | static int mtk_hdmi_audio_startup(struct device *dev, void *data) |
| 1608 | { | 1608 | { |
| 1609 | struct mtk_hdmi *hdmi = dev_get_drvdata(dev); | 1609 | struct mtk_hdmi *hdmi = dev_get_drvdata(dev); |
| 1610 | 1610 | ||
| @@ -1615,7 +1615,7 @@ static int mtk_hdmi_audio_startup(struct device *dev) | |||
| 1615 | return 0; | 1615 | return 0; |
| 1616 | } | 1616 | } |
| 1617 | 1617 | ||
| 1618 | static void mtk_hdmi_audio_shutdown(struct device *dev) | 1618 | static void mtk_hdmi_audio_shutdown(struct device *dev, void *data) |
| 1619 | { | 1619 | { |
| 1620 | struct mtk_hdmi *hdmi = dev_get_drvdata(dev); | 1620 | struct mtk_hdmi *hdmi = dev_get_drvdata(dev); |
| 1621 | 1621 | ||
| @@ -1624,7 +1624,7 @@ static void mtk_hdmi_audio_shutdown(struct device *dev) | |||
| 1624 | mtk_hdmi_audio_disable(hdmi); | 1624 | mtk_hdmi_audio_disable(hdmi); |
| 1625 | } | 1625 | } |
| 1626 | 1626 | ||
| 1627 | int mtk_hdmi_audio_digital_mute(struct device *dev, bool enable) | 1627 | int mtk_hdmi_audio_digital_mute(struct device *dev, void *data, bool enable) |
| 1628 | { | 1628 | { |
| 1629 | struct mtk_hdmi *hdmi = dev_get_drvdata(dev); | 1629 | struct mtk_hdmi *hdmi = dev_get_drvdata(dev); |
| 1630 | 1630 | ||
| @@ -1638,7 +1638,7 @@ int mtk_hdmi_audio_digital_mute(struct device *dev, bool enable) | |||
| 1638 | return 0; | 1638 | return 0; |
| 1639 | } | 1639 | } |
| 1640 | 1640 | ||
| 1641 | static int mtk_hdmi_audio_get_eld(struct device *dev, uint8_t *buf, size_t len) | 1641 | static int mtk_hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf, size_t len) |
| 1642 | { | 1642 | { |
| 1643 | struct mtk_hdmi *hdmi = dev_get_drvdata(dev); | 1643 | struct mtk_hdmi *hdmi = dev_get_drvdata(dev); |
| 1644 | 1644 | ||
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index 927e2b2e5af2..fedc17f98d9b 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c | |||
| @@ -1169,7 +1169,7 @@ static int hdmi_audio_configure(struct sti_hdmi *hdmi, | |||
| 1169 | return hdmi_audio_infoframe_config(hdmi); | 1169 | return hdmi_audio_infoframe_config(hdmi); |
| 1170 | } | 1170 | } |
| 1171 | 1171 | ||
| 1172 | static void hdmi_audio_shutdown(struct device *dev) | 1172 | static void hdmi_audio_shutdown(struct device *dev, void *data) |
| 1173 | { | 1173 | { |
| 1174 | struct sti_hdmi *hdmi = dev_get_drvdata(dev); | 1174 | struct sti_hdmi *hdmi = dev_get_drvdata(dev); |
| 1175 | int audio_cfg; | 1175 | int audio_cfg; |
| @@ -1186,6 +1186,7 @@ static void hdmi_audio_shutdown(struct device *dev) | |||
| 1186 | } | 1186 | } |
| 1187 | 1187 | ||
| 1188 | static int hdmi_audio_hw_params(struct device *dev, | 1188 | static int hdmi_audio_hw_params(struct device *dev, |
| 1189 | void *data, | ||
| 1189 | struct hdmi_codec_daifmt *daifmt, | 1190 | struct hdmi_codec_daifmt *daifmt, |
| 1190 | struct hdmi_codec_params *params) | 1191 | struct hdmi_codec_params *params) |
| 1191 | { | 1192 | { |
| @@ -1221,7 +1222,7 @@ static int hdmi_audio_hw_params(struct device *dev, | |||
| 1221 | return 0; | 1222 | return 0; |
| 1222 | } | 1223 | } |
| 1223 | 1224 | ||
| 1224 | static int hdmi_audio_digital_mute(struct device *dev, bool enable) | 1225 | static int hdmi_audio_digital_mute(struct device *dev, void *data, bool enable) |
| 1225 | { | 1226 | { |
| 1226 | struct sti_hdmi *hdmi = dev_get_drvdata(dev); | 1227 | struct sti_hdmi *hdmi = dev_get_drvdata(dev); |
| 1227 | 1228 | ||
| @@ -1235,7 +1236,7 @@ static int hdmi_audio_digital_mute(struct device *dev, bool enable) | |||
| 1235 | return 0; | 1236 | return 0; |
| 1236 | } | 1237 | } |
| 1237 | 1238 | ||
| 1238 | static int hdmi_audio_get_eld(struct device *dev, uint8_t *buf, size_t len) | 1239 | static int hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf, size_t len) |
| 1239 | { | 1240 | { |
| 1240 | struct sti_hdmi *hdmi = dev_get_drvdata(dev); | 1241 | struct sti_hdmi *hdmi = dev_get_drvdata(dev); |
| 1241 | struct drm_connector *connector = hdmi->drm_connector; | 1242 | struct drm_connector *connector = hdmi->drm_connector; |
diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h index fc3a481ad91e..530c57bdefa0 100644 --- a/include/sound/hdmi-codec.h +++ b/include/sound/hdmi-codec.h | |||
| @@ -53,18 +53,19 @@ struct hdmi_codec_params { | |||
| 53 | int channels; | 53 | int channels; |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | struct hdmi_codec_pdata; | ||
| 56 | struct hdmi_codec_ops { | 57 | struct hdmi_codec_ops { |
| 57 | /* | 58 | /* |
| 58 | * Called when ASoC starts an audio stream setup. | 59 | * Called when ASoC starts an audio stream setup. |
| 59 | * Optional | 60 | * Optional |
| 60 | */ | 61 | */ |
| 61 | int (*audio_startup)(struct device *dev); | 62 | int (*audio_startup)(struct device *dev, void *data); |
| 62 | 63 | ||
| 63 | /* | 64 | /* |
| 64 | * Configures HDMI-encoder for audio stream. | 65 | * Configures HDMI-encoder for audio stream. |
| 65 | * Mandatory | 66 | * Mandatory |
| 66 | */ | 67 | */ |
| 67 | int (*hw_params)(struct device *dev, | 68 | int (*hw_params)(struct device *dev, void *data, |
| 68 | struct hdmi_codec_daifmt *fmt, | 69 | struct hdmi_codec_daifmt *fmt, |
| 69 | struct hdmi_codec_params *hparms); | 70 | struct hdmi_codec_params *hparms); |
| 70 | 71 | ||
| @@ -72,19 +73,20 @@ struct hdmi_codec_ops { | |||
| 72 | * Shuts down the audio stream. | 73 | * Shuts down the audio stream. |
| 73 | * Mandatory | 74 | * Mandatory |
| 74 | */ | 75 | */ |
| 75 | void (*audio_shutdown)(struct device *dev); | 76 | void (*audio_shutdown)(struct device *dev, void *data); |
| 76 | 77 | ||
| 77 | /* | 78 | /* |
| 78 | * Mute/unmute HDMI audio stream. | 79 | * Mute/unmute HDMI audio stream. |
| 79 | * Optional | 80 | * Optional |
| 80 | */ | 81 | */ |
| 81 | int (*digital_mute)(struct device *dev, bool enable); | 82 | int (*digital_mute)(struct device *dev, void *data, bool enable); |
| 82 | 83 | ||
| 83 | /* | 84 | /* |
| 84 | * Provides EDID-Like-Data from connected HDMI device. | 85 | * Provides EDID-Like-Data from connected HDMI device. |
| 85 | * Optional | 86 | * Optional |
| 86 | */ | 87 | */ |
| 87 | int (*get_eld)(struct device *dev, uint8_t *buf, size_t len); | 88 | int (*get_eld)(struct device *dev, void *data, |
| 89 | uint8_t *buf, size_t len); | ||
| 88 | }; | 90 | }; |
| 89 | 91 | ||
| 90 | /* HDMI codec initalization data */ | 92 | /* HDMI codec initalization data */ |
| @@ -93,6 +95,7 @@ struct hdmi_codec_pdata { | |||
| 93 | uint i2s:1; | 95 | uint i2s:1; |
| 94 | uint spdif:1; | 96 | uint spdif:1; |
| 95 | int max_i2s_channels; | 97 | int max_i2s_channels; |
| 98 | void *data; | ||
| 96 | }; | 99 | }; |
| 97 | 100 | ||
| 98 | #define HDMI_CODEC_DRV_NAME "hdmi-audio-codec" | 101 | #define HDMI_CODEC_DRV_NAME "hdmi-audio-codec" |
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 8e36e883e453..f27d115626db 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c | |||
| @@ -112,7 +112,7 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, | |||
| 112 | return ret; | 112 | return ret; |
| 113 | 113 | ||
| 114 | if (hcp->hcd.ops->audio_startup) { | 114 | if (hcp->hcd.ops->audio_startup) { |
| 115 | ret = hcp->hcd.ops->audio_startup(dai->dev->parent); | 115 | ret = hcp->hcd.ops->audio_startup(dai->dev->parent, hcp->hcd.data); |
| 116 | if (ret) { | 116 | if (ret) { |
| 117 | mutex_lock(&hcp->current_stream_lock); | 117 | mutex_lock(&hcp->current_stream_lock); |
| 118 | hcp->current_stream = NULL; | 118 | hcp->current_stream = NULL; |
| @@ -122,8 +122,8 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, | |||
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | if (hcp->hcd.ops->get_eld) { | 124 | if (hcp->hcd.ops->get_eld) { |
| 125 | ret = hcp->hcd.ops->get_eld(dai->dev->parent, hcp->eld, | 125 | ret = hcp->hcd.ops->get_eld(dai->dev->parent, hcp->hcd.data, |
| 126 | sizeof(hcp->eld)); | 126 | hcp->eld, sizeof(hcp->eld)); |
| 127 | 127 | ||
| 128 | if (!ret) { | 128 | if (!ret) { |
| 129 | ret = snd_pcm_hw_constraint_eld(substream->runtime, | 129 | ret = snd_pcm_hw_constraint_eld(substream->runtime, |
| @@ -144,7 +144,7 @@ static void hdmi_codec_shutdown(struct snd_pcm_substream *substream, | |||
| 144 | 144 | ||
| 145 | WARN_ON(hcp->current_stream != substream); | 145 | WARN_ON(hcp->current_stream != substream); |
| 146 | 146 | ||
| 147 | hcp->hcd.ops->audio_shutdown(dai->dev->parent); | 147 | hcp->hcd.ops->audio_shutdown(dai->dev->parent, hcp->hcd.data); |
| 148 | 148 | ||
| 149 | mutex_lock(&hcp->current_stream_lock); | 149 | mutex_lock(&hcp->current_stream_lock); |
| 150 | hcp->current_stream = NULL; | 150 | hcp->current_stream = NULL; |
| @@ -195,8 +195,8 @@ static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, | |||
| 195 | hp.sample_rate = params_rate(params); | 195 | hp.sample_rate = params_rate(params); |
| 196 | hp.channels = params_channels(params); | 196 | hp.channels = params_channels(params); |
| 197 | 197 | ||
| 198 | return hcp->hcd.ops->hw_params(dai->dev->parent, &hcp->daifmt[dai->id], | 198 | return hcp->hcd.ops->hw_params(dai->dev->parent, hcp->hcd.data, |
| 199 | &hp); | 199 | &hcp->daifmt[dai->id], &hp); |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | static int hdmi_codec_set_fmt(struct snd_soc_dai *dai, | 202 | static int hdmi_codec_set_fmt(struct snd_soc_dai *dai, |
| @@ -280,7 +280,8 @@ static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute) | |||
| 280 | dev_dbg(dai->dev, "%s()\n", __func__); | 280 | dev_dbg(dai->dev, "%s()\n", __func__); |
| 281 | 281 | ||
| 282 | if (hcp->hcd.ops->digital_mute) | 282 | if (hcp->hcd.ops->digital_mute) |
| 283 | return hcp->hcd.ops->digital_mute(dai->dev->parent, mute); | 283 | return hcp->hcd.ops->digital_mute(dai->dev->parent, |
| 284 | hcp->hcd.data, mute); | ||
| 284 | 285 | ||
| 285 | return 0; | 286 | return 0; |
| 286 | } | 287 | } |
