* [PATCH] ASoC: rt286: Set cbj_en for ACPI devices
@ 2014-09-10 1:40 bardliao
2014-09-10 6:32 ` Lars-Peter Clausen
2014-09-10 10:00 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: bardliao @ 2014-09-10 1:40 UTC (permalink / raw)
To: broonie, lgirdwood; +Cc: oder_chiou, Bard Liao, alsa-devel, lars, flove
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 | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c
index e4f6102..d04616b 100644
--- a/sound/soc/codecs/rt286.c
+++ b/sound/soc/codecs/rt286.c
@@ -1106,11 +1106,25 @@ static const struct acpi_device_id rt286_acpi_match[] = {
};
MODULE_DEVICE_TABLE(acpi, rt286_acpi_match);
+struct rt286_acpi_jack {
+ const char *acpi_id;
+ bool jack_combo;
+};
+
+/* list of devices using jack combo mode */
+static struct rt286_acpi_jack rt286_jack_combo[] = {
+ { "INT343A", true },
+ {},
+};
+
static int rt286_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
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;
+ struct rt286_acpi_jack *mach;
int i, ret;
rt286 = devm_kzalloc(&i2c->dev, sizeof(*rt286),
@@ -1141,6 +1155,17 @@ 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) {
+ for (mach = rt286_jack_combo; mach->acpi_id; mach++) {
+ if (!strcmp(mach->acpi_id, acpiid->id))
+ rt286->pdata.cbj_en =
+ rt286_jack_combo->jack_combo;
+
+ }
+ }
+
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ASoC: rt286: Set cbj_en for ACPI devices
2014-09-10 1:40 [PATCH] ASoC: rt286: Set cbj_en for ACPI devices bardliao
@ 2014-09-10 6:32 ` Lars-Peter Clausen
2014-09-10 10:00 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Lars-Peter Clausen @ 2014-09-10 6:32 UTC (permalink / raw)
To: bardliao, broonie, lgirdwood; +Cc: oder_chiou, alsa-devel, flove
On 09/10/2014 03:40 AM, bardliao@realtek.com wrote:
[...]
> + /* enable jack combo mode on supported devices */
> + acpiid = acpi_match_device(dev->driver->acpi_match_table, dev);
> + if (acpiid) {
> + for (mach = rt286_jack_combo; mach->acpi_id; mach++) {
> + if (!strcmp(mach->acpi_id, acpiid->id))
> + rt286->pdata.cbj_en =
> + rt286_jack_combo->jack_combo;
> +
> + }
> + }
Don't invent your own mechanism for this. Use the driver_data field from the
acpi_device_id table.
> +
> regmap_write(rt286->regmap, RT286_SET_AUDIO_POWER, AC_PWRST_D3);
>
> for (i = 0; i < RT286_POWER_REG_LEN; i++)
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ASoC: rt286: Set cbj_en for ACPI devices
2014-09-10 1:40 [PATCH] ASoC: rt286: Set cbj_en for ACPI devices bardliao
2014-09-10 6:32 ` Lars-Peter Clausen
@ 2014-09-10 10:00 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-09-10 10:00 UTC (permalink / raw)
To: bardliao; +Cc: oder_chiou, alsa-devel, lars, lgirdwood, flove
[-- Attachment #1.1: Type: text/plain, Size: 441 bytes --]
On Wed, Sep 10, 2014 at 09:40:33AM +0800, bardliao@realtek.com wrote:
> From: Bard Liao <bardliao@realtek.com>
>
> This patch set cbj_en value for ACPI devices.
> +/* list of devices using jack combo mode */
> +static struct rt286_acpi_jack rt286_jack_combo[] = {
> + { "INT343A", true },
> + {},
> +};
I'm having a hard time believing that all devices ever used in an ACPI
system will have the board configured like this...
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-10 10:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-10 1:40 [PATCH] ASoC: rt286: Set cbj_en for ACPI devices bardliao
2014-09-10 6:32 ` Lars-Peter Clausen
2014-09-10 10:00 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.