[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0bfeee6a-a425-4892-a062-5ef91db305a3@kernel.org>
Date: Thu, 18 Jul 2024 13:43:21 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: yang.li@...ogic.com, Marcel Holtmann <marcel@...tmann.org>,
Luiz Augusto von Dentz <luiz.dentz@...il.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Catalin Marinas
<catalin.marinas@....com>, Will Deacon <will@...nel.org>
Cc: linux-bluetooth@...r.kernel.org, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, Ye He <ye.he@...ogic.com>
Subject: Re: [PATCH v2 2/3] Bluetooth: hci_uart: Add support for Amlogic HCI
UART
On 18/07/2024 09:42, Yang Li via B4 Relay wrote:
> From: Yang Li <yang.li@...ogic.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
Powered by blists - more mailing lists