* [PATCH 1/2] ASoC: rt5645: Add ACPI match ID @ 2015-04-23 23:35 yang.a.fang 2015-04-23 23:35 ` [PATCH 2/2] ASoC: rt5645: set platform data base on DMI yang.a.fang 2015-04-24 10:14 ` [PATCH 1/2] ASoC: rt5645: Add ACPI match ID Mark Brown 0 siblings, 2 replies; 6+ messages in thread From: yang.a.fang @ 2015-04-23 23:35 UTC (permalink / raw) To: broonie, lgirdwood Cc: alsa-devel, vinod.koul, praveen.k.jain, denny.iriawan, Fang, Yang A, sathyanarayana.nujella, kevin.strasser, bardliao From: "Fang, Yang A" <yang.a.fang@intel.com> This patch adds the ACPI match ID for rt5645/5650 codec Signed-off-by: Fang, Yang A <yang.a.fang@intel.com> --- sound/soc/codecs/rt5645.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index c9a4c5b..e16724a 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -18,6 +18,7 @@ #include <linux/platform_device.h> #include <linux/spi/spi.h> #include <linux/gpio.h> +#include <linux/acpi.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/pcm_params.h> @@ -2618,6 +2619,15 @@ static const struct i2c_device_id rt5645_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, rt5645_i2c_id); +#ifdef CONFIG_ACPI +static struct acpi_device_id rt5645_acpi_match[] = { + { "10EC5645", 0 }, + { "10EC5650", 0 }, + {}, +}; +MODULE_DEVICE_TABLE(acpi, rt5645_acpi_match); +#endif + static int rt5645_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { @@ -2834,6 +2844,7 @@ static struct i2c_driver rt5645_i2c_driver = { .driver = { .name = "rt5645", .owner = THIS_MODULE, + .acpi_match_table = ACPI_PTR(rt5645_acpi_match), }, .probe = rt5645_i2c_probe, .remove = rt5645_i2c_remove, -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] ASoC: rt5645: set platform data base on DMI 2015-04-23 23:35 [PATCH 1/2] ASoC: rt5645: Add ACPI match ID yang.a.fang @ 2015-04-23 23:35 ` yang.a.fang 2015-04-24 10:12 ` Mark Brown 2015-04-25 0:50 ` [PATCH v2] " yang.a.fang 2015-04-24 10:14 ` [PATCH 1/2] ASoC: rt5645: Add ACPI match ID Mark Brown 1 sibling, 2 replies; 6+ messages in thread From: yang.a.fang @ 2015-04-23 23:35 UTC (permalink / raw) To: broonie, lgirdwood Cc: alsa-devel, vinod.koul, praveen.k.jain, denny.iriawan, Fang, Yang A, sathyanarayana.nujella, kevin.strasser, bardliao From: "Fang, Yang A" <yang.a.fang@intel.com> set platform specific data for intel strago platform Signed-off-by: Fang, Yang A <yang.a.fang@intel.com> --- sound/soc/codecs/rt5645.c | 51 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index e16724a..14cabee 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -19,6 +19,7 @@ #include <linux/spi/spi.h> #include <linux/gpio.h> #include <linux/acpi.h> +#include <linux/dmi.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/pcm_params.h> @@ -2628,6 +2629,39 @@ static struct acpi_device_id rt5645_acpi_match[] = { MODULE_DEVICE_TABLE(acpi, rt5645_acpi_match); #endif +static struct rt5645_priv *grt5645; + +static int strago_quirk_cb(const struct dmi_system_id *id) +{ + struct rt5645_priv **rt5645; + + rt5645 = (struct rt5645_priv **)id->driver_data; + + if (*rt5645) { + + (*rt5645)->pdata.dmic_en = 1; + (*rt5645)->pdata.dmic1_data_pin = -1; + (*rt5645)->pdata.dmic2_data_pin = RT5645_DMIC_DATA_IN2P; + (*rt5645)->pdata.en_jd_func = 1; + (*rt5645)->pdata.jd_mode = 3; + + } + + return 1; +} + +static struct dmi_system_id dmi_platform_intel_braswell[] __initdata = { + { + .ident = "Intel Strago", + .callback = strago_quirk_cb, + .matches = { + DMI_MATCH(DMI_PRODUCT_NAME, "Strago"), + }, + .driver_data = (void *)&grt5645, + }, + { } +}; + static int rt5645_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { @@ -2635,17 +2669,32 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, struct rt5645_priv *rt5645; int ret; unsigned int val; + struct gpio_desc *gpiod; rt5645 = devm_kzalloc(&i2c->dev, sizeof(struct rt5645_priv), GFP_KERNEL); if (rt5645 == NULL) return -ENOMEM; + grt5645 = rt5645; rt5645->i2c = i2c; i2c_set_clientdata(i2c, rt5645); - if (pdata) + if (pdata) { rt5645->pdata = *pdata; + } else { + dmi_check_system(dmi_platform_intel_braswell); + gpiod = devm_gpiod_get_index(&i2c->dev, "rt5645", 0); + + if (IS_ERR(gpiod) || gpiod_direction_input(gpiod)) { + rt5645->pdata.hp_det_gpio = -1; + dev_err(&i2c->dev, "failed to initialize gpiod\n"); + } else { + rt5645->pdata.hp_det_gpio = desc_to_gpio(gpiod); + rt5645->pdata.gpio_hp_det_active_high + = !gpiod_is_active_low(gpiod); + } + } rt5645->regmap = devm_regmap_init_i2c(i2c, &rt5645_regmap); if (IS_ERR(rt5645->regmap)) { -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] ASoC: rt5645: set platform data base on DMI 2015-04-23 23:35 ` [PATCH 2/2] ASoC: rt5645: set platform data base on DMI yang.a.fang @ 2015-04-24 10:12 ` Mark Brown 2015-04-25 0:50 ` [PATCH v2] " yang.a.fang 1 sibling, 0 replies; 6+ messages in thread From: Mark Brown @ 2015-04-24 10:12 UTC (permalink / raw) To: yang.a.fang Cc: alsa-devel, vinod.koul, praveen.k.jain, lgirdwood, denny.iriawan, sathyanarayana.nujella, kevin.strasser, bardliao [-- Attachment #1.1: Type: text/plain, Size: 727 bytes --] On Thu, Apr 23, 2015 at 04:35:18PM -0700, yang.a.fang@intel.com wrote: > +static int strago_quirk_cb(const struct dmi_system_id *id) > +{ > + struct rt5645_priv **rt5645; > + > + rt5645 = (struct rt5645_priv **)id->driver_data; > + > + if (*rt5645) { > + > + (*rt5645)->pdata.dmic_en = 1; > + (*rt5645)->pdata.dmic1_data_pin = -1; > + (*rt5645)->pdata.dmic2_data_pin = RT5645_DMIC_DATA_IN2P; > + (*rt5645)->pdata.en_jd_func = 1; > + (*rt5645)->pdata.jd_mode = 3; > + > + } > + > + return 1; > +} This doesn't look good - we're modifying the driver data which should really be global static data. I'd expect us to be doing something like return a pointer to the platform data for the device, not modify things in place. [-- 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] 6+ messages in thread
* [PATCH v2] ASoC: rt5645: set platform data base on DMI 2015-04-23 23:35 ` [PATCH 2/2] ASoC: rt5645: set platform data base on DMI yang.a.fang 2015-04-24 10:12 ` Mark Brown @ 2015-04-25 0:50 ` yang.a.fang 2015-04-27 21:00 ` Mark Brown 1 sibling, 1 reply; 6+ messages in thread From: yang.a.fang @ 2015-04-25 0:50 UTC (permalink / raw) To: broonie, lgirdwood Cc: alsa-devel, vinod.koul, praveen.k.jain, denny.iriawan, Fang, Yang A, sathyanarayana.nujella, kevin.strasser, bardliao From: "Fang, Yang A" <yang.a.fang@intel.com> set platform specific data for intel strago platform Signed-off-by: Fang, Yang A <yang.a.fang@intel.com> --- sound/soc/codecs/rt5645.c | 47 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 61ca49f..07ef1b9 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -19,6 +19,7 @@ #include <linux/spi/spi.h> #include <linux/gpio.h> #include <linux/acpi.h> +#include <linux/dmi.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/pcm_params.h> @@ -2666,6 +2667,34 @@ static struct acpi_device_id rt5645_acpi_match[] = { MODULE_DEVICE_TABLE(acpi, rt5645_acpi_match); #endif +static struct rt5645_platform_data *rt5645_pdata; + +static struct rt5645_platform_data strago_platform_data = { + .dmic_en = true, + .dmic1_data_pin = -1, + .dmic2_data_pin = RT5645_DMIC_DATA_IN2P, + .en_jd_func = true, + .jd_mode = 3, +}; + +static int strago_quirk_cb(const struct dmi_system_id *id) +{ + rt5645_pdata = &strago_platform_data; + + return 1; +} + +static struct dmi_system_id dmi_platform_intel_braswell[] __initdata = { + { + .ident = "Intel Strago", + .callback = strago_quirk_cb, + .matches = { + DMI_MATCH(DMI_PRODUCT_NAME, "Strago"), + }, + }, + { } +}; + static int rt5645_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { @@ -2673,6 +2702,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, struct rt5645_priv *rt5645; int ret; unsigned int val; + struct gpio_desc *gpiod; rt5645 = devm_kzalloc(&i2c->dev, sizeof(struct rt5645_priv), GFP_KERNEL); @@ -2682,8 +2712,23 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, rt5645->i2c = i2c; i2c_set_clientdata(i2c, rt5645); - if (pdata) + if (pdata) { rt5645->pdata = *pdata; + } else { + if (dmi_check_system(dmi_platform_intel_braswell)) { + rt5645->pdata = *rt5645_pdata; + gpiod = devm_gpiod_get_index(&i2c->dev, "rt5645", 0); + + if (IS_ERR(gpiod) || gpiod_direction_input(gpiod)) { + rt5645->pdata.hp_det_gpio = -1; + dev_err(&i2c->dev, "failed to initialize gpiod\n"); + } else { + rt5645->pdata.hp_det_gpio = desc_to_gpio(gpiod); + rt5645->pdata.gpio_hp_det_active_high + = !gpiod_is_active_low(gpiod); + } + } + } rt5645->regmap = devm_regmap_init_i2c(i2c, &rt5645_regmap); if (IS_ERR(rt5645->regmap)) { -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] ASoC: rt5645: set platform data base on DMI 2015-04-25 0:50 ` [PATCH v2] " yang.a.fang @ 2015-04-27 21:00 ` Mark Brown 0 siblings, 0 replies; 6+ messages in thread From: Mark Brown @ 2015-04-27 21:00 UTC (permalink / raw) To: yang.a.fang Cc: alsa-devel, vinod.koul, praveen.k.jain, lgirdwood, denny.iriawan, sathyanarayana.nujella, kevin.strasser, bardliao [-- Attachment #1.1: Type: text/plain, Size: 200 bytes --] On Fri, Apr 24, 2015 at 05:50:54PM -0700, yang.a.fang@intel.com wrote: > From: "Fang, Yang A" <yang.a.fang@intel.com> > > set platform specific data for intel strago platform Applied, thanks. [-- 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] 6+ messages in thread
* Re: [PATCH 1/2] ASoC: rt5645: Add ACPI match ID 2015-04-23 23:35 [PATCH 1/2] ASoC: rt5645: Add ACPI match ID yang.a.fang 2015-04-23 23:35 ` [PATCH 2/2] ASoC: rt5645: set platform data base on DMI yang.a.fang @ 2015-04-24 10:14 ` Mark Brown 1 sibling, 0 replies; 6+ messages in thread From: Mark Brown @ 2015-04-24 10:14 UTC (permalink / raw) To: yang.a.fang Cc: alsa-devel, vinod.koul, praveen.k.jain, lgirdwood, denny.iriawan, sathyanarayana.nujella, kevin.strasser, bardliao [-- Attachment #1.1: Type: text/plain, Size: 203 bytes --] On Thu, Apr 23, 2015 at 04:35:17PM -0700, yang.a.fang@intel.com wrote: > From: "Fang, Yang A" <yang.a.fang@intel.com> > > This patch adds the ACPI match ID for rt5645/5650 codec Applied, thanks. [-- 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] 6+ messages in thread
end of thread, other threads:[~2015-04-27 21:00 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-04-23 23:35 [PATCH 1/2] ASoC: rt5645: Add ACPI match ID yang.a.fang 2015-04-23 23:35 ` [PATCH 2/2] ASoC: rt5645: set platform data base on DMI yang.a.fang 2015-04-24 10:12 ` Mark Brown 2015-04-25 0:50 ` [PATCH v2] " yang.a.fang 2015-04-27 21:00 ` Mark Brown 2015-04-24 10:14 ` [PATCH 1/2] ASoC: rt5645: Add ACPI match ID Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox