Nokia H4+ support
Subsystems (5)
cover Nokia H4+ support
Hi,
As the title suggest here is another try to get the Nokia bluetooth supported mainline. The driver is based on the serdev work from Rob Herring, which got merged into 4.11-rc1 (this patchset is based on recent master branch from torvalds).
The driver was tested on N950 (I can connect to different devices with bluetoothctl and fetch their info). It does not yet run completly stable (especially on N900), but its better than no device support at all.
-- Sebastian
Rob Herring (1):
Bluetooth: hci_uart: add serdev driver support library
Sebastian Reichel (9):
ARM: dts: N9/N950: add bluetooth
ARM: dts: N900: Add bluetooth
Bluetooth: hci_uart: add support for word alignment
Bluetooth: hci_serdev: do not open device in hci open
tty: serial: omap: add UPF_BOOT_AUTOCONF flag for DT init
serdev: add serdev_device_wait_until_sent
serdev: add serdev_device_get_cts
serdev: add serdev_device_set_rts
Bluetooth: add nokia driver
.../devicetree/bindings/net/nokia-bluetooth.txt | 51 ++ arch/arm/boot/dts/omap3-n900.dts | 23 +- arch/arm/boot/dts/omap3-n950-n9.dtsi | 32 + drivers/bluetooth/Kconfig | 12 + drivers/bluetooth/Makefile | 3 + drivers/bluetooth/hci_h4.c | 17 + drivers/bluetooth/hci_ldisc.c | 4 + drivers/bluetooth/hci_nokia.c | 839 +++++++++++++++++++++ drivers/bluetooth/hci_serdev.c | 365 +++++++++ drivers/bluetooth/hci_uart.h | 7 + drivers/tty/serdev/core.c | 33 + drivers/tty/serdev/serdev-ttyport.c | 62 +- drivers/tty/serial/omap-serial.c | 3 + include/linux/serdev.h | 12 + 14 files changed, 1460 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/nokia-bluetooth.txt create mode 100644 drivers/bluetooth/hci_nokia.c create mode 100644 drivers/bluetooth/hci_serdev.c
Signature · 1 line
2.11.0
PATCH 1/10 ARM: dts: N9/N950: add bluetooth
The Nokia N950 and N9 have a wl1271 (with nokia bootloader) bluetooth module connected to second UART.
--- arch/arm/boot/dts/omap3-n950-n9.dtsi | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
arch/arm/boot/dts/omap3-n950-n9.dtsi +32 -0
@@ -58,6 +58,13 @@ pinctrl-0 = <&debug_leds>; }; }; + + /* controlled (enabled/disabled) directly by wl1271 */ + vctcxo: vctcxo { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <38400000>; + }; }; &omap3_pmx_core {
@@ -125,6 +132,15 @@ OMAP3_CORE1_IOPAD(0x210a, PIN_OUTPUT | MUX_MODE4) /* gpio_93 (cmt_apeslpx) */ >; }; + + uart2_pins: pinmux_uart2_pins { + pinctrl-single,pins = < + OMAP3_CORE1_IOPAD(0x2174, PIN_INPUT_PULLUP | MUX_MODE0) /* uart2_cts */ + OMAP3_CORE1_IOPAD(0x2176, PIN_OUTPUT | MUX_MODE0) /* uart2_rts */ + OMAP3_CORE1_IOPAD(0x2178, PIN_OUTPUT | MUX_MODE0) /* uart2_tx */ + OMAP3_CORE1_IOPAD(0x217a, PIN_INPUT | MUX_MODE0) /* uart2_rx */ + >; + }; }; &omap3_pmx_core2 {
@@ -435,3 +451,19 @@ &ssi_port2 { status = "disabled"; }; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2_pins>; + + bluetooth { + compatible = "nokia,ti,wl1271-bluetooth"; + + reset-gpios = <&gpio1 26 GPIO_ACTIVE_LOW>; /* 26 */ + host-wakeup-gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>; /* 101 */ + bluetooth-wakeup-gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>; /* 37 */ + + clocks = <&vctcxo>; + clock-names = "sysclk"; + }; +};
Signature · 1 line
2.11.0
Re: [PATCH 01/10] ARM: dts: N9/N950: add bluetooth
Quoted 4 lines · Sebastian Reichel
The Nokia N950 and N9 have a wl1271 (with nokia bootloader) bluetooth module connected to second UART.
Signed-off-by Sebastian Reichel <[email protected]>
Picking this patch into omap-for-v4.12/dt thanks.
Regards,
Tony
Re: [PATCH 01/10] ARM: dts: N9/N950: add bluetooth
In reply to Sebastian ReichelHi!
Quoted 2 lines
The Nokia N950 and N9 have a wl1271 (with nokia bootloader) bluetooth module connected to second UART.
I don't get it. We are describing hardware, what does it have to do with bootloader? Is there something not described here, because it is already initialized by bootloader?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 01/10] ARM: dts: N9/N950: add bluetooth
Hi,
Quoted 8 lines · Pavel Machek
Hi!
Quoted 2 lines
The Nokia N950 and N9 have a wl1271 (with nokia bootloader) bluetooth module connected to second UART.
I don't get it. We are describing hardware, what does it have to do with bootloader? Is there something not described here, because it is already initialized by bootloader?
This is about the wl1271 "bootloader"/low-level interface. The same chip exists with a TI low-level interface, which requires a different driver/firmware.
-- Sebastian
PATCH 2/10 ARM: dts: N900: Add bluetooth
In reply to Sebastian ReichelAdd bcm2048 node and its system clock to the N900 device tree file. Apart from that a reference to the new clock has been added to wl1251 (which uses it, too).
--- arch/arm/boot/dts/omap3-n900.dts | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
arch/arm/boot/dts/omap3-n900.dts +21 -2
@@ -155,6 +155,13 @@ compatible = "nokia,n900-ir"; pwms = <&pwm9 0 26316 0>; /* 38000 Hz */ }; + + /* controlled (enabled/disabled) directly by bcm2048 and wl1251 */ + vctcxo: vctcxo { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <38400000>; + }; }; &omap3_pmx_core {
@@ -162,8 +169,10 @@ uart2_pins: pinmux_uart2_pins { pinctrl-single,pins = < - OMAP3_CORE1_IOPAD(0x217a, PIN_INPUT | MUX_MODE0) /* uart2_rx */ + OMAP3_CORE1_IOPAD(0x2174, PIN_INPUT_PULLUP | MUX_MODE0) /* uart2_cts */ + OMAP3_CORE1_IOPAD(0x2176, PIN_OUTPUT | MUX_MODE0) /* uart2_rts */ OMAP3_CORE1_IOPAD(0x2178, PIN_OUTPUT | MUX_MODE0) /* uart2_tx */ + OMAP3_CORE1_IOPAD(0x217a, PIN_INPUT | MUX_MODE0) /* uart2_rx */ >; };
@@ -920,6 +929,8 @@ interrupt-parent = <&gpio2>; interrupts = <10 IRQ_TYPE_NONE>; /* gpio line 42 */ + + clocks = <&vctcxo>; }; };
@@ -937,9 +948,17 @@ }; &uart2 { - interrupts-extended = <&intc 73 &omap3_pmx_core OMAP3_UART2_RX>; pinctrl-names = "default"; pinctrl-0 = <&uart2_pins>; + + bcm2048: bluetooth { + compatible = "nokia,brcm,bcm2048"; + reset-gpios = <&gpio3 27 GPIO_ACTIVE_LOW>; /* 91 */ + host-wakeup-gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>; /* 101 */ + bluetooth-wakeup-gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>; /* 37 */ + clocks = <&vctcxo>; + clock-names = "sysclk"; + }; }; &uart3 {
Signature · 1 line
2.11.0
Re: [PATCH 02/10] ARM: dts: N900: Add bluetooth
Quoted 5 lines · Sebastian Reichel
Add bcm2048 node and its system clock to the N900 device tree file. Apart from that a reference to the new clock has been added to wl1251 (which uses it, too).
Signed-off-by Sebastian Reichel <[email protected]>
Picking this patch into omap-for-v4.12/dt thanks.
Regards,
Tony
Re: [PATCH 02/10] ARM: dts: N900: Add bluetooth
Quoted 8 lines · Tony Lindgren
Quoted 5 lines · Sebastian Reichel
Add bcm2048 node and its system clock to the N900 device tree file. Apart from that a reference to the new clock has been added to wl1251 (which uses it, too).
Signed-off-by Sebastian Reichel <[email protected]>Picking this patch into omap-for-v4.12/dt thanks.
The binding is not yet settled.
Rob
Re: [PATCH 02/10] ARM: dts: N900: Add bluetooth
Quoted 11 lines · Rob Herring
Quoted 8 lines · Tony Lindgren
Quoted 5 lines · Sebastian Reichel
Add bcm2048 node and its system clock to the N900 device tree file. Apart from that a reference to the new clock has been added to wl1251 (which uses it, too).
Signed-off-by Sebastian Reichel <[email protected]>Picking this patch into omap-for-v4.12/dt thanks.
The binding is not yet settled.
Oh sorry I thought the binding was already done. Will revert.
Regards,
Tony
Re: [PATCH 02/10] ARM: dts: N900: Add bluetooth
In reply to Sebastian ReichelQuoted 5 lines · Sebastian Reichel
Add bcm2048 node and its system clock to the N900 device tree file. Apart from that a reference to the new clock has been added to wl1251 (which uses it, too).
Signed-off-by Sebastian Reichel <[email protected]>
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH 3/10 Bluetooth: hci_uart: add support for word alignment
In reply to Sebastian ReichelThis will be used by Nokia's H4+ protocol, which
uses 2-byte aligned packets.
--- drivers/bluetooth/hci_h4.c | 17 +++++++++++++++++ drivers/bluetooth/hci_ldisc.c | 4 ++++ drivers/bluetooth/hci_uart.h | 3 +++ 3 files changed, 24 insertions(+)
drivers/bluetooth/hci_h4.c +17 -0
@@ -171,9 +171,20 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb, const unsigned char *buffer, int count, const struct h4_recv_pkt *pkts, int pkts_count) { + struct hci_uart *hu = hci_get_drvdata(hdev); +uint8_t alignment = hu->alignment; +while (count) {int i, len; +/* remove padding bytes from buffer */ +for (; hu->padding && count >0 ; hu->padding--) { + count--; + buffer++; + } +if (!count) +break ; +if (!skb) {for (i =0 ; i < pkts_count; i++) {if (buffer[0 ] != (&pkts[i])->type)
@@ -253,11 +264,17 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb, }if (!dlen) { + hu->padding = (skb->len -1 ) % alignment; + hu->padding = (alignment - hu->padding) % alignment; +/* No more data, complete frame */ (&pkts[i])->recv (hdev, skb); skb =NULL ; } }else { + hu->padding = (skb->len -1 ) % alignment; + hu->padding = (alignment - hu->padding) % alignment; +/* Complete frame */ (&pkts[i])->recv (hdev, skb); skb =NULL ;
drivers/bluetooth/hci_ldisc.c +4 -0
@@ -459,6 +459,10 @@ static int hci_uart_tty_open(struct tty_struct *tty) hu->tty = tty; tty->receive_room =65536 ; +/* disable alignment support by default */ + hu->alignment =1 ; + hu->padding =0 ; +INIT_WORK (&hu->init_ready, hci_uart_init_work);INIT_WORK (&hu->write_work, hci_uart_write_work);
drivers/bluetooth/hci_uart.h +3 -0
@@ -92,6 +92,9 @@ struct hci_uart {unsigned int init_speed;unsigned int oper_speed; + +u8 alignment; +u8 padding; };/* HCI_UART proto flag bits */
Signature · 1 line
2.11.0
Re: [PATCH 03/10] Bluetooth: hci_uart: add support for word alignment
Hi!
Quoted 4 lines
This will be used by Nokia's H4+ protocol, which
uses 2-byte aligned packets.Signed-off-by Sebastian Reichel <[email protected]>
drivers/bluetooth/hci_h4.c struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb, · line 175
Quoted 8 lines
drivers/bluetooth/hci_h4.c +2
-0@@ -171,9 +171,20 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb, const unsigned char *buffer, int count, const struct h4_recv_pkt *pkts, int pkts_count) { + struct hci_uart *hu = hci_get_drvdata(hdev); +uint8_t alignment = hu->alignment;
I'd do u8 here, too, for consistency with struct below (and becuase uint8_t is somehow unusual in kernel).
drivers/bluetooth/hci_h4.c struct hci_uart { · line 99
Quoted 9 lines
drivers/bluetooth/hci_h4.c +3
-0@@ -92,6 +92,9 @@ struct hci_uart {unsigned int init_speed;unsigned int oper_speed; + +u8 alignment; +u8 padding; };
Thanks,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH 4/10 Bluetooth: hci_uart: add serdev driver support library
In reply to Sebastian ReichelFrom: Rob Herring <[email protected]>
This adds library functions for serdev based BT drivers. This is largely copied from hci_ldisc.c and modified to use serdev calls. There's a little bit of duplication, but I avoided intermixing this as the ldisc code should eventually go away.
--- drivers/bluetooth/Makefile | 1 + drivers/bluetooth/hci_serdev.c | 370 +++++++++++++++++++++++++++++++++++++++++ drivers/bluetooth/hci_uart.h | 4 + 3 files changed, 375 insertions(+) create mode 100644 drivers/bluetooth/hci_serdev.c
drivers/bluetooth/Makefile +1 -0
@@ -29,6 +29,7 @@ btmrvl-y := btmrvl_main.o btmrvl-$(CONFIG_DEBUG_FS) += btmrvl_debugfs.o hci_uart-y := hci_ldisc.o +hci_uart-$(CONFIG_SERIAL_DEV_BUS) += hci_serdev.o hci_uart-$(CONFIG_BT_HCIUART_H4) += hci_h4.o hci_uart-$(CONFIG_BT_HCIUART_BCSP) += hci_bcsp.o hci_uart-$(CONFIG_BT_HCIUART_LL) += hci_ll.o
drivers/bluetooth/hci_serdev.c new file +370 -0
370 lines not on this page · raw message
drivers/bluetooth/hci_uart.h +4 -0
@@ -58,6 +58,7 @@#define HCI_UART_VND_DETECT 5struct hci_uart ; +struct serdev_device ;struct hci_uart_proto {unsigned int id;
@@ -77,6 +78,7 @@ struct hci_uart_proto {struct hci_uart {struct tty_struct *tty; +struct serdev_device *serdev;struct hci_dev *hdev;unsigned long flags;unsigned long hdev_flags;
@@ -108,6 +110,8 @@ struct hci_uart {int hci_uart_register_proto (const struct hci_uart_proto *p);int hci_uart_unregister_proto (const struct hci_uart_proto *p); +int hci_uart_register_device (struct hci_uart *hu,const struct hci_uart_proto *p); +int hci_uart_tx_wakeup (struct hci_uart *hu);int hci_uart_init_ready (struct hci_uart *hu);void hci_uart_init_tty (struct hci_uart *hu);
Signature · 1 line
2.11.0
Re: [PATCH 04/10] Bluetooth: hci_uart: add serdev driver support library
Hi!
Quoted 7 lines
From: Rob Herring <[email protected]>
This adds library functions for serdev based BT drivers. This is largely copied from
hci_ldisc.cand modified to use serdev calls. There's a little bit of duplication, but I avoided intermixing this as the ldisc code should eventually go away.
Quoted 6 lines
Signed-off-by Rob Herring <[email protected]>Cc Marcel Holtmann <[email protected]>Cc Gustavo Padovan <[email protected]>Cc Johan Hedberg <[email protected]>Tested-by Sebastian Reichel <[email protected]>
Trivial comments below.
drivers/bluetooth/hci_serdev.c line 3
Quoted 4 lines
drivers/bluetooth/hci_serdev.c new file +3
-0@@ -0,0 +1,370 @@ +/* +* +* Bluetooth HCI serdev driver lib
Just one empty line.
drivers/bluetooth/hci_serdev.c line 28
Quoted 5 lines
drivers/bluetooth/hci_serdev.c new file +5
-0+* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +*/
I don't think we put the address in there any more.
drivers/bluetooth/hci_serdev.c line 83
Quoted 10 lines
drivers/bluetooth/hci_serdev.c new file +10
-0+static void hci_uart_write_work (struct work_struct *work) +{ + struct hci_uart *hu = container_of(work, struct hci_uart, write_work); +struct serdev_device *serdev = hu->serdev; +struct hci_dev *hdev = hu->hdev; +struct sk_buff *skb; + +/* REVISIT: should we cope with bad skbs or ->write() returning +* and error value ? +*/
"an error value"? Comment style?
Quoted 11 lines
drivers/bluetooth/hci_serdev.c new file +11
-0+restart: +clear_bit (HCI_UART_TX_WAKEUP , &hu->tx_state); + +while ((skb =hci_uart_dequeue (hu))) { +int len; + + len =serdev_device_write_buf (serdev, skb->data, skb->len); + hdev->stat.byte_tx += len; + +skb_pull (skb, len); +if (skb->len) {
drivers/bluetooth/hci_serdev.c line 105
Quoted 10 lines
drivers/bluetooth/hci_serdev.c new file +10
-0+ hu->tx_skb = skb; +break ; + } + +hci_uart_tx_complete (hu,hci_skb_pkt_type (skb)); +kfree_skb (skb); + } + +if (test_bit (HCI_UART_TX_WAKEUP , &hu->tx_state)) + goto restart;
do {} while () instead of goto?
drivers/bluetooth/hci_serdev.c line 111
Quoted 2 lines
drivers/bluetooth/hci_serdev.c new file +2
-0+/* ------- Interface to HCI layer ------ */ +/* Initialize device */
Comment style?
drivers/bluetooth/hci_serdev.c line 204
Quoted 5 lines
drivers/bluetooth/hci_serdev.c new file +5
-0+if (hu->proto->set_baudrate && speed) { + err = hu->proto->set_baudrate (hu, speed); +if (!err) +serdev_device_set_baudrate (hu->serdev, speed); + }
Complain about the error here?
drivers/bluetooth/hci_serdev.c line 226
Quoted 7 lines
drivers/bluetooth/hci_serdev.c new file +7
-0+if (skb->len !=sizeof (*ver)) { +BT_ERR ("%s: Event length mismatch for version information" , + hdev->name); + goto done; + } + +done:
Get rid of goto and label?
drivers/bluetooth/hci_serdev.c line 238
Quoted 8 lines
drivers/bluetooth/hci_serdev.c new file +8
-0+/* hci_uart_write_wakeup() +* +* Callback for transmit wakeup. Called when low level +* device driver can accept more send data. +* +* Arguments: tty pointer to associated tty instance data +* Return Value: None +*/
Kerneldoc? :-)
drivers/bluetooth/hci_serdev.c line 249
Quoted 11 lines
drivers/bluetooth/hci_serdev.c new file +11
-0+static void hci_uart_write_wakeup (struct serdev_device *serdev) +{ +struct hci_uart *hu =serdev_device_get_drvdata (serdev); + +BT_DBG ("" ); + +if (!hu) +return ; + +if (serdev != hu->serdev) +return ;
WARN_ON on both of these? That should not be normal condition...
drivers/bluetooth/hci_serdev.c line 326
Quoted 4 lines
drivers/bluetooth/hci_serdev.c new file +4
-0+/* Only when vendor specific setup callback is provided, consider +* the manufacturer information valid. This avoids filling in the +* value for Ericsson when nothing is specified. +*/
Is this comment still up-to-date?
Thanks,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH 5/10 Bluetooth: hci_serdev: do not open device in hci open
In reply to Sebastian ReichelThe device driver may need to communicate with the UART device while the Bluetooth device is closed (e.g. due to interrupts).
--- drivers/bluetooth/hci_serdev.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/bluetooth/hci_serdev.c +4 -9
@@ -111,13 +111,9 @@ static void hci_uart_write_work(struct work_struct *work)/* Initialize device */ static int hci_uart_open (struct hci_dev *hdev) { -struct hci_uart *hu =hci_get_drvdata (hdev); -BT_DBG ("%s %p" , hdev->name, hdev); -serdev_device_set_client_ops (hu->serdev, &hci_serdev_client_ops); - -return serdev_device_open (hu->serdev); +return 0 ; }/* Reset device */
@@ -143,15 +139,11 @@ static int hci_uart_flush(struct hci_dev *hdev)/* Close device */ static int hci_uart_close (struct hci_dev *hdev) { -struct hci_uart *hu =hci_get_drvdata (hdev); -BT_DBG ("hdev %p" , hdev);hci_uart_flush (hdev); hdev->flush =NULL ; -serdev_device_close (hu->serdev); -return 0 ; }
@@ -298,6 +290,8 @@ int hci_uart_register_device(struct hci_uart *hu, const struct hci_uart_proto *pBT_DBG ("" ); +serdev_device_set_client_ops (hu->serdev, &hci_serdev_client_ops); + err = p->open (hu);if (err)return err;
@@ -366,5 +360,6 @@ int hci_uart_register_device(struct hci_uart *hu, const struct hci_uart_proto *p err_alloc:clear_bit (HCI_UART_PROTO_READY , &hu->flags); p->close (hu); +return err; }
Signature · 1 line
2.11.0
Re: [PATCH 05/10] Bluetooth: hci_serdev: do not open device in hci open
drivers/bluetooth/hci_serdev.c int hci_uart_register_device(struct hci_uart *hu, const struct hci_uart_proto *p · line 365
Quoted 7 lines
drivers/bluetooth/hci_serdev.c +1
-0@@ -366,5 +360,6 @@ int hci_uart_register_device(struct hci_uart *hu, const struct hci_uart_proto *p err_alloc:clear_bit (HCI_UART_PROTO_READY , &hu->flags); p->close (hu); +return err; }
This could be removed, I guess.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH 6/10 tty: serial: omap: add UPF_BOOT_AUTOCONF flag for DT init
In reply to Sebastian ReichelThe UPF_BOOT_AUTOCONF flag is needed for proper
flow control support.
--- drivers/tty/serial/omap-serial.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/serial/omap-serial.c +3 -0
@@ -1597,6 +1597,9 @@ static struct omap_uart_port_info *of_get_uart_port_info(struct device *dev)of_property_read_u32 (dev->of_node,"clock-frequency" , &omap_up_info->uartclk); + + omap_up_info->flags =UPF_BOOT_AUTOCONF ; +return omap_up_info; }
Signature · 1 line
2.11.0
PATCH 7/10 serdev: add serdev_device_wait_until_sent
In reply to Sebastian ReichelAdd method, which waits until the transmission buffer has been sent.
--- drivers/tty/serdev/core.c | 11 +++++++++++ drivers/tty/serdev/serdev-ttyport.c | 15 ++++++++++++++- include/linux/serdev.h | 3 +++ 3 files changed, 28 insertions(+), 1 deletion(-)
drivers/tty/serdev/core.c +11 -0
@@ -173,6 +173,17 @@ void serdev_device_set_flow_control(struct serdev_device *serdev, bool enable) }EXPORT_SYMBOL_GPL (serdev_device_set_flow_control); +void serdev_device_wait_until_sent (struct serdev_device *serdev,long timeout) +{ +struct serdev_controller *ctrl = serdev->ctrl; + +if (!ctrl || !ctrl->ops->wait_until_sent) +return ; + + ctrl->ops->wait_until_sent (ctrl, timeout); +} +EXPORT_SYMBOL_GPL (serdev_device_wait_until_sent); +static int serdev_drv_probe (struct device *dev) {const struct serdev_device_driver *sdrv =to_serdev_device_driver (dev->driver);
drivers/tty/serdev/serdev-ttyport.c +14 -1
@@ -14,6 +14,7 @@#include <linux/serdev.h> #include <linux/tty.h> #include <linux/tty_driver.h> +#include <linux/poll.h> #define SERPORT_ACTIVE 1
@@ -47,10 +48,13 @@ static void ttyport_write_wakeup(struct tty_port *port)struct serport *serport =serdev_controller_get_drvdata (ctrl);if (!test_and_clear_bit (TTY_DO_WRITE_WAKEUP , &port->tty->flags)) -return ; + goto out;if (test_bit (SERPORT_ACTIVE , &serport->flags))serdev_controller_write_wakeup (ctrl); + +out: +wake_up_interruptible_poll (&port->tty->write_wait,POLLOUT ); }static const struct tty_port_client_operations client_ops = {
@@ -167,6 +171,14 @@ static void ttyport_set_flow_control(struct serdev_controller *ctrl, bool enabletty_set_termios (tty, &ktermios); } +static void ttyport_wait_until_sent (struct serdev_controller *ctrl,long timeout) +{ +struct serport *serport =serdev_controller_get_drvdata (ctrl); +struct tty_struct *tty = serport->tty; + +tty_wait_until_sent (tty, timeout); +} +static const struct serdev_controller_ops ctrl_ops = { .write_buf = ttyport_write_buf, .write_flush = ttyport_write_flush,
@@ -175,6 +187,7 @@ static const struct serdev_controller_ops ctrl_ops = { .close = ttyport_close, .set_flow_control = ttyport_set_flow_control, .set_baudrate = ttyport_set_baudrate, + .wait_until_sent = ttyport_wait_until_sent, }; struct device *serdev_tty_port_register(struct tty_port *port,
include/linux/serdev.h +3 -0
@@ -81,6 +81,7 @@ struct serdev_controller_ops {void (*close)(struct serdev_controller *);void (*set_flow_control)(struct serdev_controller *,bool );unsigned int (*set_baudrate)(struct serdev_controller *,unsigned int ); +void (*wait_until_sent)(struct serdev_controller *,long ); };/**
@@ -186,6 +187,7 @@ int serdev_device_open(struct serdev_device *);void serdev_device_close (struct serdev_device *);unsigned int serdev_device_set_baudrate (struct serdev_device *,unsigned int );void serdev_device_set_flow_control (struct serdev_device *,bool ); +void serdev_device_wait_until_sent (struct serdev_device *,long );int serdev_device_write_buf (struct serdev_device *,const unsigned char *,size_t );void serdev_device_write_flush (struct serdev_device *);int serdev_device_write_room (struct serdev_device *);
@@ -223,6 +225,7 @@ static inline unsigned int serdev_device_set_baudrate(struct serdev_device *sdevreturn 0 ; }static inline void serdev_device_set_flow_control (struct serdev_device *sdev,bool enable) {} +static inline void serdev_device_wait_until_sent (struct serdev_device *sdev,long timeout) {}static inline int serdev_device_write_buf (struct serdev_device *sdev,const unsigned char *buf,size_t count) {return -ENODEV ;
Signature · 1 line
2.11.0
Re: [PATCH 07/10] serdev: add serdev_device_wait_until_sent
Quoted 45 lines · Sebastian Reichel
Add method, which waits until the transmission buffer has been sent.
Signed-off-by Sebastian Reichel <[email protected]>--- drivers/tty/serdev/core.c | 11 +++++++++++ drivers/tty/serdev/serdev-ttyport.c | 15 ++++++++++++++- include/linux/serdev.h | 3 +++ 3 files changed, 28 insertions(+), 1 deletion(-)drivers/tty/serdev/core.c +11
-0@@ -173,6 +173,17 @@ void serdev_device_set_flow_control(struct serdev_device *serdev, bool enable) }EXPORT_SYMBOL_GPL (serdev_device_set_flow_control); +void serdev_device_wait_until_sent (struct serdev_device *serdev,long timeout) +{ +struct serdev_controller *ctrl = serdev->ctrl; + +if (!ctrl || !ctrl->ops->wait_until_sent) +return ; + + ctrl->ops->wait_until_sent (ctrl, timeout); +} +EXPORT_SYMBOL_GPL (serdev_device_wait_until_sent); +static int serdev_drv_probe (struct device *dev) {const struct serdev_device_driver *sdrv =to_serdev_device_driver (dev->driver);drivers/tty/serdev/serdev-ttyport.c +1
-0@@ -14,6 +14,7 @@#include <linux/serdev.h> #include <linux/tty.h> #include <linux/tty_driver.h> +#include <linux/poll.h> #define SERPORT_ACTIVE 1@@ -47,10 +48,13 @@ static void ttyport_write_wakeup(struct tty_port *port)struct serport *serport =serdev_controller_get_drvdata (ctrl);
drivers/tty/serdev/serdev-ttyport.c static void ttyport_write_wakeup(struct tty_port *port) · line 57
Quoted 10 lines
drivers/tty/serdev/serdev-ttyport.c +4
-1if (!test_and_clear_bit (TTY_DO_WRITE_WAKEUP , &port->tty->flags)) -return ; + goto out;if (test_bit (SERPORT_ACTIVE , &serport->flags))serdev_controller_write_wakeup (ctrl); + +out: +wake_up_interruptible_poll (&port->tty->write_wait,POLLOUT );
Shouldn't this be separate patch?
Rob
Re: [PATCH 07/10] serdev: add serdev_device_wait_until_sent
Hi,
Quoted 51 lines · Rob Herring
Quoted 50 lines · Sebastian Reichel
Add method, which waits until the transmission buffer has been sent.
Signed-off-by Sebastian Reichel <[email protected]>--- drivers/tty/serdev/core.c | 11 +++++++++++ drivers/tty/serdev/serdev-ttyport.c | 15 ++++++++++++++- include/linux/serdev.h | 3 +++ 3 files changed, 28 insertions(+), 1 deletion(-)drivers/tty/serdev/core.c +11
-0@@ -173,6 +173,17 @@ void serdev_device_set_flow_control(struct serdev_device *serdev, bool enable) }EXPORT_SYMBOL_GPL (serdev_device_set_flow_control); +void serdev_device_wait_until_sent (struct serdev_device *serdev,long timeout) +{ +struct serdev_controller *ctrl = serdev->ctrl; + +if (!ctrl || !ctrl->ops->wait_until_sent) +return ; + + ctrl->ops->wait_until_sent (ctrl, timeout); +} +EXPORT_SYMBOL_GPL (serdev_device_wait_until_sent); +static int serdev_drv_probe (struct device *dev) {const struct serdev_device_driver *sdrv =to_serdev_device_driver (dev->driver);drivers/tty/serdev/serdev-ttyport.c +2
-1@@ -14,6 +14,7 @@#include <linux/serdev.h> #include <linux/tty.h> #include <linux/tty_driver.h> +#include <linux/poll.h> #define SERPORT_ACTIVE 1@@ -47,10 +48,13 @@ static void ttyport_write_wakeup(struct tty_port *port)struct serport *serport =serdev_controller_get_drvdata (ctrl);if (!test_and_clear_bit (TTY_DO_WRITE_WAKEUP , &port->tty->flags)) -return ; + goto out;
Quoted 7 lines
drivers/tty/serdev/serdev-ttyport.c static void ttyport_write_wakeup(struct tty_port *port) · line 57
Quoted 5 lines
drivers/tty/serdev/serdev-ttyport.c +3
-0if (test_bit (SERPORT_ACTIVE , &serport->flags))serdev_controller_write_wakeup (ctrl); + +out: +wake_up_interruptible_poll (&port->tty->write_wait,POLLOUT );Shouldn't this be separate patch?
That change is needed for tty_wait_until_sent to work correctly, which starts with a wait_event_interruptible_timeout() on write_wait.
-- Sebastian
Rob Herring
Acked-byRe: [PATCH 07/10] serdev: add serdev_device_wait_until_sent
Quoted 62 lines · Sebastian Reichel
Hi,
Quoted 51 lines · Rob Herring
Quoted 50 lines · Sebastian Reichel
Add method, which waits until the transmission buffer has been sent.
Signed-off-by Sebastian Reichel <[email protected]>--- drivers/tty/serdev/core.c | 11 +++++++++++ drivers/tty/serdev/serdev-ttyport.c | 15 ++++++++++++++- include/linux/serdev.h | 3 +++ 3 files changed, 28 insertions(+), 1 deletion(-)drivers/tty/serdev/core.c +11
-0@@ -173,6 +173,17 @@ void serdev_device_set_flow_control(struct serdev_device *serdev, bool enable) }EXPORT_SYMBOL_GPL (serdev_device_set_flow_control); +void serdev_device_wait_until_sent (struct serdev_device *serdev,long timeout) +{ +struct serdev_controller *ctrl = serdev->ctrl; + +if (!ctrl || !ctrl->ops->wait_until_sent) +return ; + + ctrl->ops->wait_until_sent (ctrl, timeout); +} +EXPORT_SYMBOL_GPL (serdev_device_wait_until_sent); +static int serdev_drv_probe (struct device *dev) {const struct serdev_device_driver *sdrv =to_serdev_device_driver (dev->driver);drivers/tty/serdev/serdev-ttyport.c +2
-1@@ -14,6 +14,7 @@#include <linux/serdev.h> #include <linux/tty.h> #include <linux/tty_driver.h> +#include <linux/poll.h> #define SERPORT_ACTIVE 1@@ -47,10 +48,13 @@ static void ttyport_write_wakeup(struct tty_port *port)struct serport *serport =serdev_controller_get_drvdata (ctrl);if (!test_and_clear_bit (TTY_DO_WRITE_WAKEUP , &port->tty->flags)) -return ; + goto out;Quoted 7 lines
drivers/tty/serdev/serdev-ttyport.c static void ttyport_write_wakeup(struct tty_port *port) · line 57
Quoted 5 lines
drivers/tty/serdev/serdev-ttyport.c +3
-0if (test_bit (SERPORT_ACTIVE , &serport->flags))serdev_controller_write_wakeup (ctrl); + +out: +wake_up_interruptible_poll (&port->tty->write_wait,POLLOUT );Shouldn't this be separate patch?
Quoted 2 lines
That change is needed for
tty_wait_until_sentto work correctly, which starts with await_event_interruptible_timeout()onwrite_wait.
Okay.
PATCH 8/10 serdev: add serdev_device_get_cts
In reply to Sebastian ReichelAdd method to get current CTS line state.
--- drivers/tty/serdev/core.c | 11 +++++++++++ drivers/tty/serdev/serdev-ttyport.c | 15 +++++++++++++++ include/linux/serdev.h | 6 ++++++ 3 files changed, 32 insertions(+)
drivers/tty/serdev/core.c +11 -0
@@ -184,6 +184,17 @@ void serdev_device_wait_until_sent(struct serdev_device *serdev, long timeout) }EXPORT_SYMBOL_GPL (serdev_device_wait_until_sent); +bool serdev_device_get_cts (struct serdev_device *serdev) +{ +struct serdev_controller *ctrl = serdev->ctrl; + +if (!ctrl || !ctrl->ops->get_cts) +return false; + +return ctrl->ops->get_cts (ctrl); +} +EXPORT_SYMBOL_GPL (serdev_device_get_cts); +static int serdev_drv_probe (struct device *dev) {const struct serdev_device_driver *sdrv =to_serdev_device_driver (dev->driver);
drivers/tty/serdev/serdev-ttyport.c +15 -0
@@ -179,6 +179,20 @@ static void ttyport_wait_until_sent(struct serdev_controller *ctrl, long timeouttty_wait_until_sent (tty, timeout); } +static bool ttyport_get_cts (struct serdev_controller *ctrl) +{ +struct serport *serport =serdev_controller_get_drvdata (ctrl); +struct tty_struct *tty = serport->tty; +int status; + +if (!tty->ops->tiocmget) +return false; + + status = tty->ops->tiocmget (tty); + +return !!(status &TIOCM_CTS ); +} +static const struct serdev_controller_ops ctrl_ops = { .write_buf = ttyport_write_buf, .write_flush = ttyport_write_flush,
@@ -188,6 +202,7 @@ static const struct serdev_controller_ops ctrl_ops = { .set_flow_control = ttyport_set_flow_control, .set_baudrate = ttyport_set_baudrate, .wait_until_sent = ttyport_wait_until_sent, + .get_cts = ttyport_get_cts, }; struct device *serdev_tty_port_register(struct tty_port *port,
include/linux/serdev.h +6 -0
@@ -82,6 +82,7 @@ struct serdev_controller_ops {void (*set_flow_control)(struct serdev_controller *,bool );unsigned int (*set_baudrate)(struct serdev_controller *,unsigned int );void (*wait_until_sent)(struct serdev_controller *,long ); +bool (*get_cts)(struct serdev_controller *); };/**
@@ -188,6 +189,7 @@ void serdev_device_close(struct serdev_device *);unsigned int serdev_device_set_baudrate (struct serdev_device *,unsigned int );void serdev_device_set_flow_control (struct serdev_device *,bool );void serdev_device_wait_until_sent (struct serdev_device *,long ); +bool serdev_device_get_cts (struct serdev_device *);int serdev_device_write_buf (struct serdev_device *,const unsigned char *,size_t );void serdev_device_write_flush (struct serdev_device *);int serdev_device_write_room (struct serdev_device *);
@@ -226,6 +228,10 @@ static inline unsigned int serdev_device_set_baudrate(struct serdev_device *sdev }static inline void serdev_device_set_flow_control (struct serdev_device *sdev,bool enable) {}static inline void serdev_device_wait_until_sent (struct serdev_device *sdev,long timeout) {} +static inline bool serdev_device_get_cts (struct serdev_device *serdev) +{ +return false; +}static inline int serdev_device_write_buf (struct serdev_device *sdev,const unsigned char *buf,size_t count) {return -ENODEV ;
Signature · 1 line
2.11.0
Re: [PATCH 08/10] serdev: add serdev_device_get_cts
Quoted 14 lines · Sebastian Reichel
Add method to get current CTS line state.
Signed-off-by Sebastian Reichel <[email protected]>--- drivers/tty/serdev/core.c | 11 +++++++++++ drivers/tty/serdev/serdev-ttyport.c | 15 +++++++++++++++ include/linux/serdev.h | 6 ++++++ 3 files changed, 32 insertions(+)drivers/tty/serdev/core.c +0
-0
drivers/tty/serdev/core.c void serdev_device_wait_until_sent(struct serdev_device *serdev, long timeout) · line 187
Quoted 4 lines
drivers/tty/serdev/core.c +1
-0@@ -184,6 +184,17 @@ void serdev_device_wait_until_sent(struct serdev_device *serdev, long timeout) }EXPORT_SYMBOL_GPL (serdev_device_wait_until_sent); +bool serdev_device_get_cts (struct serdev_device *serdev)
I wonder if this should just be the wait for cts in the core. I think that would be the common use for reading the CTS state. IIRC, I saw some other device needing the same thing.
Rob
Re: [PATCH 08/10] serdev: add serdev_device_get_cts
Hi Rob,
Quoted 18 lines · Rob Herring
Quoted 17 lines · Sebastian Reichel
Add method to get current CTS line state.
Signed-off-by Sebastian Reichel <[email protected]>--- drivers/tty/serdev/core.c | 11 +++++++++++ drivers/tty/serdev/serdev-ttyport.c | 15 +++++++++++++++ include/linux/serdev.h | 6 ++++++ 3 files changed, 32 insertions(+)drivers/tty/serdev/core.c +0
-0@@ -184,6 +184,17 @@ void serdev_device_wait_until_sent(struct serdev_device *serdev, long timeout) }EXPORT_SYMBOL_GPL (serdev_device_wait_until_sent);
Quoted 5 lines
drivers/tty/serdev/core.c void serdev_device_wait_until_sent(struct serdev_device *serdev, long timeout) · line 187
Quoted 1 line
drivers/tty/serdev/core.c +1
-0+bool serdev_device_get_cts (struct serdev_device *serdev)I wonder if this should just be the wait for cts in the core. I think that would be the common use for reading the CTS state. IIRC, I saw some other device needing the same thing.
mh. I think it fits nicely to serdev_device_set_rts(). But I guess it makes sense to have the wait feature directly in serdev. So I suggest to add the function in addition to the simple get_cts function. Does that make sense to you?
-- Sebastian
Re: [PATCH 08/10] serdev: add serdev_device_get_cts
Quoted 27 lines · Sebastian Reichel
Hi Rob,
Quoted 18 lines · Rob Herring
Quoted 17 lines · Sebastian Reichel
Add method to get current CTS line state.
Signed-off-by Sebastian Reichel <[email protected]>--- drivers/tty/serdev/core.c | 11 +++++++++++ drivers/tty/serdev/serdev-ttyport.c | 15 +++++++++++++++ include/linux/serdev.h | 6 ++++++ 3 files changed, 32 insertions(+)drivers/tty/serdev/core.c +0
-0@@ -184,6 +184,17 @@ void serdev_device_wait_until_sent(struct serdev_device *serdev, long timeout) }EXPORT_SYMBOL_GPL (serdev_device_wait_until_sent);Quoted 5 lines
drivers/tty/serdev/core.c void serdev_device_wait_until_sent(struct serdev_device *serdev, long timeout) · line 187
Quoted 1 line
drivers/tty/serdev/core.c +1
-0+bool serdev_device_get_cts (struct serdev_device *serdev)I wonder if this should just be the wait for cts in the core. I think that would be the common use for reading the CTS state. IIRC, I saw some other device needing the same thing.
Quoted 4 lines
mh. I think it fits nicely to
serdev_device_set_rts(). But I guess it makes sense to have the wait feature directly in serdev. So I suggest to add the function in addition to the simpleget_ctsfunction. Does that make sense to you?
Sure. You should be able to implement that just in the core. Then the host driver stays simple and we're not duplicating the wait in host drivers (not that we expect to have lots of host drivers).
Rob
PATCH 9/10 serdev: add serdev_device_set_rts
In reply to Sebastian ReichelAdd function to enable/disable RTS line.
--- drivers/tty/serdev/core.c | 11 +++++++++++ drivers/tty/serdev/serdev-ttyport.c | 32 ++++++++++++++++++++++++++++++++ include/linux/serdev.h | 3 +++ 3 files changed, 46 insertions(+)
drivers/tty/serdev/core.c +11 -0
@@ -195,6 +195,17 @@ bool serdev_device_get_cts(struct serdev_device *serdev) }EXPORT_SYMBOL_GPL (serdev_device_get_cts); +void serdev_device_set_rts (struct serdev_device *serdev,bool enable) +{ +struct serdev_controller *ctrl = serdev->ctrl; + +if (!ctrl || !ctrl->ops->set_rts) +return ; + +return ctrl->ops->set_rts (ctrl, enable); +} +EXPORT_SYMBOL_GPL (serdev_device_set_rts); +static int serdev_drv_probe (struct device *dev) {const struct serdev_device_driver *sdrv =to_serdev_device_driver (dev->driver);
drivers/tty/serdev/serdev-ttyport.c +32 -0
@@ -193,6 +193,37 @@ static bool ttyport_get_cts(struct serdev_controller *ctrl)return !!(status &TIOCM_CTS ); } +static void ttyport_set_rts (struct serdev_controller *ctrl,bool enable) +{ +struct serport *serport =serdev_controller_get_drvdata (ctrl); +struct tty_struct *tty = serport->tty; +int status = tty->driver->ops->tiocmget (tty); +unsigned int set =0 ; +unsigned int clear =0 ; + +if (enable) { + set |= (TIOCM_OUT2 |TIOCM_RTS ); + clear = ~set; + set &=TIOCM_DTR |TIOCM_RTS |TIOCM_OUT1 | +TIOCM_OUT2 |TIOCM_LOOP ; + clear &=TIOCM_DTR |TIOCM_RTS |TIOCM_OUT1 | +TIOCM_OUT2 |TIOCM_LOOP ; + status = tty->driver->ops->tiocmset (tty, set, clear); + }else { + set &= ~(TIOCM_OUT2 |TIOCM_RTS ); + clear = ~set; + set &=TIOCM_DTR |TIOCM_RTS |TIOCM_OUT1 | +TIOCM_OUT2 |TIOCM_LOOP ; + clear &=TIOCM_DTR |TIOCM_RTS |TIOCM_OUT1 | +TIOCM_OUT2 |TIOCM_LOOP ; + status = tty->driver->ops->tiocmset (tty, set, clear); + } + +if (status) +dev_err (&ctrl->dev,"failed to %s RTS: %d" , + enable ?"enable" :"disable" , status); +} +static const struct serdev_controller_ops ctrl_ops = { .write_buf = ttyport_write_buf, .write_flush = ttyport_write_flush,
@@ -203,6 +234,7 @@ static const struct serdev_controller_ops ctrl_ops = { .set_baudrate = ttyport_set_baudrate, .wait_until_sent = ttyport_wait_until_sent, .get_cts = ttyport_get_cts, + .set_rts = ttyport_set_rts, }; struct device *serdev_tty_port_register(struct tty_port *port,
include/linux/serdev.h +3 -0
@@ -83,6 +83,7 @@ struct serdev_controller_ops {unsigned int (*set_baudrate)(struct serdev_controller *,unsigned int );void (*wait_until_sent)(struct serdev_controller *,long );bool (*get_cts)(struct serdev_controller *); +void (*set_rts)(struct serdev_controller *,bool ); };/**
@@ -190,6 +191,7 @@ unsigned int serdev_device_set_baudrate(struct serdev_device *, unsigned int);void serdev_device_set_flow_control (struct serdev_device *,bool );void serdev_device_wait_until_sent (struct serdev_device *,long );bool serdev_device_get_cts (struct serdev_device *); +void serdev_device_set_rts (struct serdev_device *,bool );int serdev_device_write_buf (struct serdev_device *,const unsigned char *,size_t );void serdev_device_write_flush (struct serdev_device *);int serdev_device_write_room (struct serdev_device *);
@@ -232,6 +234,7 @@ static inline bool serdev_device_get_cts(struct serdev_device *serdev) {return false; } +static inline void serdev_device_set_rts (struct serdev_controller *serdev,bool ) {}static inline int serdev_device_write_buf (struct serdev_device *sdev,const unsigned char *buf,size_t count) {return -ENODEV ;
Signature · 1 line
2.11.0
Re: [PATCH 09/10] serdev: add serdev_device_set_rts
Quoted 19 lines · Sebastian Reichel
Add function to enable/disable RTS line.
Signed-off-by Sebastian Reichel <[email protected]>---
(quoted diff) +14
-0+static void ttyport_set_rts(struct serdev_controller *ctrl, bool enable) +{ + struct serport *serport = serdev_controller_get_drvdata(ctrl); + struct tty_struct *tty = serport->tty; + int status = tty->driver->ops->tiocmget(tty); + unsigned int set = 0; + unsigned int clear = 0; + + if (enable) { + set |= (TIOCM_OUT2 | TIOCM_RTS); + clear = ~set; + set &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 | + TIOCM_OUT2 | TIOCM_LOOP; + clear &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 |
Review
Quoted 10 lines
(quoted diff) +10
-0+ TIOCM_OUT2 | TIOCM_LOOP; + status = tty->driver->ops->tiocmset(tty, set, clear); + } else { + set &= ~(TIOCM_OUT2 | TIOCM_RTS); + clear = ~set; + set &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 | + TIOCM_OUT2 | TIOCM_LOOP; + clear &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 | + TIOCM_OUT2 | TIOCM_LOOP; + status = tty->driver->ops->tiocmset(tty, set, clear);
The logic here can be greatly simplified. Here's a patch to the original version that I came up with, but haven't tested:
drivers/bluetooth/hci_ldisc.c +0 -0
@@ -264,8 +264,8 @@ void hci_uart_set_flow_control(struct hci_uart
*hu, bool enable)
struct tty_struct *tty = hu->tty;
struct ktermios ktermios;
int status;
- unsigned int set = 0;
- unsigned int clear = 0;
+ unsigned int set;
+ unsigned int clear = TIOCM_DTR | TIOCM_OUT1 | TIOCM_LOOP; if (enable) {
/* Disable hardware flow control */
@@ -280,25 +280,15 @@ void hci_uart_set_flow_control(struct hci_uart
*hu, bool enable)
status = tty->driver->ops->tiocmget(tty);
BT_DBG("Current tiocm 0x%x", status);- set &= ~(TIOCM_OUT2 | TIOCM_RTS);
- clear = ~set;
- set &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 |
- TIOCM_OUT2 | TIOCM_LOOP;
- clear &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 |
- TIOCM_OUT2 | TIOCM_LOOP;
- status = tty->driver->ops->tiocmset(tty, set, clear);
+ clear |= TIOCM_RTS | TIOCM_OUT2;
+ status = tty->driver->ops->tiocmset(tty, 0, clear);
BT_DBG("Clearing RTS: %s", status ? "failed" : "success");
} else {
/* Set RTS to allow the device to send again */
status = tty->driver->ops->tiocmget(tty);
BT_DBG("Current tiocm 0x%x", status);- set |= (TIOCM_OUT2 | TIOCM_RTS);
- clear = ~set;
- set &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 |
- TIOCM_OUT2 | TIOCM_LOOP;
- clear &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 |
- TIOCM_OUT2 | TIOCM_LOOP;
+ set = TIOCM_OUT2 | TIOCM_RTS;
status = tty->driver->ops->tiocmset(tty, set, clear);
BT_DBG("Setting RTS: %s", status ? "failed" : "success");Re: [PATCH 09/10] serdev: add serdev_device_set_rts
Hi Rob,
Quoted 25 lines · Rob Herring
Quoted 24 lines · Sebastian Reichel
Add function to enable/disable RTS line.
Signed-off-by Sebastian Reichel <[email protected]>---
(quoted diff) +19
-0+static void ttyport_set_rts(struct serdev_controller *ctrl, bool enable) +{ + struct serport *serport = serdev_controller_get_drvdata(ctrl); + struct tty_struct *tty = serport->tty; + int status = tty->driver->ops->tiocmget(tty); + unsigned int set = 0; + unsigned int clear = 0; + + if (enable) { + set |= (TIOCM_OUT2 | TIOCM_RTS); + clear = ~set; + set &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 | + TIOCM_OUT2 | TIOCM_LOOP; + clear &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 | + TIOCM_OUT2 | TIOCM_LOOP; + status = tty->driver->ops->tiocmset(tty, set, clear); + } else { + set &= ~(TIOCM_OUT2 | TIOCM_RTS); + clear = ~set;
Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ set &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 | + TIOCM_OUT2 | TIOCM_LOOP; + clear &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 | + TIOCM_OUT2 | TIOCM_LOOP; + status = tty->driver->ops->tiocmset(tty, set, clear);The logic here can be greatly simplified. Here's a patch to the original version that I came up with, but haven't tested:
ah I totally forgot to clean that mess. I took that over from the bluetooth code, since that got the nokia bluetooth chips working. I will do this in the next revision.
-- Sebastian
PATCH 10/10 Bluetooth: add nokia driver
In reply to Sebastian ReichelThis adds a driver for the Nokia H4+ protocol, which is used at least on the Nokia N9, N900 & N950.
--- .../devicetree/bindings/net/nokia-bluetooth.txt | 51 ++ drivers/bluetooth/Kconfig | 12 + drivers/bluetooth/Makefile | 2 + drivers/bluetooth/hci_nokia.c | 839 +++++++++++++++++++++ 4 files changed, 904 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/nokia-bluetooth.txt create mode 100644 drivers/bluetooth/hci_nokia.c
Documentation/devicetree/bindings/net/nokia-bluetooth.txt new file +51 -0
@@ -0,0 +1,51 @@ +Nokia Bluetooth Chips +--------------------- + +Nokia phones often come with UART connected bluetooth chips from different +vendors and modified device API. Those devices speak a protocol named H4+ +by Nokia, which is similar to the H4 protocol from the Bluetooth standard. +In addition to the H4 protocol it specifies two more UART status lines for +wakeup of UART transceivers to improve power management and a few new packet +types used to negotiate uart speed. + +Required properties: + + - compatible: should be one of the following: + * "nokia,brcm,bcm2048" + * "nokia,ti,wl1271-bluetooth" + - reset-gpios: GPIO specifier, used to reset the BT module + - bluetooth-wakeup-gpios: GPIO specifier, used to wakeup the BT module + - host-wakeup-gpios: GPIO specifier, used to wakeup the host processor + - clock-names: should be "sysclk" + - clocks: should contain a clock specifier for every name in clock-names + +Optional properties: + + - None + +Example: + +/ { + /* controlled (enabled/disabled) directly by BT module */ + bluetooth_clk: vctcxo { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <38400000>; + }; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2_pins>; + + bluetooth { + compatible = "nokia,ti,wl1271-bluetooth"; + + reset-gpios = <&gpio1 26 GPIO_ACTIVE_LOW>; /* gpio26 */ + host-wakeup-gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>; /* gpio101 */ + bluetooth-wakeup-gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>; /* gpio37 */ + + clocks = <&bluetooth_clk>; + clock-names = "sysclk"; + }; +};
drivers/bluetooth/Kconfig +12 -0
@@ -86,6 +86,18 @@ config BT_HCIUART_H4 Say Y here to compile support for HCI UART (H4) protocol. +config BT_HCIUART_NOKIA + tristate "UART Nokia H4+ protocol support" + depends on BT_HCIUART + depends on SERIAL_DEV_BUS + depends on PM + help + Nokia H4+ is serial protocol for communication between Bluetooth + device and host. This protocol is required for Bluetooth devices + with UART interface in Nokia devices. + + Say Y here to compile support for Nokia's H4+ protocol. + config BT_HCIUART_BCSP bool "BCSP protocol support" depends on BT_HCIUART
drivers/bluetooth/Makefile +2 -0
@@ -25,6 +25,8 @@ obj-$(CONFIG_BT_BCM) += btbcm.o obj-$(CONFIG_BT_RTL) += btrtl.o obj-$(CONFIG_BT_QCA) += btqca.o +obj-$(CONFIG_BT_HCIUART_NOKIA) += hci_nokia.o + btmrvl-y := btmrvl_main.o btmrvl-$(CONFIG_DEBUG_FS) += btmrvl_debugfs.o
drivers/bluetooth/hci_nokia.c new file +839 -0
839 lines not on this page · raw message
Signature · 1 line
2.11.0
Re: [PATCH 10/10] Bluetooth: add nokia driver
Quoted 6 lines · Sebastian Reichel
This adds a driver for the Nokia H4+ protocol, which is used at least on the Nokia N9, N900 & N950.
Signed-off-by Sebastian Reichel <[email protected]>--- .../devicetree/bindings/net/nokia-bluetooth.txt | 51 ++
This should be separate and before the dts files.
Quoted 18 lines
drivers/bluetooth/Kconfig | 12 + drivers/bluetooth/Makefile | 2 + drivers/bluetooth/hci_nokia.c | 839 +++++++++++++++++++++ 4 files changed, 904 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/nokia-bluetooth.txt create mode 100644 drivers/bluetooth/hci_nokia.cDocumentation/devicetree/bindings/net/nokia-bluetooth.txt new file +5
-0@@ -0,0 +1,51 @@ +Nokia Bluetooth Chips +--------------------- + +Nokia phones often come with UART connected bluetooth chips from different +vendors and modified device API. Those devices speak a protocol named H4+
Documentation/devicetree/bindings/net/nokia-bluetooth.txt line 15
Quoted 10 lines
Documentation/devicetree/bindings/net/nokia-bluetooth.txt new file +10
-0+by Nokia, which is similar to the H4 protocol from the Bluetooth standard. +In addition to the H4 protocol it specifies two more UART status lines for +wakeup of UART transceivers to improve power management and a few new packet +types used to negotiate uart speed. + +Required properties: + + - compatible: should be one of the following: + * "nokia,brcm,bcm2048" + * "nokia,ti,wl1271-bluetooth"
Drop the chip vendors' prefix here. I don't really want to start a pattern of 2 vendor prefixes.
Documentation/devicetree/bindings/net/nokia-bluetooth.txt line 16
Quoted 1 line
Documentation/devicetree/bindings/net/nokia-bluetooth.txt new file +1
-0+ - reset-gpios: GPIO specifier, used to reset the BT module
Need to state active state.
Documentation/devicetree/bindings/net/nokia-bluetooth.txt line 18
Quoted 2 lines
Documentation/devicetree/bindings/net/nokia-bluetooth.txt new file +2
-0+ - bluetooth-wakeup-gpios: GPIO specifier, used to wakeup the BT module + - host-wakeup-gpios: GPIO specifier, used to wakeup the host processor
I think most BCM devices have these. These apply to the TI device too? If not, then add brcm prefix.
Also need to specify the active state.
Quoted 33 lines
Documentation/devicetree/bindings/net/nokia-bluetooth.txt new file +33
-0+ - clock-names: should be "sysclk" + - clocks: should contain a clock specifier for every name in clock-names + +Optional properties: + + - None + +Example: + +/ { + /* controlled (enabled/disabled) directly by BT module */ + bluetooth_clk: vctcxo { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <38400000>; + }; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2_pins>; + + bluetooth { + compatible = "nokia,ti,wl1271-bluetooth"; + + reset-gpios = <&gpio1 26 GPIO_ACTIVE_LOW>; /* gpio26 */ + host-wakeup-gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>; /* gpio101 */ + bluetooth-wakeup-gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>; /* gpio37 */ + + clocks = <&bluetooth_clk>; + clock-names = "sysclk"; + }; +};
Re: [PATCH 10/10] Bluetooth: add nokia driver
Hi Rob,
Quoted 33 lines · Rob Herring
Quoted 6 lines · Sebastian Reichel
This adds a driver for the Nokia H4+ protocol, which is used at least on the Nokia N9, N900 & N950.
Signed-off-by Sebastian Reichel <[email protected]>--- .../devicetree/bindings/net/nokia-bluetooth.txt | 51 ++This should be separate and before the dts files.
Quoted 23 lines
drivers/bluetooth/Kconfig | 12 + drivers/bluetooth/Makefile | 2 + drivers/bluetooth/hci_nokia.c | 839 +++++++++++++++++++++ 4 files changed, 904 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/nokia-bluetooth.txt create mode 100644 drivers/bluetooth/hci_nokia.cDocumentation/devicetree/bindings/net/nokia-bluetooth.txt new file +10
-0@@ -0,0 +1,51 @@ +Nokia Bluetooth Chips +--------------------- + +Nokia phones often come with UART connected bluetooth chips from different +vendors and modified device API. Those devices speak a protocol named H4+ +by Nokia, which is similar to the H4 protocol from the Bluetooth standard. +In addition to the H4 protocol it specifies two more UART status lines for +wakeup of UART transceivers to improve power management and a few new packet +types used to negotiate uart speed. +
Quoted 8 lines
Documentation/devicetree/bindings/net/nokia-bluetooth.txt line 15
Quoted 5 lines
Documentation/devicetree/bindings/net/nokia-bluetooth.txt new file +5
-0+Required properties: + + - compatible: should be one of the following: + * "nokia,brcm,bcm2048" + * "nokia,ti,wl1271-bluetooth"Drop the chip vendors' prefix here. I don't really want to start a pattern of 2 vendor prefixes.
Right, I think we discussed this before, but I don't remember the result. How about
- compatible: should contain "nokia,h4p-bluetooth" as well as one of the following:
* "brcm,bcm2048-nokia"
* "ti,wl1271-blueooth-nokia"
For the driver it should be enough to know "nokia,h4p-bluetooth" actually. The device identifies itself in the negotiation reply.
Quoted 3 lines
Documentation/devicetree/bindings/net/nokia-bluetooth.txt line 16
Quoted 1 line
Documentation/devicetree/bindings/net/nokia-bluetooth.txt new file +1
-0+ - reset-gpios: GPIO specifier, used to reset the BT moduleNeed to state active state.
ok. Any suggestion about the wording? The BT chips use usually active low reset pin. The driver handles all GPIOs as active high with the DT binding translating this transparently.
Quoted 5 lines
Documentation/devicetree/bindings/net/nokia-bluetooth.txt line 18
Quoted 2 lines
Documentation/devicetree/bindings/net/nokia-bluetooth.txt new file +2
-0+ - bluetooth-wakeup-gpios: GPIO specifier, used to wakeup the BT module + - host-wakeup-gpios: GPIO specifier, used to wakeup the host processorI think most BCM devices have these. These apply to the TI device too? If not, then add brcm prefix.
Yes, Nokia N950 uses a TI WL1271 and also has them. Actually the example from below is a TI chip.
Quoted 1 line
Also need to specify the active state.
ok.
Quoted 25 lines
Quoted 25 lines
Documentation/devicetree/bindings/net/nokia-bluetooth.txt new file +25
-0+ - clock-names: should be "sysclk" + - clocks: should contain a clock specifier for every name in clock-names + +Optional properties: + + - None + +Example: + +/ { + /* controlled (enabled/disabled) directly by BT module */ + bluetooth_clk: vctcxo { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <38400000>; + }; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2_pins>; + + bluetooth { + compatible = "nokia,ti,wl1271-bluetooth"; +
Quoted 8 lines
Documentation/devicetree/bindings/net/nokia-bluetooth.txt line 51
Quoted 8 lines
Documentation/devicetree/bindings/net/nokia-bluetooth.txt new file +8
-0+ reset-gpios = <&gpio1 26 GPIO_ACTIVE_LOW>; /* gpio26 */ + host-wakeup-gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>; /* gpio101 */ + bluetooth-wakeup-gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>; /* gpio37 */ + + clocks = <&bluetooth_clk>; + clock-names = "sysclk"; + }; +};
-- Sebastian
Marcel Holtmann
maintainerRe: [PATCH 10/10] Bluetooth: add nokia driver
Hi Sebastian,
Quoted 41 lines
Quoted 32 lines
Quoted 6 lines
This adds a driver for the Nokia H4+ protocol, which is used at least on the Nokia N9, N900 & N950.
Signed-off-by Sebastian Reichel <[email protected]>---
.../devicetree/bindings/net/nokia-bluetooth.txt| 51 ++This should be separate and before the dts files.
Quoted 23 lines
drivers/bluetooth/Kconfig | 12 + drivers/bluetooth/Makefile | 2 + drivers/bluetooth/hci_nokia.c | 839 +++++++++++++++++++++ 4 files changed, 904 insertions(+)create mode 100644
Documentation/devicetree/bindings/net/nokia-bluetooth.txtcreate mode 100644drivers/bluetooth/hci_nokia.cDocumentation/devicetree/bindings/net/nokia-bluetooth.txt new file +10
-0@@ -0,0 +1,51 @@ +Nokia Bluetooth Chips +--------------------- + +Nokia phones often come with UART connected bluetooth chips from different +vendors and modified device API. Those devices speak a protocol named H4+ +by Nokia, which is similar to the H4 protocol from the Bluetooth standard. +In addition to the H4 protocol it specifies two more UART status lines for +wakeup of UART transceivers to improve power management and a few new packet +types used to negotiate uart speed. +Quoted 8 lines
Documentation/devicetree/bindings/net/nokia-bluetooth.txt line 15
Quoted 5 lines
Documentation/devicetree/bindings/net/nokia-bluetooth.txt new file +5
-0+Required properties: + + - compatible: should be one of the following: + * "nokia,brcm,bcm2048" + * "nokia,ti,wl1271-bluetooth"Drop the chip vendors' prefix here. I don't really want to start a pattern of 2 vendor prefixes.
Quoted 6 lines
Right, I think we discussed this before, but I don't remember the result. How about
- compatible: should contain "nokia,h4p-bluetooth" as well as one of the following:
* "brcm,bcm2048-nokia"
* "ti,wl1271-blueooth-nokia”
I never liked the term “h4p”. It is fundamentally just “bluetooth”. What are our plans for Broadcom, Intel etc. Bluetooth UARTs?
Regards
Marcel
Re: [PATCH 10/10] Bluetooth: add nokia driver
Hi Marcel,
Quoted 8 lines · Marcel Holtmann
Quoted 5 lines
[...]
- compatible: should contain "nokia,h4p-bluetooth" as well as one of the following:
* "brcm,bcm2048-nokia"
* "ti,wl1271-blueooth-nokia”I never liked the term “h4p”. It is fundamentally just “bluetooth”.
It's not me, that came up with the term, Nokia called their protocol H4+ (for DT people not familiar with bluetooth - the standard bluetooth UART protocol is named H4). I agree, that H4+ is ambiguous, but with the "nokia," prefix it should be clear what protocol is meant. I don't really mind, though. We can also just list the individual chips and add all compatible strings to the driver.
FWIW I remove the term from the driver leaving only a single instance in the header ("AKA H4+").
Quoted 1 line
What are our plans for Broadcom, Intel etc. Bluetooth UARTs?
I think drivers, that need extra resources (like GPIOs) can switch to serdev exclusively. The kernel needs ACPI/DT/boardcode data for those devices anyways.
Iirc Rob is working on serdev patches for Broadcom and TI BT, so he may provide more information.
-- Sebastian
Re: [PATCH 10/10] Bluetooth: add nokia driver
In reply to Sebastian ReichelQuoted 45 lines · Sebastian Reichel
Hi Rob,
Quoted 33 lines · Rob Herring
Quoted 6 lines · Sebastian Reichel
This adds a driver for the Nokia H4+ protocol, which is used at least on the Nokia N9, N900 & N950.
Signed-off-by Sebastian Reichel <[email protected]>--- .../devicetree/bindings/net/nokia-bluetooth.txt | 51 ++This should be separate and before the dts files.
Quoted 23 lines
drivers/bluetooth/Kconfig | 12 + drivers/bluetooth/Makefile | 2 + drivers/bluetooth/hci_nokia.c | 839 +++++++++++++++++++++ 4 files changed, 904 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/nokia-bluetooth.txt create mode 100644 drivers/bluetooth/hci_nokia.cDocumentation/devicetree/bindings/net/nokia-bluetooth.txt new file +10
-0@@ -0,0 +1,51 @@ +Nokia Bluetooth Chips +--------------------- + +Nokia phones often come with UART connected bluetooth chips from different +vendors and modified device API. Those devices speak a protocol named H4+ +by Nokia, which is similar to the H4 protocol from the Bluetooth standard. +In addition to the H4 protocol it specifies two more UART status lines for +wakeup of UART transceivers to improve power management and a few new packet +types used to negotiate uart speed. +Quoted 8 lines
Documentation/devicetree/bindings/net/nokia-bluetooth.txt line 15
Quoted 5 lines
Documentation/devicetree/bindings/net/nokia-bluetooth.txt new file +5
-0+Required properties: + + - compatible: should be one of the following: + * "nokia,brcm,bcm2048" + * "nokia,ti,wl1271-bluetooth"Drop the chip vendors' prefix here. I don't really want to start a pattern of 2 vendor prefixes.
Quoted 6 lines
Right, I think we discussed this before, but I don't remember the result. How about
- compatible: should contain "nokia,h4p-bluetooth" as well as one of the following:
* "brcm,bcm2048-nokia"
* "ti,wl1271-blueooth-nokia"
Sure, that's fine (other than the typo).
Quoted 10 lines
For the driver it should be enough to know "nokia,h4p-bluetooth" actually. The device identifies itself in the negotiation reply.
Quoted 3 lines
Documentation/devicetree/bindings/net/nokia-bluetooth.txt line 16
Quoted 1 line
Documentation/devicetree/bindings/net/nokia-bluetooth.txt new file +1
-0+ - reset-gpios: GPIO specifier, used to reset the BT moduleNeed to state active state.
ok. Any suggestion about the wording? The BT chips use usually active low reset pin. The driver handles all GPIOs as active high with the DT binding translating this transparently.
Just having "active low" in there is enough.
Personally I find the GPIO translating confusing...
Rob
Re: [PATCH 10/10] Bluetooth: add nokia driver
In reply to Sebastian ReichelHi!
drivers/bluetooth/hci_nokia.c line 96
Quoted 12 lines
drivers/bluetooth/hci_nokia.c new file +12
-0+struct hci_nokia_neg_hdr { +__u8 dlen; +} __packed; + +struct hci_nokia_neg_cmd { +__u8 ack; +__u16 baud; +__u16 unused1; +__u8 proto; +__u16 sys_clk; +__u16 unused2; +} __packed;
__u8 -> u8? This is not exported to userspace...
Quoted 1 line
+#define
BT_BAUDRATE_DIVIDER384000000
Is this really divider?
drivers/bluetooth/hci_nokia.c line 149
Quoted 5 lines
drivers/bluetooth/hci_nokia.c new file +5
-0+int init_error; +struct completion init_completion; + +uint8_t man_id; +uint8_t ver_id;
u8...
Quoted 10 lines
drivers/bluetooth/hci_nokia.c new file +10
-0+static int nokia_wait_for_cts (struct hci_uart *hu,bool state, +int timeout_ms) +{ +struct nokia_bt_dev *btdev = hu->priv; +struct device *dev = &btdev->serdev->dev; +unsigned long timeout; +bool signal; + + timeout = jiffies +msecs_to_jiffies (timeout_ms); +while (!time_after (jiffies, timeout)) {
drivers/bluetooth/hci_nokia.c line 177
Quoted 10 lines
drivers/bluetooth/hci_nokia.c new file +10
-0+ signal =serdev_device_get_cts (btdev->serdev); +if (signal == state) { +dev_dbg (dev,"wait for cts... received!" ); +return 0 ; + } +usleep_range (1000 ,2000 ); + } + +return -ETIMEDOUT ; +}
Do we have devices where cts triggers interrupt?
drivers/bluetooth/hci_nokia.c line 337
Quoted 7 lines
drivers/bluetooth/hci_nokia.c new file +7
-0+if (btdev->init_error <0 ) +return btdev->init_error; + +/* Change to previously negotiated speed. Flow Control +* is disabled until bluetooth adapter is ready to avoid +* broken bytes being ready by the bluetooth adapter +*/
Umm. I'd at dot at end of sentence... but still can't understand the sentence.
"to avoid broken bytes being received."?
drivers/bluetooth/hci_nokia.c line 584
Quoted 6 lines
drivers/bluetooth/hci_nokia.c new file +6
-0+ evt = (struct hci_nokia_neg_evt *)skb_pull (skb,sizeof (*hdr)); + +if (evt->ack !=NOKIA_NEG_ACK ) { +dev_err (dev,"Negotiation received: wrong reply" ); + btdev->init_error = -EINVAL ; + }
But we still return success and trust the man_id / ver_id?
drivers/bluetooth/hci_nokia.c line 622
Quoted 8 lines
drivers/bluetooth/hci_nokia.c new file +8
-0+ pkt = (struct hci_nokia_alive_pkt *)skb_pull (skb,sizeof (*hdr)); + +if (pkt->mid !=NOKIA_ALIVE_RESP ) { +dev_err (dev,"Alive received: invalid response: 0x%02x!" , + pkt->mid); + btdev->init_error = -EINVAL ; + goto finish_alive; + }
ret = -EINVAL?
Thanks!
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html