alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: <bardliao@realtek.com>
To: broonie@kernel.org, lgirdwood@gmail.com
Cc: oder_chiou@realtek.com, Bard Liao <bardliao@realtek.com>,
	alsa-devel@alsa-project.org, lars@metafoo.de, flove@realtek.com
Subject: [PATCH v2] ASoC: rt286: Set cbj_en for ACPI devices
Date: Thu, 11 Sep 2014 09:40:54 +0800	[thread overview]
Message-ID: <1410399654-10371-1-git-send-email-bardliao@realtek.com> (raw)

From: Bard Liao <bardliao@realtek.com>

This patch set cbj_en value for ACPI devices.

Signed-off-by: Bard Liao <bardliao@realtek.com>
---
 sound/soc/codecs/rt286.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c
index e4f6102..7dfca82 100644
--- a/sound/soc/codecs/rt286.c
+++ b/sound/soc/codecs/rt286.c
@@ -1100,8 +1100,14 @@ static const struct i2c_device_id rt286_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, rt286_i2c_id);
 
+/* the default platform data for acpi devices */
+static struct rt286_platform_data rt286_acpi_data = {
+	.cbj_en = true,
+	.gpio2_en = false,
+};
+
 static const struct acpi_device_id rt286_acpi_match[] = {
-	{ "INT343A", 0 },
+	{ "INT343A", (unsigned long)&rt286_acpi_data },
 	{},
 };
 MODULE_DEVICE_TABLE(acpi, rt286_acpi_match);
@@ -1111,6 +1117,8 @@ static int rt286_i2c_probe(struct i2c_client *i2c,
 {
 	struct rt286_platform_data *pdata = dev_get_platdata(&i2c->dev);
 	struct rt286_priv *rt286;
+	struct device *dev = &i2c->dev;
+	const struct acpi_device_id *acpiid;
 	int i, ret;
 
 	rt286 = devm_kzalloc(&i2c->dev,	sizeof(*rt286),
@@ -1141,6 +1149,13 @@ static int rt286_i2c_probe(struct i2c_client *i2c,
 	if (pdata)
 		rt286->pdata = *pdata;
 
+	/* enable jack combo mode on supported devices */
+	acpiid = acpi_match_device(dev->driver->acpi_match_table, dev);
+	if (acpiid) {
+		rt286->pdata = *(struct rt286_platform_data *)
+				acpiid->driver_data;
+	}
+
 	regmap_write(rt286->regmap, RT286_SET_AUDIO_POWER, AC_PWRST_D3);
 
 	for (i = 0; i < RT286_POWER_REG_LEN; i++)
-- 
1.8.1.1.439.g50a6b54

             reply	other threads:[~2014-09-11  1:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11  1:40 bardliao [this message]
2014-09-12 13:55 ` [PATCH v2] ASoC: rt286: Set cbj_en for ACPI devices Mark Brown
2014-09-16  7:31   ` Liam Girdwood
2014-09-16 16:14     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1410399654-10371-1-git-send-email-bardliao@realtek.com \
    --to=bardliao@realtek.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=flove@realtek.com \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=oder_chiou@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).