h5                100 drivers/bluetooth/hci_h5.c 	int (*setup)(struct h5 *h5);
h5                101 drivers/bluetooth/hci_h5.c 	void (*open)(struct h5 *h5);
h5                102 drivers/bluetooth/hci_h5.c 	void (*close)(struct h5 *h5);
h5                103 drivers/bluetooth/hci_h5.c 	int (*suspend)(struct h5 *h5);
h5                104 drivers/bluetooth/hci_h5.c 	int (*resume)(struct h5 *h5);
h5                108 drivers/bluetooth/hci_h5.c static void h5_reset_rx(struct h5 *h5);
h5                112 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = hu->priv;
h5                123 drivers/bluetooth/hci_h5.c 	skb_queue_tail(&h5->unrel, nskb);
h5                126 drivers/bluetooth/hci_h5.c static u8 h5_cfg_field(struct h5 *h5)
h5                129 drivers/bluetooth/hci_h5.c 	return h5->tx_win & 0x07;
h5                136 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = from_timer(h5, t, timer);
h5                137 drivers/bluetooth/hci_h5.c 	struct hci_uart *hu = h5->hu;
h5                143 drivers/bluetooth/hci_h5.c 	if (h5->state == H5_UNINITIALIZED)
h5                146 drivers/bluetooth/hci_h5.c 	if (h5->state == H5_INITIALIZED) {
h5                147 drivers/bluetooth/hci_h5.c 		conf_req[2] = h5_cfg_field(h5);
h5                151 drivers/bluetooth/hci_h5.c 	if (h5->state != H5_ACTIVE) {
h5                152 drivers/bluetooth/hci_h5.c 		mod_timer(&h5->timer, jiffies + H5_SYNC_TIMEOUT);
h5                156 drivers/bluetooth/hci_h5.c 	if (h5->sleep != H5_AWAKE) {
h5                157 drivers/bluetooth/hci_h5.c 		h5->sleep = H5_SLEEPING;
h5                161 drivers/bluetooth/hci_h5.c 	BT_DBG("hu %p retransmitting %u pkts", hu, h5->unack.qlen);
h5                163 drivers/bluetooth/hci_h5.c 	spin_lock_irqsave_nested(&h5->unack.lock, flags, SINGLE_DEPTH_NESTING);
h5                165 drivers/bluetooth/hci_h5.c 	while ((skb = __skb_dequeue_tail(&h5->unack)) != NULL) {
h5                166 drivers/bluetooth/hci_h5.c 		h5->tx_seq = (h5->tx_seq - 1) & 0x07;
h5                167 drivers/bluetooth/hci_h5.c 		skb_queue_head(&h5->rel, skb);
h5                170 drivers/bluetooth/hci_h5.c 	spin_unlock_irqrestore(&h5->unack.lock, flags);
h5                178 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = hu->priv;
h5                182 drivers/bluetooth/hci_h5.c 	h5->state = H5_UNINITIALIZED;
h5                184 drivers/bluetooth/hci_h5.c 	del_timer(&h5->timer);
h5                186 drivers/bluetooth/hci_h5.c 	skb_queue_purge(&h5->rel);
h5                187 drivers/bluetooth/hci_h5.c 	skb_queue_purge(&h5->unrel);
h5                188 drivers/bluetooth/hci_h5.c 	skb_queue_purge(&h5->unack);
h5                190 drivers/bluetooth/hci_h5.c 	h5->tx_seq = 0;
h5                191 drivers/bluetooth/hci_h5.c 	h5->tx_ack = 0;
h5                199 drivers/bluetooth/hci_h5.c 	struct h5 *h5;
h5                205 drivers/bluetooth/hci_h5.c 		h5 = serdev_device_get_drvdata(hu->serdev);
h5                207 drivers/bluetooth/hci_h5.c 		h5 = kzalloc(sizeof(*h5), GFP_KERNEL);
h5                208 drivers/bluetooth/hci_h5.c 		if (!h5)
h5                212 drivers/bluetooth/hci_h5.c 	hu->priv = h5;
h5                213 drivers/bluetooth/hci_h5.c 	h5->hu = hu;
h5                215 drivers/bluetooth/hci_h5.c 	skb_queue_head_init(&h5->unack);
h5                216 drivers/bluetooth/hci_h5.c 	skb_queue_head_init(&h5->rel);
h5                217 drivers/bluetooth/hci_h5.c 	skb_queue_head_init(&h5->unrel);
h5                219 drivers/bluetooth/hci_h5.c 	h5_reset_rx(h5);
h5                221 drivers/bluetooth/hci_h5.c 	timer_setup(&h5->timer, h5_timed_event, 0);
h5                223 drivers/bluetooth/hci_h5.c 	h5->tx_win = H5_TX_WIN_MAX;
h5                225 drivers/bluetooth/hci_h5.c 	if (h5->vnd && h5->vnd->open)
h5                226 drivers/bluetooth/hci_h5.c 		h5->vnd->open(h5);
h5                232 drivers/bluetooth/hci_h5.c 	mod_timer(&h5->timer, jiffies + H5_SYNC_TIMEOUT);
h5                239 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = hu->priv;
h5                241 drivers/bluetooth/hci_h5.c 	del_timer_sync(&h5->timer);
h5                243 drivers/bluetooth/hci_h5.c 	skb_queue_purge(&h5->unack);
h5                244 drivers/bluetooth/hci_h5.c 	skb_queue_purge(&h5->rel);
h5                245 drivers/bluetooth/hci_h5.c 	skb_queue_purge(&h5->unrel);
h5                247 drivers/bluetooth/hci_h5.c 	if (h5->vnd && h5->vnd->close)
h5                248 drivers/bluetooth/hci_h5.c 		h5->vnd->close(h5);
h5                251 drivers/bluetooth/hci_h5.c 		kfree(h5);
h5                258 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = hu->priv;
h5                260 drivers/bluetooth/hci_h5.c 	if (h5->vnd && h5->vnd->setup)
h5                261 drivers/bluetooth/hci_h5.c 		return h5->vnd->setup(h5);
h5                266 drivers/bluetooth/hci_h5.c static void h5_pkt_cull(struct h5 *h5)
h5                273 drivers/bluetooth/hci_h5.c 	spin_lock_irqsave(&h5->unack.lock, flags);
h5                275 drivers/bluetooth/hci_h5.c 	to_remove = skb_queue_len(&h5->unack);
h5                279 drivers/bluetooth/hci_h5.c 	seq = h5->tx_seq;
h5                282 drivers/bluetooth/hci_h5.c 		if (h5->rx_ack == seq)
h5                289 drivers/bluetooth/hci_h5.c 	if (seq != h5->rx_ack)
h5                293 drivers/bluetooth/hci_h5.c 	skb_queue_walk_safe(&h5->unack, skb, tmp) {
h5                297 drivers/bluetooth/hci_h5.c 		__skb_unlink(skb, &h5->unack);
h5                301 drivers/bluetooth/hci_h5.c 	if (skb_queue_empty(&h5->unack))
h5                302 drivers/bluetooth/hci_h5.c 		del_timer(&h5->timer);
h5                305 drivers/bluetooth/hci_h5.c 	spin_unlock_irqrestore(&h5->unack.lock, flags);
h5                310 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = hu->priv;
h5                318 drivers/bluetooth/hci_h5.c 	const unsigned char *hdr = h5->rx_skb->data;
h5                319 drivers/bluetooth/hci_h5.c 	const unsigned char *data = &h5->rx_skb->data[4];
h5                329 drivers/bluetooth/hci_h5.c 	conf_req[2] = h5_cfg_field(h5);
h5                332 drivers/bluetooth/hci_h5.c 		if (h5->state == H5_ACTIVE)
h5                336 drivers/bluetooth/hci_h5.c 		if (h5->state == H5_ACTIVE)
h5                338 drivers/bluetooth/hci_h5.c 		h5->state = H5_INITIALIZED;
h5                345 drivers/bluetooth/hci_h5.c 			h5->tx_win = (data[2] & 0x07);
h5                346 drivers/bluetooth/hci_h5.c 		BT_DBG("Three-wire init complete. tx_win %u", h5->tx_win);
h5                347 drivers/bluetooth/hci_h5.c 		h5->state = H5_ACTIVE;
h5                352 drivers/bluetooth/hci_h5.c 		h5->sleep = H5_SLEEPING;
h5                356 drivers/bluetooth/hci_h5.c 		h5->sleep = H5_AWAKE;
h5                360 drivers/bluetooth/hci_h5.c 		h5->sleep = H5_AWAKE;
h5                371 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = hu->priv;
h5                372 drivers/bluetooth/hci_h5.c 	const unsigned char *hdr = h5->rx_skb->data;
h5                375 drivers/bluetooth/hci_h5.c 		h5->tx_ack = (h5->tx_ack + 1) % 8;
h5                376 drivers/bluetooth/hci_h5.c 		set_bit(H5_TX_ACK_REQ, &h5->flags);
h5                380 drivers/bluetooth/hci_h5.c 	h5->rx_ack = H5_HDR_ACK(hdr);
h5                382 drivers/bluetooth/hci_h5.c 	h5_pkt_cull(h5);
h5                388 drivers/bluetooth/hci_h5.c 		hci_skb_pkt_type(h5->rx_skb) = H5_HDR_PKT_TYPE(hdr);
h5                391 drivers/bluetooth/hci_h5.c 		skb_pull(h5->rx_skb, 4);
h5                393 drivers/bluetooth/hci_h5.c 		hci_recv_frame(hu->hdev, h5->rx_skb);
h5                394 drivers/bluetooth/hci_h5.c 		h5->rx_skb = NULL;
h5                403 drivers/bluetooth/hci_h5.c 	h5_reset_rx(h5);
h5                415 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = hu->priv;
h5                416 drivers/bluetooth/hci_h5.c 	const unsigned char *hdr = h5->rx_skb->data;
h5                419 drivers/bluetooth/hci_h5.c 		h5->rx_func = h5_rx_crc;
h5                420 drivers/bluetooth/hci_h5.c 		h5->rx_pending = 2;
h5                430 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = hu->priv;
h5                431 drivers/bluetooth/hci_h5.c 	const unsigned char *hdr = h5->rx_skb->data;
h5                440 drivers/bluetooth/hci_h5.c 		h5_reset_rx(h5);
h5                444 drivers/bluetooth/hci_h5.c 	if (H5_HDR_RELIABLE(hdr) && H5_HDR_SEQ(hdr) != h5->tx_ack) {
h5                446 drivers/bluetooth/hci_h5.c 		       H5_HDR_SEQ(hdr), h5->tx_ack);
h5                447 drivers/bluetooth/hci_h5.c 		h5_reset_rx(h5);
h5                451 drivers/bluetooth/hci_h5.c 	if (h5->state != H5_ACTIVE &&
h5                454 drivers/bluetooth/hci_h5.c 		h5_reset_rx(h5);
h5                458 drivers/bluetooth/hci_h5.c 	h5->rx_func = h5_rx_payload;
h5                459 drivers/bluetooth/hci_h5.c 	h5->rx_pending = H5_HDR_LEN(hdr);
h5                466 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = hu->priv;
h5                471 drivers/bluetooth/hci_h5.c 	h5->rx_func = h5_rx_3wire_hdr;
h5                472 drivers/bluetooth/hci_h5.c 	h5->rx_pending = 4;
h5                474 drivers/bluetooth/hci_h5.c 	h5->rx_skb = bt_skb_alloc(H5_MAX_LEN, GFP_ATOMIC);
h5                475 drivers/bluetooth/hci_h5.c 	if (!h5->rx_skb) {
h5                477 drivers/bluetooth/hci_h5.c 		h5_reset_rx(h5);
h5                481 drivers/bluetooth/hci_h5.c 	h5->rx_skb->dev = (void *)hu->hdev;
h5                488 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = hu->priv;
h5                491 drivers/bluetooth/hci_h5.c 		h5->rx_func = h5_rx_pkt_start;
h5                496 drivers/bluetooth/hci_h5.c static void h5_unslip_one_byte(struct h5 *h5, unsigned char c)
h5                501 drivers/bluetooth/hci_h5.c 	if (!test_bit(H5_RX_ESC, &h5->flags) && c == SLIP_ESC) {
h5                502 drivers/bluetooth/hci_h5.c 		set_bit(H5_RX_ESC, &h5->flags);
h5                506 drivers/bluetooth/hci_h5.c 	if (test_and_clear_bit(H5_RX_ESC, &h5->flags)) {
h5                516 drivers/bluetooth/hci_h5.c 			h5_reset_rx(h5);
h5                521 drivers/bluetooth/hci_h5.c 	skb_put_data(h5->rx_skb, byte, 1);
h5                522 drivers/bluetooth/hci_h5.c 	h5->rx_pending--;
h5                524 drivers/bluetooth/hci_h5.c 	BT_DBG("unslipped 0x%02hhx, rx_pending %zu", *byte, h5->rx_pending);
h5                527 drivers/bluetooth/hci_h5.c static void h5_reset_rx(struct h5 *h5)
h5                529 drivers/bluetooth/hci_h5.c 	if (h5->rx_skb) {
h5                530 drivers/bluetooth/hci_h5.c 		kfree_skb(h5->rx_skb);
h5                531 drivers/bluetooth/hci_h5.c 		h5->rx_skb = NULL;
h5                534 drivers/bluetooth/hci_h5.c 	h5->rx_func = h5_rx_delimiter;
h5                535 drivers/bluetooth/hci_h5.c 	h5->rx_pending = 0;
h5                536 drivers/bluetooth/hci_h5.c 	clear_bit(H5_RX_ESC, &h5->flags);
h5                541 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = hu->priv;
h5                544 drivers/bluetooth/hci_h5.c 	BT_DBG("%s pending %zu count %d", hu->hdev->name, h5->rx_pending,
h5                550 drivers/bluetooth/hci_h5.c 		if (h5->rx_pending > 0) {
h5                553 drivers/bluetooth/hci_h5.c 				h5_reset_rx(h5);
h5                557 drivers/bluetooth/hci_h5.c 			h5_unslip_one_byte(h5, *ptr);
h5                563 drivers/bluetooth/hci_h5.c 		processed = h5->rx_func(hu, *ptr);
h5                576 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = hu->priv;
h5                584 drivers/bluetooth/hci_h5.c 	if (h5->state != H5_ACTIVE) {
h5                593 drivers/bluetooth/hci_h5.c 		skb_queue_tail(&h5->rel, skb);
h5                597 drivers/bluetooth/hci_h5.c 		skb_queue_tail(&h5->unrel, skb);
h5                650 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = hu->priv;
h5                674 drivers/bluetooth/hci_h5.c 	hdr[0] = h5->tx_ack << 3;
h5                675 drivers/bluetooth/hci_h5.c 	clear_bit(H5_TX_ACK_REQ, &h5->flags);
h5                680 drivers/bluetooth/hci_h5.c 		hdr[0] |= h5->tx_seq;
h5                681 drivers/bluetooth/hci_h5.c 		h5->tx_seq = (h5->tx_seq + 1) % 8;
h5                706 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = hu->priv;
h5                710 drivers/bluetooth/hci_h5.c 	if (h5->sleep != H5_AWAKE) {
h5                713 drivers/bluetooth/hci_h5.c 		if (h5->sleep == H5_WAKING_UP)
h5                716 drivers/bluetooth/hci_h5.c 		h5->sleep = H5_WAKING_UP;
h5                719 drivers/bluetooth/hci_h5.c 		mod_timer(&h5->timer, jiffies + HZ / 100);
h5                723 drivers/bluetooth/hci_h5.c 	skb = skb_dequeue(&h5->unrel);
h5                732 drivers/bluetooth/hci_h5.c 		skb_queue_head(&h5->unrel, skb);
h5                736 drivers/bluetooth/hci_h5.c 	spin_lock_irqsave_nested(&h5->unack.lock, flags, SINGLE_DEPTH_NESTING);
h5                738 drivers/bluetooth/hci_h5.c 	if (h5->unack.qlen >= h5->tx_win)
h5                741 drivers/bluetooth/hci_h5.c 	skb = skb_dequeue(&h5->rel);
h5                746 drivers/bluetooth/hci_h5.c 			__skb_queue_tail(&h5->unack, skb);
h5                747 drivers/bluetooth/hci_h5.c 			mod_timer(&h5->timer, jiffies + H5_ACK_TIMEOUT);
h5                748 drivers/bluetooth/hci_h5.c 			spin_unlock_irqrestore(&h5->unack.lock, flags);
h5                752 drivers/bluetooth/hci_h5.c 		skb_queue_head(&h5->rel, skb);
h5                757 drivers/bluetooth/hci_h5.c 	spin_unlock_irqrestore(&h5->unack.lock, flags);
h5                759 drivers/bluetooth/hci_h5.c 	if (test_bit(H5_TX_ACK_REQ, &h5->flags))
h5                787 drivers/bluetooth/hci_h5.c 	struct h5 *h5;
h5                789 drivers/bluetooth/hci_h5.c 	h5 = devm_kzalloc(dev, sizeof(*h5), GFP_KERNEL);
h5                790 drivers/bluetooth/hci_h5.c 	if (!h5)
h5                793 drivers/bluetooth/hci_h5.c 	set_bit(HCI_UART_RESET_ON_INIT, &h5->serdev_hu.flags);
h5                795 drivers/bluetooth/hci_h5.c 	h5->hu = &h5->serdev_hu;
h5                796 drivers/bluetooth/hci_h5.c 	h5->serdev_hu.serdev = serdev;
h5                797 drivers/bluetooth/hci_h5.c 	serdev_device_set_drvdata(serdev, h5);
h5                804 drivers/bluetooth/hci_h5.c 		h5->vnd = (const struct h5_vnd *)match->driver_data;
h5                805 drivers/bluetooth/hci_h5.c 		h5->id  = (char *)match->id;
h5                807 drivers/bluetooth/hci_h5.c 		if (h5->vnd->acpi_gpio_map)
h5                809 drivers/bluetooth/hci_h5.c 						       h5->vnd->acpi_gpio_map);
h5                812 drivers/bluetooth/hci_h5.c 	h5->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW);
h5                813 drivers/bluetooth/hci_h5.c 	if (IS_ERR(h5->enable_gpio))
h5                814 drivers/bluetooth/hci_h5.c 		return PTR_ERR(h5->enable_gpio);
h5                816 drivers/bluetooth/hci_h5.c 	h5->device_wake_gpio = devm_gpiod_get_optional(dev, "device-wake",
h5                818 drivers/bluetooth/hci_h5.c 	if (IS_ERR(h5->device_wake_gpio))
h5                819 drivers/bluetooth/hci_h5.c 		return PTR_ERR(h5->device_wake_gpio);
h5                821 drivers/bluetooth/hci_h5.c 	return hci_uart_register_device(&h5->serdev_hu, &h5p);
h5                826 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = serdev_device_get_drvdata(serdev);
h5                828 drivers/bluetooth/hci_h5.c 	hci_uart_unregister_device(&h5->serdev_hu);
h5                833 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = dev_get_drvdata(dev);
h5                836 drivers/bluetooth/hci_h5.c 	if (h5->vnd && h5->vnd->suspend)
h5                837 drivers/bluetooth/hci_h5.c 		ret = h5->vnd->suspend(h5);
h5                844 drivers/bluetooth/hci_h5.c 	struct h5 *h5 = dev_get_drvdata(dev);
h5                847 drivers/bluetooth/hci_h5.c 	if (h5->vnd && h5->vnd->resume)
h5                848 drivers/bluetooth/hci_h5.c 		ret = h5->vnd->resume(h5);
h5                854 drivers/bluetooth/hci_h5.c static int h5_btrtl_setup(struct h5 *h5)
h5                864 drivers/bluetooth/hci_h5.c 	btrtl_dev = btrtl_initialize(h5->hu->hdev, h5->id);
h5                868 drivers/bluetooth/hci_h5.c 	err = btrtl_get_uart_settings(h5->hu->hdev, btrtl_dev,
h5                875 drivers/bluetooth/hci_h5.c 	skb = __hci_cmd_sync(h5->hu->hdev, 0xfc17, sizeof(baudrate_data),
h5                878 drivers/bluetooth/hci_h5.c 		rtl_dev_err(h5->hu->hdev, "set baud rate command failed\n");
h5                887 drivers/bluetooth/hci_h5.c 	serdev_device_set_baudrate(h5->hu->serdev, controller_baudrate);
h5                888 drivers/bluetooth/hci_h5.c 	serdev_device_set_flow_control(h5->hu->serdev, flow_control);
h5                890 drivers/bluetooth/hci_h5.c 	err = btrtl_download_firmware(h5->hu->hdev, btrtl_dev);
h5                900 drivers/bluetooth/hci_h5.c static void h5_btrtl_open(struct h5 *h5)
h5                903 drivers/bluetooth/hci_h5.c 	serdev_device_set_flow_control(h5->hu->serdev, false);
h5                904 drivers/bluetooth/hci_h5.c 	serdev_device_set_parity(h5->hu->serdev, SERDEV_PARITY_EVEN);
h5                905 drivers/bluetooth/hci_h5.c 	serdev_device_set_baudrate(h5->hu->serdev, 115200);
h5                908 drivers/bluetooth/hci_h5.c 	gpiod_set_value_cansleep(h5->enable_gpio, 1);
h5                909 drivers/bluetooth/hci_h5.c 	gpiod_set_value_cansleep(h5->device_wake_gpio, 1);
h5                913 drivers/bluetooth/hci_h5.c static void h5_btrtl_close(struct h5 *h5)
h5                915 drivers/bluetooth/hci_h5.c 	gpiod_set_value_cansleep(h5->device_wake_gpio, 0);
h5                916 drivers/bluetooth/hci_h5.c 	gpiod_set_value_cansleep(h5->enable_gpio, 0);
h5                925 drivers/bluetooth/hci_h5.c static int h5_btrtl_suspend(struct h5 *h5)
h5                927 drivers/bluetooth/hci_h5.c 	serdev_device_set_flow_control(h5->hu->serdev, false);
h5                928 drivers/bluetooth/hci_h5.c 	gpiod_set_value_cansleep(h5->device_wake_gpio, 0);
h5                929 drivers/bluetooth/hci_h5.c 	gpiod_set_value_cansleep(h5->enable_gpio, 0);
h5                953 drivers/bluetooth/hci_h5.c static int h5_btrtl_resume(struct h5 *h5)
h5                964 drivers/bluetooth/hci_h5.c 	reprobe->dev = get_device(&h5->hu->serdev->dev);