blob: d19b59299d78adca911089a28cebdeff9661250a [file] [log] [blame]
Johannes Stezenbach43f1a8f2005-05-16 21:54:49 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 bt878.h - Bt878 audio module (register offsets)
3
Johannes Stezenbacha8d995c2005-09-09 13:02:19 -07004 Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@htp-tel.de>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef _BT878_H_
22#define _BT878_H_
23
24#include <linux/interrupt.h>
25#include <linux/pci.h>
26#include <linux/sched.h>
27#include <linux/spinlock.h>
Ingo Molnar3593cab2006-02-07 06:49:14 -020028#include <linux/mutex.h>
29
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#include "bt848.h"
31#include "bttv.h"
32
33#define BT878_VERSION_CODE 0x000000
34
35#define BT878_AINT_STAT 0x100
36#define BT878_ARISCS (0xf<<28)
37#define BT878_ARISC_EN (1<<27)
38#define BT878_ASCERR (1<<19)
39#define BT878_AOCERR (1<<18)
40#define BT878_APABORT (1<<17)
41#define BT878_ARIPERR (1<<16)
42#define BT878_APPERR (1<<15)
43#define BT878_AFDSR (1<<14)
44#define BT878_AFTRGT (1<<13)
45#define BT878_AFBUS (1<<12)
46#define BT878_ARISCI (1<<11)
47#define BT878_AOFLOW (1<<3)
48
49#define BT878_AINT_MASK 0x104
50
51#define BT878_AGPIO_DMA_CTL 0x10c
52#define BT878_A_GAIN (0xf<<28)
53#define BT878_A_G2X (1<<27)
54#define BT878_A_PWRDN (1<<26)
55#define BT878_A_SEL (3<<24)
56#define BT878_DA_SCE (1<<23)
57#define BT878_DA_LRI (1<<22)
58#define BT878_DA_MLB (1<<21)
59#define BT878_DA_LRD (0x1f<<16)
60#define BT878_DA_DPM (1<<15)
61#define BT878_DA_SBR (1<<14)
62#define BT878_DA_ES2 (1<<13)
63#define BT878_DA_LMT (1<<12)
64#define BT878_DA_SDR (0xf<<8)
65#define BT878_DA_IOM (3<<6)
66#define BT878_DA_APP (1<<5)
67#define BT878_ACAP_EN (1<<4)
68#define BT878_PKTP (3<<2)
69#define BT878_RISC_EN (1<<1)
70#define BT878_FIFO_EN 1
71
72#define BT878_APACK_LEN 0x110
73#define BT878_AFP_LEN (0xff<<16)
74#define BT878_ALP_LEN 0xfff
75
76#define BT878_ARISC_START 0x114
77
78#define BT878_ARISC_PC 0x120
79
80/* BT878 FUNCTION 0 REGISTERS */
81#define BT878_GPIO_DMA_CTL 0x10c
82
83/* Interrupt register */
84#define BT878_INT_STAT 0x100
85#define BT878_INT_MASK 0x104
86#define BT878_I2CRACK (1<<25)
87#define BT878_I2CDONE (1<<8)
88
89#define BT878_MAX 4
90
91#define BT878_RISC_SYNC_MASK (1 << 15)
92
Manu Abraham6a5b28f2006-02-07 06:45:30 -020093
94#define BTTV_BOARD_UNKNOWN 0x00
95#define BTTV_BOARD_PINNACLESAT 0x5e
96#define BTTV_BOARD_NEBULA_DIGITV 0x68
97#define BTTV_BOARD_PC_HDTV 0x70
98#define BTTV_BOARD_TWINHAN_DST 0x71
99#define BTTV_BOARD_AVDVBT_771 0x7b
100#define BTTV_BOARD_AVDVBT_761 0x7c
101#define BTTV_BOARD_DVICO_DVBT_LITE 0x80
102#define BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE 0x87
103
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104extern int bt878_num;
105
106struct bt878 {
Ingo Molnar3593cab2006-02-07 06:49:14 -0200107 struct mutex gpio_lock;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 unsigned int nr;
109 unsigned int bttv_nr;
110 struct i2c_adapter *adapter;
111 struct pci_dev *dev;
112 unsigned int id;
113 unsigned int TS_Size;
114 unsigned char revision;
115 unsigned int irq;
116 unsigned long bt878_adr;
117 volatile void __iomem *bt878_mem; /* function 1 */
118
119 volatile u32 finished_block;
120 volatile u32 last_block;
121 u32 block_count;
122 u32 block_bytes;
123 u32 line_bytes;
124 u32 line_count;
125
126 u32 buf_size;
127 u8 *buf_cpu;
128 dma_addr_t buf_dma;
129
130 u32 risc_size;
Al Viro3aa71102008-06-22 14:20:09 -0300131 __le32 *risc_cpu;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132 dma_addr_t risc_dma;
133 u32 risc_pos;
134
135 struct tasklet_struct tasklet;
Johannes Stezenbach43f1a8f2005-05-16 21:54:49 -0700136 int shutdown;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137};
138
139extern struct bt878 bt878[BT878_MAX];
140
141void bt878_start(struct bt878 *bt, u32 controlreg, u32 op_sync_orin,
142 u32 irq_err_ignore);
Johannes Stezenbach43f1a8f2005-05-16 21:54:49 -0700143void bt878_stop(struct bt878 *bt);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144
145#if defined(__powerpc__) /* big-endian */
Adrian Bunkfbd8af02007-08-15 10:43:08 -0300146static inline void io_st_le32(volatile unsigned __iomem *addr, unsigned val)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147{
Kumar Galae9f668d2007-08-15 10:43:19 -0300148 st_le32(addr, val);
149 eieio();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150}
151
152#define bmtwrite(dat,adr) io_st_le32((adr),(dat))
153#define bmtread(adr) ld_le32((adr))
154#else
155#define bmtwrite(dat,adr) writel((dat), (adr))
156#define bmtread(adr) readl(adr)
157#endif
158
159#endif