From: csanjay@mistralsolutions.com
To: linux-omap@vger.kernel.org
Cc: linux-wireless@vger.kernel.org,
Sanjay Kumar Champati <csanjay@mistralsolutions.com>
Subject: [WL1271 DC supprot on OMAP3EVM 3/5] ARM: Supported for BT enable on OMAP3EVM for WL1271 DC
Date: Wed, 13 Oct 2010 16:21:15 +0530 [thread overview]
Message-ID: <1286967077-20071-4-git-send-email-csanjay@mistralsolutions.com> (raw)
In-Reply-To: <1286967077-20071-1-git-send-email-csanjay@mistralsolutions.com>
From: Sanjay Kumar Champati <csanjay@mistralsolutions.com>
* Midified "tty_io.c" and "Kconfig" files to suuport BT enable for WL1271
Signed-off-by: Sanjay Kumar Champati <csanjay@mistralsolutions.com>
---
drivers/bluetooth/Kconfig | 7 +++
drivers/char/tty_io.c | 110 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 117 insertions(+), 0 deletions(-)
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
index 652367a..2ed159c 100644
--- a/drivers/bluetooth/Kconfig
+++ b/drivers/bluetooth/Kconfig
@@ -195,5 +195,12 @@ config BT_MRVL_SDIO
Say Y here to compile support for Marvell BT-over-SDIO driver
into the kernel or say M to compile it as module.
+config BT_WL1271
+ bool "WL1271 Bluetooth driver support"
+ depends on BT_HCIUART
+ help
+ The core driver to support WL1271 Bluetooth devices.
+ Say Y here to compile WL1271 Bluetooth driver into the kernel.
+
endmenu
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index f15df40..a3ae352 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -107,6 +107,17 @@
#include <linux/kmod.h>
#include <linux/nsproxy.h>
+#ifdef CONFIG_BT_WL1271
+/*
+ * WL1271: To control T2 gpios on OMAP3 EVM
+ */
+#include "linux/i2c/twl.h"
+
+/*
+ * WL1271: To set BT_EN of TI's WL1271 Bluetooth chip
+ */
+#define TIOSETWL1271POWER 0x6000
+#endif
#undef TTY_DEBUG_HANGUP
#define TTY_PARANOIA_CHECK 1
@@ -154,6 +165,95 @@ static void release_tty(struct tty_struct *tty, int idx);
static void __proc_set_tty(struct task_struct *tsk, struct tty_struct *tty);
static void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty);
+#ifdef CONFIG_BT_WL1271
+/*
+ * WL1271: Power enable sequence
+ */
+static int bt_init_power(void)
+{
+ int ret = 0;
+ u8 reg_value = 0;
+
+ /* Wl1271 Daughter card BT_EN is connected to T2-GPIO.13 */
+ /* Enable GPIO */
+ ret = twl_i2c_read_u8(TWL4030_MODULE_GPIO,
+ ®_value, REG_GPIO_CTRL);
+ if (ret != 0)
+ goto err;
+ /* T2-GPIO.13 -> output */
+ ret = twl_i2c_read_u8(TWL4030_MODULE_GPIO,
+ ®_value, REG_GPIODATADIR2);
+ if (ret != 0)
+ goto err;
+ reg_value |= 0x20;
+ ret = twl_i2c_write_u8(TWL4030_MODULE_GPIO,
+ reg_value, REG_GPIODATADIR2);
+ if (ret != 0)
+ goto err;
+ /* T2-GPIO.13 -> LOW */
+ ret = twl_i2c_read_u8(TWL4030_MODULE_GPIO,
+ ®_value, REG_GPIODATAOUT2);
+ if (ret != 0)
+ goto err;
+ reg_value &= ~(0x20);
+ ret = twl_i2c_write_u8(TWL4030_MODULE_GPIO,
+ reg_value, REG_GPIODATAOUT2);
+ if (ret != 0)
+ goto err;
+
+ mdelay(50);
+ /* T2-GPIO.13 -> HIGH */
+ reg_value |= (0x20);
+ ret = twl_i2c_write_u8(TWL4030_MODULE_GPIO,
+ reg_value, REG_GPIODATAOUT2);
+ if (ret != 0)
+ goto err;
+
+ mdelay(50);
+ /* T2-GPIO.13 -> LOW */
+ reg_value &= ~(0x20);
+ ret = twl_i2c_write_u8(TWL4030_MODULE_GPIO,
+ reg_value, REG_GPIODATAOUT2);
+ if (ret != 0)
+ goto err;
+ printk(KERN_INFO "WL1271: BT_EN GPIO initialized\n");
+err:
+ return ret;
+} /* End of init_bt_power() */
+
+/*
+ * WL1271: Set Bluetooth Enable
+ */
+static int tty_setbt_power(int __user *p)
+{
+ int power;
+ int err = 0;
+ u8 reg_value = 0;
+
+ if (get_user(power, p))
+ return -EFAULT;
+
+ printk(KERN_INFO "Set BT_EN of WL1271\n");
+ /* Power settings argument should either be 1 or 0 */
+ power = power ? 1 : 0;
+
+ if (power)
+ reg_value |= (0x20);
+ else
+ reg_value &= ~(0x20);
+
+ err = twl_i2c_write_u8(TWL4030_MODULE_GPIO,
+ reg_value, REG_GPIODATAOUT2);
+ if (err != 0) {
+ printk(KERN_DEBUG "WL1271: Set BT_EN failed %d %d\n",
+ err, power);
+ return err;
+ }
+ printk(KERN_INFO "WL1271: Powering %s\n", power ? "on" : "off");
+ return 0;
+} /* End of set_bt_power() */
+#endif
+
/**
* alloc_tty_struct - allocate a tty object
*
@@ -2571,6 +2671,11 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case TIOCMBIC:
case TIOCMBIS:
return tty_tiocmset(tty, file, cmd, p);
+#ifdef CONFIG_BT_WL1271
+ /* Control BT_EN pin of Bluetooth-WL1271 */
+ case TIOSETWL1271POWER:
+ return tty_setbt_power(p);
+#endif
case TCFLSH:
switch (arg) {
case TCIFLUSH:
@@ -3142,6 +3247,11 @@ static int __init tty_init(void)
#ifdef CONFIG_VT
vty_init(&console_fops);
#endif
+
+#ifdef CONFIG_BT_WL1271
+ /* Initialize Bluetooth- WL1271chip connected to UART */
+ bt_init_power();
+#endif
return 0;
}
module_init(tty_init);
--
1.6.3.3
next prev parent reply other threads:[~2010-10-13 11:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-13 10:51 [WL1271 DC supprot on OMAP3EVM 0/5] csanjay
2010-10-13 10:51 ` [WL1271 DC supprot on OMAP3EVM 1/5] ARM: Supported MMC 2 features for OMAP3EVM csanjay
2010-10-13 12:23 ` Premi, Sanjeev
2010-10-13 10:51 ` [WL1271 DC supprot on OMAP3EVM 2/5] ARM: Supported for Standard SDIO driver on OMAP3EVM for WL1271 DC csanjay
2010-10-13 11:17 ` Premi, Sanjeev
[not found] ` <2615178032399077084343141213216@psmtp.com>
2010-10-13 13:01 ` [WL1271 DC support " Premi, Sanjeev
2010-10-13 10:51 ` csanjay [this message]
2010-10-13 12:01 ` [WL1271 DC supprot on OMAP3EVM 3/5] ARM: Supported for BT enable " Govindraj
2010-10-13 12:03 ` Premi, Sanjeev
2010-10-13 10:51 ` [WL1271 DC supprot on OMAP3EVM 4/5] ARM: Added ALSA audio support for WL1271 DC over the PCM interface (OMAP37XX) csanjay
2010-10-13 11:59 ` Premi, Sanjeev
2010-10-13 10:51 ` [WL1271 DC supprot on OMAP3EVM 5/5] Supported BT and WLAN configuration for WL1271 over the OMAP37XX csanjay
2010-10-13 12:06 ` Premi, Sanjeev
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=1286967077-20071-4-git-send-email-csanjay@mistralsolutions.com \
--to=csanjay@mistralsolutions.com \
--cc=linux-omap@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).