aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-01-12 16:16:17 -0500
committerMark Brown <broonie@kernel.org>2018-01-12 16:20:29 -0500
commit3a1479599a610cd49cbf91da68963ade90ee0fa3 (patch)
tree9e221f7d87156f6d6c0f997a4c6247ff50819b2d
parent05a76e8101828950a4e7faa3178d418d7fad3db7 (diff)
ASoC: Intel - Convert to use acpi_dev_get_first_match_name()
Instead of home grown snd_soc_acpi_find_name_from_hid() use acpi_dev_get_first_match_name(). Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--include/sound/soc-acpi.h7
-rw-r--r--sound/soc/intel/boards/bytcht_da7213.c2
-rw-r--r--sound/soc/intel/boards/bytcht_es8316.c2
-rw-r--r--sound/soc/intel/boards/bytcr_rt5640.c2
-rw-r--r--sound/soc/intel/boards/bytcr_rt5651.c2
-rw-r--r--sound/soc/intel/boards/cht_bsw_rt5645.c2
-rw-r--r--sound/soc/intel/boards/cht_bsw_rt5672.c2
-rw-r--r--sound/soc/soc-acpi.c33
8 files changed, 6 insertions, 46 deletions
diff --git a/include/sound/soc-acpi.h b/include/sound/soc-acpi.h
index 83320af8def2..082224275f52 100644
--- a/include/sound/soc-acpi.h
+++ b/include/sound/soc-acpi.h
@@ -31,16 +31,9 @@ struct snd_soc_acpi_package_context {
31#define SND_ACPI_I2C_ID_LEN (4 + ACPI_ID_LEN + 3 + 1) 31#define SND_ACPI_I2C_ID_LEN (4 + ACPI_ID_LEN + 3 + 1)
32 32
33#if IS_ENABLED(CONFIG_ACPI) 33#if IS_ENABLED(CONFIG_ACPI)
34/* translation fron HID to I2C name, needed for DAI codec_name */
35const char *snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN]);
36bool snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN], 34bool snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
37 struct snd_soc_acpi_package_context *ctx); 35 struct snd_soc_acpi_package_context *ctx);
38#else 36#else
39static inline const char *
40snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN])
41{
42 return NULL;
43}
44static inline bool 37static inline bool
45snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN], 38snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
46 struct snd_soc_acpi_package_context *ctx) 39 struct snd_soc_acpi_package_context *ctx)
diff --git a/sound/soc/intel/boards/bytcht_da7213.c b/sound/soc/intel/boards/bytcht_da7213.c
index 6219c04d4731..2179dedb28ad 100644
--- a/sound/soc/intel/boards/bytcht_da7213.c
+++ b/sound/soc/intel/boards/bytcht_da7213.c
@@ -243,7 +243,7 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
243 } 243 }
244 244
245 /* fixup codec name based on HID */ 245 /* fixup codec name based on HID */
246 i2c_name = snd_soc_acpi_find_name_from_hid(mach->id); 246 i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
247 if (i2c_name) { 247 if (i2c_name) {
248 snprintf(codec_name, sizeof(codec_name), 248 snprintf(codec_name, sizeof(codec_name),
249 "%s%s", "i2c-", i2c_name); 249 "%s%s", "i2c-", i2c_name);
diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
index 079f35cd4eaf..305e7f4fe55a 100644
--- a/sound/soc/intel/boards/bytcht_es8316.c
+++ b/sound/soc/intel/boards/bytcht_es8316.c
@@ -258,7 +258,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
258 } 258 }
259 259
260 /* fixup codec name based on HID */ 260 /* fixup codec name based on HID */
261 i2c_name = snd_soc_acpi_find_name_from_hid(mach->id); 261 i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
262 if (i2c_name) { 262 if (i2c_name) {
263 snprintf(codec_name, sizeof(codec_name), 263 snprintf(codec_name, sizeof(codec_name),
264 "%s%s", "i2c-", i2c_name); 264 "%s%s", "i2c-", i2c_name);
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index 4548f75498d0..b6a1cfeec830 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -762,7 +762,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
762 } 762 }
763 763
764 /* fixup codec name based on HID */ 764 /* fixup codec name based on HID */
765 i2c_name = snd_soc_acpi_find_name_from_hid(mach->id); 765 i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
766 if (i2c_name) { 766 if (i2c_name) {
767 snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name), 767 snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name),
768 "%s%s", "i2c-", i2c_name); 768 "%s%s", "i2c-", i2c_name);
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 5a6b7dedb773..456526a93dd5 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -539,7 +539,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
539 } 539 }
540 540
541 /* fixup codec name based on HID */ 541 /* fixup codec name based on HID */
542 i2c_name = snd_soc_acpi_find_name_from_hid(mach->id); 542 i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
543 if (i2c_name) { 543 if (i2c_name) {
544 snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name), 544 snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name),
545 "%s%s", "i2c-", i2c_name); 545 "%s%s", "i2c-", i2c_name);
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
index cef6a8c31c8d..976ea6bf9539 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -566,7 +566,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
566 } 566 }
567 567
568 /* fixup codec name based on HID */ 568 /* fixup codec name based on HID */
569 i2c_name = snd_soc_acpi_find_name_from_hid(mach->id); 569 i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
570 if (i2c_name) { 570 if (i2c_name) {
571 snprintf(cht_rt5645_codec_name, sizeof(cht_rt5645_codec_name), 571 snprintf(cht_rt5645_codec_name, sizeof(cht_rt5645_codec_name),
572 "%s%s", "i2c-", i2c_name); 572 "%s%s", "i2c-", i2c_name);
diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c b/sound/soc/intel/boards/cht_bsw_rt5672.c
index 1f3d38dc4fcb..c14a52d2f714 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5672.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5672.c
@@ -396,7 +396,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
396 396
397 /* fixup codec name based on HID */ 397 /* fixup codec name based on HID */
398 if (mach) { 398 if (mach) {
399 i2c_name = snd_soc_acpi_find_name_from_hid(mach->id); 399 i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
400 if (i2c_name) { 400 if (i2c_name) {
401 snprintf(drv->codec_name, sizeof(drv->codec_name), 401 snprintf(drv->codec_name, sizeof(drv->codec_name),
402 "i2c-%s", i2c_name); 402 "i2c-%s", i2c_name);
diff --git a/sound/soc/soc-acpi.c b/sound/soc/soc-acpi.c
index 7f43c9bf3d09..3d7e1ff79139 100644
--- a/sound/soc/soc-acpi.c
+++ b/sound/soc/soc-acpi.c
@@ -16,39 +16,6 @@
16 16
17#include <sound/soc-acpi.h> 17#include <sound/soc-acpi.h>
18 18
19static acpi_status snd_soc_acpi_find_name(acpi_handle handle, u32 level,
20 void *context, void **ret)
21{
22 struct acpi_device *adev;
23 const char *name = NULL;
24
25 if (acpi_bus_get_device(handle, &adev))
26 return AE_OK;
27
28 if (adev->status.present && adev->status.functional) {
29 name = acpi_dev_name(adev);
30 *(const char **)ret = name;
31 return AE_CTRL_TERMINATE;
32 }
33
34 return AE_OK;
35}
36
37const char *snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN])
38{
39 const char *name = NULL;
40 acpi_status status;
41
42 status = acpi_get_devices(hid, snd_soc_acpi_find_name, NULL,
43 (void **)&name);
44
45 if (ACPI_FAILURE(status) || name[0] == '\0')
46 return NULL;
47
48 return name;
49}
50EXPORT_SYMBOL_GPL(snd_soc_acpi_find_name_from_hid);
51
52struct snd_soc_acpi_mach * 19struct snd_soc_acpi_mach *
53snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines) 20snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines)
54{ 21{