netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, marcel@holtmann.org,
	johan.hedberg@gmail.com, luiz.dentz@gmail.com,
	gregkh@linuxfoundation.org, jirislaby@kernel.org,
	alok.a.tiwari@oracle.com, hdanton@sina.com,
	ilpo.jarvinen@linux.intel.com, leon@kernel.org,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org,
	linux-serial@vger.kernel.org, amitkumar.karwar@nxp.com,
	rohit.fule@nxp.com, sherry.sun@nxp.com
Subject: Re: [PATCH v12 4/4] Bluetooth: NXP: Add protocol support for NXP Bluetooth chipsets
Date: Wed, 15 Mar 2023 17:15:23 +0100	[thread overview]
Message-ID: <ZBHvG9Nh1n+xp59X@corigine.com> (raw)
In-Reply-To: <20230315120327.958413-5-neeraj.sanjaykale@nxp.com>

On Wed, Mar 15, 2023 at 05:33:26PM +0530, Neeraj Sanjay Kale wrote:
> This adds a driver based on serdev driver for the NXP BT serial protocol
> based on running H:4, which can enable the built-in Bluetooth device
> inside an NXP BT chip.
> 
> This driver has Power Save feature that will put the chip into sleep state
> whenever there is no activity for 2000ms, and will be woken up when any
> activity is to be initiated over UART.
> 
> This driver enables the power save feature by default by sending the vendor
> specific commands to the chip during setup.
> 
> During setup, the driver checks if a FW is already running on the chip
> by waiting for the bootloader signature, and downloads device specific FW
> file into the chip over UART if bootloader signature is received..
> 
> Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

...

> +static int nxp_set_ind_reset(struct hci_dev *hdev, void *data)
> +{
> +	struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev);
> +	struct sk_buff *skb;
> +	u8 *status;
> +	u8 pcmd = 0;
> +	int err = 0;
> +
> +	skb = nxp_drv_send_cmd(hdev, HCI_NXP_IND_RESET, 1, &pcmd);
> +	if (IS_ERR(skb))
> +		return PTR_ERR(skb);
> +
> +	status = skb_pull_data(skb, 1);
> +	if (status) {
> +		if (*status == 0) {
> +			set_bit(BTNXPUART_FW_DOWNLOADING, &nxpdev->tx_state);

nit: perhaps this can be written more idiomatically as:

	if (!status || *status)
		goto free_skb;

	set_bit(BTNXPUART_FW_DOWNLOADING, &nxpdev->tx_state);
	...

> +			err = nxp_download_firmware(hdev);
> +			if (err < 0)
> +				goto free_skb;
> +			serdev_device_set_baudrate(nxpdev->serdev, nxpdev->fw_init_baudrate);
> +			nxpdev->current_baudrate = nxpdev->fw_init_baudrate;
> +			hci_cmd_sync_queue(hdev, send_wakeup_method_cmd, NULL, NULL);
> +			hci_cmd_sync_queue(hdev, send_ps_cmd, NULL, NULL);
> +		}
> +	}
> +
> +free_skb:
> +	kfree_skb(skb);
> +	return err;
> +}

...

      parent reply	other threads:[~2023-03-15 16:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 12:03 [PATCH v12 0/4] Add support for NXP bluetooth chipsets Neeraj Sanjay Kale
2023-03-15 12:03 ` [PATCH v12 1/4] serdev: Replace all instances of ENOTSUPP with EOPNOTSUPP Neeraj Sanjay Kale
2023-03-15 16:06   ` Simon Horman
2023-03-15 12:03 ` [PATCH v12 2/4] serdev: Add method to assert break signal over tty UART port Neeraj Sanjay Kale
2023-03-15 16:09   ` Simon Horman
2023-03-15 12:03 ` [PATCH v12 3/4] dt-bindings: net: bluetooth: Add NXP bluetooth support Neeraj Sanjay Kale
2023-03-15 12:03 ` [PATCH v12 4/4] Bluetooth: NXP: Add protocol support for NXP Bluetooth chipsets Neeraj Sanjay Kale
2023-03-15 13:57   ` Paul Menzel
2023-03-16  7:06     ` [EXT] " Neeraj sanjay kale
2023-03-15 16:15   ` Simon Horman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZBHvG9Nh1n+xp59X@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=alok.a.tiwari@oracle.com \
    --cc=amitkumar.karwar@nxp.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdanton@sina.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=johan.hedberg@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=neeraj.sanjaykale@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh+dt@kernel.org \
    --cc=rohit.fule@nxp.com \
    --cc=sherry.sun@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).