2010-10-13 11:02:55

by csanjay

[permalink] [raw]
Subject: [WL1271 DC supprot on OMAP3EVM 0/5]

From: Sanjay Kumar Champati <[email protected]>


Sanjay Kumar Champati (5):
ARM: Supported MMC 2 features for OMAP3EVM
ARM: Supported for Standard SDIO driver on OMAP3EVM for WL1271 DC
ARM: Supported for BT enable on OMAP3EVM for WL1271 DC
ARM: Added ALSA audio support for WL1271 DC over the PCM interface
(OMAP37XX)
Supported BT and WLAN configuration for WL1271 over the OMAP37XX

arch/arm/configs/omap3_evm_defconfig | 27 +++++++-
arch/arm/mach-omap2/board-omap3evm.c | 28 ++++++++-
arch/arm/mach-omap2/mmc-twl4030.c | 1 +
arch/arm/mach-omap2/mmc-twl4030.h | 2 +
drivers/bluetooth/Kconfig | 7 ++
drivers/char/tty_io.c | 110 ++++++++++++++++++++++++++++++++++
drivers/mmc/core/sdio_ops.c | 7 ++-
drivers/net/wireless/Kconfig | 11 ++++
sound/soc/omap/Kconfig | 6 ++
sound/soc/omap/Makefile | 2 +
sound/soc/omap/omap3evm.c | 81 ++++++++++++++++++++++++-
sound/soc/omap/wl1271bt.c | 59 ++++++++++++++++++
sound/soc/omap/wl1271bt.h | 16 +++++
13 files changed, 350 insertions(+), 7 deletions(-)
create mode 100644 sound/soc/omap/wl1271bt.c
create mode 100644 sound/soc/omap/wl1271bt.h



2010-10-13 11:03:06

by csanjay

[permalink] [raw]
Subject: [WL1271 DC supprot on OMAP3EVM 2/5] ARM: Supported for Standard SDIO driver on OMAP3EVM for WL1271 DC

From: Sanjay Kumar Champati <[email protected]>

* Apply MMC2 support patch before apply this patch
* Modified the "Kconfig" and "board-omap3evm.c" files to support
standard SDIO driver for WL1271 DC

Signed-off-by: Sanjay Kumar Champati <[email protected]>
---
arch/arm/mach-omap2/board-omap3evm.c | 13 ++++++++++++-
drivers/mmc/core/sdio_ops.c | 7 ++++++-
drivers/net/wireless/Kconfig | 11 +++++++++++
3 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 6b45b6e..06fab2e 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -79,6 +79,10 @@
#define OMAP3EVM_ETHR_ID_REV 0x50
#define OMAP3EVM_ETHR_GPIO_IRQ 176
#define OMAP3EVM_SMSC911X_CS 5
+#ifdef CONFIG_WL1271_WLAN
+#define OMAP3EVM_WLAN_EN 150
+#define OMAP3EVM_WLAN_IRQ 149
+#endif

extern struct regulator_consumer_supply twl4030_vmmc1_supply;
extern struct regulator_consumer_supply twl4030_vsim_supply;
@@ -749,7 +753,14 @@ static int omap3evm_twl_gpio_setup(struct device *dev,
twl4030_vmmc1_supply.dev = mmc[0].dev;
twl4030_vsim_supply.dev = mmc[0].dev;
twl4030_vmmc2_supply.dev = mmc[1].dev;
-
+#ifdef CONFIG_WL1271_WLAN
+ omap_mux_init_gpio(OMAP3EVM_WLAN_EN, OMAP_PIN_OUTPUT);
+ if (gpio_request(OMAP3EVM_WLAN_EN, "WLAN_ENABLE"))
+ printk(KERN_ERR "Fail to get WLAN Enable GPIO\n");
+ gpio_direction_output(OMAP3EVM_WLAN_EN, 1);
+ mdelay(100);
+ omap_mux_init_gpio(OMAP3EVM_WLAN_IRQ, OMAP_PIN_INPUT);
+#endif
/*
* Most GPIOs are for USB OTG. Some are mostly sent to
* the P2 connector; notably LEDA for the LCD backlight.
diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c
index 4eb7825..4213ee0 100644
--- a/drivers/mmc/core/sdio_ops.c
+++ b/drivers/mmc/core/sdio_ops.c
@@ -114,6 +114,9 @@ int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,

return 0;
}
+#ifdef CONFIG_WL1271_WLAN
+EXPORT_SYMBOL(mmc_io_rw_direct);
+#endif

int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
unsigned addr, int incr_addr, u8 *buf, unsigned blocks, unsigned blksz)
@@ -181,4 +184,6 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,

return 0;
}
-
+#ifdef CONFIG_WL1271_WLAN
+EXPORT_SYMBOL(mmc_io_rw_extended);
+#endif
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 56dd665..dc319b7 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -31,6 +31,17 @@ config PCMCIA_RAYCS
To compile this driver as a module, choose M here: the module will be
called ray_cs. If unsure, say N.

+config WL1271_WLAN
+ tristate "WL1271 TI's SDIO based wireless card"
+ select WIRELESS_EXT
+ select CRYPTO
+ select WEXT_SPY
+ select WEXT_PRIV
+ ---help---
+ This driver support both the standard Linux Wireless Extensions
+ and TI's proprietary API, so both the Linux Wireless Tools and this
+ module support 2.4 GHz 802.11 b/g/n standrd.
+
config LIBERTAS_THINFIRM
tristate "Marvell 8xxx Libertas WLAN driver support with thin firmware"
depends on MAC80211
--
1.6.3.3


2010-10-13 11:59:36

by Premi, Sanjeev

[permalink] [raw]
Subject: RE: [WL1271 DC supprot on OMAP3EVM 4/5] ARM: Added ALSA audio support for WL1271 DC over the PCM interface (OMAP37XX)

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> [email protected]
> Sent: Wednesday, October 13, 2010 4:21 PM
> To: [email protected]
> Cc: [email protected]; Sanjay Kumar Champati
> Subject: [WL1271 DC supprot on OMAP3EVM 4/5] ARM: Added ALSA
> audio support for WL1271 DC over the PCM interface (OMAP37XX)
[sp] There is no OMAP37xx. It is AM37xx.

>
> From: Sanjay Kumar Champati <[email protected]>
>
> * Add "wl1271bt.c" & "wl1271bt.h" in the PS kernel to support
> PCM interface for OMAP37XX
> * Modified "Makefile" file to compile "wl1271bt.c" &
> "wl1271bt.h" files
> * Modified "omap3evm.c" file to support Audio codec for WL1271 DC
>
> Signed-off-by: Sanjay Kumar Champati <[email protected]>
> ---
> sound/soc/omap/Kconfig | 6 +++
> sound/soc/omap/Makefile | 2 +
> sound/soc/omap/omap3evm.c | 81
> +++++++++++++++++++++++++++++++++++++++++++-
> sound/soc/omap/wl1271bt.c | 59 ++++++++++++++++++++++++++++++++
> sound/soc/omap/wl1271bt.h | 16 +++++++++
> 5 files changed, 162 insertions(+), 2 deletions(-)
> create mode 100644 sound/soc/omap/wl1271bt.c
> create mode 100644 sound/soc/omap/wl1271bt.h
>
> diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
> index 61952aa..68054c2 100644
> --- a/sound/soc/omap/Kconfig
> +++ b/sound/soc/omap/Kconfig
> @@ -116,3 +116,9 @@ config SND_OMAP_SOC_IGEP0020
> select SND_SOC_TWL4030
> help
> Say Y if you want to add support for Soc audio on
> IGEP v2 board.
> +
> +config SND_OMAP_SOC_WL1271BT
> + tristate "WL1271 Bluetooth Codec support"
> + default n
> + help
> + Say Y if you want to add support for WL1271 on OMAP3EVM board.
> diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
> index 19283e5..684b8f2 100644
> --- a/sound/soc/omap/Makefile
> +++ b/sound/soc/omap/Makefile
> @@ -18,6 +18,7 @@ snd-soc-omap3pandora-objs := omap3pandora.o
> snd-soc-omap3beagle-objs := omap3beagle.o
> snd-soc-zoom2-objs := zoom2.o
> snd-soc-igep0020-objs := igep0020.o
> +snd-soc-wl1271bt-objs := wl1271bt.o
>
> obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
> obj-$(CONFIG_SND_OMAP_SOC_AMS_DELTA) += snd-soc-ams-delta.o
> @@ -31,3 +32,4 @@ obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) +=
> snd-soc-omap3pandora.o
> obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o
> obj-$(CONFIG_SND_OMAP_SOC_ZOOM2) += snd-soc-zoom2.o
> obj-$(CONFIG_SND_OMAP_SOC_IGEP0020) += snd-soc-igep0020.o
> +obj-$(CONFIG_SND_OMAP_SOC_WL1271BT) += snd-soc-wl1271bt.o
> diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c
> index dfcb344..6731ad3 100644
> --- a/sound/soc/omap/omap3evm.c
> +++ b/sound/soc/omap/omap3evm.c
> @@ -32,6 +32,10 @@
> #include "omap-mcbsp.h"
> #include "omap-pcm.h"
> #include "../codecs/twl4030.h"
> +#if defined(CONFIG_SND_OMAP_SOC_WL1271BT)
> +#include <plat/control.h>
> +#include "wl1271bt.h"
> +#endif
>
> static int omap3evm_hw_params(struct snd_pcm_substream *substream,
> struct snd_pcm_hw_params *params)
> @@ -72,11 +76,58 @@ static int omap3evm_hw_params(struct
> snd_pcm_substream *substream,
> return 0;
> }
>
> +#if defined(CONFIG_SND_OMAP_SOC_WL1271BT)
> +static int omap3evm_wl1271bt_pcm_hw_params(struct
> snd_pcm_substream *substream,
> + struct
> snd_pcm_hw_params *params)
> +{
> + struct snd_soc_pcm_runtime *rtd = substream->private_data;
> + struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
> + int ret;
> +
> + /* Set cpu DAI configuration for WL1271 Bluetooth codec */
> + ret = snd_soc_dai_set_fmt(cpu_dai,
> + SND_SOC_DAIFMT_DSP_B |
> + SND_SOC_DAIFMT_NB_NF |
> + SND_SOC_DAIFMT_CBM_CFM);
> + if (ret < 0) {
> + printk(KERN_ERR "Can't set cpu DAI configuration for " \
> + "WL1271
> Bluetooth codec \n");
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +static struct snd_soc_ops omap3evm_wl1271bt_pcm_ops = {
> + .hw_params = omap3evm_wl1271bt_pcm_hw_params,
> +};
> +#endif
> +
> static struct snd_soc_ops omap3evm_ops = {
> +
> .hw_params = omap3evm_hw_params,
> };
>
> /* Digital audio interface glue - connects codec <--> CPU */
> +#if defined(CONFIG_SND_OMAP_SOC_WL1271BT)
> +static struct snd_soc_dai_link omap3evm_dai[] = {
> + {
> + .name = "TWL4030",
> + .stream_name = "TWL4030",
> + .cpu_dai = &omap_mcbsp_dai[0],
> + .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI],
> + .ops = &omap3evm_ops,
> + },
> + /* Connects WL1271 Bluetooth codec <--> CPU */
> + {
> + .name = "WL1271BTPCM",
> + .stream_name = "WL1271 BT PCM",
> + .cpu_dai = &omap_mcbsp_dai[1],
> + .codec_dai = &wl1271bt_dai,
> + .ops = &omap3evm_wl1271bt_pcm_ops,
> + },
> +};
> +#else
> static struct snd_soc_dai_link omap3evm_dai = {
> .name = "TWL4030",
> .stream_name = "TWL4030",
> @@ -84,13 +135,18 @@ static struct snd_soc_dai_link omap3evm_dai = {
> .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI],
> .ops = &omap3evm_ops,
> };
> -
> +#endif
> /* Audio machine driver */
> static struct snd_soc_card snd_soc_omap3evm = {
> .name = "omap3evm",
> .platform = &omap_soc_platform,
> +#if defined(CONFIG_SND_OMAP_SOC_WL1271BT)
> + .dai_link = &omap3evm_dai[0],
> + .num_links = ARRAY_SIZE(omap3evm_dai),
> +#else
> .dai_link = &omap3evm_dai,
> .num_links = 1,
> +#endif
> };
>
> /* twl4030 setup */
> @@ -111,7 +167,10 @@ static struct platform_device
> *omap3evm_snd_device;
> static int __init omap3evm_soc_init(void)
> {
> int ret;
> -
> +#if defined(CONFIG_SND_OMAP_SOC_WL1271BT)
> + u16 reg;
> + u32 val;
> +#endif
> if (!machine_is_omap3evm()) {
> pr_err("Not OMAP3 EVM!\n");
> return -ENODEV;
> @@ -124,9 +183,27 @@ static int __init omap3evm_soc_init(void)
> return -ENOMEM;
> }
>
> +#if defined(CONFIG_SND_OMAP_SOC_WL1271BT)
> +/*
> + * Set DEVCONF0 register to connect
> + * MCBSP1_CLKR -> MCBSP1_CLKX & MCBSP1_FSR -> MCBSP1_FSX
> + */
> + reg = OMAP2_CONTROL_DEVCONF0;
> + val = omap_ctrl_readl(reg);
> + val = val | 0x18;
> + omap_ctrl_writel(val, reg);
> +#endif

[sp] I am not conversant with McBSP configuration, but isn't there
a better way than directly manipulating on DEVCONF0?

How is it done for other devices using McBSP? e.g. default
audio on omap3evm.

> +
> platform_set_drvdata(omap3evm_snd_device,
> &omap3evm_snd_devdata);
> omap3evm_snd_devdata.dev = &omap3evm_snd_device->dev;
> +#if defined(CONFIG_SND_OMAP_SOC_WL1271BT)
> + /* McBSP2 */
> + *(unsigned int *)omap3evm_dai[0].cpu_dai->private_data = 1;
> + /* McBSP1 */
> + *(unsigned int *)omap3evm_dai[1].cpu_dai->private_data = 0;
> +#else
> *(unsigned int *)omap3evm_dai.cpu_dai->private_data = 1;
> +#endif
>
> ret = platform_device_add(omap3evm_snd_device);
> if (ret)
> diff --git a/sound/soc/omap/wl1271bt.c b/sound/soc/omap/wl1271bt.c
> new file mode 100644
> index 0000000..b41895b
> --- /dev/null
> +++ b/sound/soc/omap/wl1271bt.c
> @@ -0,0 +1,59 @@
> +/*
> + * wl1271bt.c -- ALSA SoC WL1271 Bluetooth codec driver
> for omap3evm board
> + *
> + * Author: Sinoj M. Issac, <sinoj at mistralsolutions.com>
> + *
> + * Based on sound/soc/codecs/twl4030.c by Steve Sakoman
> + *
> + * This file provides stub codec that can be used on OMAP3530 evm to
> + * send/receive voice samples to/from WL1271 Bluetooth chip
> over PCM interface.
> + * The Bluetoothchip codec interface is configured by HCI
> commands. ALSA is
> + * configured and aligned to the codec interface.
> + *
> + * 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.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/moduleparam.h>
> +#include <sound/soc.h>
> +#include <sound/pcm.h>
> +
> +/*
> + * Since WL1271 PCM interface is intended for Voice,
> + * Support sampling rate 8K only
> + */
> +#define WL1271BT_RATES SNDRV_PCM_RATE_8000
> +#define WL1271BT_FORMATS SNDRV_PCM_FMTBIT_S16_LE
> +
> +struct snd_soc_dai wl1271bt_dai = {
> + .name = "wl1271bt",
> + .playback = {
> + .stream_name = "Playback",
> + .channels_min = 1,
> + .channels_max = 2,
> + .rates = WL1271BT_RATES,
> + .formats = WL1271BT_FORMATS,},
> + .capture = {
> + .stream_name = "Capture",
> + .channels_min = 1,
> + .channels_max = 2,
> + .rates = WL1271BT_RATES,
> + .formats = WL1271BT_FORMATS,},
> +};
> +
> +static int __init wl1271bt_modinit(void)
> +{
> + /* Register number of DAIs (wl1271bt_dai) with the ASoC core */
> + return snd_soc_register_dais(&wl1271bt_dai, 1);
> +}
> +
> +static void __exit wl1271bt_modexit(void)
> +{
> + /* Unregister number of DAIs (wl1271bt_dai) from the
> ASoC core */
> + snd_soc_unregister_dais(&wl1271bt_dai, 1);
> +}
> +
> +module_init(wl1271bt_modinit);
> +module_exit(wl1271bt_modexit);
> diff --git a/sound/soc/omap/wl1271bt.h b/sound/soc/omap/wl1271bt.h
> new file mode 100644
> index 0000000..769f9a9
> --- /dev/null
> +++ b/sound/soc/omap/wl1271bt.h
> @@ -0,0 +1,16 @@
> +/*
> + * wl1271bt.h -- ALSA SoC WL1271 Bluetooth codec driver header
> + *
> + * Author: Sinoj M. Issac, <sinoj at mistralsolutions.com>
> + *
> + * 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.
> + */
> +
> +#ifndef WL1271BT_H
> +#define WL1271BT_H
> +
> +extern struct snd_soc_dai wl1271bt_dai;
> +
> +#endif /* WL1271BT_H */
> --
> 1.6.3.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe
> linux-omap" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2010-10-13 11:03:24

by csanjay

[permalink] [raw]
Subject: [WL1271 DC supprot on OMAP3EVM 5/5] Supported BT and WLAN configuration for WL1271 over the OMAP37XX

From: Sanjay Kumar Champati <[email protected]>

* Modified the "omap3_evm_defconfig" file to support WLAN and BT configuration for WL1271

Signed-off-by: Sanjay Kumar Champati <[email protected]>
---
arch/arm/configs/omap3_evm_defconfig | 27 ++++++++++++++++++++++++---
1 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/arch/arm/configs/omap3_evm_defconfig b/arch/arm/configs/omap3_evm_defconfig
index a18b22e..676cd99 100644
--- a/arch/arm/configs/omap3_evm_defconfig
+++ b/arch/arm/configs/omap3_evm_defconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.32
-# Tue Jan 5 13:03:54 2010
+# Sun Oct 10 05:00:18 2010
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -492,10 +492,29 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_HAMRADIO is not set
# CONFIG_CAN is not set
# CONFIG_IRDA is not set
-# CONFIG_BT is not set
+CONFIG_BT=y
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
+CONFIG_BT_RFCOMM_TTY=y
+
+#
+# Bluetooth device drivers
+#
+CONFIG_BT_HCIUART=y
+CONFIG_BT_HCIUART_H4=y
+CONFIG_BT_HCIUART_BCSP=y
+CONFIG_BT_HCIUART_LL=y
+CONFIG_BT_WL1271=y
# CONFIG_AF_RXRPC is not set
CONFIG_WIRELESS=y
+CONFIG_WIRELESS_EXT=y
+CONFIG_WEXT_CORE=y
+CONFIG_WEXT_PROC=y
+CONFIG_WEXT_SPY=y
+CONFIG_WEXT_PRIV=y
# CONFIG_CFG80211 is not set
+CONFIG_WIRELESS_EXT_SYSFS=y
# CONFIG_LIB80211 is not set

#
@@ -740,6 +759,7 @@ CONFIG_SMSC911X=y
# CONFIG_NETDEV_1000 is not set
# CONFIG_NETDEV_10000 is not set
CONFIG_WLAN=y
+CONFIG_WL1271_WLAN=y
# CONFIG_USB_ZD1201 is not set
# CONFIG_HOSTAP is not set

@@ -1302,6 +1322,7 @@ CONFIG_SND_SOC=y
CONFIG_SND_OMAP_SOC=y
CONFIG_SND_OMAP_SOC_MCBSP=y
CONFIG_SND_OMAP_SOC_OMAP3EVM=y
+CONFIG_SND_OMAP_SOC_WL1271BT=y
CONFIG_SND_SOC_I2C_AND_SPI=y
# CONFIG_SND_SOC_ALL_CODECS is not set
CONFIG_SND_SOC_TWL4030=y
@@ -2004,7 +2025,7 @@ CONFIG_CRYPTO_HW=y
CONFIG_BITREVERSE=y
CONFIG_GENERIC_FIND_LAST_BIT=y
CONFIG_CRC_CCITT=y
-# CONFIG_CRC16 is not set
+CONFIG_CRC16=y
# CONFIG_CRC_T10DIF is not set
# CONFIG_CRC_ITU_T is not set
CONFIG_CRC32=y
--
1.6.3.3


2010-10-13 12:03:33

by Premi, Sanjeev

[permalink] [raw]
Subject: RE: [WL1271 DC supprot on OMAP3EVM 3/5] ARM: Supported for BT enable on OMAP3EVM for WL1271 DC

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> [email protected]
> Sent: Wednesday, October 13, 2010 4:21 PM
> To: [email protected]
> Cc: [email protected]; Sanjay Kumar Champati
> Subject: [WL1271 DC supprot on OMAP3EVM 3/5] ARM: Supported
> for BT enable on OMAP3EVM for WL1271 DC
>
> From: Sanjay Kumar Champati <[email protected]>
>
> * Midified "tty_io.c" and "Kconfig" files to suuport BT
> enable for WL1271
>
> Signed-off-by: Sanjay Kumar Champati <[email protected]>
> ---
> 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

[sp] No. This isn't the place for it.
You cannot change the generic driver for custom implementation.

Same comment applies to all the changes in this file.

[snip]...[snip]

2010-10-13 12:01:59

by Govindraj

[permalink] [raw]
Subject: Re: [WL1271 DC supprot on OMAP3EVM 3/5] ARM: Supported for BT enable on OMAP3EVM for WL1271 DC

On Wed, Oct 13, 2010 at 4:21 PM, <[email protected]> wrote:
> From: Sanjay Kumar Champati <[email protected]>
>
> * Midified "tty_io.c" and "Kconfig" files to suuport BT enable for WL1271
>
> Signed-off-by: Sanjay Kumar Champati <[email protected]>
> ---
> ?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,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &reg_value, REG_GPIO_CTRL);
> + ? ? ? if (ret != 0)
> + ? ? ? ? ? ? ? goto err;
> + ? ? ? /* T2-GPIO.13 -> output */
> + ? ? ? ret = twl_i2c_read_u8(TWL4030_MODULE_GPIO,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &reg_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,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &reg_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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to [email protected]
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>

Cannot pollute tty_io.c with omap-evm platform specific things

tty_io.c is a file part of generic tty-layer stack we cannot have
any platform specific things there.

bt_init_power
tty_setbt_power

All are one time configuration don't see why it needs
to be done with ioctl interface.
Can be done in board file itself.

---
Regards,
Govindraj.R

2010-10-13 11:03:13

by csanjay

[permalink] [raw]
Subject: [WL1271 DC supprot on OMAP3EVM 3/5] ARM: Supported for BT enable on OMAP3EVM for WL1271 DC

From: Sanjay Kumar Champati <[email protected]>

* Midified "tty_io.c" and "Kconfig" files to suuport BT enable for WL1271

Signed-off-by: Sanjay Kumar Champati <[email protected]>
---
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,
+ &reg_value, REG_GPIO_CTRL);
+ if (ret != 0)
+ goto err;
+ /* T2-GPIO.13 -> output */
+ ret = twl_i2c_read_u8(TWL4030_MODULE_GPIO,
+ &reg_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,
+ &reg_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


2010-10-13 11:03:19

by csanjay

[permalink] [raw]
Subject: [WL1271 DC supprot on OMAP3EVM 4/5] ARM: Added ALSA audio support for WL1271 DC over the PCM interface (OMAP37XX)

From: Sanjay Kumar Champati <[email protected]>

* Add "wl1271bt.c" & "wl1271bt.h" in the PS kernel to support PCM interface for OMAP37XX
* Modified "Makefile" file to compile "wl1271bt.c" & "wl1271bt.h" files
* Modified "omap3evm.c" file to support Audio codec for WL1271 DC

Signed-off-by: Sanjay Kumar Champati <[email protected]>
---
sound/soc/omap/Kconfig | 6 +++
sound/soc/omap/Makefile | 2 +
sound/soc/omap/omap3evm.c | 81 +++++++++++++++++++++++++++++++++++++++++++-
sound/soc/omap/wl1271bt.c | 59 ++++++++++++++++++++++++++++++++
sound/soc/omap/wl1271bt.h | 16 +++++++++
5 files changed, 162 insertions(+), 2 deletions(-)
create mode 100644 sound/soc/omap/wl1271bt.c
create mode 100644 sound/soc/omap/wl1271bt.h

diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 61952aa..68054c2 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -116,3 +116,9 @@ config SND_OMAP_SOC_IGEP0020
select SND_SOC_TWL4030
help
Say Y if you want to add support for Soc audio on IGEP v2 board.
+
+config SND_OMAP_SOC_WL1271BT
+ tristate "WL1271 Bluetooth Codec support"
+ default n
+ help
+ Say Y if you want to add support for WL1271 on OMAP3EVM board.
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 19283e5..684b8f2 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -18,6 +18,7 @@ snd-soc-omap3pandora-objs := omap3pandora.o
snd-soc-omap3beagle-objs := omap3beagle.o
snd-soc-zoom2-objs := zoom2.o
snd-soc-igep0020-objs := igep0020.o
+snd-soc-wl1271bt-objs := wl1271bt.o

obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
obj-$(CONFIG_SND_OMAP_SOC_AMS_DELTA) += snd-soc-ams-delta.o
@@ -31,3 +32,4 @@ obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o
obj-$(CONFIG_SND_OMAP_SOC_ZOOM2) += snd-soc-zoom2.o
obj-$(CONFIG_SND_OMAP_SOC_IGEP0020) += snd-soc-igep0020.o
+obj-$(CONFIG_SND_OMAP_SOC_WL1271BT) += snd-soc-wl1271bt.o
diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c
index dfcb344..6731ad3 100644
--- a/sound/soc/omap/omap3evm.c
+++ b/sound/soc/omap/omap3evm.c
@@ -32,6 +32,10 @@
#include "omap-mcbsp.h"
#include "omap-pcm.h"
#include "../codecs/twl4030.h"
+#if defined(CONFIG_SND_OMAP_SOC_WL1271BT)
+#include <plat/control.h>
+#include "wl1271bt.h"
+#endif

static int omap3evm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
@@ -72,11 +76,58 @@ static int omap3evm_hw_params(struct snd_pcm_substream *substream,
return 0;
}

+#if defined(CONFIG_SND_OMAP_SOC_WL1271BT)
+static int omap3evm_wl1271bt_pcm_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
+ int ret;
+
+ /* Set cpu DAI configuration for WL1271 Bluetooth codec */
+ ret = snd_soc_dai_set_fmt(cpu_dai,
+ SND_SOC_DAIFMT_DSP_B |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBM_CFM);
+ if (ret < 0) {
+ printk(KERN_ERR "Can't set cpu DAI configuration for " \
+ "WL1271 Bluetooth codec \n");
+ return ret;
+ }
+
+ return 0;
+}
+
+static struct snd_soc_ops omap3evm_wl1271bt_pcm_ops = {
+ .hw_params = omap3evm_wl1271bt_pcm_hw_params,
+};
+#endif
+
static struct snd_soc_ops omap3evm_ops = {
+
.hw_params = omap3evm_hw_params,
};

/* Digital audio interface glue - connects codec <--> CPU */
+#if defined(CONFIG_SND_OMAP_SOC_WL1271BT)
+static struct snd_soc_dai_link omap3evm_dai[] = {
+ {
+ .name = "TWL4030",
+ .stream_name = "TWL4030",
+ .cpu_dai = &omap_mcbsp_dai[0],
+ .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI],
+ .ops = &omap3evm_ops,
+ },
+ /* Connects WL1271 Bluetooth codec <--> CPU */
+ {
+ .name = "WL1271BTPCM",
+ .stream_name = "WL1271 BT PCM",
+ .cpu_dai = &omap_mcbsp_dai[1],
+ .codec_dai = &wl1271bt_dai,
+ .ops = &omap3evm_wl1271bt_pcm_ops,
+ },
+};
+#else
static struct snd_soc_dai_link omap3evm_dai = {
.name = "TWL4030",
.stream_name = "TWL4030",
@@ -84,13 +135,18 @@ static struct snd_soc_dai_link omap3evm_dai = {
.codec_dai = &twl4030_dai[TWL4030_DAI_HIFI],
.ops = &omap3evm_ops,
};
-
+#endif
/* Audio machine driver */
static struct snd_soc_card snd_soc_omap3evm = {
.name = "omap3evm",
.platform = &omap_soc_platform,
+#if defined(CONFIG_SND_OMAP_SOC_WL1271BT)
+ .dai_link = &omap3evm_dai[0],
+ .num_links = ARRAY_SIZE(omap3evm_dai),
+#else
.dai_link = &omap3evm_dai,
.num_links = 1,
+#endif
};

/* twl4030 setup */
@@ -111,7 +167,10 @@ static struct platform_device *omap3evm_snd_device;
static int __init omap3evm_soc_init(void)
{
int ret;
-
+#if defined(CONFIG_SND_OMAP_SOC_WL1271BT)
+ u16 reg;
+ u32 val;
+#endif
if (!machine_is_omap3evm()) {
pr_err("Not OMAP3 EVM!\n");
return -ENODEV;
@@ -124,9 +183,27 @@ static int __init omap3evm_soc_init(void)
return -ENOMEM;
}

+#if defined(CONFIG_SND_OMAP_SOC_WL1271BT)
+/*
+ * Set DEVCONF0 register to connect
+ * MCBSP1_CLKR -> MCBSP1_CLKX & MCBSP1_FSR -> MCBSP1_FSX
+ */
+ reg = OMAP2_CONTROL_DEVCONF0;
+ val = omap_ctrl_readl(reg);
+ val = val | 0x18;
+ omap_ctrl_writel(val, reg);
+#endif
+
platform_set_drvdata(omap3evm_snd_device, &omap3evm_snd_devdata);
omap3evm_snd_devdata.dev = &omap3evm_snd_device->dev;
+#if defined(CONFIG_SND_OMAP_SOC_WL1271BT)
+ /* McBSP2 */
+ *(unsigned int *)omap3evm_dai[0].cpu_dai->private_data = 1;
+ /* McBSP1 */
+ *(unsigned int *)omap3evm_dai[1].cpu_dai->private_data = 0;
+#else
*(unsigned int *)omap3evm_dai.cpu_dai->private_data = 1;
+#endif

ret = platform_device_add(omap3evm_snd_device);
if (ret)
diff --git a/sound/soc/omap/wl1271bt.c b/sound/soc/omap/wl1271bt.c
new file mode 100644
index 0000000..b41895b
--- /dev/null
+++ b/sound/soc/omap/wl1271bt.c
@@ -0,0 +1,59 @@
+/*
+ * wl1271bt.c -- ALSA SoC WL1271 Bluetooth codec driver for omap3evm board
+ *
+ * Author: Sinoj M. Issac, <sinoj at mistralsolutions.com>
+ *
+ * Based on sound/soc/codecs/twl4030.c by Steve Sakoman
+ *
+ * This file provides stub codec that can be used on OMAP3530 evm to
+ * send/receive voice samples to/from WL1271 Bluetooth chip over PCM interface.
+ * The Bluetoothchip codec interface is configured by HCI commands. ALSA is
+ * configured and aligned to the codec interface.
+ *
+ * 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.
+ */
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <sound/soc.h>
+#include <sound/pcm.h>
+
+/*
+ * Since WL1271 PCM interface is intended for Voice,
+ * Support sampling rate 8K only
+ */
+#define WL1271BT_RATES SNDRV_PCM_RATE_8000
+#define WL1271BT_FORMATS SNDRV_PCM_FMTBIT_S16_LE
+
+struct snd_soc_dai wl1271bt_dai = {
+ .name = "wl1271bt",
+ .playback = {
+ .stream_name = "Playback",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = WL1271BT_RATES,
+ .formats = WL1271BT_FORMATS,},
+ .capture = {
+ .stream_name = "Capture",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = WL1271BT_RATES,
+ .formats = WL1271BT_FORMATS,},
+};
+
+static int __init wl1271bt_modinit(void)
+{
+ /* Register number of DAIs (wl1271bt_dai) with the ASoC core */
+ return snd_soc_register_dais(&wl1271bt_dai, 1);
+}
+
+static void __exit wl1271bt_modexit(void)
+{
+ /* Unregister number of DAIs (wl1271bt_dai) from the ASoC core */
+ snd_soc_unregister_dais(&wl1271bt_dai, 1);
+}
+
+module_init(wl1271bt_modinit);
+module_exit(wl1271bt_modexit);
diff --git a/sound/soc/omap/wl1271bt.h b/sound/soc/omap/wl1271bt.h
new file mode 100644
index 0000000..769f9a9
--- /dev/null
+++ b/sound/soc/omap/wl1271bt.h
@@ -0,0 +1,16 @@
+/*
+ * wl1271bt.h -- ALSA SoC WL1271 Bluetooth codec driver header
+ *
+ * Author: Sinoj M. Issac, <sinoj at mistralsolutions.com>
+ *
+ * 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.
+ */
+
+#ifndef WL1271BT_H
+#define WL1271BT_H
+
+extern struct snd_soc_dai wl1271bt_dai;
+
+#endif /* WL1271BT_H */
--
1.6.3.3


2010-10-13 12:06:09

by Premi, Sanjeev

[permalink] [raw]
Subject: RE: [WL1271 DC supprot on OMAP3EVM 5/5] Supported BT and WLAN configuration for WL1271 over the OMAP37XX



> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> [email protected]
> Sent: Wednesday, October 13, 2010 4:21 PM
> To: [email protected]
> Cc: [email protected]; Sanjay Kumar Champati
> Subject: [WL1271 DC supprot on OMAP3EVM 5/5] Supported BT and
> WLAN configuration for WL1271 over the OMAP37XX
>
> From: Sanjay Kumar Champati <[email protected]>
>
> * Modified the "omap3_evm_defconfig" file to support WLAN and
> BT configuration for WL1271
>
> Signed-off-by: Sanjay Kumar Champati <[email protected]>
> ---
> arch/arm/configs/omap3_evm_defconfig | 27
> ++++++++++++++++++++++++---
[sp] There is no such file in the tree. It seems you haven't rebased
your tree for long.

[snip]...[snip]

2010-10-13 11:17:42

by Premi, Sanjeev

[permalink] [raw]
Subject: RE: [WL1271 DC supprot on OMAP3EVM 2/5] ARM: Supported for Standard SDIO driver on OMAP3EVM for WL1271 DC

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> [email protected]
> Sent: Wednesday, October 13, 2010 4:21 PM
> To: [email protected]
> Cc: [email protected]; Sanjay Kumar Champati
> Subject: [WL1271 DC supprot on OMAP3EVM 2/5] ARM: Supported
> for Standard SDIO driver on OMAP3EVM for WL1271 DC
>
> From: Sanjay Kumar Champati <[email protected]>
>
> * Apply MMC2 support patch before apply this patch

[sp] Can you be more explicit about this change? It isn't useful
here?

> * Modified the "Kconfig" and "board-omap3evm.c" files to support
> standard SDIO driver for WL1271 DC
>
> Signed-off-by: Sanjay Kumar Champati <[email protected]>
> ---
> arch/arm/mach-omap2/board-omap3evm.c | 13 ++++++++++++-
> drivers/mmc/core/sdio_ops.c | 7 ++++++-
> drivers/net/wireless/Kconfig | 11 +++++++++++
> 3 files changed, 29 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-omap3evm.c
> b/arch/arm/mach-omap2/board-omap3evm.c
> index 6b45b6e..06fab2e 100644
> --- a/arch/arm/mach-omap2/board-omap3evm.c
> +++ b/arch/arm/mach-omap2/board-omap3evm.c
> @@ -79,6 +79,10 @@
> #define OMAP3EVM_ETHR_ID_REV 0x50
> #define OMAP3EVM_ETHR_GPIO_IRQ 176
> #define OMAP3EVM_SMSC911X_CS 5
> +#ifdef CONFIG_WL1271_WLAN
> +#define OMAP3EVM_WLAN_EN 150
> +#define OMAP3EVM_WLAN_IRQ 149
> +#endif
>
> extern struct regulator_consumer_supply twl4030_vmmc1_supply;
> extern struct regulator_consumer_supply twl4030_vsim_supply;
> @@ -749,7 +753,14 @@ static int
> omap3evm_twl_gpio_setup(struct device *dev,
> twl4030_vmmc1_supply.dev = mmc[0].dev;
> twl4030_vsim_supply.dev = mmc[0].dev;
> twl4030_vmmc2_supply.dev = mmc[1].dev;
> -
> +#ifdef CONFIG_WL1271_WLAN
> + omap_mux_init_gpio(OMAP3EVM_WLAN_EN, OMAP_PIN_OUTPUT);
> + if (gpio_request(OMAP3EVM_WLAN_EN, "WLAN_ENABLE"))
> + printk(KERN_ERR "Fail to get WLAN Enable GPIO\n");
> + gpio_direction_output(OMAP3EVM_WLAN_EN, 1);
> + mdelay(100);

[sp] Why is this delay required?

> + omap_mux_init_gpio(OMAP3EVM_WLAN_IRQ, OMAP_PIN_INPUT);
> +#endif
> /*
> * Most GPIOs are for USB OTG. Some are mostly sent to
> * the P2 connector; notably LEDA for the LCD backlight.
> diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c
> index 4eb7825..4213ee0 100644
> --- a/drivers/mmc/core/sdio_ops.c
> +++ b/drivers/mmc/core/sdio_ops.c
> @@ -114,6 +114,9 @@ int mmc_io_rw_direct(struct mmc_card
> *card, int write, unsigned fn,
>
> return 0;
> }
> +#ifdef CONFIG_WL1271_WLAN
> +EXPORT_SYMBOL(mmc_io_rw_direct);
> +#endif

[sp] Why is the export required?

>
> int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
> unsigned addr, int incr_addr, u8 *buf, unsigned blocks,
> unsigned blksz)
> @@ -181,4 +184,6 @@ int mmc_io_rw_extended(struct mmc_card
> *card, int write, unsigned fn,
>
> return 0;
> }
> -
> +#ifdef CONFIG_WL1271_WLAN
> +EXPORT_SYMBOL(mmc_io_rw_extended);
> +#endif

[sp] Why is the export required?

> diff --git a/drivers/net/wireless/Kconfig
> b/drivers/net/wireless/Kconfig
> index 56dd665..dc319b7 100644
> --- a/drivers/net/wireless/Kconfig
> +++ b/drivers/net/wireless/Kconfig
> @@ -31,6 +31,17 @@ config PCMCIA_RAYCS
> To compile this driver as a module, choose M here:
> the module will be
> called ray_cs. If unsure, say N.
>
> +config WL1271_WLAN
> + tristate "WL1271 TI's SDIO based wireless card"
> + select WIRELESS_EXT
> + select CRYPTO
> + select WEXT_SPY
> + select WEXT_PRIV
> + ---help---
> + This driver support both the standard Linux Wireless Extensions
> + and TI's proprietary API, so both the Linux Wireless
> Tools and this
> + module support 2.4 GHz 802.11 b/g/n standrd.
[sp] Can you do a spellcheck? ^^^^^^

> +
> config LIBERTAS_THINFIRM
> tristate "Marvell 8xxx Libertas WLAN driver support
> with thin firmware"
> depends on MAC80211
> --
> 1.6.3.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe
> linux-omap" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2010-10-13 12:23:28

by Premi, Sanjeev

[permalink] [raw]
Subject: RE: [WL1271 DC supprot on OMAP3EVM 1/5] ARM: Supported MMC 2 features for OMAP3EVM

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> [email protected]
> Sent: Wednesday, October 13, 2010 4:21 PM
> To: [email protected]
> Cc: [email protected]; Sanjay Kumar Champati
> Subject: [WL1271 DC supprot on OMAP3EVM 1/5] ARM: Supported
> MMC 2 features for OMAP3EVM
>
> From: Sanjay Kumar Champati <[email protected]>
>
> * Modified "board-omap3evm.c" file for MMC2 support
> * Modified "mmc-twl4030.c" and "mmc-twl4030.h" file for MMC2
> power support

[sp] Can you describe how to use the MMC2 on omap3evm?
Also, the name of the files modified is already part of the
patch syntax. You don't need to mention them in the
description here.

>
> Signed-off-by: Sanjay Kumar Champati <[email protected]>
> ---
> arch/arm/mach-omap2/board-omap3evm.c | 15 +++++++++++++++
> arch/arm/mach-omap2/mmc-twl4030.c | 1 +
> arch/arm/mach-omap2/mmc-twl4030.h | 2 ++
> 3 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-omap3evm.c
> b/arch/arm/mach-omap2/board-omap3evm.c
> index d2c8dcf..6b45b6e 100644
> --- a/arch/arm/mach-omap2/board-omap3evm.c
> +++ b/arch/arm/mach-omap2/board-omap3evm.c
> @@ -611,6 +611,13 @@ static struct twl4030_hsmmc_info mmc[] = {
> .gpio_cd = -EINVAL,
> .gpio_wp = 63,
> },
> + {
> + .mmc = 2,
> + .wires = 4,
> + .gpio_cd = -EINVAL,
> + .gpio_wp = -EINVAL,
> + .ocr_mask = 0x00000080,
> + },
> {} /* Terminator */
> };
>
> @@ -741,6 +748,7 @@ static int omap3evm_twl_gpio_setup(struct
> device *dev,
> /* link regulators to MMC adapters */
> twl4030_vmmc1_supply.dev = mmc[0].dev;
> twl4030_vsim_supply.dev = mmc[0].dev;
> + twl4030_vmmc2_supply.dev = mmc[1].dev;
>
> /*
> * Most GPIOs are for USB OTG. Some are mostly sent to
> @@ -949,6 +957,7 @@ static int __init omap3_evm_i2c_init(void)
> */
> omap3evm_twldata.vmmc1 = &vmmc1_data;
> omap3evm_twldata.vsim = &vsim_data;
> + omap3evm_twldata.vmmc2 = &vmmc2_data;
>
> omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo,
> ARRAY_SIZE(omap3evm_i2c_boardinfo));
> @@ -1067,6 +1076,12 @@ static struct omap_board_mux
> omap35x_board_mux[] __initdata = {
> OMAP_PIN_OFF_INPUT_PULLUP |
> OMAP_PIN_OFF_OUTPUT_LOW |
> OMAP_PIN_OFF_WAKEUPENABLE),
> #endif
> + OMAP3_MUX(SDMMC2_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
> + OMAP3_MUX(SDMMC2_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
> + OMAP3_MUX(SDMMC2_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
> + OMAP3_MUX(SDMMC2_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
> + OMAP3_MUX(SDMMC2_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
> + OMAP3_MUX(SDMMC2_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),

[sp] What is/will be the behavior on the boards where MMC2 isn't
available on the board?

I haven't verified, but this hunk also tells me that you haven't
updated your development tree for long.

>
> { .reg_offset = OMAP_MUX_TERMINATOR },
> };
> diff --git a/arch/arm/mach-omap2/mmc-twl4030.c
> b/arch/arm/mach-omap2/mmc-twl4030.c
> index 0c3c72d..c56f8c7 100644
> --- a/arch/arm/mach-omap2/mmc-twl4030.c
> +++ b/arch/arm/mach-omap2/mmc-twl4030.c
> @@ -124,6 +124,7 @@ static int twl_mmc_late_init(struct device *dev)
> }
> hsmmc[i].vcc = reg;
> mmc->slots[0].ocr_mask =
> mmc_regulator_get_ocrmask(reg);
> + mmc->slots[1].ocr_mask =
> mmc_regulator_get_ocrmask(reg);
>
> /* allow an aux regulator */
> reg = regulator_get(dev, "vmmc_aux");
> diff --git a/arch/arm/mach-omap2/mmc-twl4030.h
> b/arch/arm/mach-omap2/mmc-twl4030.h
> index a47e685..88bcf46 100644
> --- a/arch/arm/mach-omap2/mmc-twl4030.h
> +++ b/arch/arm/mach-omap2/mmc-twl4030.h
> @@ -34,3 +34,5 @@ static inline void twl4030_mmc_init(struct
> twl4030_hsmmc_info *info)
> }
>
> #endif
> +extern struct regulator_consumer_supply twl4030_vmmc2_supply;
> +extern struct regulator_init_data vmmc2_data;
> --
> 1.6.3.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe
> linux-omap" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2010-10-13 11:03:00

by csanjay

[permalink] [raw]
Subject: [WL1271 DC supprot on OMAP3EVM 1/5] ARM: Supported MMC 2 features for OMAP3EVM

From: Sanjay Kumar Champati <[email protected]>

* Modified "board-omap3evm.c" file for MMC2 support
* Modified "mmc-twl4030.c" and "mmc-twl4030.h" file for MMC2 power support

Signed-off-by: Sanjay Kumar Champati <[email protected]>
---
arch/arm/mach-omap2/board-omap3evm.c | 15 +++++++++++++++
arch/arm/mach-omap2/mmc-twl4030.c | 1 +
arch/arm/mach-omap2/mmc-twl4030.h | 2 ++
3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index d2c8dcf..6b45b6e 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -611,6 +611,13 @@ static struct twl4030_hsmmc_info mmc[] = {
.gpio_cd = -EINVAL,
.gpio_wp = 63,
},
+ {
+ .mmc = 2,
+ .wires = 4,
+ .gpio_cd = -EINVAL,
+ .gpio_wp = -EINVAL,
+ .ocr_mask = 0x00000080,
+ },
{} /* Terminator */
};

@@ -741,6 +748,7 @@ static int omap3evm_twl_gpio_setup(struct device *dev,
/* link regulators to MMC adapters */
twl4030_vmmc1_supply.dev = mmc[0].dev;
twl4030_vsim_supply.dev = mmc[0].dev;
+ twl4030_vmmc2_supply.dev = mmc[1].dev;

/*
* Most GPIOs are for USB OTG. Some are mostly sent to
@@ -949,6 +957,7 @@ static int __init omap3_evm_i2c_init(void)
*/
omap3evm_twldata.vmmc1 = &vmmc1_data;
omap3evm_twldata.vsim = &vsim_data;
+ omap3evm_twldata.vmmc2 = &vmmc2_data;

omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo,
ARRAY_SIZE(omap3evm_i2c_boardinfo));
@@ -1067,6 +1076,12 @@ static struct omap_board_mux omap35x_board_mux[] __initdata = {
OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
OMAP_PIN_OFF_WAKEUPENABLE),
#endif
+ OMAP3_MUX(SDMMC2_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
+ OMAP3_MUX(SDMMC2_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
+ OMAP3_MUX(SDMMC2_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
+ OMAP3_MUX(SDMMC2_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
+ OMAP3_MUX(SDMMC2_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
+ OMAP3_MUX(SDMMC2_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),

{ .reg_offset = OMAP_MUX_TERMINATOR },
};
diff --git a/arch/arm/mach-omap2/mmc-twl4030.c b/arch/arm/mach-omap2/mmc-twl4030.c
index 0c3c72d..c56f8c7 100644
--- a/arch/arm/mach-omap2/mmc-twl4030.c
+++ b/arch/arm/mach-omap2/mmc-twl4030.c
@@ -124,6 +124,7 @@ static int twl_mmc_late_init(struct device *dev)
}
hsmmc[i].vcc = reg;
mmc->slots[0].ocr_mask = mmc_regulator_get_ocrmask(reg);
+ mmc->slots[1].ocr_mask = mmc_regulator_get_ocrmask(reg);

/* allow an aux regulator */
reg = regulator_get(dev, "vmmc_aux");
diff --git a/arch/arm/mach-omap2/mmc-twl4030.h b/arch/arm/mach-omap2/mmc-twl4030.h
index a47e685..88bcf46 100644
--- a/arch/arm/mach-omap2/mmc-twl4030.h
+++ b/arch/arm/mach-omap2/mmc-twl4030.h
@@ -34,3 +34,5 @@ static inline void twl4030_mmc_init(struct twl4030_hsmmc_info *info)
}

#endif
+extern struct regulator_consumer_supply twl4030_vmmc2_supply;
+extern struct regulator_init_data vmmc2_data;
--
1.6.3.3