From: Tony Lindgren Date: Wed, 23 Apr 2008 23:39:36 +0000 (-0700) Subject: BT: Sync hcih4p with Nokia N810 driver and fix compile X-Git-Tag: v2.6.26-omap1~123^2~163 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=9e0e45e644392e99945937416e0485f587127918;p=linux-2.6-omap-h63xx.git BT: Sync hcih4p with Nokia N810 driver and fix compile Sync hcih4p with kernel-source-rx-34-2.6.21.0 and fix compile. Signed-off-by: Tony Lindgren --- diff --git a/drivers/bluetooth/hci_h4p/core.c b/drivers/bluetooth/hci_h4p/core.c index 09c1f939d74..7fb5d123db0 100644 --- a/drivers/bluetooth/hci_h4p/core.c +++ b/drivers/bluetooth/hci_h4p/core.c @@ -144,7 +144,7 @@ static void hci_h4p_enable_rx(struct hci_h4p_info *info) if (info->rx_pm_enabled) { hci_h4p_set_clk(info, &info->rx_clocks_en, 1); hci_h4p_outb(info, UART_IER, hci_h4p_inb(info, UART_IER) | UART_IER_RDI); - hci_h4p_set_auto_ctsrts(info, 1, UART_EFR_RTS); + __hci_h4p_set_auto_ctsrts(info, 1, UART_EFR_RTS); info->rx_pm_enabled = 0; } spin_unlock_irqrestore(&info->lock, flags); @@ -157,7 +157,7 @@ static void hci_h4p_rx_pm_timer(unsigned long data) spin_lock_irqsave(&info->lock, flags); if (!(hci_h4p_inb(info, UART_LSR) & UART_LSR_DR)) { - hci_h4p_set_auto_ctsrts(info, 0, UART_EFR_RTS); + __hci_h4p_set_auto_ctsrts(info, 0, UART_EFR_RTS); hci_h4p_set_rts(info, 0); hci_h4p_outb(info, UART_IER, hci_h4p_inb(info, UART_IER) & ~UART_IER_RDI); hci_h4p_set_clk(info, &info->rx_clocks_en, 0); @@ -231,7 +231,6 @@ static void hci_h4p_negotiation_packet(struct hci_h4p_info *info, goto neg_ret; hci_h4p_change_speed(info, MAX_BAUD_RATE); - hci_h4p_set_rts(info, 1); err = hci_h4p_wait_for_cts(info, 1, 100); if (err < 0) @@ -252,8 +251,8 @@ static void hci_h4p_negotiation_packet(struct hci_h4p_info *info, return; neg_ret: - complete(&info->init_completion); info->init_error = err; + complete(&info->init_completion); kfree_skb(skb); } @@ -511,7 +510,6 @@ static irqreturn_t hci_h4p_interrupt(int irq, void *data) ret = IRQ_HANDLED; } - return ret; } @@ -545,7 +543,6 @@ static int hci_h4p_reset(struct hci_h4p_info *info) int err; hci_h4p_init_uart(info); - hci_h4p_set_auto_ctsrts(info, 0, UART_EFR_CTS | UART_EFR_RTS); hci_h4p_set_rts(info, 0); omap_set_gpio_dataout(info->reset_gpio, 0); @@ -626,8 +623,6 @@ static int hci_h4p_hci_open(struct hci_dev *hdev) if (err < 0) goto err_clean; - hci_h4p_set_auto_ctsrts(info, 1, UART_EFR_CTS | UART_EFR_RTS); - err = hci_h4p_send_fw(info, &fw_queue); if (err < 0) { dev_err(info->dev, "Sending firmware failed.\n"); @@ -675,6 +670,8 @@ static int hci_h4p_hci_close(struct hci_dev *hdev) del_timer_sync(&info->rx_pm_timer); tasklet_disable(&info->tx_task); tasklet_disable(&info->rx_task); + hci_h4p_set_clk(info, &info->tx_clocks_en, 1); + hci_h4p_set_clk(info, &info->rx_clocks_en, 1); hci_h4p_reset_uart(info); hci_h4p_set_clk(info, &info->tx_clocks_en, 0); hci_h4p_set_clk(info, &info->rx_clocks_en, 0); @@ -906,7 +903,8 @@ static int hci_h4p_probe(struct platform_device *pdev) } err = request_irq(OMAP_GPIO_IRQ(info->host_wakeup_gpio), - hci_h4p_wakeup_interrupt, SA_TRIGGER_FALLING | SA_TRIGGER_RISING, + hci_h4p_wakeup_interrupt, + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, "hci_h4p_wkup", (void *)info); if (err < 0) { dev_err(info->dev, "hci_h4p: unable to get wakeup IRQ %d\n", @@ -916,11 +914,10 @@ static int hci_h4p_probe(struct platform_device *pdev) } hci_h4p_set_clk(info, &info->tx_clocks_en, 1); + hci_h4p_set_auto_ctsrts(info, 0, UART_EFR_CTS | UART_EFR_RTS); err = hci_h4p_init_uart(info); if (err < 0) goto cleanup_irq; - hci_h4p_set_auto_ctsrts(info, 0, UART_EFR_CTS | UART_EFR_RTS); - hci_h4p_set_rts(info, 0); err = hci_h4p_reset(info); if (err < 0) goto cleanup_irq; diff --git a/drivers/bluetooth/hci_h4p/hci_h4p.h b/drivers/bluetooth/hci_h4p/hci_h4p.h index af9da25d07c..eed5205cce3 100644 --- a/drivers/bluetooth/hci_h4p/hci_h4p.h +++ b/drivers/bluetooth/hci_h4p/hci_h4p.h @@ -174,6 +174,7 @@ void hci_h4p_outb(struct hci_h4p_info *info, unsigned int offset, u8 val); u8 hci_h4p_inb(struct hci_h4p_info *info, unsigned int offset); void hci_h4p_set_rts(struct hci_h4p_info *info, int active); int hci_h4p_wait_for_cts(struct hci_h4p_info *info, int active, int timeout_ms); +void __hci_h4p_set_auto_ctsrts(struct hci_h4p_info *info, int on, u8 which); void hci_h4p_set_auto_ctsrts(struct hci_h4p_info *info, int on, u8 which); void hci_h4p_change_speed(struct hci_h4p_info *info, unsigned long speed); int hci_h4p_reset_uart(struct hci_h4p_info *info); diff --git a/drivers/bluetooth/hci_h4p/uart.c b/drivers/bluetooth/hci_h4p/uart.c index 67220fb4632..1b75a4204dd 100644 --- a/drivers/bluetooth/hci_h4p/uart.c +++ b/drivers/bluetooth/hci_h4p/uart.c @@ -75,7 +75,7 @@ int hci_h4p_wait_for_cts(struct hci_h4p_info *info, int active, } } -void hci_h4p_set_auto_ctsrts(struct hci_h4p_info *info, int on, u8 which) +void __hci_h4p_set_auto_ctsrts(struct hci_h4p_info *info, int on, u8 which) { u8 lcr, b; @@ -90,6 +90,15 @@ void hci_h4p_set_auto_ctsrts(struct hci_h4p_info *info, int on, u8 which) hci_h4p_outb(info, UART_LCR, lcr); } +void hci_h4p_set_auto_ctsrts(struct hci_h4p_info *info, int on, u8 which) +{ + unsigned long flags; + + spin_lock_irqsave(&info->lock, flags); + __hci_h4p_set_auto_ctsrts(info, on, which); + spin_unlock_irqrestore(&info->lock, flags); +} + void hci_h4p_change_speed(struct hci_h4p_info *info, unsigned long speed) { unsigned int divisor;