* [PATCH v3 0/3] ACPI, ASoC, gpio: Add and use acpi_dev_get_first_match_name()
@ 2018-01-05 16:09 Andy Shevchenko
  2018-01-05 16:09 ` [PATCH v3 1/3] ACPI / utils: Introduce acpi_dev_get_first_match_name() Andy Shevchenko
                   ` (4 more replies)
  0 siblings, 5 replies; 22+ messages in thread
From: Andy Shevchenko @ 2018-01-05 16:09 UTC (permalink / raw)
  To: Rafael J . Wysocki, Erik Schmauss, linux-acpi,
	Pierre-Louis Bossart, Liam Girdwood, Mark Brown, alsa-devel,
	Linus Walleij, linux-gpio, Mika Westerberg
  Cc: Andy Shevchenko
It appears that at least one current user (patch 3) and upcoming one
(patch 2) need to get device name by ACPI HID.
Here we introduce acpi_dev_get_first_match_name() based on code
done for acpi_dev_present() and reuse it where appropriate.
The series has been tested on Intel Edison with non-ACPI and
ACPI enabled versions of U-Boot, while patches 1 and 3 were tested
by Pierre.
Since patch 1 and cross subsystem nature of the series I think
the best way is to push this (patches 1 and 2) via Rafael's linux-pm tree.
Taking into consideration that patch 3 requires not-yet-applied work
from Pierre, I left it for reference, in particular to show the LOC
statistics.
Changelog v3:
- add Pierre's tag (I dared to do this for both patches 1 and 3)
- address comment about function name (patch 1)
- add a reference to the first user (patch 1)
- consolidate pin control device possible names in one place (patch 2)
- rebase ASoC patch on not-yet-applied series from Pierre (patch 3), and
- thus reordered to make it last in the series (patch 3)
Andy Shevchenko (3):
  ACPI / utils: Introduce acpi_dev_get_first_match_name()
  gpio: merrifield: Add support of ACPI enabled platforms
  ASoC: Intel - Convert to use acpi_dev_get_first_match_name()
 drivers/acpi/utils.c                    | 41 +++++++++++++++++++++++++++------
 drivers/gpio/gpio-merrifield.c          | 11 ++++++++-
 include/acpi/acpi_bus.h                 |  3 +++
 include/linux/acpi.h                    |  6 +++++
 include/sound/soc-acpi.h                |  7 ------
 sound/soc/intel/boards/bytcht_da7213.c  |  2 +-
 sound/soc/intel/boards/bytcht_es8316.c  |  2 +-
 sound/soc/intel/boards/bytcr_rt5640.c   |  2 +-
 sound/soc/intel/boards/bytcr_rt5651.c   |  2 +-
 sound/soc/intel/boards/cht_bsw_rt5645.c |  2 +-
 sound/soc/intel/boards/cht_bsw_rt5672.c |  2 +-
 sound/soc/soc-acpi.c                    | 33 --------------------------
 12 files changed, 59 insertions(+), 54 deletions(-)
-- 
2.15.1
^ permalink raw reply	[flat|nested] 22+ messages in thread
* [PATCH v3 1/3] ACPI / utils: Introduce acpi_dev_get_first_match_name()
  2018-01-05 16:09 [PATCH v3 0/3] ACPI, ASoC, gpio: Add and use acpi_dev_get_first_match_name() Andy Shevchenko
@ 2018-01-05 16:09 ` Andy Shevchenko
  2018-01-05 23:27   ` Rafael J. Wysocki
  2018-01-12 20:01   ` Applied "ACPI: utils: Introduce acpi_dev_get_first_match_name()" to the asoc tree Mark Brown
  2018-01-05 16:09 ` [PATCH v3 2/3] gpio: merrifield: Add support of ACPI enabled platforms Andy Shevchenko
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 22+ messages in thread
From: Andy Shevchenko @ 2018-01-05 16:09 UTC (permalink / raw)
  To: Rafael J . Wysocki, Erik Schmauss, linux-acpi,
	Pierre-Louis Bossart, Liam Girdwood, Mark Brown, alsa-devel,
	Linus Walleij, linux-gpio, Mika Westerberg
  Cc: Andy Shevchenko
Sometimes the user wants to have device name of the match rather than
just checking if device present or not. To make life easier for such
users introduce acpi_dev_get_first_match_name() helper based on code
for acpi_dev_present().
For example, GPIO driver for Intel Merrifield needs to know the device
name of pin control to be able to apply GPIO mapping table to the proper
device.
To be more consistent with the purpose rename
  struct acpi_dev_present_info  -> struct acpi_dev_match_info
  acpi_dev_present_cb()         -> acpi_dev_match_cb()
in the utils.c file.
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/acpi/utils.c    | 41 ++++++++++++++++++++++++++++++++++-------
 include/acpi/acpi_bus.h |  3 +++
 include/linux/acpi.h    |  6 ++++++
 3 files changed, 43 insertions(+), 7 deletions(-)
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 9d49a1acebe3..78db97687f26 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -737,16 +737,17 @@ bool acpi_dev_found(const char *hid)
 }
 EXPORT_SYMBOL(acpi_dev_found);
 
-struct acpi_dev_present_info {
+struct acpi_dev_match_info {
+	const char *dev_name;
 	struct acpi_device_id hid[2];
 	const char *uid;
 	s64 hrv;
 };
 
-static int acpi_dev_present_cb(struct device *dev, void *data)
+static int acpi_dev_match_cb(struct device *dev, void *data)
 {
 	struct acpi_device *adev = to_acpi_device(dev);
-	struct acpi_dev_present_info *match = data;
+	struct acpi_dev_match_info *match = data;
 	unsigned long long hrv;
 	acpi_status status;
 
@@ -757,6 +758,8 @@ static int acpi_dev_present_cb(struct device *dev, void *data)
 	    strcmp(adev->pnp.unique_id, match->uid)))
 		return 0;
 
+	match->dev_name = acpi_dev_name(adev);
+
 	if (match->hrv == -1)
 		return 1;
 
@@ -789,20 +792,44 @@ static int acpi_dev_present_cb(struct device *dev, void *data)
  */
 bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
 {
-	struct acpi_dev_present_info match = {};
+	struct acpi_dev_match_info match = {};
 	struct device *dev;
 
 	strlcpy(match.hid[0].id, hid, sizeof(match.hid[0].id));
 	match.uid = uid;
 	match.hrv = hrv;
 
-	dev = bus_find_device(&acpi_bus_type, NULL, &match,
-			      acpi_dev_present_cb);
-
+	dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb);
 	return !!dev;
 }
 EXPORT_SYMBOL(acpi_dev_present);
 
+/**
+ * acpi_dev_get_first_match_name - Return name of first match of ACPI device
+ * @hid: Hardware ID of the device.
+ * @uid: Unique ID of the device, pass NULL to not check _UID
+ * @hrv: Hardware Revision of the device, pass -1 to not check _HRV
+ *
+ * Return device name if a matching device was present
+ * at the moment of invocation, or NULL otherwise.
+ *
+ * See additional information in acpi_dev_present() as well.
+ */
+const char *
+acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
+{
+	struct acpi_dev_match_info match = {};
+	struct device *dev;
+
+	strlcpy(match.hid[0].id, hid, sizeof(match.hid[0].id));
+	match.uid = uid;
+	match.hrv = hrv;
+
+	dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb);
+	return dev ? match.dev_name : NULL;
+}
+EXPORT_SYMBOL(acpi_dev_get_first_match_name);
+
 /*
  * acpi_backlight= handling, this is done here rather then in video_detect.c
  * because __setup cannot be used in modules.
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 79287629c888..c9608b0b80c6 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -91,6 +91,9 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev,
 bool acpi_dev_found(const char *hid);
 bool acpi_dev_present(const char *hid, const char *uid, s64 hrv);
 
+const char *
+acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv);
+
 #ifdef CONFIG_ACPI
 
 #include <linux/proc_fs.h>
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 60f0d3248125..493ac6451773 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -642,6 +642,12 @@ static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
 	return false;
 }
 
+static inline const char *
+acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
+{
+	return NULL;
+}
+
 static inline bool is_acpi_node(struct fwnode_handle *fwnode)
 {
 	return false;
-- 
2.15.1
^ permalink raw reply related	[flat|nested] 22+ messages in thread
* [PATCH v3 2/3] gpio: merrifield: Add support of ACPI enabled platforms
  2018-01-05 16:09 [PATCH v3 0/3] ACPI, ASoC, gpio: Add and use acpi_dev_get_first_match_name() Andy Shevchenko
  2018-01-05 16:09 ` [PATCH v3 1/3] ACPI / utils: Introduce acpi_dev_get_first_match_name() Andy Shevchenko
@ 2018-01-05 16:09 ` Andy Shevchenko
  2018-01-06  9:32   ` Mika Westerberg
                     ` (2 more replies)
  2018-01-05 16:09 ` [PATCH v3 3/3] ASoC: Intel - Convert to use acpi_dev_get_first_match_name() Andy Shevchenko
                   ` (2 subsequent siblings)
  4 siblings, 3 replies; 22+ messages in thread
From: Andy Shevchenko @ 2018-01-05 16:09 UTC (permalink / raw)
  To: Rafael J . Wysocki, Erik Schmauss, linux-acpi,
	Pierre-Louis Bossart, Liam Girdwood, Mark Brown, alsa-devel,
	Linus Walleij, linux-gpio, Mika Westerberg
  Cc: Andy Shevchenko
The driver needs the pin control device name for ACPI.
We are looking through ACPI namespace and return first found device
based on ACPI HID for Intel Merrifield FLIS (pin control device).
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-merrifield.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c
index dd67a31ac337..c38624ea0251 100644
--- a/drivers/gpio/gpio-merrifield.c
+++ b/drivers/gpio/gpio-merrifield.c
@@ -9,6 +9,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/acpi.h>
 #include <linux/bitops.h>
 #include <linux/gpio/driver.h>
 #include <linux/init.h>
@@ -380,9 +381,16 @@ static void mrfld_irq_init_hw(struct mrfld_gpio *priv)
 	}
 }
 
+static const char *mrfld_gpio_get_pinctrl_dev_name(void)
+{
+	const char *dev_name = acpi_dev_get_first_match_name("INTC1002", NULL, -1);
+	return dev_name ? dev_name : "pinctrl-merrifield";
+}
+
 static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 {
 	const struct mrfld_gpio_pinrange *range;
+	const char *pinctrl_dev_name;
 	struct mrfld_gpio *priv;
 	u32 gpio_base, irq_base;
 	void __iomem *base;
@@ -439,10 +447,11 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id
 		return retval;
 	}
 
+	pinctrl_dev_name = mrfld_gpio_get_pinctrl_dev_name();
 	for (i = 0; i < ARRAY_SIZE(mrfld_gpio_ranges); i++) {
 		range = &mrfld_gpio_ranges[i];
 		retval = gpiochip_add_pin_range(&priv->chip,
-						"pinctrl-merrifield",
+						pinctrl_dev_name,
 						range->gpio_base,
 						range->pin_base,
 						range->npins);
-- 
2.15.1
^ permalink raw reply related	[flat|nested] 22+ messages in thread
* [PATCH v3 3/3] ASoC: Intel - Convert to use acpi_dev_get_first_match_name()
  2018-01-05 16:09 [PATCH v3 0/3] ACPI, ASoC, gpio: Add and use acpi_dev_get_first_match_name() Andy Shevchenko
  2018-01-05 16:09 ` [PATCH v3 1/3] ACPI / utils: Introduce acpi_dev_get_first_match_name() Andy Shevchenko
  2018-01-05 16:09 ` [PATCH v3 2/3] gpio: merrifield: Add support of ACPI enabled platforms Andy Shevchenko
@ 2018-01-05 16:09 ` Andy Shevchenko
  2018-01-12 19:03   ` Mark Brown
  2018-01-05 16:13 ` [PATCH v3 0/3] ACPI, ASoC, gpio: Add and " Pierre-Louis Bossart
  2018-01-12 13:24 ` Rafael J. Wysocki
  4 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2018-01-05 16:09 UTC (permalink / raw)
  To: Rafael J . Wysocki, Erik Schmauss, linux-acpi,
	Pierre-Louis Bossart, Liam Girdwood, Mark Brown, alsa-devel,
	Linus Walleij, linux-gpio, Mika Westerberg
  Cc: Andy Shevchenko
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>
---
 include/sound/soc-acpi.h                |  7 -------
 sound/soc/intel/boards/bytcht_da7213.c  |  2 +-
 sound/soc/intel/boards/bytcht_es8316.c  |  2 +-
 sound/soc/intel/boards/bytcr_rt5640.c   |  2 +-
 sound/soc/intel/boards/bytcr_rt5651.c   |  2 +-
 sound/soc/intel/boards/cht_bsw_rt5645.c |  2 +-
 sound/soc/intel/boards/cht_bsw_rt5672.c |  2 +-
 sound/soc/soc-acpi.c                    | 33 ---------------------------------
 8 files changed, 6 insertions(+), 46 deletions(-)
diff --git a/include/sound/soc-acpi.h b/include/sound/soc-acpi.h
index 703c78483113..5ab6b2069f6b 100644
--- a/include/sound/soc-acpi.h
+++ b/include/sound/soc-acpi.h
@@ -31,16 +31,9 @@ struct snd_soc_acpi_package_context {
 #define SND_SOC_ACPI_I2C_DEVICE_NAME_LEN (4 + ACPI_ID_LEN + 3 + 1)
 
 #if IS_ENABLED(CONFIG_ACPI)
-/* translation fron HID to I2C name, needed for DAI codec_name */
-const char *snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN]);
 bool snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
 				    struct snd_soc_acpi_package_context *ctx);
 #else
-static inline const char *
-snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN])
-{
-	return NULL;
-}
 static inline bool
 snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
 				   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 e78d9e860522..bf6217c3de94 100644
--- a/sound/soc/intel/boards/bytcht_da7213.c
+++ b/sound/soc/intel/boards/bytcht_da7213.c
@@ -244,7 +244,7 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
 	}
 
 	/* fixup codec name based on HID */
-	i2c_name = snd_soc_acpi_find_name_from_hid(mach->id);
+	i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
 	if (i2c_name) {
 		snprintf(codec_name, sizeof(codec_name),
 			"%s%s", "i2c-", i2c_name);
diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
index a1cc9590747e..4f6af9f43df8 100644
--- a/sound/soc/intel/boards/bytcht_es8316.c
+++ b/sound/soc/intel/boards/bytcht_es8316.c
@@ -259,7 +259,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
 	}
 
 	/* fixup codec name based on HID */
-	i2c_name = snd_soc_acpi_find_name_from_hid(mach->id);
+	i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
 	if (i2c_name) {
 		snprintf(codec_name, sizeof(codec_name),
 			"%s%s", "i2c-", i2c_name);
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index 4bfd11968f77..a45180ad5882 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -763,7 +763,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 	}
 
 	/* fixup codec name based on HID */
-	i2c_name = snd_soc_acpi_find_name_from_hid(mach->id);
+	i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
 	if (i2c_name) {
 		snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name),
 			"%s%s", "i2c-", i2c_name);
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 86baa6906e92..794d984e420b 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -500,7 +500,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	}
 
 	/* fixup codec name based on HID */
-	i2c_name = snd_soc_acpi_find_name_from_hid(mach->id);
+	i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
 	if (i2c_name) {
 		snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name),
 			"%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 b2a69aae257e..cd3febbffcfe 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -568,7 +568,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 		}
 
 	/* fixup codec name based on HID */
-	i2c_name = snd_soc_acpi_find_name_from_hid(mach->id);
+	i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
 	if (i2c_name) {
 		snprintf(cht_rt5645_codec_name, sizeof(cht_rt5645_codec_name),
 			"%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 c488dca55570..d1d0617bdf15 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5672.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5672.c
@@ -397,7 +397,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 
 	/* fixup codec name based on HID */
 	if (mach) {
-		i2c_name = snd_soc_acpi_find_name_from_hid(mach->id);
+		i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
 		if (i2c_name) {
 			snprintf(drv->codec_name, sizeof(drv->codec_name),
 				 "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 @@
 
 #include <sound/soc-acpi.h>
 
-static acpi_status snd_soc_acpi_find_name(acpi_handle handle, u32 level,
-				      void *context, void **ret)
-{
-	struct acpi_device *adev;
-	const char *name = NULL;
-
-	if (acpi_bus_get_device(handle, &adev))
-		return AE_OK;
-
-	if (adev->status.present && adev->status.functional) {
-		name = acpi_dev_name(adev);
-		*(const char **)ret = name;
-		return AE_CTRL_TERMINATE;
-	}
-
-	return AE_OK;
-}
-
-const char *snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN])
-{
-	const char *name = NULL;
-	acpi_status status;
-
-	status = acpi_get_devices(hid, snd_soc_acpi_find_name, NULL,
-				  (void **)&name);
-
-	if (ACPI_FAILURE(status) || name[0] == '\0')
-		return NULL;
-
-	return name;
-}
-EXPORT_SYMBOL_GPL(snd_soc_acpi_find_name_from_hid);
-
 struct snd_soc_acpi_mach *
 snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines)
 {
-- 
2.15.1
^ permalink raw reply related	[flat|nested] 22+ messages in thread
* Re: [PATCH v3 0/3] ACPI, ASoC, gpio: Add and use acpi_dev_get_first_match_name()
  2018-01-05 16:09 [PATCH v3 0/3] ACPI, ASoC, gpio: Add and use acpi_dev_get_first_match_name() Andy Shevchenko
                   ` (2 preceding siblings ...)
  2018-01-05 16:09 ` [PATCH v3 3/3] ASoC: Intel - Convert to use acpi_dev_get_first_match_name() Andy Shevchenko
@ 2018-01-05 16:13 ` Pierre-Louis Bossart
  2018-01-05 17:08   ` Andy Shevchenko
  2018-01-12 13:24 ` Rafael J. Wysocki
  4 siblings, 1 reply; 22+ messages in thread
From: Pierre-Louis Bossart @ 2018-01-05 16:13 UTC (permalink / raw)
  To: Andy Shevchenko, Rafael J . Wysocki, Erik Schmauss, linux-acpi,
	Liam Girdwood, Mark Brown, alsa-devel, Linus Walleij, linux-gpio,
	Mika Westerberg
On 1/5/18 10:09 AM, Andy Shevchenko wrote:
> It appears that at least one current user (patch 3) and upcoming one
> (patch 2) need to get device name by ACPI HID.
> 
> Here we introduce acpi_dev_get_first_match_name() based on code
> done for acpi_dev_present() and reuse it where appropriate.
> 
> The series has been tested on Intel Edison with non-ACPI and
> ACPI enabled versions of U-Boot, while patches 1 and 3 were tested
> by Pierre.
> 
> Since patch 1 and cross subsystem nature of the series I think
> the best way is to push this (patches 1 and 2) via Rafael's linux-pm tree.
> 
> Taking into consideration that patch 3 requires not-yet-applied work
> from Pierre, I left it for reference, in particular to show the LOC
> statistics.
> 
> Changelog v3:
> - add Pierre's tag (I dared to do this for both patches 1 and 3)
I tested a modified version of patch 3 (conflict resolution + addition 
of ES8316 support).
> - address comment about function name (patch 1)
> - add a reference to the first user (patch 1)
> - consolidate pin control device possible names in one place (patch 2)
> - rebase ASoC patch on not-yet-applied series from Pierre (patch 3), and
> - thus reordered to make it last in the series (patch 3)
> 
> Andy Shevchenko (3):
>    ACPI / utils: Introduce acpi_dev_get_first_match_name()
>    gpio: merrifield: Add support of ACPI enabled platforms
>    ASoC: Intel - Convert to use acpi_dev_get_first_match_name()
> 
>   drivers/acpi/utils.c                    | 41 +++++++++++++++++++++++++++------
>   drivers/gpio/gpio-merrifield.c          | 11 ++++++++-
>   include/acpi/acpi_bus.h                 |  3 +++
>   include/linux/acpi.h                    |  6 +++++
>   include/sound/soc-acpi.h                |  7 ------
>   sound/soc/intel/boards/bytcht_da7213.c  |  2 +-
>   sound/soc/intel/boards/bytcht_es8316.c  |  2 +-
>   sound/soc/intel/boards/bytcr_rt5640.c   |  2 +-
>   sound/soc/intel/boards/bytcr_rt5651.c   |  2 +-
>   sound/soc/intel/boards/cht_bsw_rt5645.c |  2 +-
>   sound/soc/intel/boards/cht_bsw_rt5672.c |  2 +-
>   sound/soc/soc-acpi.c                    | 33 --------------------------
>   12 files changed, 59 insertions(+), 54 deletions(-)
> 
^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH v3 0/3] ACPI, ASoC, gpio: Add and use acpi_dev_get_first_match_name()
  2018-01-05 16:13 ` [PATCH v3 0/3] ACPI, ASoC, gpio: Add and " Pierre-Louis Bossart
@ 2018-01-05 17:08   ` Andy Shevchenko
  0 siblings, 0 replies; 22+ messages in thread
From: Andy Shevchenko @ 2018-01-05 17:08 UTC (permalink / raw)
  To: Pierre-Louis Bossart, Rafael J . Wysocki, Erik Schmauss,
	linux-acpi, Liam Girdwood, Mark Brown, alsa-devel, Linus Walleij,
	linux-gpio, Mika Westerberg
On Fri, 2018-01-05 at 10:13 -0600, Pierre-Louis Bossart wrote:
> On 1/5/18 10:09 AM, Andy Shevchenko wrote:
> > It appears that at least one current user (patch 3) and upcoming one
> > (patch 2) need to get device name by ACPI HID.
> > 
> > Here we introduce acpi_dev_get_first_match_name() based on code
> > done for acpi_dev_present() and reuse it where appropriate.
> > 
> > The series has been tested on Intel Edison with non-ACPI and
> > ACPI enabled versions of U-Boot, while patches 1 and 3 were tested
> > by Pierre.
> > 
> > Since patch 1 and cross subsystem nature of the series I think
> > the best way is to push this (patches 1 and 2) via Rafael's linux-pm 
> > tree.
> > 
> > Taking into consideration that patch 3 requires not-yet-applied work
> > from Pierre, I left it for reference, in particular to show the LOC
> > statistics.
> > 
> > Changelog v3:
> > - add Pierre's tag (I dared to do this for both patches 1 and 3)
> 
> I tested a modified version of patch 3 (conflict resolution +
> addition 
> of ES8316 support).
In v3 these have been addressed as I put above as "requires non-yet-
applied work".
> 
> > - address comment about function name (patch 1)
> > - add a reference to the first user (patch 1)
> > - consolidate pin control device possible names in one place (patch
> > 2)
> > - rebase ASoC patch on not-yet-applied series from Pierre (patch 3),
> > and
> > - thus reordered to make it last in the series (patch 3)
> > 
> > Andy Shevchenko (3):
> >    ACPI / utils: Introduce acpi_dev_get_first_match_name()
> >    gpio: merrifield: Add support of ACPI enabled platforms
> >    ASoC: Intel - Convert to use acpi_dev_get_first_match_name()
> > 
> >   drivers/acpi/utils.c                    | 41
> > +++++++++++++++++++++++++++------
> >   drivers/gpio/gpio-merrifield.c          | 11 ++++++++-
> >   include/acpi/acpi_bus.h                 |  3 +++
> >   include/linux/acpi.h                    |  6 +++++
> >   include/sound/soc-acpi.h                |  7 ------
> >   sound/soc/intel/boards/bytcht_da7213.c  |  2 +-
> >   sound/soc/intel/boards/bytcht_es8316.c  |  2 +-
> >   sound/soc/intel/boards/bytcr_rt5640.c   |  2 +-
> >   sound/soc/intel/boards/bytcr_rt5651.c   |  2 +-
> >   sound/soc/intel/boards/cht_bsw_rt5645.c |  2 +-
> >   sound/soc/intel/boards/cht_bsw_rt5672.c |  2 +-
> >   sound/soc/soc-acpi.c                    | 33 -------------------
> > -------
> >   12 files changed, 59 insertions(+), 54 deletions(-)
> > 
> 
> 
-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH v3 1/3] ACPI / utils: Introduce acpi_dev_get_first_match_name()
  2018-01-05 16:09 ` [PATCH v3 1/3] ACPI / utils: Introduce acpi_dev_get_first_match_name() Andy Shevchenko
@ 2018-01-05 23:27   ` Rafael J. Wysocki
  2018-01-08 13:09     ` Andy Shevchenko
  2018-01-12 20:01   ` Applied "ACPI: utils: Introduce acpi_dev_get_first_match_name()" to the asoc tree Mark Brown
  1 sibling, 1 reply; 22+ messages in thread
From: Rafael J. Wysocki @ 2018-01-05 23:27 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Rafael J . Wysocki, Erik Schmauss, ACPI Devel Maling List,
	Pierre-Louis Bossart, Liam Girdwood, Mark Brown,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	Linus Walleij, linux-gpio, Mika Westerberg
On Fri, Jan 5, 2018 at 5:09 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Sometimes the user wants to have device name of the match rather than
> just checking if device present or not. To make life easier for such
> users introduce acpi_dev_get_first_match_name() helper based on code
> for acpi_dev_present().
>
> For example, GPIO driver for Intel Merrifield needs to know the device
> name of pin control to be able to apply GPIO mapping table to the proper
> device.
>
> To be more consistent with the purpose rename
>
>   struct acpi_dev_present_info  -> struct acpi_dev_match_info
>   acpi_dev_present_cb()         -> acpi_dev_match_cb()
>
> in the utils.c file.
>
> Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
OK, so which way do you want this to go in?
> ---
>  drivers/acpi/utils.c    | 41 ++++++++++++++++++++++++++++++++++-------
>  include/acpi/acpi_bus.h |  3 +++
>  include/linux/acpi.h    |  6 ++++++
>  3 files changed, 43 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
> index 9d49a1acebe3..78db97687f26 100644
> --- a/drivers/acpi/utils.c
> +++ b/drivers/acpi/utils.c
> @@ -737,16 +737,17 @@ bool acpi_dev_found(const char *hid)
>  }
>  EXPORT_SYMBOL(acpi_dev_found);
>
> -struct acpi_dev_present_info {
> +struct acpi_dev_match_info {
> +       const char *dev_name;
>         struct acpi_device_id hid[2];
>         const char *uid;
>         s64 hrv;
>  };
>
> -static int acpi_dev_present_cb(struct device *dev, void *data)
> +static int acpi_dev_match_cb(struct device *dev, void *data)
>  {
>         struct acpi_device *adev = to_acpi_device(dev);
> -       struct acpi_dev_present_info *match = data;
> +       struct acpi_dev_match_info *match = data;
>         unsigned long long hrv;
>         acpi_status status;
>
> @@ -757,6 +758,8 @@ static int acpi_dev_present_cb(struct device *dev, void *data)
>             strcmp(adev->pnp.unique_id, match->uid)))
>                 return 0;
>
> +       match->dev_name = acpi_dev_name(adev);
> +
>         if (match->hrv == -1)
>                 return 1;
>
> @@ -789,20 +792,44 @@ static int acpi_dev_present_cb(struct device *dev, void *data)
>   */
>  bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
>  {
> -       struct acpi_dev_present_info match = {};
> +       struct acpi_dev_match_info match = {};
>         struct device *dev;
>
>         strlcpy(match.hid[0].id, hid, sizeof(match.hid[0].id));
>         match.uid = uid;
>         match.hrv = hrv;
>
> -       dev = bus_find_device(&acpi_bus_type, NULL, &match,
> -                             acpi_dev_present_cb);
> -
> +       dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb);
>         return !!dev;
>  }
>  EXPORT_SYMBOL(acpi_dev_present);
>
> +/**
> + * acpi_dev_get_first_match_name - Return name of first match of ACPI device
> + * @hid: Hardware ID of the device.
> + * @uid: Unique ID of the device, pass NULL to not check _UID
> + * @hrv: Hardware Revision of the device, pass -1 to not check _HRV
> + *
> + * Return device name if a matching device was present
> + * at the moment of invocation, or NULL otherwise.
> + *
> + * See additional information in acpi_dev_present() as well.
> + */
> +const char *
> +acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
> +{
> +       struct acpi_dev_match_info match = {};
> +       struct device *dev;
> +
> +       strlcpy(match.hid[0].id, hid, sizeof(match.hid[0].id));
> +       match.uid = uid;
> +       match.hrv = hrv;
> +
> +       dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb);
> +       return dev ? match.dev_name : NULL;
> +}
> +EXPORT_SYMBOL(acpi_dev_get_first_match_name);
> +
>  /*
>   * acpi_backlight= handling, this is done here rather then in video_detect.c
>   * because __setup cannot be used in modules.
> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> index 79287629c888..c9608b0b80c6 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -91,6 +91,9 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev,
>  bool acpi_dev_found(const char *hid);
>  bool acpi_dev_present(const char *hid, const char *uid, s64 hrv);
>
> +const char *
> +acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv);
> +
>  #ifdef CONFIG_ACPI
>
>  #include <linux/proc_fs.h>
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 60f0d3248125..493ac6451773 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -642,6 +642,12 @@ static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
>         return false;
>  }
>
> +static inline const char *
> +acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
> +{
> +       return NULL;
> +}
> +
>  static inline bool is_acpi_node(struct fwnode_handle *fwnode)
>  {
>         return false;
> --
> 2.15.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH v3 2/3] gpio: merrifield: Add support of ACPI enabled platforms
  2018-01-05 16:09 ` [PATCH v3 2/3] gpio: merrifield: Add support of ACPI enabled platforms Andy Shevchenko
@ 2018-01-06  9:32   ` Mika Westerberg
  2018-01-09 13:37   ` Linus Walleij
  2018-01-12 20:01   ` Applied "gpio: merrifield: Add support of ACPI enabled platforms" to the asoc tree Mark Brown
  2 siblings, 0 replies; 22+ messages in thread
From: Mika Westerberg @ 2018-01-06  9:32 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Rafael J . Wysocki, Erik Schmauss, linux-acpi,
	Pierre-Louis Bossart, Liam Girdwood, Mark Brown, alsa-devel,
	Linus Walleij, linux-gpio
On Fri, Jan 05, 2018 at 06:09:34PM +0200, Andy Shevchenko wrote:
> The driver needs the pin control device name for ACPI.
> 
> We are looking through ACPI namespace and return first found device
> based on ACPI HID for Intel Merrifield FLIS (pin control device).
> 
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH v3 1/3] ACPI / utils: Introduce acpi_dev_get_first_match_name()
  2018-01-05 23:27   ` Rafael J. Wysocki
@ 2018-01-08 13:09     ` Andy Shevchenko
  2018-01-09  0:18       ` Rafael J. Wysocki
  2018-01-09 15:54       ` Mark Brown
  0 siblings, 2 replies; 22+ messages in thread
From: Andy Shevchenko @ 2018-01-08 13:09 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Rafael J . Wysocki, Erik Schmauss, ACPI Devel Maling List,
	Pierre-Louis Bossart, Liam Girdwood, Mark Brown,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	Linus Walleij, linux-gpio, Mika Westerberg
On Sat, 2018-01-06 at 00:27 +0100, Rafael J. Wysocki wrote:
> On Fri, Jan 5, 2018 at 5:09 PM, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > Sometimes the user wants to have device name of the match rather
> > than
> > just checking if device present or not. To make life easier for such
> > users introduce acpi_dev_get_first_match_name() helper based on code
> > for acpi_dev_present().
> > 
> > For example, GPIO driver for Intel Merrifield needs to know the
> > device
> > name of pin control to be able to apply GPIO mapping table to the
> > proper
> > device.
> > 
> > To be more consistent with the purpose rename
> > 
> >   struct acpi_dev_present_info  -> struct acpi_dev_match_info
> >   acpi_dev_present_cb()         -> acpi_dev_match_cb()
> > 
> > in the utils.c file.
> > 
> > Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.co
> > m>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> OK, so which way do you want this to go in?
If you have no objections, patch 1 may go straight forward to linux-pm
tree as far as you are okay with the contents.
I dunno, if Mika's ACK is enough to you to get the second one (patch 2)
together, otherwise Linus' ACK would be needed or leave it for next
cycle.
According to what Mark and Pierre told previously I guess we just
postpone patch 3 for next cycle.
> 
> > ---
> >  drivers/acpi/utils.c    | 41 ++++++++++++++++++++++++++++++++++--
> > -----
> >  include/acpi/acpi_bus.h |  3 +++
> >  include/linux/acpi.h    |  6 ++++++
> >  3 files changed, 43 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
> > index 9d49a1acebe3..78db97687f26 100644
> > --- a/drivers/acpi/utils.c
> > +++ b/drivers/acpi/utils.c
> > @@ -737,16 +737,17 @@ bool acpi_dev_found(const char *hid)
> >  }
> >  EXPORT_SYMBOL(acpi_dev_found);
> > 
> > -struct acpi_dev_present_info {
> > +struct acpi_dev_match_info {
> > +       const char *dev_name;
> >         struct acpi_device_id hid[2];
> >         const char *uid;
> >         s64 hrv;
> >  };
> > 
> > -static int acpi_dev_present_cb(struct device *dev, void *data)
> > +static int acpi_dev_match_cb(struct device *dev, void *data)
> >  {
> >         struct acpi_device *adev = to_acpi_device(dev);
> > -       struct acpi_dev_present_info *match = data;
> > +       struct acpi_dev_match_info *match = data;
> >         unsigned long long hrv;
> >         acpi_status status;
> > 
> > @@ -757,6 +758,8 @@ static int acpi_dev_present_cb(struct device
> > *dev, void *data)
> >             strcmp(adev->pnp.unique_id, match->uid)))
> >                 return 0;
> > 
> > +       match->dev_name = acpi_dev_name(adev);
> > +
> >         if (match->hrv == -1)
> >                 return 1;
> > 
> > @@ -789,20 +792,44 @@ static int acpi_dev_present_cb(struct device
> > *dev, void *data)
> >   */
> >  bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
> >  {
> > -       struct acpi_dev_present_info match = {};
> > +       struct acpi_dev_match_info match = {};
> >         struct device *dev;
> > 
> >         strlcpy(match.hid[0].id, hid, sizeof(match.hid[0].id));
> >         match.uid = uid;
> >         match.hrv = hrv;
> > 
> > -       dev = bus_find_device(&acpi_bus_type, NULL, &match,
> > -                             acpi_dev_present_cb);
> > -
> > +       dev = bus_find_device(&acpi_bus_type, NULL, &match,
> > acpi_dev_match_cb);
> >         return !!dev;
> >  }
> >  EXPORT_SYMBOL(acpi_dev_present);
> > 
> > +/**
> > + * acpi_dev_get_first_match_name - Return name of first match of
> > ACPI device
> > + * @hid: Hardware ID of the device.
> > + * @uid: Unique ID of the device, pass NULL to not check _UID
> > + * @hrv: Hardware Revision of the device, pass -1 to not check _HRV
> > + *
> > + * Return device name if a matching device was present
> > + * at the moment of invocation, or NULL otherwise.
> > + *
> > + * See additional information in acpi_dev_present() as well.
> > + */
> > +const char *
> > +acpi_dev_get_first_match_name(const char *hid, const char *uid, s64
> > hrv)
> > +{
> > +       struct acpi_dev_match_info match = {};
> > +       struct device *dev;
> > +
> > +       strlcpy(match.hid[0].id, hid, sizeof(match.hid[0].id));
> > +       match.uid = uid;
> > +       match.hrv = hrv;
> > +
> > +       dev = bus_find_device(&acpi_bus_type, NULL, &match,
> > acpi_dev_match_cb);
> > +       return dev ? match.dev_name : NULL;
> > +}
> > +EXPORT_SYMBOL(acpi_dev_get_first_match_name);
> > +
> >  /*
> >   * acpi_backlight= handling, this is done here rather then in
> > video_detect.c
> >   * because __setup cannot be used in modules.
> > diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> > index 79287629c888..c9608b0b80c6 100644
> > --- a/include/acpi/acpi_bus.h
> > +++ b/include/acpi/acpi_bus.h
> > @@ -91,6 +91,9 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const
> > guid_t *guid, u64 rev,
> >  bool acpi_dev_found(const char *hid);
> >  bool acpi_dev_present(const char *hid, const char *uid, s64 hrv);
> > 
> > +const char *
> > +acpi_dev_get_first_match_name(const char *hid, const char *uid, s64
> > hrv);
> > +
> >  #ifdef CONFIG_ACPI
> > 
> >  #include <linux/proc_fs.h>
> > diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> > index 60f0d3248125..493ac6451773 100644
> > --- a/include/linux/acpi.h
> > +++ b/include/linux/acpi.h
> > @@ -642,6 +642,12 @@ static inline bool acpi_dev_present(const char
> > *hid, const char *uid, s64 hrv)
> >         return false;
> >  }
> > 
> > +static inline const char *
> > +acpi_dev_get_first_match_name(const char *hid, const char *uid, s64
> > hrv)
> > +{
> > +       return NULL;
> > +}
> > +
> >  static inline bool is_acpi_node(struct fwnode_handle *fwnode)
> >  {
> >         return false;
> > --
> > 2.15.1
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-
> > acpi" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH v3 1/3] ACPI / utils: Introduce acpi_dev_get_first_match_name()
  2018-01-08 13:09     ` Andy Shevchenko
@ 2018-01-09  0:18       ` Rafael J. Wysocki
  2018-01-09 13:34         ` Linus Walleij
  2018-01-09 15:54       ` Mark Brown
  1 sibling, 1 reply; 22+ messages in thread
From: Rafael J. Wysocki @ 2018-01-09  0:18 UTC (permalink / raw)
  To: Andy Shevchenko, Linus Walleij
  Cc: Rafael J. Wysocki, Erik Schmauss, ACPI Devel Maling List,
	Pierre-Louis Bossart, Liam Girdwood, Mark Brown,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	linux-gpio, Mika Westerberg
On Monday, January 8, 2018 2:09:20 PM CET Andy Shevchenko wrote:
> On Sat, 2018-01-06 at 00:27 +0100, Rafael J. Wysocki wrote:
> > On Fri, Jan 5, 2018 at 5:09 PM, Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > > Sometimes the user wants to have device name of the match rather
> > > than
> > > just checking if device present or not. To make life easier for such
> > > users introduce acpi_dev_get_first_match_name() helper based on code
> > > for acpi_dev_present().
> > > 
> > > For example, GPIO driver for Intel Merrifield needs to know the
> > > device
> > > name of pin control to be able to apply GPIO mapping table to the
> > > proper
> > > device.
> > > 
> > > To be more consistent with the purpose rename
> > > 
> > >   struct acpi_dev_present_info  -> struct acpi_dev_match_info
> > >   acpi_dev_present_cb()         -> acpi_dev_match_cb()
> > > 
> > > in the utils.c file.
> > > 
> > > Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.co
> > > m>
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > 
> > OK, so which way do you want this to go in?
> 
> If you have no objections, patch 1 may go straight forward to linux-pm
> tree as far as you are okay with the contents.
> 
> I dunno, if Mika's ACK is enough to you to get the second one (patch 2)
> together, otherwise Linus' ACK would be needed or leave it for next
> cycle.
> 
> According to what Mark and Pierre told previously I guess we just
> postpone patch 3 for next cycle.
OK
Linus, can you please have a look at the [2/3] from this lot and let me know
whether or not I can take it?
Thanks,
Rafael
^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH v3 1/3] ACPI / utils: Introduce acpi_dev_get_first_match_name()
  2018-01-09  0:18       ` Rafael J. Wysocki
@ 2018-01-09 13:34         ` Linus Walleij
  0 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2018-01-09 13:34 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Andy Shevchenko, Rafael J. Wysocki, Erik Schmauss,
	ACPI Devel Maling List, Pierre-Louis Bossart, Liam Girdwood,
	Mark Brown,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	linux-gpio, Mika Westerberg
On Tue, Jan 9, 2018 at 1:18 AM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Monday, January 8, 2018 2:09:20 PM CET Andy Shevchenko wrote:
>> On Sat, 2018-01-06 at 00:27 +0100, Rafael J. Wysocki wrote:
>> > On Fri, Jan 5, 2018 at 5:09 PM, Andy Shevchenko
>> > <andriy.shevchenko@linux.intel.com> wrote:
>> > > Sometimes the user wants to have device name of the match rather
>> > > than
>> > > just checking if device present or not. To make life easier for such
>> > > users introduce acpi_dev_get_first_match_name() helper based on code
>> > > for acpi_dev_present().
>> > >
>> > > For example, GPIO driver for Intel Merrifield needs to know the
>> > > device
>> > > name of pin control to be able to apply GPIO mapping table to the
>> > > proper
>> > > device.
>> > >
>> > > To be more consistent with the purpose rename
>> > >
>> > >   struct acpi_dev_present_info  -> struct acpi_dev_match_info
>> > >   acpi_dev_present_cb()         -> acpi_dev_match_cb()
>> > >
>> > > in the utils.c file.
>> > >
>> > > Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.co
>> > > m>
>> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>> >
>> > OK, so which way do you want this to go in?
>>
>> If you have no objections, patch 1 may go straight forward to linux-pm
>> tree as far as you are okay with the contents.
>>
>> I dunno, if Mika's ACK is enough to you to get the second one (patch 2)
>> together, otherwise Linus' ACK would be needed or leave it for next
>> cycle.
>>
>> According to what Mark and Pierre told previously I guess we just
>> postpone patch 3 for next cycle.
>
> OK
>
> Linus, can you please have a look at the [2/3] from this lot and let me know
> whether or not I can take it?
OK looking...
Yours,
Linus Walleij
^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH v3 2/3] gpio: merrifield: Add support of ACPI enabled platforms
  2018-01-05 16:09 ` [PATCH v3 2/3] gpio: merrifield: Add support of ACPI enabled platforms Andy Shevchenko
  2018-01-06  9:32   ` Mika Westerberg
@ 2018-01-09 13:37   ` Linus Walleij
  2018-01-12 20:01   ` Applied "gpio: merrifield: Add support of ACPI enabled platforms" to the asoc tree Mark Brown
  2 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2018-01-09 13:37 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Rafael J . Wysocki, Erik Schmauss, ACPI Devel Maling List,
	Pierre-Louis Bossart, Liam Girdwood, Mark Brown,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	linux-gpio, Mika Westerberg
On Fri, Jan 5, 2018 at 5:09 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> The driver needs the pin control device name for ACPI.
>
> We are looking through ACPI namespace and return first found device
> based on ACPI HID for Intel Merrifield FLIS (pin control device).
>
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Looks neat and clean.
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Rafael: feel free to pick this up with the series.
Yours,
Linus Walleij
^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH v3 1/3] ACPI / utils: Introduce acpi_dev_get_first_match_name()
  2018-01-08 13:09     ` Andy Shevchenko
  2018-01-09  0:18       ` Rafael J. Wysocki
@ 2018-01-09 15:54       ` Mark Brown
  2018-01-12 13:22         ` Rafael J. Wysocki
  1 sibling, 1 reply; 22+ messages in thread
From: Mark Brown @ 2018-01-09 15:54 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Rafael J. Wysocki, Rafael J . Wysocki, Erik Schmauss,
	ACPI Devel Maling List, Pierre-Louis Bossart, Liam Girdwood,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	Linus Walleij, linux-gpio, Mika Westerberg
[-- Attachment #1: Type: text/plain, Size: 335 bytes --]
On Mon, Jan 08, 2018 at 03:09:20PM +0200, Andy Shevchenko wrote:
> According to what Mark and Pierre told previously I guess we just
> postpone patch 3 for next cycle.
Well, if someone can send me a pull request I could look at merging
it...  I had thought we might get a new release this week and be in the
merge window by now TBH.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH v3 1/3] ACPI / utils: Introduce acpi_dev_get_first_match_name()
  2018-01-09 15:54       ` Mark Brown
@ 2018-01-12 13:22         ` Rafael J. Wysocki
  0 siblings, 0 replies; 22+ messages in thread
From: Rafael J. Wysocki @ 2018-01-12 13:22 UTC (permalink / raw)
  To: Mark Brown
  Cc: Andy Shevchenko, Rafael J. Wysocki, Erik Schmauss,
	ACPI Devel Maling List, Pierre-Louis Bossart, Liam Girdwood,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	Linus Walleij, linux-gpio, Mika Westerberg
On Tuesday, January 9, 2018 4:54:15 PM CET Mark Brown wrote:
> 
> --vkogqOf2sHV7VnPd
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> 
> On Mon, Jan 08, 2018 at 03:09:20PM +0200, Andy Shevchenko wrote:
> 
> > According to what Mark and Pierre told previously I guess we just
> > postpone patch 3 for next cycle.
> 
> Well, if someone can send me a pull request I could look at merging
> it...  I had thought we might get a new release this week and be in the
> merge window by now TBH.
Patches [1-2/3] from this series are available for pulling in the git branch at
 git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git acpi-gpio
with top-most commit dd1dbf94d2826a045fbbe2649d84b27d48620d56
    gpio: merrifield: Add support of ACPI enabled platforms
on top of commit b2cd1df66037e7c4697c7e40496bf7e4a5e16a2d
    Linux 4.15-rc7
Thanks!
^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH v3 0/3] ACPI, ASoC, gpio: Add and use acpi_dev_get_first_match_name()
  2018-01-05 16:09 [PATCH v3 0/3] ACPI, ASoC, gpio: Add and use acpi_dev_get_first_match_name() Andy Shevchenko
                   ` (3 preceding siblings ...)
  2018-01-05 16:13 ` [PATCH v3 0/3] ACPI, ASoC, gpio: Add and " Pierre-Louis Bossart
@ 2018-01-12 13:24 ` Rafael J. Wysocki
  2018-01-12 14:00   ` Andy Shevchenko
  4 siblings, 1 reply; 22+ messages in thread
From: Rafael J. Wysocki @ 2018-01-12 13:24 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Erik Schmauss, linux-acpi, Pierre-Louis Bossart, Liam Girdwood,
	Mark Brown, alsa-devel, Linus Walleij, linux-gpio,
	Mika Westerberg
On Friday, January 5, 2018 5:09:32 PM CET Andy Shevchenko wrote:
> It appears that at least one current user (patch 3) and upcoming one
> (patch 2) need to get device name by ACPI HID.
> 
> Here we introduce acpi_dev_get_first_match_name() based on code
> done for acpi_dev_present() and reuse it where appropriate.
> 
> The series has been tested on Intel Edison with non-ACPI and
> ACPI enabled versions of U-Boot, while patches 1 and 3 were tested
> by Pierre.
> 
> Since patch 1 and cross subsystem nature of the series I think
> the best way is to push this (patches 1 and 2) via Rafael's linux-pm tree.
> 
> Taking into consideration that patch 3 requires not-yet-applied work
> from Pierre, I left it for reference, in particular to show the LOC
> statistics.
> 
> Changelog v3:
> - add Pierre's tag (I dared to do this for both patches 1 and 3)
> - address comment about function name (patch 1)
> - add a reference to the first user (patch 1)
> - consolidate pin control device possible names in one place (patch 2)
> - rebase ASoC patch on not-yet-applied series from Pierre (patch 3), and
> - thus reordered to make it last in the series (patch 3)
> 
> Andy Shevchenko (3):
>   ACPI / utils: Introduce acpi_dev_get_first_match_name()
>   gpio: merrifield: Add support of ACPI enabled platforms
>   ASoC: Intel - Convert to use acpi_dev_get_first_match_name()
> 
>  drivers/acpi/utils.c                    | 41 +++++++++++++++++++++++++++------
>  drivers/gpio/gpio-merrifield.c          | 11 ++++++++-
>  include/acpi/acpi_bus.h                 |  3 +++
>  include/linux/acpi.h                    |  6 +++++
>  include/sound/soc-acpi.h                |  7 ------
>  sound/soc/intel/boards/bytcht_da7213.c  |  2 +-
>  sound/soc/intel/boards/bytcht_es8316.c  |  2 +-
>  sound/soc/intel/boards/bytcr_rt5640.c   |  2 +-
>  sound/soc/intel/boards/bytcr_rt5651.c   |  2 +-
>  sound/soc/intel/boards/cht_bsw_rt5645.c |  2 +-
>  sound/soc/intel/boards/cht_bsw_rt5672.c |  2 +-
>  sound/soc/soc-acpi.c                    | 33 --------------------------
>  12 files changed, 59 insertions(+), 54 deletions(-)
[1-2/3] applied and I set up a git branch with them to pull from for Mark.
Thanks,
Rafael
^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH v3 0/3] ACPI, ASoC, gpio: Add and use acpi_dev_get_first_match_name()
  2018-01-12 13:24 ` Rafael J. Wysocki
@ 2018-01-12 14:00   ` Andy Shevchenko
  0 siblings, 0 replies; 22+ messages in thread
From: Andy Shevchenko @ 2018-01-12 14:00 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Erik Schmauss, linux-acpi, Pierre-Louis Bossart, Liam Girdwood,
	Mark Brown, alsa-devel, Linus Walleij, linux-gpio,
	Mika Westerberg
On Fri, 2018-01-12 at 14:24 +0100, Rafael J. Wysocki wrote:
> On Friday, January 5, 2018 5:09:32 PM CET Andy Shevchenko wrote:
> > It appears that at least one current user (patch 3) and upcoming one
> > (patch 2) need to get device name by ACPI HID.
> > 
> > Here we introduce acpi_dev_get_first_match_name() based on code
> > done for acpi_dev_present() and reuse it where appropriate.
> > 
> > The series has been tested on Intel Edison with non-ACPI and
> > ACPI enabled versions of U-Boot, while patches 1 and 3 were tested
> > by Pierre.
> > 
> > Since patch 1 and cross subsystem nature of the series I think
> > the best way is to push this (patches 1 and 2) via Rafael's linux-pm 
> > tree.
> > 
> > Taking into consideration that patch 3 requires not-yet-applied work
> > from Pierre, I left it for reference, in particular to show the LOC
> > statistics.
> > 
> > Changelog v3:
> > - add Pierre's tag (I dared to do this for both patches 1 and 3)
> > - address comment about function name (patch 1)
> > - add a reference to the first user (patch 1)
> > - consolidate pin control device possible names in one place (patch
> > 2)
> > - rebase ASoC patch on not-yet-applied series from Pierre (patch 3),
> > and
> > - thus reordered to make it last in the series (patch 3)
> > 
> > Andy Shevchenko (3):
> >   ACPI / utils: Introduce acpi_dev_get_first_match_name()
> >   gpio: merrifield: Add support of ACPI enabled platforms
> >   ASoC: Intel - Convert to use acpi_dev_get_first_match_name()
> > 
> >  drivers/acpi/utils.c                    | 41
> > +++++++++++++++++++++++++++------
> >  drivers/gpio/gpio-merrifield.c          | 11 ++++++++-
> >  include/acpi/acpi_bus.h                 |  3 +++
> >  include/linux/acpi.h                    |  6 +++++
> >  include/sound/soc-acpi.h                |  7 ------
> >  sound/soc/intel/boards/bytcht_da7213.c  |  2 +-
> >  sound/soc/intel/boards/bytcht_es8316.c  |  2 +-
> >  sound/soc/intel/boards/bytcr_rt5640.c   |  2 +-
> >  sound/soc/intel/boards/bytcr_rt5651.c   |  2 +-
> >  sound/soc/intel/boards/cht_bsw_rt5645.c |  2 +-
> >  sound/soc/intel/boards/cht_bsw_rt5672.c |  2 +-
> >  sound/soc/soc-acpi.c                    | 33 ----------------------
> > ----
> >  12 files changed, 59 insertions(+), 54 deletions(-)
> 
> [1-2/3] applied and I set up a git branch with them to pull from for
> Mark.
Thanks, Rafael!
So, the roadmap is as I see the following:
1) Mark applies (if no objection) latest version of the second patch
series from Pierre...
2) ...followed by PR from Rafael...
3) ...followed by the patch 3 from this series.
Mark, does it sound like a plan to you?
-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH v3 3/3] ASoC: Intel - Convert to use acpi_dev_get_first_match_name()
  2018-01-05 16:09 ` [PATCH v3 3/3] ASoC: Intel - Convert to use acpi_dev_get_first_match_name() Andy Shevchenko
@ 2018-01-12 19:03   ` Mark Brown
  2018-01-12 20:21     ` Andy Shevchenko
  0 siblings, 1 reply; 22+ messages in thread
From: Mark Brown @ 2018-01-12 19:03 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Rafael J . Wysocki, Erik Schmauss, linux-acpi,
	Pierre-Louis Bossart, Liam Girdwood, alsa-devel, Linus Walleij,
	linux-gpio, Mika Westerberg
[-- Attachment #1: Type: text/plain, Size: 282 bytes --]
On Fri, Jan 05, 2018 at 06:09:35PM +0200, Andy Shevchenko wrote:
> Instead of home grown snd_soc_acpi_find_name_from_hid() use
> acpi_dev_get_first_match_name().
This doesn't apply against current code (even after pulling Raphael's
pull request) - can you please check and resend?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply	[flat|nested] 22+ messages in thread
* Applied "gpio: merrifield: Add support of ACPI enabled platforms" to the asoc tree
  2018-01-05 16:09 ` [PATCH v3 2/3] gpio: merrifield: Add support of ACPI enabled platforms Andy Shevchenko
  2018-01-06  9:32   ` Mika Westerberg
  2018-01-09 13:37   ` Linus Walleij
@ 2018-01-12 20:01   ` Mark Brown
  2 siblings, 0 replies; 22+ messages in thread
From: Mark Brown @ 2018-01-12 20:01 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: alsa-devel, linux-gpio, Erik Schmauss, Linus Walleij,
	Rafael J. Wysocki, Rafael J . Wysocki, Pierre-Louis Bossart,
	Liam Girdwood, linux-acpi, Mark Brown, Mika Westerberg
The patch
   gpio: merrifield: Add support of ACPI enabled platforms
has been applied to the asoc tree at
   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From dd1dbf94d2826a045fbbe2649d84b27d48620d56 Mon Sep 17 00:00:00 2001
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Fri, 5 Jan 2018 18:09:34 +0200
Subject: [PATCH] gpio: merrifield: Add support of ACPI enabled platforms
The driver needs the pin control device name for ACPI.
We are looking through ACPI namespace and return first found device
based on ACPI HID for Intel Merrifield FLIS (pin control device).
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/gpio/gpio-merrifield.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c
index dd67a31ac337..c38624ea0251 100644
--- a/drivers/gpio/gpio-merrifield.c
+++ b/drivers/gpio/gpio-merrifield.c
@@ -9,6 +9,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/acpi.h>
 #include <linux/bitops.h>
 #include <linux/gpio/driver.h>
 #include <linux/init.h>
@@ -380,9 +381,16 @@ static void mrfld_irq_init_hw(struct mrfld_gpio *priv)
 	}
 }
 
+static const char *mrfld_gpio_get_pinctrl_dev_name(void)
+{
+	const char *dev_name = acpi_dev_get_first_match_name("INTC1002", NULL, -1);
+	return dev_name ? dev_name : "pinctrl-merrifield";
+}
+
 static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 {
 	const struct mrfld_gpio_pinrange *range;
+	const char *pinctrl_dev_name;
 	struct mrfld_gpio *priv;
 	u32 gpio_base, irq_base;
 	void __iomem *base;
@@ -439,10 +447,11 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id
 		return retval;
 	}
 
+	pinctrl_dev_name = mrfld_gpio_get_pinctrl_dev_name();
 	for (i = 0; i < ARRAY_SIZE(mrfld_gpio_ranges); i++) {
 		range = &mrfld_gpio_ranges[i];
 		retval = gpiochip_add_pin_range(&priv->chip,
-						"pinctrl-merrifield",
+						pinctrl_dev_name,
 						range->gpio_base,
 						range->pin_base,
 						range->npins);
-- 
2.15.1
^ permalink raw reply related	[flat|nested] 22+ messages in thread
* Applied "ACPI: utils: Introduce acpi_dev_get_first_match_name()" to the asoc tree
  2018-01-05 16:09 ` [PATCH v3 1/3] ACPI / utils: Introduce acpi_dev_get_first_match_name() Andy Shevchenko
  2018-01-05 23:27   ` Rafael J. Wysocki
@ 2018-01-12 20:01   ` Mark Brown
  1 sibling, 0 replies; 22+ messages in thread
From: Mark Brown @ 2018-01-12 20:01 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: alsa-devel, linux-gpio, Mika Westerberg, Linus Walleij,
	Rafael J. Wysocki, Rafael J . Wysocki, Liam Girdwood,
	Pierre-Louis Bossart, linux-acpi, Mark Brown, Erik Schmauss
The patch
   ACPI: utils: Introduce acpi_dev_get_first_match_name()
has been applied to the asoc tree at
   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From 67dcf8a3e06582cb6b02952335b5612beb97889f Mon Sep 17 00:00:00 2001
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Fri, 5 Jan 2018 18:09:33 +0200
Subject: [PATCH] ACPI: utils: Introduce acpi_dev_get_first_match_name()
Sometimes the user wants to have device name of the match rather than
just checking if device present or not. To make life easier for such
users introduce acpi_dev_get_first_match_name() helper based on code
for acpi_dev_present().
For example, GPIO driver for Intel Merrifield needs to know the device
name of pin control to be able to apply GPIO mapping table to the proper
device.
To be more consistent with the purpose rename
  struct acpi_dev_present_info  -> struct acpi_dev_match_info
  acpi_dev_present_cb()         -> acpi_dev_match_cb()
in the utils.c file.
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/utils.c    | 41 ++++++++++++++++++++++++++++++++++-------
 include/acpi/acpi_bus.h |  3 +++
 include/linux/acpi.h    |  6 ++++++
 3 files changed, 43 insertions(+), 7 deletions(-)
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 9d49a1acebe3..78db97687f26 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -737,16 +737,17 @@ bool acpi_dev_found(const char *hid)
 }
 EXPORT_SYMBOL(acpi_dev_found);
 
-struct acpi_dev_present_info {
+struct acpi_dev_match_info {
+	const char *dev_name;
 	struct acpi_device_id hid[2];
 	const char *uid;
 	s64 hrv;
 };
 
-static int acpi_dev_present_cb(struct device *dev, void *data)
+static int acpi_dev_match_cb(struct device *dev, void *data)
 {
 	struct acpi_device *adev = to_acpi_device(dev);
-	struct acpi_dev_present_info *match = data;
+	struct acpi_dev_match_info *match = data;
 	unsigned long long hrv;
 	acpi_status status;
 
@@ -757,6 +758,8 @@ static int acpi_dev_present_cb(struct device *dev, void *data)
 	    strcmp(adev->pnp.unique_id, match->uid)))
 		return 0;
 
+	match->dev_name = acpi_dev_name(adev);
+
 	if (match->hrv == -1)
 		return 1;
 
@@ -789,20 +792,44 @@ static int acpi_dev_present_cb(struct device *dev, void *data)
  */
 bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
 {
-	struct acpi_dev_present_info match = {};
+	struct acpi_dev_match_info match = {};
 	struct device *dev;
 
 	strlcpy(match.hid[0].id, hid, sizeof(match.hid[0].id));
 	match.uid = uid;
 	match.hrv = hrv;
 
-	dev = bus_find_device(&acpi_bus_type, NULL, &match,
-			      acpi_dev_present_cb);
-
+	dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb);
 	return !!dev;
 }
 EXPORT_SYMBOL(acpi_dev_present);
 
+/**
+ * acpi_dev_get_first_match_name - Return name of first match of ACPI device
+ * @hid: Hardware ID of the device.
+ * @uid: Unique ID of the device, pass NULL to not check _UID
+ * @hrv: Hardware Revision of the device, pass -1 to not check _HRV
+ *
+ * Return device name if a matching device was present
+ * at the moment of invocation, or NULL otherwise.
+ *
+ * See additional information in acpi_dev_present() as well.
+ */
+const char *
+acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
+{
+	struct acpi_dev_match_info match = {};
+	struct device *dev;
+
+	strlcpy(match.hid[0].id, hid, sizeof(match.hid[0].id));
+	match.uid = uid;
+	match.hrv = hrv;
+
+	dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb);
+	return dev ? match.dev_name : NULL;
+}
+EXPORT_SYMBOL(acpi_dev_get_first_match_name);
+
 /*
  * acpi_backlight= handling, this is done here rather then in video_detect.c
  * because __setup cannot be used in modules.
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 79287629c888..c9608b0b80c6 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -91,6 +91,9 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev,
 bool acpi_dev_found(const char *hid);
 bool acpi_dev_present(const char *hid, const char *uid, s64 hrv);
 
+const char *
+acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv);
+
 #ifdef CONFIG_ACPI
 
 #include <linux/proc_fs.h>
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index dc1ebfeeb5ec..d918f1ea84e6 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -640,6 +640,12 @@ static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
 	return false;
 }
 
+static inline const char *
+acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
+{
+	return NULL;
+}
+
 static inline bool is_acpi_node(struct fwnode_handle *fwnode)
 {
 	return false;
-- 
2.15.1
^ permalink raw reply related	[flat|nested] 22+ messages in thread
* Re: [PATCH v3 3/3] ASoC: Intel - Convert to use acpi_dev_get_first_match_name()
  2018-01-12 19:03   ` Mark Brown
@ 2018-01-12 20:21     ` Andy Shevchenko
  2018-01-12 21:01       ` Mark Brown
  2018-01-12 21:03       ` Mark Brown
  0 siblings, 2 replies; 22+ messages in thread
From: Andy Shevchenko @ 2018-01-12 20:21 UTC (permalink / raw)
  To: Mark Brown
  Cc: Rafael J . Wysocki, Erik Schmauss, linux-acpi,
	Pierre-Louis Bossart, Liam Girdwood, alsa-devel, Linus Walleij,
	linux-gpio, Mika Westerberg
On Fri, 2018-01-12 at 19:03 +0000, Mark Brown wrote:
> On Fri, Jan 05, 2018 at 06:09:35PM +0200, Andy Shevchenko wrote:
> > Instead of home grown snd_soc_acpi_find_name_from_hid() use
> > acpi_dev_get_first_match_name().
> 
> This doesn't apply against current code (even after pulling Raphael's
> pull request) - can you please check and resend?
It requires Pierre's series #2 [1] to be applied first.
[1]: https://www.spinics.net/lists/alsa-devel/msg72463.html
-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH v3 3/3] ASoC: Intel - Convert to use acpi_dev_get_first_match_name()
  2018-01-12 20:21     ` Andy Shevchenko
@ 2018-01-12 21:01       ` Mark Brown
  2018-01-12 21:03       ` Mark Brown
  1 sibling, 0 replies; 22+ messages in thread
From: Mark Brown @ 2018-01-12 21:01 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Rafael J . Wysocki, Erik Schmauss, linux-acpi,
	Pierre-Louis Bossart, Liam Girdwood, alsa-devel, Linus Walleij,
	linux-gpio, Mika Westerberg
[-- Attachment #1: Type: text/plain, Size: 883 bytes --]
On Fri, Jan 12, 2018 at 10:21:07PM +0200, Andy Shevchenko wrote:
> On Fri, 2018-01-12 at 19:03 +0000, Mark Brown wrote:
> > This doesn't apply against current code (even after pulling Raphael's
> > pull request) - can you please check and resend?
> It requires Pierre's series #2 [1] to be applied first.
Ugh, I see.  I'm surprised I was getting pushed about applying this when
it had unreviewed dependencies...  
> [1]: https://www.spinics.net/lists/alsa-devel/msg72463.html
Please include human readable descriptions of things like commits and
issues being discussed in e-mail in your mails, this makes them much
easier for humans to read especially when they have no internet access.
I do frequently catch up on my mail on flights or while otherwise
travelling so this is even more pressing for me than just being about
making things a bit easier to read.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH v3 3/3] ASoC: Intel - Convert to use acpi_dev_get_first_match_name()
  2018-01-12 20:21     ` Andy Shevchenko
  2018-01-12 21:01       ` Mark Brown
@ 2018-01-12 21:03       ` Mark Brown
  1 sibling, 0 replies; 22+ messages in thread
From: Mark Brown @ 2018-01-12 21:03 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: alsa-devel, linux-gpio, Mika Westerberg, Linus Walleij,
	Rafael J . Wysocki, Liam Girdwood, Pierre-Louis Bossart,
	linux-acpi, Erik Schmauss
[-- Attachment #1.1: Type: text/plain, Size: 541 bytes --]
On Fri, Jan 12, 2018 at 10:21:07PM +0200, Andy Shevchenko wrote:
> On Fri, 2018-01-12 at 19:03 +0000, Mark Brown wrote:
> > This doesn't apply against current code (even after pulling Raphael's
> > pull request) - can you please check and resend?
> It requires Pierre's series #2 [1] to be applied first.
Oh, and please note that the "and resend" part there is important, if
I've replied like that it means the patch is gone from my review queue
so I'll need to go and try to find a copy to do something with it which
can be error prone.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply	[flat|nested] 22+ messages in thread
end of thread, other threads:[~2018-01-12 21:03 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-05 16:09 [PATCH v3 0/3] ACPI, ASoC, gpio: Add and use acpi_dev_get_first_match_name() Andy Shevchenko
2018-01-05 16:09 ` [PATCH v3 1/3] ACPI / utils: Introduce acpi_dev_get_first_match_name() Andy Shevchenko
2018-01-05 23:27   ` Rafael J. Wysocki
2018-01-08 13:09     ` Andy Shevchenko
2018-01-09  0:18       ` Rafael J. Wysocki
2018-01-09 13:34         ` Linus Walleij
2018-01-09 15:54       ` Mark Brown
2018-01-12 13:22         ` Rafael J. Wysocki
2018-01-12 20:01   ` Applied "ACPI: utils: Introduce acpi_dev_get_first_match_name()" to the asoc tree Mark Brown
2018-01-05 16:09 ` [PATCH v3 2/3] gpio: merrifield: Add support of ACPI enabled platforms Andy Shevchenko
2018-01-06  9:32   ` Mika Westerberg
2018-01-09 13:37   ` Linus Walleij
2018-01-12 20:01   ` Applied "gpio: merrifield: Add support of ACPI enabled platforms" to the asoc tree Mark Brown
2018-01-05 16:09 ` [PATCH v3 3/3] ASoC: Intel - Convert to use acpi_dev_get_first_match_name() Andy Shevchenko
2018-01-12 19:03   ` Mark Brown
2018-01-12 20:21     ` Andy Shevchenko
2018-01-12 21:01       ` Mark Brown
2018-01-12 21:03       ` Mark Brown
2018-01-05 16:13 ` [PATCH v3 0/3] ACPI, ASoC, gpio: Add and " Pierre-Louis Bossart
2018-01-05 17:08   ` Andy Shevchenko
2018-01-12 13:24 ` Rafael J. Wysocki
2018-01-12 14:00   ` Andy Shevchenko
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).