lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c379dca6-88a7-8ed6-c585-714ea411bd02@collabora.com>
Date:   Thu, 23 Jun 2022 10:42:26 +0200
From:   AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>
To:     sean.wang@...iatek.com, marcel@...tmann.org,
        johan.hedberg@...il.com
Cc:     Soul.Huang@...iatek.com, YN.Chen@...iatek.com,
        Leon.Yen@...iatek.com, Eric-SY.Chang@...iatek.com,
        Deren.Wu@...iatek.com, km.lin@...iatek.com,
        robin.chiu@...iatek.com, Eddie.Chen@...iatek.com,
        ch.yeh@...iatek.com, posh.sun@...iatek.com, ted.huang@...iatek.com,
        Eric.Liang@...iatek.com, Stella.Chang@...iatek.com,
        Tom.Chou@...iatek.com, steve.lee@...iatek.com, jsiuda@...gle.com,
        frankgor@...gle.com, abhishekpandit@...gle.com,
        michaelfsun@...gle.com, mcchou@...omium.org, shawnku@...gle.com,
        linux-bluetooth@...r.kernel.org,
        linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Yake Yang <yake.yang@...iatek.com>
Subject: Re: [PATCH v2] Bluetooth: btmtksdio: Add in-band wakeup support

Il 22/06/22 23:56, sean.wang@...iatek.com ha scritto:
> From: Sean Wang <sean.wang@...iatek.com>
> 
> Commit ce64b3e94919 ("Bluetooth: mt7921s: Support wake on bluetooth")
> adds the wake on bluethooth via a dedicated GPIO.
> 
> Extend the wake-on-bluetooth to use the SDIO DAT1 pin (in-band wakeup),
> when supported by the SDIO host driver.
> 
> Co-developed-by: Yake Yang <yake.yang@...iatek.com>
> Signed-off-by: Yake Yang <yake.yang@...iatek.com>
> Signed-off-by: Sean Wang <sean.wang@...iatek.com>
> ---
> v2: enhance the patch description and comments
> ---
>   drivers/bluetooth/btmtksdio.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
> index d6700efcfe8c..9d79c9107b3a 100644
> --- a/drivers/bluetooth/btmtksdio.c
> +++ b/drivers/bluetooth/btmtksdio.c
> @@ -118,6 +118,7 @@ MODULE_DEVICE_TABLE(sdio, btmtksdio_table);
>   #define BTMTKSDIO_FUNC_ENABLED		3
>   #define BTMTKSDIO_PATCH_ENABLED		4
>   #define BTMTKSDIO_HW_RESET_ACTIVE	5
> +#define BTMTKSDIO_INBAND_WAKEUP		6
>   
>   struct mtkbtsdio_hdr {
>   	__le16	len;
> @@ -1294,6 +1295,9 @@ static bool btmtksdio_sdio_wakeup(struct hci_dev *hdev)
>   		.wakeup_delay = cpu_to_le16(0x20),
>   	};
>   
> +	if (test_bit(BTMTKSDIO_INBAND_WAKEUP, &bdev->tx_state))
> +		return may_wakeup;
> +

Uhm... this flag is either *always* set, or *always not set*... and we decide that
during probe time... and we use it in just one function as well.

At this point, I would just avoid the addition of the BTMTKSDIO_INBAND_WAKEUP flag
and add a new function for handling the .wakeup() callback - something like:

static bool btmtksdio_sdio_inband_wakeup(struct hci_dev *hdev)
{
	struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);

	return device_may_wakeup(bdev->dev);
}

static int btmtksdio_probe(...)
{
	.... code ....

	/*
	 * If SDIO controller supports wake on Bluetooth, sending a wakeon
	 * command is not necessary.
	 */
	if (device_can_wakeup(func->card->host->parent))
		hdev->wakeup = btmtksdio_sdio_inband_wakeup;
	else
		hdev->wakeup = btmtksdio_sdio_wakeup;

	.... etc ....
}

Regards,
Angelo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ