* [PATCH v1 1/2] Bluetooth: hci_bcm: Switch to devm_acpi_dev_add_driver_gpios()
@ 2017-06-06 14:47 Andy Shevchenko
2017-06-06 14:47 ` [PATCH v1 2/2] Bluetooth: hci_intel: Add GPIO ACPI mapping table Andy Shevchenko
2017-06-09 16:47 ` [PATCH v1 1/2] Bluetooth: hci_bcm: Switch to devm_acpi_dev_add_driver_gpios() Marcel Holtmann
0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2017-06-06 14:47 UTC (permalink / raw)
To: Marcel Holtmann, Gustavo Padovan, Johan Hedberg, linux-bluetooth
Cc: Andy Shevchenko
Switch to use managed variant of acpi_dev_add_driver_gpios() to simplify
error path and fix potentially wrong assingment if ->probe() fails.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/bluetooth/hci_bcm.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
index f87bfdfee4ff..e2096c7803b3 100644
--- a/drivers/bluetooth/hci_bcm.c
+++ b/drivers/bluetooth/hci_bcm.c
@@ -762,8 +762,7 @@ static int bcm_acpi_probe(struct bcm_device *dev)
if (id)
gpio_mapping = (const struct acpi_gpio_mapping *) id->driver_data;
- ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(&pdev->dev),
- gpio_mapping);
+ ret = devm_acpi_dev_add_driver_gpios(&pdev->dev, gpio_mapping);
if (ret)
return ret;
@@ -834,8 +833,6 @@ static int bcm_remove(struct platform_device *pdev)
list_del(&dev->list);
mutex_unlock(&bcm_device_lock);
- acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pdev->dev));
-
dev_info(&pdev->dev, "%s device unregistered.\n", dev->name);
return 0;
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v1 2/2] Bluetooth: hci_intel: Add GPIO ACPI mapping table
2017-06-06 14:47 [PATCH v1 1/2] Bluetooth: hci_bcm: Switch to devm_acpi_dev_add_driver_gpios() Andy Shevchenko
@ 2017-06-06 14:47 ` Andy Shevchenko
2017-06-09 16:47 ` Marcel Holtmann
2017-06-09 16:47 ` [PATCH v1 1/2] Bluetooth: hci_bcm: Switch to devm_acpi_dev_add_driver_gpios() Marcel Holtmann
1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2017-06-06 14:47 UTC (permalink / raw)
To: Marcel Holtmann, Gustavo Padovan, Johan Hedberg, linux-bluetooth
Cc: Andy Shevchenko
In order to make GPIO ACPI library stricter prepare users of
gpiod_get_index() to correctly behave when there no mapping is
provided by firmware.
Here we add explicit mapping between _CRS GpioIo() resources and
their names used in the driver.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/bluetooth/hci_intel.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c
index fa5099986f1b..851bee82df2a 100644
--- a/drivers/bluetooth/hci_intel.c
+++ b/drivers/bluetooth/hci_intel.c
@@ -1205,9 +1205,19 @@ static const struct dev_pm_ops intel_pm_ops = {
SET_RUNTIME_PM_OPS(intel_suspend_device, intel_resume_device, NULL)
};
+static const struct acpi_gpio_params reset_gpios = { 0, 0, false };
+static const struct acpi_gpio_params host_wake_gpios = { 1, 0, false };
+
+static const struct acpi_gpio_mapping acpi_hci_intel_gpios[] = {
+ { "reset-gpios", &reset_gpios, 1 },
+ { "host-wake-gpios", &host_wake_gpios, 1 },
+ { },
+};
+
static int intel_probe(struct platform_device *pdev)
{
struct intel_device *idev;
+ int ret;
idev = devm_kzalloc(&pdev->dev, sizeof(*idev), GFP_KERNEL);
if (!idev)
@@ -1217,6 +1227,10 @@ static int intel_probe(struct platform_device *pdev)
idev->pdev = pdev;
+ ret = devm_acpi_dev_add_driver_gpios(&pdev->dev, acpi_hci_intel_gpios);
+ if (ret)
+ dev_dbg(&pdev->dev, "Unable to add GPIO mapping table\n");
+
idev->reset = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(idev->reset)) {
dev_err(&pdev->dev, "Unable to retrieve gpio\n");
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/2] Bluetooth: hci_bcm: Switch to devm_acpi_dev_add_driver_gpios()
2017-06-06 14:47 [PATCH v1 1/2] Bluetooth: hci_bcm: Switch to devm_acpi_dev_add_driver_gpios() Andy Shevchenko
2017-06-06 14:47 ` [PATCH v1 2/2] Bluetooth: hci_intel: Add GPIO ACPI mapping table Andy Shevchenko
@ 2017-06-09 16:47 ` Marcel Holtmann
1 sibling, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2017-06-09 16:47 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Gustavo F. Padovan, Johan Hedberg, linux-bluetooth
Hi Andy,
> Switch to use managed variant of acpi_dev_add_driver_gpios() to simplify
> error path and fix potentially wrong assingment if ->probe() fails.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/bluetooth/hci_bcm.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 2/2] Bluetooth: hci_intel: Add GPIO ACPI mapping table
2017-06-06 14:47 ` [PATCH v1 2/2] Bluetooth: hci_intel: Add GPIO ACPI mapping table Andy Shevchenko
@ 2017-06-09 16:47 ` Marcel Holtmann
0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2017-06-09 16:47 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Gustavo F. Padovan, Johan Hedberg, linux-bluetooth
Hi Andy,
> In order to make GPIO ACPI library stricter prepare users of
> gpiod_get_index() to correctly behave when there no mapping is
> provided by firmware.
>
> Here we add explicit mapping between _CRS GpioIo() resources and
> their names used in the driver.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/bluetooth/hci_intel.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-06-09 16:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-06 14:47 [PATCH v1 1/2] Bluetooth: hci_bcm: Switch to devm_acpi_dev_add_driver_gpios() Andy Shevchenko
2017-06-06 14:47 ` [PATCH v1 2/2] Bluetooth: hci_intel: Add GPIO ACPI mapping table Andy Shevchenko
2017-06-09 16:47 ` Marcel Holtmann
2017-06-09 16:47 ` [PATCH v1 1/2] Bluetooth: hci_bcm: Switch to devm_acpi_dev_add_driver_gpios() Marcel Holtmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.