Skip to contentSkip to conversation

Bluetooth: hci_bcm: Support platform enumeration

PATCH In review Andy Shevchenko 2 participants 8 messages Mar 10, 2017 – Mar 28, 2017 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: hci_bcm: Support platform enumeration

Until now the driver supports only ACPI enumeration. Nevertheless Intel Edison SoM has Broadcom Wi-Fi + BT chip and neither ACPI nor DT enumeration mechanism.

Enable pure platform driver in order to support Intel Edison SoM.

---
 drivers/bluetooth/hci_bcm.c | 50 ++++++++++++++++++++++++++++++---------------
 1 file changed, 33 insertions(+), 17 deletions(-)
drivers/bluetooth/hci_bcm.c +33 -17
index 5262a2077d7a..a26a4ca6968b 100644
@@ -697,28 +697,14 @@ static int bcm_resource(struct acpi_resource *ares, void *data)
 	/* Always tell the ACPI core to skip this resource */
 	return 1;
 }
+#endif /* CONFIG_ACPI */
 
-static int bcm_acpi_probe(struct bcm_device *dev)
+static int bcm_platform_probe(struct bcm_device *dev)
 {
 	struct platform_device *pdev = dev->pdev;
-	LIST_HEAD(resources);
-	const struct dmi_system_id *dmi_id;
-	const struct acpi_gpio_mapping *gpio_mapping = acpi_bcm_int_last_gpios;
-	const struct acpi_device_id *id;
-	int ret;
 
 	dev->name = dev_name(&pdev->dev);
 
-	/* Retrieve GPIO data */
-	id = acpi_match_device(pdev->dev.driver->acpi_match_table, &pdev->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);
-	if (ret)
-		return ret;
-
 	dev->clk = devm_clk_get(&pdev->dev, NULL);
 
 	dev->device_wakeup = devm_gpiod_get_optional(&pdev->dev,
@@ -755,6 +741,33 @@ static int bcm_acpi_probe(struct bcm_device *dev)
 		return -EINVAL;
 	}
 
+	return 0;
+}
+
+#ifdef CONFIG_ACPI
+static int bcm_acpi_probe(struct bcm_device *dev)
+{
+	struct platform_device *pdev = dev->pdev;
+	LIST_HEAD(resources);
+	const struct dmi_system_id *dmi_id;
+	const struct acpi_gpio_mapping *gpio_mapping = acpi_bcm_int_last_gpios;
+	const struct acpi_device_id *id;
+	int ret;
+
+	/* Retrieve GPIO data */
+	id = acpi_match_device(pdev->dev.driver->acpi_match_table, &pdev->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);
+	if (ret)
+		return ret;
+
+	ret = bcm_platform_probe(dev);
+	if (ret)
+		return ret;
+
 	/* Retrieve UART ACPI info */
 	ret = acpi_dev_get_resources(ACPI_COMPANION(&dev->pdev->dev),
 				     &resources, bcm_resource, dev);
@@ -789,7 +802,10 @@ static int bcm_probe(struct platform_device *pdev)
 
 	dev->pdev = pdev;
 
-	ret = bcm_acpi_probe(dev);
+	if (has_acpi_companion(&pdev->dev))
+		ret = bcm_acpi_probe(dev);
+	else
+		ret = bcm_platform_probe(dev);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.11.0
#1 lore raw
Quoted 6 lines · Andy Shevchenko

Until now the driver supports only ACPI enumeration. Nevertheless Intel Edison SoM has Broadcom Wi-Fi + BT chip and neither ACPI nor DT enumeration mechanism.

Enable pure platform driver in order to support Intel Edison SoM.

Any comment on this?

Quoted 96 lines

---
 drivers/bluetooth/hci_bcm.c | 50 ++++++++++++++++++++++++++++++----
-----------

 1 file changed, 33 insertions(+), 17 deletions(-)
drivers/bluetooth/hci_bcm.c +1 -0
index 5262a2077d7a..a26a4ca6968b 100644
@@ -697,28 +697,14 @@ static int bcm_resource(struct acpi_resource
 *ares, void *data)
  	/* Always tell the ACPI core to skip this resource */
  	return 1;
  }
+#endif /* CONFIG_ACPI */

drivers/bluetooth/hci_bcm.c +1 -1
-static int bcm_acpi_probe(struct bcm_device *dev)
+static int bcm_platform_probe(struct bcm_device *dev)

 {
  struct platform_device *pdev = dev->pdev;

drivers/bluetooth/hci_bcm.c +0 -3
-	LIST_HEAD(resources);
-	const struct dmi_system_id *dmi_id;
-	const struct acpi_gpio_mapping *gpio_mapping =

acpi_bcm_int_last_gpios;

drivers/bluetooth/hci_bcm.c +0 -2
-	const struct acpi_device_id *id;
-	int ret;


  dev->name = dev_name(&pdev->dev);

drivers/bluetooth/hci_bcm.c +0 -2
-	/* Retrieve GPIO data */
-	id = acpi_match_device(pdev->dev.driver->acpi_match_table,

&pdev->dev);

drivers/bluetooth/hci_bcm.c +0 -2
-	if (id)
-		gpio_mapping = (const struct acpi_gpio_mapping *) id-
Quoted 1 line

driver_data;

drivers/bluetooth/hci_bcm.c +0 -6
-
-	ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(&pdev->dev),
-					gpio_mapping);
-	if (ret)
-		return ret;
-

  dev->clk = devm_clk_get(&pdev->dev, NULL);

  dev->device_wakeup = devm_gpiod_get_optional(&pdev->dev,

drivers/bluetooth/hci_bcm.c +0 -0
@@ -755,6 +741,33 @@ static int bcm_acpi_probe(struct bcm_device *dev)
  		return -EINVAL;
  	}

drivers/bluetooth/hci_bcm.c +10 -0
+	return 0;
+}
+
+#ifdef CONFIG_ACPI
+static int bcm_acpi_probe(struct bcm_device *dev)
+{
+	struct platform_device *pdev = dev->pdev;
+	LIST_HEAD(resources);
+	const struct dmi_system_id *dmi_id;
+	const struct acpi_gpio_mapping *gpio_mapping =

acpi_bcm_int_last_gpios;

drivers/bluetooth/hci_bcm.c +5 -0
+	const struct acpi_device_id *id;
+	int ret;
+
+	/* Retrieve GPIO data */
+	id = acpi_match_device(pdev->dev.driver->acpi_match_table,

&pdev->dev);

drivers/bluetooth/hci_bcm.c +2 -0
+	if (id)
+		gpio_mapping = (const struct acpi_gpio_mapping *) id-
Quoted 1 line

driver_data;

drivers/bluetooth/hci_bcm.c +10 -0
+
+	ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(&pdev->dev),
+					gpio_mapping);
+	if (ret)
+		return ret;
+
+	ret = bcm_platform_probe(dev);
+	if (ret)
+		return ret;
+

  /* Retrieve UART ACPI info */
  ret = acpi_dev_get_resources(ACPI_COMPANION(&dev->pdev->dev), &resources, bcm_resource, dev);

drivers/bluetooth/hci_bcm.c +0 -0
@@ -789,7 +802,10 @@ static int bcm_probe(struct platform_device
 *pdev)


  dev->pdev = pdev;

drivers/bluetooth/hci_bcm.c +4 -1
-	ret = bcm_acpi_probe(dev);
+	if (has_acpi_companion(&pdev->dev))
+		ret = bcm_acpi_probe(dev);
+	else
+		ret = bcm_platform_probe(dev);

  if (ret)
  return ret;

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
maintainer
#2 lore raw
In reply to Andy Shevchenko

Hi Andy,

Quoted 5 lines

Until now the driver supports only ACPI enumeration. Nevertheless Intel Edison SoM has Broadcom Wi-Fi + BT chip and neither ACPI nor DT enumeration mechanism.

Enable pure platform driver in order to support Intel Edison SoM.

explain to me what this the case. Didn’t we enabled also DT for Edison? And I assumed in general we planned to move away from platform drivers in favour of DT.

Regards

Marcel

#3 lore raw
Quoted 7 lines · Marcel Holtmann

Hi Andy,

Quoted 5 lines

Until now the driver supports only ACPI enumeration. Nevertheless Intel Edison SoM has Broadcom Wi-Fi + BT chip and neither ACPI nor DT
enumeration mechanism.

Quoted 5 lines
Quoted 1 line

Enable pure platform driver in order to support Intel Edison SoM.

explain to me what this the case. Didn’t we enabled also DT for Edison? And I assumed in general we planned to move away from platform drivers in favour of DT.

Nope. It's SFI based device which basically means platform data only.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
maintainer
#4 lore raw

Hi Andy,

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Until now the driver supports only ACPI enumeration. Nevertheless Intel Edison SoM has Broadcom Wi-Fi + BT chip and neither ACPI nor DT
enumeration mechanism.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Enable pure platform driver in order to support Intel Edison SoM.

explain to me what this the case. Didn’t we enabled also DT for Edison? And I assumed in general we planned to move away from platform drivers in favour of DT.

Nope. It's SFI based device which basically means platform data only.

hold on, but SFI can be enumerated like ACPI. What am I missing here?

Regards

Marcel

#5 lore raw
Quoted 17 lines · Marcel Holtmann

Hi Andy,

Quoted 15 lines
Quoted 14 lines
Quoted 9 lines

Until now the driver supports only ACPI enumeration. Nevertheless
Intel Edison SoM has Broadcom Wi-Fi + BT chip and neither ACPI nor
DT
enumeration mechanism.

Enable pure platform driver in order to support Intel Edison SoM.

explain to me what this the case. Didn’t we enabled also DT for Edison? And I assumed in general we planned to move away from platform
drivers in favour of DT.

Quoted 4 lines
Quoted 2 lines

Nope. It's SFI based device which basically means platform data only.

hold on, but SFI can be enumerated like ACPI. What am I missing here?

You missed a whole point. :-)

SFI so useless that you may just forget about it.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
maintainer
#6 lore raw

Hi Andy,

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 9 lines

Until now the driver supports only ACPI enumeration. Nevertheless
Intel Edison SoM has Broadcom Wi-Fi + BT chip and neither ACPI nor
DT
enumeration mechanism.

Enable pure platform driver in order to support Intel Edison SoM.

explain to me what this the case. Didn’t we enabled also DT for Edison? And I assumed in general we planned to move away from platform
drivers in favour of DT.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Nope. It's SFI based device which basically means platform data only.

hold on, but SFI can be enumerated like ACPI. What am I missing here?

You missed a whole point. :-)

SFI so useless that you may just forget about it.

my memory of MRST is still present ;)

Regards

Marcel

maintainer
#7 lore raw
In reply to Andy Shevchenko

Hi Andy,

Quoted 11 lines

Until now the driver supports only ACPI enumeration. Nevertheless Intel Edison SoM has Broadcom Wi-Fi + BT chip and neither ACPI nor DT enumeration mechanism.

Enable pure platform driver in order to support Intel Edison SoM.

---
drivers/bluetooth/hci_bcm.c | 50 ++++++++++++++++++++++++++++++---------------

1 file changed, 33 insertions(+), 17 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel