summaryrefslogtreecommitdiffstats
path: root/extras/recipes-kernel/linux/linux-omap/wl1271/0007-drivers-media-radio-wl128x-FM-Driver-common-header-f.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap/wl1271/0007-drivers-media-radio-wl128x-FM-Driver-common-header-f.patch')
-rw-r--r--extras/recipes-kernel/linux/linux-omap/wl1271/0007-drivers-media-radio-wl128x-FM-Driver-common-header-f.patch268
1 files changed, 268 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap/wl1271/0007-drivers-media-radio-wl128x-FM-Driver-common-header-f.patch b/extras/recipes-kernel/linux/linux-omap/wl1271/0007-drivers-media-radio-wl128x-FM-Driver-common-header-f.patch
new file mode 100644
index 00000000..d104a727
--- /dev/null
+++ b/extras/recipes-kernel/linux/linux-omap/wl1271/0007-drivers-media-radio-wl128x-FM-Driver-common-header-f.patch
@@ -0,0 +1,268 @@
1From f568ec9bb6ccd1e17278dcab3fbc810cf2e071ac Mon Sep 17 00:00:00 2001
2From: Manjunatha Halli <manjunatha_halli@ti.com>
3Date: Tue, 11 Jan 2011 11:31:21 +0000
4Subject: [PATCH 07/15] drivers:media:radio: wl128x: FM Driver common header file
5
6These are common headers used in FM submodules (FM V4L2,
7FM common, FM Rx,and FM TX).
8
9Signed-off-by: Manjunatha Halli <manjunatha_halli@ti.com>
10Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
11---
12 drivers/media/radio/wl128x/fmdrv.h | 244 ++++++++++++++++++++++++++++++++++++
13 1 files changed, 244 insertions(+), 0 deletions(-)
14 create mode 100644 drivers/media/radio/wl128x/fmdrv.h
15
16diff --git a/drivers/media/radio/wl128x/fmdrv.h b/drivers/media/radio/wl128x/fmdrv.h
17new file mode 100644
18index 0000000..392b62d
19--- /dev/null
20+++ b/drivers/media/radio/wl128x/fmdrv.h
21@@ -0,0 +1,244 @@
22+/*
23+ * FM Driver for Connectivity chip of Texas Instruments.
24+ *
25+ * Common header for all FM driver sub-modules.
26+ *
27+ * Copyright (C) 2011 Texas Instruments
28+ *
29+ * This program is free software; you can redistribute it and/or modify
30+ * it under the terms of the GNU General Public License version 2 as
31+ * published by the Free Software Foundation.
32+ *
33+ * This program is distributed in the hope that it will be useful,
34+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
35+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36+ * GNU General Public License for more details.
37+ *
38+ * You should have received a copy of the GNU General Public License
39+ * along with this program; if not, write to the Free Software
40+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
41+ *
42+ */
43+
44+#ifndef _FM_DRV_H
45+#define _FM_DRV_H
46+
47+#include <linux/skbuff.h>
48+#include <linux/interrupt.h>
49+#include <sound/core.h>
50+#include <sound/initval.h>
51+#include <linux/timer.h>
52+#include <linux/version.h>
53+#include <media/v4l2-ioctl.h>
54+#include <media/v4l2-common.h>
55+#include <media/v4l2-ctrls.h>
56+
57+#define FM_DRV_VERSION "0.09"
58+/* Should match with FM_DRV_VERSION */
59+#define FM_DRV_RADIO_VERSION KERNEL_VERSION(0, 0, 1)
60+#define FM_DRV_NAME "ti_fmdrv"
61+#define FM_DRV_CARD_SHORT_NAME "TI FM Radio"
62+#define FM_DRV_CARD_LONG_NAME "Texas Instruments FM Radio"
63+
64+/* Flag info */
65+#define FM_INTTASK_RUNNING 0
66+#define FM_INTTASK_SCHEDULE_PENDING 1
67+#define FM_FW_DW_INPROGRESS 2
68+#define FM_CORE_READY 3
69+#define FM_CORE_TRANSPORT_READY 4
70+#define FM_AF_SWITCH_INPROGRESS 5
71+#define FM_CORE_TX_XMITING 6
72+
73+#define FM_TUNE_COMPLETE 0x1
74+#define FM_BAND_LIMIT 0x2
75+
76+#define FM_DRV_TX_TIMEOUT (5*HZ) /* 5 seconds */
77+#define FM_DRV_RX_SEEK_TIMEOUT (20*HZ) /* 20 seconds */
78+
79+#define NO_OF_ENTRIES_IN_ARRAY(array) (sizeof(array) / sizeof(array[0]))
80+
81+#define fmerr(format, ...) \
82+ printk(KERN_ERR "fmdrv: " format, ## __VA_ARGS__)
83+#define fmwarn(format, ...) \
84+ printk(KERN_WARNING "fmdrv: " format, ##__VA_ARGS__)
85+#ifdef DEBUG
86+#define fmdbg(format, ...) \
87+ printk(KERN_DEBUG "fmdrv: " format, ## __VA_ARGS__)
88+#else /* DEBUG */
89+#define fmdbg(format, ...)
90+#endif
91+enum {
92+ FM_MODE_OFF,
93+ FM_MODE_TX,
94+ FM_MODE_RX,
95+ FM_MODE_ENTRY_MAX
96+};
97+
98+#define FM_RX_RDS_INFO_FIELD_MAX 8 /* 4 Group * 2 Bytes */
99+
100+/* RX RDS data format */
101+struct fm_rdsdata_format {
102+ union {
103+ struct {
104+ u8 buff[FM_RX_RDS_INFO_FIELD_MAX];
105+ } groupdatabuff;
106+ struct {
107+ u16 pidata;
108+ u8 blk_b[2];
109+ u8 blk_c[2];
110+ u8 blk_d[2];
111+ } groupgeneral;
112+ struct {
113+ u16 pidata;
114+ u8 blk_b[2];
115+ u8 af[2];
116+ u8 ps[2];
117+ } group0A;
118+ struct {
119+ u16 pi[2];
120+ u8 blk_b[2];
121+ u8 ps[2];
122+ } group0B;
123+ } data;
124+};
125+
126+/* FM region (Europe/US, Japan) info */
127+struct region_info {
128+ u32 chanl_space;
129+ u32 bot_freq;
130+ u32 top_freq;
131+ u8 fm_band;
132+};
133+struct fmdev;
134+typedef void (*int_handler_prototype) (struct fmdev *);
135+
136+/* FM Interrupt processing related info */
137+struct fm_irq {
138+ u8 stage;
139+ u16 flag; /* FM interrupt flag */
140+ u16 mask; /* FM interrupt mask */
141+ /* Interrupt process timeout handler */
142+ struct timer_list timer;
143+ u8 retry;
144+ int_handler_prototype *handlers;
145+};
146+
147+/* RDS info */
148+struct fm_rds {
149+ u8 flag; /* RX RDS on/off status */
150+ u8 last_blk_idx; /* Last received RDS block */
151+
152+ /* RDS buffer */
153+ wait_queue_head_t read_queue;
154+ u32 buf_size; /* Size is always multiple of 3 */
155+ u32 wr_idx;
156+ u32 rd_idx;
157+ u8 *buff;
158+};
159+
160+#define FM_RDS_MAX_AF_LIST 25
161+
162+/*
163+ * Current RX channel Alternate Frequency cache.
164+ * This info is used to switch to other freq (AF)
165+ * when current channel signal strengh is below RSSI threshold.
166+ */
167+struct tuned_station_info {
168+ u16 picode;
169+ u32 af_cache[FM_RDS_MAX_AF_LIST];
170+ u8 afcache_size;
171+ u8 af_list_max;
172+};
173+
174+/* FM RX mode info */
175+struct fm_rx {
176+ struct region_info region; /* Current selected band */
177+ u32 freq; /* Current RX frquency */
178+ u8 mute_mode; /* Current mute mode */
179+ u8 deemphasis_mode; /* Current deemphasis mode */
180+ /* RF dependent soft mute mode */
181+ u8 rf_depend_mute;
182+ u16 volume; /* Current volume level */
183+ u16 rssi_threshold; /* Current RSSI threshold level */
184+ /* Holds the index of the current AF jump */
185+ u8 afjump_idx;
186+ /* Will hold the frequency before the jump */
187+ u32 freq_before_jump;
188+ u8 rds_mode; /* RDS operation mode (RDS/RDBS) */
189+ u8 af_mode; /* Alternate frequency on/off */
190+ struct tuned_station_info stat_info;
191+ struct fm_rds rds;
192+};
193+
194+#define FMTX_RDS_TXT_STR_SIZE 25
195+/*
196+ * FM TX RDS data
197+ *
198+ * @ text_type: is the text following PS or RT
199+ * @ text: radio text string which could either be PS or RT
200+ * @ af_freq: alternate frequency for Tx
201+ * TODO: to be declared in application
202+ */
203+struct tx_rds {
204+ u8 text_type;
205+ u8 text[FMTX_RDS_TXT_STR_SIZE];
206+ u8 flag;
207+ u32 af_freq;
208+};
209+/*
210+ * FM TX global data
211+ *
212+ * @ pwr_lvl: Power Level of the Transmission from mixer control
213+ * @ xmit_state: Transmission state = Updated locally upon Start/Stop
214+ * @ audio_io: i2S/Analog
215+ * @ tx_frq: Transmission frequency
216+ */
217+struct fmtx_data {
218+ u8 pwr_lvl;
219+ u8 xmit_state;
220+ u8 audio_io;
221+ u8 region;
222+ u16 aud_mode;
223+ u32 preemph;
224+ u32 tx_frq;
225+ struct tx_rds rds;
226+};
227+
228+/* FM driver operation structure */
229+struct fmdev {
230+ struct video_device *radio_dev; /* V4L2 video device pointer */
231+ struct snd_card *card; /* Card which holds FM mixer controls */
232+ u16 asci_id;
233+ spinlock_t rds_buff_lock; /* To protect access to RDS buffer */
234+ spinlock_t resp_skb_lock; /* To protect access to received SKB */
235+
236+ long flag; /* FM driver state machine info */
237+ u8 streg_cbdata; /* status of ST registration */
238+
239+ struct sk_buff_head rx_q; /* RX queue */
240+ struct tasklet_struct rx_task; /* RX Tasklet */
241+
242+ struct sk_buff_head tx_q; /* TX queue */
243+ struct tasklet_struct tx_task; /* TX Tasklet */
244+ unsigned long last_tx_jiffies; /* Timestamp of last pkt sent */
245+ atomic_t tx_cnt; /* Number of packets can send at a time */
246+
247+ struct sk_buff *resp_skb; /* Response from the chip */
248+ /* Main task completion handler */
249+ struct completion maintask_comp;
250+ /* Opcode of last command sent to the chip */
251+ u8 pre_op;
252+ /* Handler used for wakeup when response packet is received */
253+ struct completion *resp_comp;
254+ struct fm_irq irq_info;
255+ u8 curr_fmmode; /* Current FM chip mode (TX, RX, OFF) */
256+ struct fm_rx rx; /* FM receiver info */
257+ struct fmtx_data tx_data;
258+
259+ /* V4L2 ctrl framwork handler*/
260+ struct v4l2_ctrl_handler ctrl_handler;
261+
262+ /* For core assisted locking */
263+ struct mutex mutex;
264+};
265+#endif
266--
2671.6.6.1
268