Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+25 -20
+5 -5
drivers/gpu/drm/mediatek/mtk_hdmi.c
··· 1535 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 1539 struct hdmi_codec_daifmt *daifmt, 1540 1540 struct hdmi_codec_params *params) 1541 1541 { ··· 1604 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 1609 struct mtk_hdmi *hdmi = dev_get_drvdata(dev); 1610 1610 ··· 1615 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 1620 struct mtk_hdmi *hdmi = dev_get_drvdata(dev); 1621 1621 ··· 1624 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 1629 struct mtk_hdmi *hdmi = dev_get_drvdata(dev); 1630 1630 ··· 1638 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 1643 struct mtk_hdmi *hdmi = dev_get_drvdata(dev); 1644 1644
+4 -3
drivers/gpu/drm/sti/sti_hdmi.c
··· 1169 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 1174 struct sti_hdmi *hdmi = dev_get_drvdata(dev); 1175 1175 int audio_cfg; ··· 1186 1186 } 1187 1187 1188 1188 static int hdmi_audio_hw_params(struct device *dev, 1189 + void *data, 1189 1190 struct hdmi_codec_daifmt *daifmt, 1190 1191 struct hdmi_codec_params *params) 1191 1192 { ··· 1222 1221 return 0; 1223 1222 } 1224 1223 1225 - static int hdmi_audio_digital_mute(struct device *dev, bool enable) 1224 + static int hdmi_audio_digital_mute(struct device *dev, void *data, bool enable) 1226 1225 { 1227 1226 struct sti_hdmi *hdmi = dev_get_drvdata(dev); 1228 1227 ··· 1236 1235 return 0; 1237 1236 } 1238 1237 1239 - static int hdmi_audio_get_eld(struct device *dev, uint8_t *buf, size_t len) 1238 + static int hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf, size_t len) 1240 1239 { 1241 1240 struct sti_hdmi *hdmi = dev_get_drvdata(dev); 1242 1241 struct drm_connector *connector = hdmi->drm_connector;
+8 -5
include/sound/hdmi-codec.h
··· 53 53 int channels; 54 54 }; 55 55 56 + struct hdmi_codec_pdata; 56 57 struct hdmi_codec_ops { 57 58 /* 58 59 * Called when ASoC starts an audio stream setup. 59 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 65 * Configures HDMI-encoder for audio stream. 65 66 * Mandatory 66 67 */ 67 - int (*hw_params)(struct device *dev, 68 + int (*hw_params)(struct device *dev, void *data, 68 69 struct hdmi_codec_daifmt *fmt, 69 70 struct hdmi_codec_params *hparms); 70 71 ··· 73 72 * Shuts down the audio stream. 74 73 * Mandatory 75 74 */ 76 - void (*audio_shutdown)(struct device *dev); 75 + void (*audio_shutdown)(struct device *dev, void *data); 77 76 78 77 /* 79 78 * Mute/unmute HDMI audio stream. 80 79 * Optional 81 80 */ 82 - int (*digital_mute)(struct device *dev, bool enable); 81 + int (*digital_mute)(struct device *dev, void *data, bool enable); 83 82 84 83 /* 85 84 * Provides EDID-Like-Data from connected HDMI device. 86 85 * Optional 87 86 */ 88 - int (*get_eld)(struct device *dev, uint8_t *buf, size_t len); 87 + int (*get_eld)(struct device *dev, void *data, 88 + uint8_t *buf, size_t len); 89 89 }; 90 90 91 91 /* HDMI codec initalization data */ ··· 95 93 uint i2s:1; 96 94 uint spdif:1; 97 95 int max_i2s_channels; 96 + void *data; 98 97 }; 99 98 100 99 #define HDMI_CODEC_DRV_NAME "hdmi-audio-codec"
+8 -7
sound/soc/codecs/hdmi-codec.c
··· 112 112 return ret; 113 113 114 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 116 if (ret) { 117 117 mutex_lock(&hcp->current_stream_lock); 118 118 hcp->current_stream = NULL; ··· 122 122 } 123 123 124 124 if (hcp->hcd.ops->get_eld) { 125 - ret = hcp->hcd.ops->get_eld(dai->dev->parent, hcp->eld, 126 - sizeof(hcp->eld)); 125 + ret = hcp->hcd.ops->get_eld(dai->dev->parent, hcp->hcd.data, 126 + hcp->eld, sizeof(hcp->eld)); 127 127 128 128 if (!ret) { 129 129 ret = snd_pcm_hw_constraint_eld(substream->runtime, ··· 144 144 145 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 149 mutex_lock(&hcp->current_stream_lock); 150 150 hcp->current_stream = NULL; ··· 195 195 hp.sample_rate = params_rate(params); 196 196 hp.channels = params_channels(params); 197 197 198 - return hcp->hcd.ops->hw_params(dai->dev->parent, &hcp->daifmt[dai->id], 199 - &hp); 198 + return hcp->hcd.ops->hw_params(dai->dev->parent, hcp->hcd.data, 199 + &hcp->daifmt[dai->id], &hp); 200 200 } 201 201 202 202 static int hdmi_codec_set_fmt(struct snd_soc_dai *dai, ··· 280 280 dev_dbg(dai->dev, "%s()\n", __func__); 281 281 282 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 286 return 0; 286 287 }