-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 197132 b: refs/heads/master c: 1d065ab h: refs/heads/master v: v3
- Loading branch information
Pavan Savoy
authored and
Greg Kroah-Hartman
committed
May 11, 2010
1 parent
819b417
commit 6fb395b
Showing
3 changed files
with
210 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: d0088ce183ad111b203adc94dcc7dde2a590a198 | ||
refs/heads/master: 1d065ab683f954d864a9366927d83bfc88b2f585 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
/* | ||
* Shared Transport driver | ||
* HCI-LL module responsible for TI proprietary HCI_LL protocol | ||
* Copyright (C) 2009 Texas Instruments | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* 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 | ||
* | ||
*/ | ||
|
||
#define pr_fmt(fmt) "(stll) :" fmt | ||
#include "st_ll.h" | ||
|
||
/**********************************************************************/ | ||
/* internal functions */ | ||
static void send_ll_cmd(struct st_data_s *st_data, | ||
unsigned char cmd) | ||
{ | ||
|
||
pr_info("%s: writing %x", __func__, cmd); | ||
st_int_write(st_data, &cmd, 1); | ||
return; | ||
} | ||
|
||
static void ll_device_want_to_sleep(struct st_data_s *st_data) | ||
{ | ||
pr_info("%s", __func__); | ||
/* sanity check */ | ||
if (st_data->ll_state != ST_LL_AWAKE) | ||
pr_err("ERR hcill: ST_LL_GO_TO_SLEEP_IND" | ||
"in state %ld", st_data->ll_state); | ||
|
||
send_ll_cmd(st_data, LL_SLEEP_ACK); | ||
/* update state */ | ||
st_data->ll_state = ST_LL_ASLEEP; | ||
} | ||
|
||
static void ll_device_want_to_wakeup(struct st_data_s *st_data) | ||
{ | ||
/* diff actions in diff states */ | ||
switch (st_data->ll_state) { | ||
case ST_LL_ASLEEP: | ||
send_ll_cmd(st_data, LL_WAKE_UP_ACK); /* send wake_ack */ | ||
break; | ||
case ST_LL_ASLEEP_TO_AWAKE: | ||
/* duplicate wake_ind */ | ||
pr_err("duplicate wake_ind while waiting for Wake ack"); | ||
break; | ||
case ST_LL_AWAKE: | ||
/* duplicate wake_ind */ | ||
pr_err("duplicate wake_ind already AWAKE"); | ||
break; | ||
case ST_LL_AWAKE_TO_ASLEEP: | ||
/* duplicate wake_ind */ | ||
pr_err("duplicate wake_ind"); | ||
break; | ||
} | ||
/* update state */ | ||
st_data->ll_state = ST_LL_AWAKE; | ||
} | ||
|
||
/**********************************************************************/ | ||
/* functions invoked by ST Core */ | ||
|
||
/* called when ST Core wants to | ||
* enable ST LL */ | ||
void st_ll_enable(struct st_data_s *ll) | ||
{ | ||
ll->ll_state = ST_LL_AWAKE; | ||
} | ||
|
||
/* called when ST Core /local module wants to | ||
* disable ST LL */ | ||
void st_ll_disable(struct st_data_s *ll) | ||
{ | ||
ll->ll_state = ST_LL_INVALID; | ||
} | ||
|
||
/* called when ST Core wants to update the state */ | ||
void st_ll_wakeup(struct st_data_s *ll) | ||
{ | ||
if (likely(ll->ll_state != ST_LL_AWAKE)) { | ||
send_ll_cmd(ll, LL_WAKE_UP_IND); /* WAKE_IND */ | ||
ll->ll_state = ST_LL_ASLEEP_TO_AWAKE; | ||
} else { | ||
/* don't send the duplicate wake_indication */ | ||
pr_err(" Chip already AWAKE "); | ||
} | ||
} | ||
|
||
/* called when ST Core wants the state */ | ||
unsigned long st_ll_getstate(struct st_data_s *ll) | ||
{ | ||
pr_info(" returning state %ld", ll->ll_state); | ||
return ll->ll_state; | ||
} | ||
|
||
/* called from ST Core, when a PM related packet arrives */ | ||
unsigned long st_ll_sleep_state(struct st_data_s *st_data, | ||
unsigned char cmd) | ||
{ | ||
switch (cmd) { | ||
case LL_SLEEP_IND: /* sleep ind */ | ||
pr_info("sleep indication recvd"); | ||
ll_device_want_to_sleep(st_data); | ||
break; | ||
case LL_SLEEP_ACK: /* sleep ack */ | ||
pr_err("sleep ack rcvd: host shouldn't"); | ||
break; | ||
case LL_WAKE_UP_IND: /* wake ind */ | ||
pr_info("wake indication recvd"); | ||
ll_device_want_to_wakeup(st_data); | ||
break; | ||
case LL_WAKE_UP_ACK: /* wake ack */ | ||
pr_info("wake ack rcvd"); | ||
st_data->ll_state = ST_LL_AWAKE; | ||
break; | ||
default: | ||
pr_err(" unknown input/state "); | ||
return ST_ERR_FAILURE; | ||
} | ||
return ST_SUCCESS; | ||
} | ||
|
||
/* Called from ST CORE to initialize ST LL */ | ||
long st_ll_init(struct st_data_s *ll) | ||
{ | ||
/* set state to invalid */ | ||
ll->ll_state = ST_LL_INVALID; | ||
return 0; | ||
} | ||
|
||
/* Called from ST CORE to de-initialize ST LL */ | ||
long st_ll_deinit(struct st_data_s *ll) | ||
{ | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Shared Transport Low Level (ST LL) | ||
* | ||
* Copyright (C) 2009 Texas Instruments | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* 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 | ||
* | ||
*/ | ||
|
||
#ifndef ST_LL_H | ||
#define ST_LL_H | ||
|
||
#include <linux/skbuff.h> | ||
#include "st.h" | ||
#include "st_core.h" | ||
|
||
/* ST LL receiver states */ | ||
#define ST_W4_PACKET_TYPE 0 | ||
#define ST_BT_W4_EVENT_HDR 1 | ||
#define ST_BT_W4_ACL_HDR 2 | ||
#define ST_BT_W4_SCO_HDR 3 | ||
#define ST_BT_W4_DATA 4 | ||
#define ST_FM_W4_EVENT_HDR 5 | ||
#define ST_GPS_W4_EVENT_HDR 6 | ||
|
||
/* ST LL state machines */ | ||
#define ST_LL_ASLEEP 0 | ||
#define ST_LL_ASLEEP_TO_AWAKE 1 | ||
#define ST_LL_AWAKE 2 | ||
#define ST_LL_AWAKE_TO_ASLEEP 3 | ||
#define ST_LL_INVALID 4 | ||
|
||
#define LL_SLEEP_IND 0x30 | ||
#define LL_SLEEP_ACK 0x31 | ||
#define LL_WAKE_UP_IND 0x32 | ||
#define LL_WAKE_UP_ACK 0x33 | ||
|
||
/* initialize and de-init ST LL */ | ||
long st_ll_init(struct st_data_s *); | ||
long st_ll_deinit(struct st_data_s *); | ||
|
||
/* enable/disable ST LL along with KIM start/stop | ||
* called by ST Core | ||
*/ | ||
void st_ll_enable(struct st_data_s *); | ||
void st_ll_disable(struct st_data_s *); | ||
|
||
unsigned long st_ll_getstate(struct st_data_s *); | ||
unsigned long st_ll_sleep_state(struct st_data_s *, unsigned char); | ||
void st_ll_wakeup(struct st_data_s *); | ||
#endif /* ST_LL_H */ |