[PATCH v2 2/3] Bluetooth: hci_uart: Add support for Amlogic HCI UART
Krzysztof Kozlowski
krzk at kernel.org
Thu Jul 18 04:43:21 PDT 2024
On 18/07/2024 09:42, Yang Li via B4 Relay wrote:
> From: Yang Li <yang.li at amlogic.com>
>
> 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?
> + 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?
> + 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?
> + gpiod_set_value_cansleep(amldev->bt_en_gpio, 1);
> +
> + /* wait 100ms for bluetooth controller power on */
> + msleep(100);
> + return 0;
> +}
Best regards,
Krzysztof
More information about the linux-arm-kernel
mailing list