diff options
author | Jarkko Nikula <jarkko.nikula@linux.intel.com> | 2014-05-16 09:55:25 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-05-16 14:59:25 -0400 |
commit | 70f29d388915723ce03eee74a649f170e4c9f1e0 (patch) | |
tree | 44d97578a94325508ace5a883d97177eeb5d25eb | |
parent | c9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff) |
ASoC: max98090: Add ACPI probing support
Add ACPI ID for MAX98090 and ACPI 5 I2C device probing support.
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | sound/soc/codecs/max98090.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index f7b0b37aa858..aba6ed24c82e 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/pm_runtime.h> | 15 | #include <linux/pm_runtime.h> |
16 | #include <linux/regmap.h> | 16 | #include <linux/regmap.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/acpi.h> | ||
18 | #include <sound/jack.h> | 19 | #include <sound/jack.h> |
19 | #include <sound/pcm.h> | 20 | #include <sound/pcm.h> |
20 | #include <sound/pcm_params.h> | 21 | #include <sound/pcm_params.h> |
@@ -2329,9 +2330,11 @@ static const struct regmap_config max98090_regmap = { | |||
2329 | }; | 2330 | }; |
2330 | 2331 | ||
2331 | static int max98090_i2c_probe(struct i2c_client *i2c, | 2332 | static int max98090_i2c_probe(struct i2c_client *i2c, |
2332 | const struct i2c_device_id *id) | 2333 | const struct i2c_device_id *i2c_id) |
2333 | { | 2334 | { |
2334 | struct max98090_priv *max98090; | 2335 | struct max98090_priv *max98090; |
2336 | const struct acpi_device_id *acpi_id; | ||
2337 | kernel_ulong_t driver_data = 0; | ||
2335 | int ret; | 2338 | int ret; |
2336 | 2339 | ||
2337 | pr_debug("max98090_i2c_probe\n"); | 2340 | pr_debug("max98090_i2c_probe\n"); |
@@ -2341,7 +2344,19 @@ static int max98090_i2c_probe(struct i2c_client *i2c, | |||
2341 | if (max98090 == NULL) | 2344 | if (max98090 == NULL) |
2342 | return -ENOMEM; | 2345 | return -ENOMEM; |
2343 | 2346 | ||
2344 | max98090->devtype = id->driver_data; | 2347 | if (ACPI_HANDLE(&i2c->dev)) { |
2348 | acpi_id = acpi_match_device(i2c->dev.driver->acpi_match_table, | ||
2349 | &i2c->dev); | ||
2350 | if (!acpi_id) { | ||
2351 | dev_err(&i2c->dev, "No driver data\n"); | ||
2352 | return -EINVAL; | ||
2353 | } | ||
2354 | driver_data = acpi_id->driver_data; | ||
2355 | } else if (i2c_id) { | ||
2356 | driver_data = i2c_id->driver_data; | ||
2357 | } | ||
2358 | |||
2359 | max98090->devtype = driver_data; | ||
2345 | i2c_set_clientdata(i2c, max98090); | 2360 | i2c_set_clientdata(i2c, max98090); |
2346 | max98090->pdata = i2c->dev.platform_data; | 2361 | max98090->pdata = i2c->dev.platform_data; |
2347 | max98090->irq = i2c->irq; | 2362 | max98090->irq = i2c->irq; |
@@ -2405,12 +2420,21 @@ static const struct of_device_id max98090_of_match[] = { | |||
2405 | }; | 2420 | }; |
2406 | MODULE_DEVICE_TABLE(of, max98090_of_match); | 2421 | MODULE_DEVICE_TABLE(of, max98090_of_match); |
2407 | 2422 | ||
2423 | #ifdef CONFIG_ACPI | ||
2424 | static struct acpi_device_id max98090_acpi_match[] = { | ||
2425 | { "193C9890", MAX98090 }, | ||
2426 | { } | ||
2427 | }; | ||
2428 | MODULE_DEVICE_TABLE(acpi, max98090_acpi_match); | ||
2429 | #endif | ||
2430 | |||
2408 | static struct i2c_driver max98090_i2c_driver = { | 2431 | static struct i2c_driver max98090_i2c_driver = { |
2409 | .driver = { | 2432 | .driver = { |
2410 | .name = "max98090", | 2433 | .name = "max98090", |
2411 | .owner = THIS_MODULE, | 2434 | .owner = THIS_MODULE, |
2412 | .pm = &max98090_pm, | 2435 | .pm = &max98090_pm, |
2413 | .of_match_table = of_match_ptr(max98090_of_match), | 2436 | .of_match_table = of_match_ptr(max98090_of_match), |
2437 | .acpi_match_table = ACPI_PTR(max98090_acpi_match), | ||
2414 | }, | 2438 | }, |
2415 | .probe = max98090_i2c_probe, | 2439 | .probe = max98090_i2c_probe, |
2416 | .remove = max98090_i2c_remove, | 2440 | .remove = max98090_i2c_remove, |