From 15bbc7531477dc3d0a868b66bb69d28a768594c7 Mon Sep 17 00:00:00 2001 From: Nitin Dhingra Date: Mon, 16 Jan 2012 14:40:41 +0530 Subject: CG2900: Fix timings for CG29XX during break In Reference to CG29x0 low power mode control document, there are some fixes required in CG2900 protocol driver for break conditions. 1)Pre-break - 900usec - This is the minimal time before Host sending a break after it completes sending data on Tx_Host line. 2)in-break - 5msec - This is the minimal time that Host should maintain the break. 3)post-break - 200usec - This is the minimal time before Host starting sending data on Tx_Host line after it exits break. ST-Ericsson Linux next: Not Tested, ER 410756 ST-Ericsson ID: 410756 ST-Ericsson FOSS-OUT ID: trivial Signed-off-by: Nitin Dhingra Change-Id: I0618c5f7e507b540907546d10fd217b046484263 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/45521 Reviewed-by: QATOOLS Reviewed-by: Nitin DHINGRA Tested-by: Nitin DHINGRA --- drivers/staging/cg2900/bluetooth/cg2900_uart.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/staging/cg2900/bluetooth/cg2900_uart.c b/drivers/staging/cg2900/bluetooth/cg2900_uart.c index 79b4efa189c..783b8327786 100644 --- a/drivers/staging/cg2900/bluetooth/cg2900_uart.c +++ b/drivers/staging/cg2900/bluetooth/cg2900_uart.c @@ -59,6 +59,14 @@ #define UART_RX_TIMEOUT 10 #define UART_RESP_TIMEOUT 1000 #define UART_RESUME_TIMEOUT 20 +/* Minimum time host should maintain the break */ +#define UART_MIN_BREAK_ON_TIME 5 + +/* Timers used in microseconds */ +/* Minimum time required after sending the last data to apply break */ +#define UART_MIN_TIME_BEFORE_APPLYING_BREAK 900 +/* Minimum time required after exiting break condition */ +#define UART_MIN_BREAK_OFF_TIME 200 /* Max latency in microseconds for PM QoS to achieve max throughput */ #define CG2900_PM_QOS_LATENCY 30 @@ -647,6 +655,7 @@ static void wake_up_chip(struct uart_info *uart_info) /* Unset BREAK. */ dev_dbg(MAIN_DEV, "wake_up_chip: Clear break\n"); hci_uart_set_break(uart_info->hu, BREAK_OFF); + udelay(UART_MIN_BREAK_OFF_TIME); dev_dbg(MAIN_DEV, "New sleep_state: CHIP_AWAKE\n"); uart_info->sleep_state = CHIP_AWAKE; @@ -714,6 +723,7 @@ static void set_chip_sleep_mode(struct work_struct *work) uart_info->baud_rate); hci_uart_flow_ctrl(uart_info->hu, FLOW_ON); hci_uart_set_break(uart_info->hu, BREAK_OFF); + udelay(UART_MIN_BREAK_OFF_TIME); dev_dbg(MAIN_DEV, "New sleep_state: CHIP_AWAKE\n"); uart_info->sleep_state = CHIP_AWAKE; @@ -745,7 +755,10 @@ static void set_chip_sleep_mode(struct work_struct *work) } dev_dbg(MAIN_DEV, "sleep_timer_expired: Set break\n"); + udelay(UART_MIN_TIME_BEFORE_APPLYING_BREAK); hci_uart_set_break(uart_info->hu, BREAK_ON); + schedule_timeout_killable( + msecs_to_jiffies(UART_MIN_BREAK_ON_TIME)); dev_dbg(MAIN_DEV, "New sleep_state: CHIP_FALLING_ASLEEP\n"); uart_info->sleep_state = CHIP_FALLING_ASLEEP; @@ -1405,6 +1418,7 @@ static void uart_set_chip_power(struct cg2900_chip_dev *dev, bool chip_on) hci_uart_flow_ctrl(uart_info->hu, FLOW_ON); hci_uart_set_break(uart_info->hu, BREAK_OFF); + udelay(UART_MIN_BREAK_OFF_TIME); } else { /* Turn off the chip.*/ switch (uart_info->sleep_state) { @@ -1412,6 +1426,7 @@ static void uart_set_chip_power(struct cg2900_chip_dev *dev, bool chip_on) break; case CHIP_FALLING_ASLEEP: hci_uart_set_break(uart_info->hu, BREAK_OFF); + udelay(UART_MIN_BREAK_OFF_TIME); break; case CHIP_SUSPENDED: case CHIP_ASLEEP: -- cgit v1.2.3