diff mbox

[12/19] ASoC: codec: rt5651: add ACPI and OF support

Message ID 1450406156-22246-13-git-send-email-pierre-louis.bossart@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Pierre-Louis Bossart Dec. 18, 2015, 2:35 a.m. UTC
Add required tables for ACPI and OF matching

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/rt5651.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Mark Brown Dec. 19, 2015, 11:50 a.m. UTC | #1
On Thu, Dec 17, 2015 at 08:35:49PM -0600, Pierre-Louis Bossart wrote:

> +#if defined(CONFIG_OF)
> +static const struct of_device_id rt5651_of_match[] = {
> +	{ .compatible = "realtek,rt5651", },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, rt5651_of_match);
> +#endif

You need a binding document for new DT bindings.
Pierre-Louis Bossart Dec. 21, 2015, 4:18 p.m. UTC | #2
On 12/19/15 5:50 AM, Mark Brown wrote:
> On Thu, Dec 17, 2015 at 08:35:49PM -0600, Pierre-Louis Bossart wrote:
>
>> +#if defined(CONFIG_OF)
>> +static const struct of_device_id rt5651_of_match[] = {
>> +	{ .compatible = "realtek,rt5651", },
>> +	{},
>> +};
>> +MODULE_DEVICE_TABLE(of, rt5651_of_match);
>> +#endif
>
> You need a binding document for new DT bindings.

Ah yes.
I added ACPI and OF support through copy-paste and s/rt5640/rt5651/, but 
I can only test ACPI and wouldn't know what bindings are required so 
will remove this OF part in the next batch.
Bard and team if you want to add OF support please go ahead.
Bard Liao Dec. 23, 2015, 5:29 a.m. UTC | #3
> -----Original Message-----
> From: Pierre-Louis Bossart [mailto:pierre-louis.bossart@linux.intel.com]
> Sent: Tuesday, December 22, 2015 12:19 AM
> To: Mark Brown
> Cc: Bard Liao; alsa-devel@alsa-project.org; Jack Yu
> Subject: Re: [alsa-devel] [PATCH 12/19] ASoC: codec: rt5651: add ACPI and
> OF support
> 
> On 12/19/15 5:50 AM, Mark Brown wrote:
> > On Thu, Dec 17, 2015 at 08:35:49PM -0600, Pierre-Louis Bossart wrote:
> >
> >> +#if defined(CONFIG_OF)
> >> +static const struct of_device_id rt5651_of_match[] = {
> >> +	{ .compatible = "realtek,rt5651", },
> >> +	{},
> >> +};
> >> +MODULE_DEVICE_TABLE(of, rt5651_of_match); #endif
> >
> > You need a binding document for new DT bindings.
> 
> Ah yes.
> I added ACPI and OF support through copy-paste and s/rt5640/rt5651/, but
> I can only test ACPI and wouldn't know what bindings are required so will
> remove this OF part in the next batch.
> Bard and team if you want to add OF support please go ahead.

Sure, I will do it.

> 
> 
> 
> ------Please consider the environment before printing this e-mail.
diff mbox

Patch

diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c
index 1d40318..4df7894 100644
--- a/sound/soc/codecs/rt5651.c
+++ b/sound/soc/codecs/rt5651.c
@@ -18,6 +18,7 @@ 
 #include <linux/regmap.h>
 #include <linux/platform_device.h>
 #include <linux/spi/spi.h>
+#include <linux/acpi.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -1741,6 +1742,22 @@  static const struct i2c_device_id rt5651_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, rt5651_i2c_id);
 
+#if defined(CONFIG_OF)
+static const struct of_device_id rt5651_of_match[] = {
+	{ .compatible = "realtek,rt5651", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, rt5651_of_match);
+#endif
+
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id rt5651_acpi_match[] = {
+	{ "10EC5651", 0 },
+	{ },
+};
+MODULE_DEVICE_TABLE(acpi, rt5651_acpi_match);
+#endif
+
 static int rt5651_i2c_probe(struct i2c_client *i2c,
 		    const struct i2c_device_id *id)
 {
@@ -1806,6 +1823,8 @@  static int rt5651_i2c_remove(struct i2c_client *i2c)
 static struct i2c_driver rt5651_i2c_driver = {
 	.driver = {
 		.name = "rt5651",
+		.acpi_match_table = ACPI_PTR(rt5651_acpi_match),
+		.of_match_table = of_match_ptr(rt5651_of_match),
 	},
 	.probe = rt5651_i2c_probe,
 	.remove   = rt5651_i2c_remove,