diff mbox

[2/3] ASoC: hdmi-codec: enable OF support

Message ID 1374041536-27643-2-git-send-email-Baohua.Song@csr.com (mailing list archive)
State New, archived
Headers show

Commit Message

Barry Song July 17, 2013, 6:12 a.m. UTC
From: Rongjun Ying <Rongjun.Ying@csr.com>

this makes users be able to add a hdmi-codec node in dts instead of
hardcoding a platform device in mach.

Signed-off-by: Rongjun Ying <Rongjun.Ying@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
---
 sound/soc/codecs/hdmi.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Mark Rutland July 17, 2013, 8:49 a.m. UTC | #1
On Wed, Jul 17, 2013 at 07:12:15AM +0100, Barry Song wrote:
> From: Rongjun Ying <Rongjun.Ying@csr.com>
> 
> this makes users be able to add a hdmi-codec node in dts instead of
> hardcoding a platform device in mach.

Similarly to my comment on the first patch, I'm not sure this is the
best way to wire this up to devicetree. Can this not be hung off of hdmi
controller drivers?

Thanks,
Mark.

> 
> Signed-off-by: Rongjun Ying <Rongjun.Ying@csr.com>
> Signed-off-by: Barry Song <Baohua.Song@csr.com>
> ---
>  sound/soc/codecs/hdmi.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/sound/soc/codecs/hdmi.c b/sound/soc/codecs/hdmi.c
> index 2bcae2b..78c7b15 100644
> --- a/sound/soc/codecs/hdmi.c
> +++ b/sound/soc/codecs/hdmi.c
> @@ -51,10 +51,21 @@ static int hdmi_codec_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_OF
> +static const struct of_device_id hdmi_audio_codec_ids[] = {
> +	{ .compatible = "hdmi-audio-codec", },
> +	{}
> +};
> +MODULE_DEVICE_TABLE(of, hdmi_audio_codec_ids);
> +#endif
> +
>  static struct platform_driver hdmi_codec_driver = {
>  	.driver		= {
>  		.name	= DRV_NAME,
>  		.owner	= THIS_MODULE,
> +#ifdef CONFIG_OF
> +		.of_match_table = hdmi_audio_codec_ids,
> +#endif
>  	},
>  
>  	.probe		= hdmi_codec_probe,
> -- 
> 1.8.2.3
> 
> 
> 
> Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
> More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
Mark Brown July 17, 2013, 9:57 a.m. UTC | #2
On Wed, Jul 17, 2013 at 09:49:10AM +0100, Mark Rutland wrote:
> On Wed, Jul 17, 2013 at 07:12:15AM +0100, Barry Song wrote:

> > this makes users be able to add a hdmi-codec node in dts instead of
> > hardcoding a platform device in mach.

> Similarly to my comment on the first patch, I'm not sure this is the
> best way to wire this up to devicetree. Can this not be hung off of hdmi
> controller drivers?

This one is different to the BT case - as you say it's hanging off the
HDMI controller so the HDMI controller ought to enumerate it either as a
stub or by actually seeing a device.  The platform device is fine but
it's not something that should appear in the DT unless it's conveying
some information about what's connected there (eg, power supplies for
something soldered down on the board).
Barry Song Aug. 6, 2013, 12:03 a.m. UTC | #3
2013/7/17 Mark Brown <broonie@kernel.org>:
> On Wed, Jul 17, 2013 at 09:49:10AM +0100, Mark Rutland wrote:
>> On Wed, Jul 17, 2013 at 07:12:15AM +0100, Barry Song wrote:
>
>> > this makes users be able to add a hdmi-codec node in dts instead of
>> > hardcoding a platform device in mach.
>
>> Similarly to my comment on the first patch, I'm not sure this is the
>> best way to wire this up to devicetree. Can this not be hung off of hdmi
>> controller drivers?
>
> This one is different to the BT case - as you say it's hanging off the
> HDMI controller so the HDMI controller ought to enumerate it either as a
> stub or by actually seeing a device.  The platform device is fine but
> it's not something that should appear in the DT unless it's conveying
> some information about what's connected there (eg, power supplies for
> something soldered down on the board).

it should be ok that the platform_device is allocated and added in the
HDMI controller codes.

-barry
diff mbox

Patch

diff --git a/sound/soc/codecs/hdmi.c b/sound/soc/codecs/hdmi.c
index 2bcae2b..78c7b15 100644
--- a/sound/soc/codecs/hdmi.c
+++ b/sound/soc/codecs/hdmi.c
@@ -51,10 +51,21 @@  static int hdmi_codec_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id hdmi_audio_codec_ids[] = {
+	{ .compatible = "hdmi-audio-codec", },
+	{}
+};
+MODULE_DEVICE_TABLE(of, hdmi_audio_codec_ids);
+#endif
+
 static struct platform_driver hdmi_codec_driver = {
 	.driver		= {
 		.name	= DRV_NAME,
 		.owner	= THIS_MODULE,
+#ifdef CONFIG_OF
+		.of_match_table = hdmi_audio_codec_ids,
+#endif
 	},
 
 	.probe		= hdmi_codec_probe,