From: <pavan_savoy@ti.com>
To: <gregkh@suse.de>, <linux-kernel@vger.kernel.org>
Cc: <pavan_savoy@sify.com>, Pavan Savoy <pavan_savoy@ti.com>
Subject: [PATCH 2/8] drivers:misc:ti-st: platform hooks for chip states
Date: Tue, 9 Aug 2011 14:38:54 -0500 [thread overview]
Message-ID: <1312918749-29627-3-git-send-email-pavan_savoy@ti.com> (raw)
In-Reply-To: <1312918749-29627-2-git-send-email-pavan_savoy@ti.com>
From: Pavan Savoy <pavan_savoy@ti.com>
Certain platform specific or Host-WiLink Interface specific actions would be
required to be taken when the chip is being enabled and after the chip is
disabled such as configuration of the mux modes for the GPIO of host connected
to the nshutdown of the chip or relinquishing UART after the chip is disabled.
Similar actions can also be taken when the chip is in deep sleep or when the
chip is awake. Performance enhancements such as configuring the host to run
faster when chip is awake and slower when chip is asleep can also be made
here.
Change-Id: I5baad900633e69740396bf1d6900feec4f2b596e
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
---
drivers/misc/ti-st/st_kim.c | 12 ++++++++++++
drivers/misc/ti-st/st_ll.c | 19 +++++++++++++++++++
2 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index 38fd2f0..6884dd1 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -434,11 +434,17 @@ long st_kim_start(void *kim_data)
{
long err = 0;
long retry = POR_RETRY_COUNT;
+ struct ti_st_plat_data *pdata;
struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data;
pr_info(" %s", __func__);
+ pdata = kim_gdata->kim_pdev->dev.platform_data;
do {
+ /* platform specific enabling code here */
+ if (pdata->chip_enable)
+ pdata->chip_enable(kim_gdata);
+
/* Configure BT nShutdown to HIGH state */
gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
mdelay(5); /* FIXME: a proper toggle */
@@ -489,6 +495,8 @@ long st_kim_stop(void *kim_data)
{
long err = 0;
struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data;
+ struct ti_st_plat_data *pdata =
+ kim_gdata->kim_pdev->dev.platform_data;
INIT_COMPLETION(kim_gdata->ldisc_installed);
@@ -515,6 +523,10 @@ long st_kim_stop(void *kim_data)
gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH);
mdelay(1);
gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
+
+ /* platform specific disable */
+ if (pdata->chip_disable)
+ pdata->chip_disable(kim_gdata);
return err;
}
diff --git a/drivers/misc/ti-st/st_ll.c b/drivers/misc/ti-st/st_ll.c
index 3f24951..1ff460a 100644
--- a/drivers/misc/ti-st/st_ll.c
+++ b/drivers/misc/ti-st/st_ll.c
@@ -22,6 +22,7 @@
#define pr_fmt(fmt) "(stll) :" fmt
#include <linux/skbuff.h>
#include <linux/module.h>
+#include <linux/platform_device.h>
#include <linux/ti_wilink_st.h>
/**********************************************************************/
@@ -37,6 +38,9 @@ static void send_ll_cmd(struct st_data_s *st_data,
static void ll_device_want_to_sleep(struct st_data_s *st_data)
{
+ struct kim_data_s *kim_data;
+ struct ti_st_plat_data *pdata;
+
pr_debug("%s", __func__);
/* sanity check */
if (st_data->ll_state != ST_LL_AWAKE)
@@ -46,10 +50,19 @@ static void ll_device_want_to_sleep(struct st_data_s *st_data)
send_ll_cmd(st_data, LL_SLEEP_ACK);
/* update state */
st_data->ll_state = ST_LL_ASLEEP;
+
+ /* communicate to platform about chip asleep */
+ kim_data = st_data->kim_data;
+ pdata = kim_data->kim_pdev->dev.platform_data;
+ if (pdata->chip_asleep)
+ pdata->chip_asleep(NULL);
}
static void ll_device_want_to_wakeup(struct st_data_s *st_data)
{
+ struct kim_data_s *kim_data;
+ struct ti_st_plat_data *pdata;
+
/* diff actions in diff states */
switch (st_data->ll_state) {
case ST_LL_ASLEEP:
@@ -70,6 +83,12 @@ static void ll_device_want_to_wakeup(struct st_data_s *st_data)
}
/* update state */
st_data->ll_state = ST_LL_AWAKE;
+
+ /* communicate to platform about chip wakeup */
+ kim_data = st_data->kim_data;
+ pdata = kim_data->kim_pdev->dev.platform_data;
+ if (pdata->chip_asleep)
+ pdata->chip_awake(NULL);
}
/**********************************************************************/
--
1.7.4.1
next prev parent reply other threads:[~2011-08-09 19:42 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-09 19:38 [PATCH 0/8] drivers:misc: ti-st: fixes pavan_savoy
2011-08-09 19:38 ` [PATCH 1/8] drivers:misc: ti-st: avoid a misleading dbg msg pavan_savoy
2011-08-09 19:38 ` pavan_savoy [this message]
2011-08-09 19:38 ` [PATCH 3/8] drivers:misc: ti-st: reinit completion on ver read pavan_savoy
2011-08-09 19:38 ` [PATCH 4/8] drivers:misc: ti-st: fail-safe on wrong pkt type pavan_savoy
2011-08-09 19:38 ` [PATCH 5/8] drivers:misc: ti-st: reinit completion before send pavan_savoy
2011-08-09 19:38 ` [PATCH 6/8] drivers:misc: ti-st: wait for completion at fail pavan_savoy
2011-08-09 19:38 ` [PATCH 7/8] drivers:misc: ti-st: free skb on firmware download pavan_savoy
2011-08-09 19:39 ` [PATCH 8/8] drivers:misc: ti-st: fix unexpected UART close pavan_savoy
2011-08-09 19:39 ` [PATCH 0/8] drivers:misc: ti-st: fixes pavan_savoy
2011-08-09 19:39 ` [PATCH 1/8] drivers:misc: ti-st: avoid a misleading dbg msg pavan_savoy
2011-08-09 19:39 ` [PATCH 2/8] drivers:misc:ti-st: platform hooks for chip states pavan_savoy
2011-08-09 19:39 ` [PATCH 3/8] drivers:misc: ti-st: reinit completion on ver read pavan_savoy
2011-08-09 19:39 ` [PATCH 4/8] drivers:misc: ti-st: fail-safe on wrong pkt type pavan_savoy
2011-08-09 19:39 ` [PATCH 5/8] drivers:misc: ti-st: reinit completion before send pavan_savoy
2011-08-09 19:39 ` [PATCH 6/8] drivers:misc: ti-st: wait for completion at fail pavan_savoy
2011-08-09 19:39 ` [PATCH 7/8] drivers:misc: ti-st: free skb on firmware download pavan_savoy
2011-08-09 19:39 ` [PATCH 8/8] drivers:misc: ti-st: fix unexpected UART close pavan_savoy
2011-08-09 20:30 ` [PATCH 1/8] drivers:misc: ti-st: avoid a misleading dbg msg Greg KH
2011-08-09 20:31 ` [PATCH 0/8] drivers:misc: ti-st: fixes Greg KH
2011-08-10 2:54 ` Pavan Savoy
2011-08-10 15:18 pavan_savoy
2011-08-10 15:18 ` [PATCH 1/8] drivers:misc: ti-st: avoid a misleading dbg msg pavan_savoy
2011-08-10 15:18 ` [PATCH 2/8] drivers:misc:ti-st: platform hooks for chip states pavan_savoy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1312918749-29627-3-git-send-email-pavan_savoy@ti.com \
--to=pavan_savoy@ti.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=pavan_savoy@sify.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®