Re: [PATCH v2 2/3] Bluetooth: hci_uart: Add support for Amlogic HCI UART

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Krzysztof

Thanks for the review.

On 2024/7/18 19:43, Krzysztof Kozlowski wrote:
On 18/07/2024 09:42, Yang Li via B4 Relay wrote:
From: Yang Li <yang.li@xxxxxxxxxxx>

This patch introduces support for Amlogic Bluetooth controller over
UART. In order to send the final firmware at full speed. It is a pretty
straight forward H4 driver with exception of actually having it's own
setup address configuration.

...

+static int aml_parse_dt(struct aml_serdev *amldev)
+{
+     struct device *pdev = amldev->dev;
+
+     amldev->bt_en_gpio = devm_gpiod_get(pdev, "bt-enable",
+                                     GPIOD_OUT_LOW);
+     if (IS_ERR(amldev->bt_en_gpio)) {
+             dev_err(pdev, "Failed to acquire bt-enable gpios");
+             return PTR_ERR(amldev->bt_en_gpio);
+     }
+
+     if (device_property_read_string(pdev, "firmware-name",
+                                     &amldev->firmware_name)) {
+             dev_err(pdev, "Failed to acquire firmware path");
+             return -ENODEV;
+     }
+
+     amldev->bt_supply = devm_regulator_get(pdev, "bt");
+     if (IS_ERR(amldev->bt_supply)) {
+             dev_err(pdev, "Failed to acquire regulator");
+             return PTR_ERR(amldev->bt_supply);
+     }
+
+     amldev->lpo_clk = devm_clk_get(pdev, NULL);
+     if (IS_ERR(amldev->lpo_clk)) {
+             dev_err(pdev, "Failed to acquire clock source");
+             return PTR_ERR(amldev->lpo_clk);
+     }
+
+     /* get rf config parameter */
+     if (device_property_read_u32(pdev, "antenna-number",
+                             &amldev->ant_number)) {
+             dev_info(pdev, "No antenna-number, using default value");
+             amldev->ant_number = 1;
+     }
+
+     return 0;
+}
+
+static int aml_power_on(struct aml_serdev *amldev)
+{
+     int err;
+
+     if (!IS_ERR(amldev->bt_supply)) {
How is IS_ERR possible?
Well, I got it.

+             err = regulator_enable(amldev->bt_supply);
+             if (err) {
+                     dev_err(amldev->dev, "Failed to enable regulator: (%d)", err);
+                     return err;
+             }
+     }
+
+     if (!IS_ERR(amldev->lpo_clk)) {
How is IS_ERR possible?
I got it.

+             err = clk_prepare_enable(amldev->lpo_clk);
+             if (err) {
+                     dev_err(amldev->dev, "Failed to enable lpo clock: (%d)", err);
+                     return err;
+             }
+     }
+
+     if (!IS_ERR(amldev->bt_en_gpio))
How is IS_ERR possible?
I got it.

+             gpiod_set_value_cansleep(amldev->bt_en_gpio, 1);
+
+     /* wait 100ms for bluetooth controller power on  */
+     msleep(100);
+     return 0;
+}

Best regards,
Krzysztof





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux