* @btlp: Apple ACPI method to toggle BT_WAKE pin ("Bluetooth Low Power")
* @btpu: Apple ACPI method to drive BT_REG_ON pin high ("Bluetooth Power Up")
* @btpd: Apple ACPI method to drive BT_REG_ON pin low ("Bluetooth Power Down")
- * @clk: clock used by Bluetooth device
- * @clk_enabled: whether @clk is prepared and enabled
+ * @txco_clk: external reference frequency clock used by Bluetooth device
+ * @clk_enabled: whether @txco_clk is prepared and enabled
* @init_speed: default baudrate of Bluetooth device;
* the host UART is initially set to this baudrate so that
* it can configure the Bluetooth device for @oper_speed
int gpio_int_idx;
#endif
- struct clk *clk;
+ struct clk *txco_clk;
bool clk_enabled;
u32 init_speed;
int err;
if (powered && !dev->clk_enabled) {
- err = clk_prepare_enable(dev->clk);
+ err = clk_prepare_enable(dev->txco_clk);
if (err)
return err;
}
goto err_revert_shutdown;
if (!powered && dev->clk_enabled)
- clk_disable_unprepare(dev->clk);
+ clk_disable_unprepare(dev->txco_clk);
dev->clk_enabled = powered;
dev->set_shutdown(dev, !powered);
err_clk_disable:
if (powered && !dev->clk_enabled)
- clk_disable_unprepare(dev->clk);
+ clk_disable_unprepare(dev->txco_clk);
return err;
}
return 0;
}
+/* Try a bunch of names for TXCO */
+static struct clk *bcm_get_txco(struct device *dev)
+{
+ struct clk *clk;
+
+ /* New explicit name */
+ clk = devm_clk_get(dev, "txco");
+ if (!IS_ERR(clk) || PTR_ERR(clk) == -EPROBE_DEFER)
+ return clk;
+
+ /* Deprecated name */
+ clk = devm_clk_get(dev, "extclk");
+ if (!IS_ERR(clk) || PTR_ERR(clk) == -EPROBE_DEFER)
+ return clk;
+
+ /* Original code used no name at all */
+ return devm_clk_get(dev, NULL);
+}
+
static int bcm_get_resources(struct bcm_device *dev)
{
const struct dmi_system_id *dmi_id;
if (x86_apple_machine && !bcm_apple_get_resources(dev))
return 0;
- dev->clk = devm_clk_get(dev->dev, NULL);
+ dev->txco_clk = bcm_get_txco(dev->dev);
/* Handle deferred probing */
- if (dev->clk == ERR_PTR(-EPROBE_DEFER))
- return PTR_ERR(dev->clk);
+ if (dev->txco_clk == ERR_PTR(-EPROBE_DEFER))
+ return PTR_ERR(dev->txco_clk);
/* Ignore all other errors as before */
- if (IS_ERR(dev->clk))
- dev->clk = NULL;
+ if (IS_ERR(dev->txco_clk))
+ dev->txco_clk = NULL;
dev->device_wakeup = devm_gpiod_get_optional(dev->dev, "device-wakeup",
GPIOD_OUT_LOW);