diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2010-08-31 01:47:07 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-09-01 06:18:32 -0400 |
commit | 1d6be338c11ddc1e58915ab85e19b0f6cbc10782 (patch) | |
tree | 814386b50bf0c959bbefbb025a17791af1c68e4f /drivers | |
parent | 41a686eedfcec74f5facd487835deff8fb5cef60 (diff) |
ASoC: Add sh_mobile_hdmi sound support
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/sh_mobile_hdmi.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c index 8a05c5b0b9b8..16187d66255c 100644 --- a/drivers/video/sh_mobile_hdmi.c +++ b/drivers/video/sh_mobile_hdmi.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/types.h> | 23 | #include <linux/types.h> |
24 | #include <linux/workqueue.h> | 24 | #include <linux/workqueue.h> |
25 | #include <sound/soc-dapm.h> | ||
26 | #include <sound/initval.h> | ||
25 | 27 | ||
26 | #include <video/sh_mobile_hdmi.h> | 28 | #include <video/sh_mobile_hdmi.h> |
27 | #include <video/sh_mobile_lcdc.h> | 29 | #include <video/sh_mobile_lcdc.h> |
@@ -222,6 +224,62 @@ static u8 hdmi_read(struct sh_hdmi *hdmi, u8 reg) | |||
222 | return ioread8(hdmi->base + reg); | 224 | return ioread8(hdmi->base + reg); |
223 | } | 225 | } |
224 | 226 | ||
227 | /************************************************************************ | ||
228 | |||
229 | |||
230 | HDMI sound | ||
231 | |||
232 | |||
233 | ************************************************************************/ | ||
234 | static unsigned int sh_hdmi_snd_read(struct snd_soc_codec *codec, | ||
235 | unsigned int reg) | ||
236 | { | ||
237 | struct sh_hdmi *hdmi = snd_soc_codec_get_drvdata(codec); | ||
238 | |||
239 | return hdmi_read(hdmi, reg); | ||
240 | } | ||
241 | |||
242 | static int sh_hdmi_snd_write(struct snd_soc_codec *codec, | ||
243 | unsigned int reg, | ||
244 | unsigned int value) | ||
245 | { | ||
246 | struct sh_hdmi *hdmi = snd_soc_codec_get_drvdata(codec); | ||
247 | |||
248 | hdmi_write(hdmi, value, reg); | ||
249 | return 0; | ||
250 | } | ||
251 | |||
252 | static struct snd_soc_dai_driver sh_hdmi_dai = { | ||
253 | .name = "sh_mobile_hdmi-hifi", | ||
254 | .playback = { | ||
255 | .stream_name = "Playback", | ||
256 | .channels_min = 1, | ||
257 | .channels_max = 2, | ||
258 | .rates = SNDRV_PCM_RATE_8000_48000, | ||
259 | .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, | ||
260 | }, | ||
261 | }; | ||
262 | |||
263 | static int sh_hdmi_snd_probe(struct snd_soc_codec *codec) | ||
264 | { | ||
265 | dev_info(codec->dev, "SH Mobile HDMI Audio Codec"); | ||
266 | |||
267 | return 0; | ||
268 | } | ||
269 | |||
270 | static struct snd_soc_codec_driver soc_codec_dev_sh_hdmi = { | ||
271 | .probe = sh_hdmi_snd_probe, | ||
272 | .read = sh_hdmi_snd_read, | ||
273 | .write = sh_hdmi_snd_write, | ||
274 | }; | ||
275 | |||
276 | /************************************************************************ | ||
277 | |||
278 | |||
279 | HDMI video | ||
280 | |||
281 | |||
282 | ************************************************************************/ | ||
225 | /* External video parameter settings */ | 283 | /* External video parameter settings */ |
226 | static void hdmi_external_video_param(struct sh_hdmi *hdmi) | 284 | static void hdmi_external_video_param(struct sh_hdmi *hdmi) |
227 | { | 285 | { |
@@ -910,6 +968,11 @@ static int __init sh_hdmi_probe(struct platform_device *pdev) | |||
910 | return -ENOMEM; | 968 | return -ENOMEM; |
911 | } | 969 | } |
912 | 970 | ||
971 | ret = snd_soc_register_codec(&pdev->dev, | ||
972 | &soc_codec_dev_sh_hdmi, &sh_hdmi_dai, 1); | ||
973 | if (ret < 0) | ||
974 | goto egetclk; | ||
975 | |||
913 | hdmi->dev = &pdev->dev; | 976 | hdmi->dev = &pdev->dev; |
914 | 977 | ||
915 | hdmi->hdmi_clk = clk_get(&pdev->dev, "ick"); | 978 | hdmi->hdmi_clk = clk_get(&pdev->dev, "ick"); |
@@ -1007,6 +1070,8 @@ static int __exit sh_hdmi_remove(struct platform_device *pdev) | |||
1007 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1070 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1008 | int irq = platform_get_irq(pdev, 0); | 1071 | int irq = platform_get_irq(pdev, 0); |
1009 | 1072 | ||
1073 | snd_soc_unregister_codec(&pdev->dev); | ||
1074 | |||
1010 | pdata->lcd_chan->board_cfg.display_on = NULL; | 1075 | pdata->lcd_chan->board_cfg.display_on = NULL; |
1011 | pdata->lcd_chan->board_cfg.display_off = NULL; | 1076 | pdata->lcd_chan->board_cfg.display_off = NULL; |
1012 | pdata->lcd_chan->board_cfg.board_data = NULL; | 1077 | pdata->lcd_chan->board_cfg.board_data = NULL; |