2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* v4l2 device driver for cx2388x based TV cards
|
|
|
|
*
|
|
|
|
* (c) 2003,04 Gerd Knorr <kraxel@bytesex.org> [SUSE Labs]
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <linux/i2c-algo-bit.h>
|
2005-11-09 13:37:17 +08:00
|
|
|
#include <linux/videodev2.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/kdev_t.h>
|
|
|
|
|
2009-03-14 23:40:51 +08:00
|
|
|
#include <media/v4l2-device.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <media/tuner.h>
|
|
|
|
#include <media/tveeprom.h>
|
2007-08-24 03:37:49 +08:00
|
|
|
#include <media/videobuf-dma-sg.h>
|
2008-07-23 16:09:15 +08:00
|
|
|
#include <media/v4l2-chip-ident.h>
|
2006-06-19 03:11:06 +08:00
|
|
|
#include <media/cx2341x.h>
|
2007-08-24 05:12:08 +08:00
|
|
|
#include <media/videobuf-dvb.h>
|
2010-09-23 11:51:44 +08:00
|
|
|
#include <media/ir-kbd-i2c.h>
|
2011-02-07 04:46:12 +08:00
|
|
|
#include <media/wm8775.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include "btcx-risc.h"
|
|
|
|
#include "cx88-reg.h"
|
V4L/DVB (7448): Add support for Kworld ATSC 120
This board has a s5h1409 demod, plus a xc30x8 tuner (probably, xc3018).
This patch adds proper support for radio, video, s-video, composite and ATSC.
However, support for radio and video depends on having s5h1409 i2c gate open,
otherwise, xc30x8 chip won't be visible.
For a better support, some rework is needed on cx88 driver, to allow adding
xc30x8 to i2c bus without sending i2c 0 byte reading to 0xc2 address.
Thanks to Vanessa Ezekowitz <vanessaezekowitz@gmail.com> for helping to figure
out the proper parameters for s5h1409 and the GPIO pins used by each
configuration.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-03-28 10:18:30 +08:00
|
|
|
#include "tuner-xc2028.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-02-07 16:49:14 +08:00
|
|
|
#include <linux/mutex.h>
|
[media] Stop using linux/version.h on most video drivers
All the modified drivers didn't have any version increment since
Jan, 1 2011. Several of them didn't have any version increment
for a long time, even having new features and important bug fixes
happening.
As we're now filling the QUERYCAP version with the current Kernel
Release, we don't need to maintain a per-driver version control
anymore. So, let's just use the default.
In order to preserve the Kernel module version history, a
KERNEL_VERSION() macro were added to all modified drivers, and
the extraver number were incremented.
I opted to preserve the per-driver version control to a few
pwc, pvrusb2, s2255, s5p-fimc and sh_vou.
A few drivers are still using the legacy way to handle ioctl's.
So, we can't do such change on them, otherwise, they'll break.
Those are: uvc, et61x251 and sn9c102.
The rationale is that the per-driver version control seems to be
actively maintained on those.
Yet, I think that the better for them would be to just use the
default version numbering, instead of doing that by themselves.
While here, removed a few uneeded include linux/version.h
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-06-25 01:45:49 +08:00
|
|
|
|
|
|
|
#define CX88_VERSION "0.0.9"
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define UNSET (-1U)
|
|
|
|
|
|
|
|
#define CX88_MAXBOARDS 8
|
|
|
|
|
2005-09-10 04:03:41 +08:00
|
|
|
/* Max number of inputs by card */
|
|
|
|
#define MAX_CX88_INPUT 8
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* defines and enums */
|
|
|
|
|
2008-10-31 01:28:19 +08:00
|
|
|
/* Currently unsupported by the driver: PAL/H, NTSC/Kr, SECAM/LC */
|
|
|
|
#define CX88_NORMS (V4L2_STD_ALL \
|
|
|
|
& ~V4L2_STD_PAL_H \
|
|
|
|
& ~V4L2_STD_NTSC_M_KR \
|
|
|
|
& ~V4L2_STD_SECAM_LC)
|
2007-01-21 00:58:33 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#define FORMAT_FLAGS_PACKED 0x01
|
|
|
|
#define FORMAT_FLAGS_PLANAR 0x02
|
|
|
|
|
|
|
|
#define VBI_LINE_COUNT 17
|
|
|
|
#define VBI_LINE_LENGTH 2048
|
|
|
|
|
2009-04-01 06:01:51 +08:00
|
|
|
#define AUD_RDS_LINES 4
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* need "shadow" registers for some write-only ones ... */
|
|
|
|
#define SHADOW_AUD_VOL_CTL 1
|
|
|
|
#define SHADOW_AUD_BAL_CTL 2
|
2006-03-09 23:03:40 +08:00
|
|
|
#define SHADOW_MAX 3
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
/* FM Radio deemphasis type */
|
|
|
|
enum cx88_deemph_type {
|
|
|
|
FM_NO_DEEMPH = 0,
|
|
|
|
FM_DEEMPH_50,
|
|
|
|
FM_DEEMPH_75
|
|
|
|
};
|
|
|
|
|
2006-09-25 23:43:45 +08:00
|
|
|
enum cx88_board_type {
|
|
|
|
CX88_BOARD_NONE = 0,
|
2006-09-26 01:09:10 +08:00
|
|
|
CX88_MPEG_DVB,
|
|
|
|
CX88_MPEG_BLACKBIRD
|
2006-09-25 23:43:45 +08:00
|
|
|
};
|
|
|
|
|
2006-12-03 07:15:51 +08:00
|
|
|
enum cx8802_board_access {
|
|
|
|
CX8802_DRVCTL_SHARED = 1,
|
|
|
|
CX8802_DRVCTL_EXCLUSIVE = 2,
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* tv norms */
|
|
|
|
|
2007-01-21 00:58:33 +08:00
|
|
|
static unsigned int inline norm_maxw(v4l2_std_id norm)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2007-01-21 00:58:33 +08:00
|
|
|
return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 720 : 768;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-07-13 04:58:44 +08:00
|
|
|
|
2007-01-21 00:58:33 +08:00
|
|
|
static unsigned int inline norm_maxh(v4l2_std_id norm)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2007-01-21 00:58:33 +08:00
|
|
|
return (norm & V4L2_STD_625_50) ? 576 : 480;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* static data */
|
|
|
|
|
|
|
|
struct cx8800_fmt {
|
2010-08-25 20:50:20 +08:00
|
|
|
const char *name;
|
2005-04-17 06:20:36 +08:00
|
|
|
u32 fourcc; /* v4l2 format id */
|
|
|
|
int depth;
|
|
|
|
int flags;
|
|
|
|
u32 cxformat;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cx88_ctrl {
|
|
|
|
struct v4l2_queryctrl v;
|
|
|
|
u32 off;
|
|
|
|
u32 reg;
|
|
|
|
u32 sreg;
|
|
|
|
u32 mask;
|
|
|
|
u32 shift;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* SRAM memory management data (see cx88-core.c) */
|
|
|
|
|
|
|
|
#define SRAM_CH21 0 /* video */
|
|
|
|
#define SRAM_CH22 1
|
|
|
|
#define SRAM_CH23 2
|
|
|
|
#define SRAM_CH24 3 /* vbi */
|
|
|
|
#define SRAM_CH25 4 /* audio */
|
|
|
|
#define SRAM_CH26 5
|
|
|
|
#define SRAM_CH28 6 /* mpeg */
|
2009-04-01 06:01:51 +08:00
|
|
|
#define SRAM_CH27 7 /* audio rds */
|
2005-04-17 06:20:36 +08:00
|
|
|
/* more */
|
|
|
|
|
|
|
|
struct sram_channel {
|
2010-08-25 20:50:20 +08:00
|
|
|
const char *name;
|
2005-04-17 06:20:36 +08:00
|
|
|
u32 cmds_start;
|
|
|
|
u32 ctrl_start;
|
|
|
|
u32 cdt;
|
|
|
|
u32 fifo_start;
|
|
|
|
u32 fifo_size;
|
|
|
|
u32 ptr1_reg;
|
|
|
|
u32 ptr2_reg;
|
|
|
|
u32 cnt1_reg;
|
|
|
|
u32 cnt2_reg;
|
|
|
|
};
|
2010-08-25 20:50:20 +08:00
|
|
|
extern const struct sram_channel const cx88_sram_channels[];
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* card configuration */
|
|
|
|
|
|
|
|
#define CX88_BOARD_NOAUTO UNSET
|
|
|
|
#define CX88_BOARD_UNKNOWN 0
|
|
|
|
#define CX88_BOARD_HAUPPAUGE 1
|
|
|
|
#define CX88_BOARD_GDI 2
|
|
|
|
#define CX88_BOARD_PIXELVIEW 3
|
|
|
|
#define CX88_BOARD_ATI_WONDER_PRO 4
|
|
|
|
#define CX88_BOARD_WINFAST2000XP_EXPERT 5
|
2005-11-09 13:38:34 +08:00
|
|
|
#define CX88_BOARD_AVERTV_STUDIO_303 6
|
2005-04-17 06:20:36 +08:00
|
|
|
#define CX88_BOARD_MSI_TVANYWHERE_MASTER 7
|
|
|
|
#define CX88_BOARD_WINFAST_DV2000 8
|
|
|
|
#define CX88_BOARD_LEADTEK_PVR2000 9
|
|
|
|
#define CX88_BOARD_IODATA_GVVCP3PCI 10
|
|
|
|
#define CX88_BOARD_PROLINK_PLAYTVPVR 11
|
|
|
|
#define CX88_BOARD_ASUS_PVR_416 12
|
|
|
|
#define CX88_BOARD_MSI_TVANYWHERE 13
|
|
|
|
#define CX88_BOARD_KWORLD_DVB_T 14
|
|
|
|
#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1 15
|
|
|
|
#define CX88_BOARD_KWORLD_LTV883 16
|
2005-07-08 08:58:36 +08:00
|
|
|
#define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q 17
|
2005-04-17 06:20:36 +08:00
|
|
|
#define CX88_BOARD_HAUPPAUGE_DVB_T1 18
|
|
|
|
#define CX88_BOARD_CONEXANT_DVB_T1 19
|
|
|
|
#define CX88_BOARD_PROVIDEO_PV259 20
|
|
|
|
#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS 21
|
|
|
|
#define CX88_BOARD_PCHDTV_HD3000 22
|
|
|
|
#define CX88_BOARD_DNTV_LIVE_DVB_T 23
|
|
|
|
#define CX88_BOARD_HAUPPAUGE_ROSLYN 24
|
2005-07-08 08:58:36 +08:00
|
|
|
#define CX88_BOARD_DIGITALLOGIC_MEC 25
|
2005-04-17 06:20:36 +08:00
|
|
|
#define CX88_BOARD_IODATA_GVBCTV7E 26
|
2005-06-24 13:04:53 +08:00
|
|
|
#define CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO 27
|
2005-06-24 13:05:03 +08:00
|
|
|
#define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T 28
|
2005-07-08 08:58:36 +08:00
|
|
|
#define CX88_BOARD_ADSTECH_DVB_T_PCI 29
|
2005-07-08 08:58:40 +08:00
|
|
|
#define CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1 30
|
2005-08-01 13:34:46 +08:00
|
|
|
#define CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD 31
|
2005-11-09 13:36:15 +08:00
|
|
|
#define CX88_BOARD_AVERMEDIA_ULTRATV_MC_550 32
|
2005-11-09 13:36:58 +08:00
|
|
|
#define CX88_BOARD_KWORLD_VSTREAM_EXPERT_DVD 33
|
2005-11-09 13:37:04 +08:00
|
|
|
#define CX88_BOARD_ATI_HDTVWONDER 34
|
2005-11-09 13:37:22 +08:00
|
|
|
#define CX88_BOARD_WINFAST_DTV1000 35
|
2005-11-09 13:38:34 +08:00
|
|
|
#define CX88_BOARD_AVERTV_303 36
|
2006-01-10 01:25:02 +08:00
|
|
|
#define CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1 37
|
|
|
|
#define CX88_BOARD_HAUPPAUGE_NOVASE2_S1 38
|
2006-01-10 01:25:02 +08:00
|
|
|
#define CX88_BOARD_KWORLD_DVBS_100 39
|
2006-01-10 01:25:12 +08:00
|
|
|
#define CX88_BOARD_HAUPPAUGE_HVR1100 40
|
|
|
|
#define CX88_BOARD_HAUPPAUGE_HVR1100LP 41
|
2006-01-10 01:25:35 +08:00
|
|
|
#define CX88_BOARD_DNTV_LIVE_DVB_T_PRO 42
|
2006-01-10 01:32:45 +08:00
|
|
|
#define CX88_BOARD_KWORLD_DVB_T_CX22702 43
|
2006-01-10 04:21:28 +08:00
|
|
|
#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL 44
|
2006-02-07 16:49:14 +08:00
|
|
|
#define CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT 45
|
2006-02-28 19:34:59 +08:00
|
|
|
#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID 46
|
2006-04-07 13:21:31 +08:00
|
|
|
#define CX88_BOARD_PCHDTV_HD5500 47
|
2006-04-13 23:41:43 +08:00
|
|
|
#define CX88_BOARD_KWORLD_MCE200_DELUXE 48
|
2006-05-10 05:27:48 +08:00
|
|
|
#define CX88_BOARD_PIXELVIEW_PLAYTV_P7000 49
|
2006-06-09 04:36:17 +08:00
|
|
|
#define CX88_BOARD_NPGTECH_REALTV_TOP10FM 50
|
2006-05-30 00:51:59 +08:00
|
|
|
#define CX88_BOARD_WINFAST_DTV2000H 51
|
2006-06-30 07:29:33 +08:00
|
|
|
#define CX88_BOARD_GENIATECH_DVBS 52
|
2006-08-08 20:10:04 +08:00
|
|
|
#define CX88_BOARD_HAUPPAUGE_HVR3000 53
|
2006-08-08 20:10:05 +08:00
|
|
|
#define CX88_BOARD_NORWOOD_MICRO 54
|
2006-08-08 20:10:05 +08:00
|
|
|
#define CX88_BOARD_TE_DTV_250_OEM_SWANN 55
|
2006-09-15 02:41:13 +08:00
|
|
|
#define CX88_BOARD_HAUPPAUGE_HVR1300 56
|
2007-05-18 05:10:17 +08:00
|
|
|
#define CX88_BOARD_ADSTECH_PTV_390 57
|
2008-01-06 03:53:01 +08:00
|
|
|
#define CX88_BOARD_PINNACLE_PCTV_HD_800i 58
|
2008-04-23 01:45:14 +08:00
|
|
|
#define CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO 59
|
2008-04-23 01:45:15 +08:00
|
|
|
#define CX88_BOARD_PINNACLE_HYBRID_PCTV 60
|
|
|
|
#define CX88_BOARD_WINFAST_TV2000_XP_GLOBAL 61
|
|
|
|
#define CX88_BOARD_POWERCOLOR_REAL_ANGEL 62
|
|
|
|
#define CX88_BOARD_GENIATECH_X8000_MT 63
|
2008-04-23 01:45:15 +08:00
|
|
|
#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO 64
|
2008-04-23 01:45:34 +08:00
|
|
|
#define CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD 65
|
2008-04-23 01:46:00 +08:00
|
|
|
#define CX88_BOARD_PROLINK_PV_8000GT 66
|
V4L/DVB (7448): Add support for Kworld ATSC 120
This board has a s5h1409 demod, plus a xc30x8 tuner (probably, xc3018).
This patch adds proper support for radio, video, s-video, composite and ATSC.
However, support for radio and video depends on having s5h1409 i2c gate open,
otherwise, xc30x8 chip won't be visible.
For a better support, some rework is needed on cx88 driver, to allow adding
xc30x8 to i2c bus without sending i2c 0 byte reading to 0xc2 address.
Thanks to Vanessa Ezekowitz <vanessaezekowitz@gmail.com> for helping to figure
out the proper parameters for s5h1409 and the GPIO pins used by each
configuration.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-03-28 10:18:30 +08:00
|
|
|
#define CX88_BOARD_KWORLD_ATSC_120 67
|
2008-09-04 12:17:33 +08:00
|
|
|
#define CX88_BOARD_HAUPPAUGE_HVR4000 68
|
|
|
|
#define CX88_BOARD_HAUPPAUGE_HVR4000LITE 69
|
2008-09-05 04:24:14 +08:00
|
|
|
#define CX88_BOARD_TEVII_S460 70
|
2008-09-17 22:30:21 +08:00
|
|
|
#define CX88_BOARD_OMICOM_SS4_PCI 71
|
2008-09-17 22:58:33 +08:00
|
|
|
#define CX88_BOARD_TBS_8920 72
|
2008-09-24 02:43:57 +08:00
|
|
|
#define CX88_BOARD_TEVII_S420 73
|
2008-09-29 23:08:29 +08:00
|
|
|
#define CX88_BOARD_PROLINK_PV_GLOBAL_XTREME 74
|
2008-10-08 17:48:08 +08:00
|
|
|
#define CX88_BOARD_PROF_7300 75
|
2008-11-10 02:25:31 +08:00
|
|
|
#define CX88_BOARD_SATTRADE_ST4200 76
|
|
|
|
#define CX88_BOARD_TBS_8910 77
|
2008-11-10 02:26:25 +08:00
|
|
|
#define CX88_BOARD_PROF_6200 78
|
2009-03-11 06:08:06 +08:00
|
|
|
#define CX88_BOARD_TERRATEC_CINERGY_HT_PCI_MKII 79
|
2009-03-29 01:22:21 +08:00
|
|
|
#define CX88_BOARD_HAUPPAUGE_IRONLY 80
|
2009-06-01 03:47:28 +08:00
|
|
|
#define CX88_BOARD_WINFAST_DTV1800H 81
|
2009-08-11 09:15:54 +08:00
|
|
|
#define CX88_BOARD_WINFAST_DTV2000H_J 82
|
2009-11-17 09:22:32 +08:00
|
|
|
#define CX88_BOARD_PROF_7301 83
|
2010-02-12 05:06:34 +08:00
|
|
|
#define CX88_BOARD_SAMSUNG_SMT_7020 84
|
2010-08-09 21:18:32 +08:00
|
|
|
#define CX88_BOARD_TWINHAN_VP1027_DVBS 85
|
2011-02-26 05:41:24 +08:00
|
|
|
#define CX88_BOARD_TEVII_S464 86
|
2011-06-08 00:14:53 +08:00
|
|
|
#define CX88_BOARD_WINFAST_DTV2000H_PLUS 87
|
2011-06-08 00:16:56 +08:00
|
|
|
#define CX88_BOARD_WINFAST_DTV1800H_XC4000 88
|
2011-12-12 07:20:24 +08:00
|
|
|
#define CX88_BOARD_WINFAST_TV2000_XP_GLOBAL_6F36 89
|
|
|
|
#define CX88_BOARD_WINFAST_TV2000_XP_GLOBAL_6F43 90
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
enum cx88_itype {
|
|
|
|
CX88_VMUX_COMPOSITE1 = 1,
|
|
|
|
CX88_VMUX_COMPOSITE2,
|
|
|
|
CX88_VMUX_COMPOSITE3,
|
|
|
|
CX88_VMUX_COMPOSITE4,
|
|
|
|
CX88_VMUX_SVIDEO,
|
|
|
|
CX88_VMUX_TELEVISION,
|
|
|
|
CX88_VMUX_CABLE,
|
|
|
|
CX88_VMUX_DVB,
|
|
|
|
CX88_VMUX_DEBUG,
|
|
|
|
CX88_RADIO,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cx88_input {
|
|
|
|
enum cx88_itype type;
|
|
|
|
u32 gpio0, gpio1, gpio2, gpio3;
|
2007-08-13 23:21:57 +08:00
|
|
|
unsigned int vmux:2;
|
2008-10-11 22:49:30 +08:00
|
|
|
unsigned int audioroute:4;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct cx88_board {
|
2010-08-25 20:50:20 +08:00
|
|
|
const char *name;
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned int tuner_type;
|
2005-06-24 13:05:03 +08:00
|
|
|
unsigned int radio_type;
|
|
|
|
unsigned char tuner_addr;
|
|
|
|
unsigned char radio_addr;
|
2005-04-17 06:20:36 +08:00
|
|
|
int tda9887_conf;
|
2005-09-10 04:03:41 +08:00
|
|
|
struct cx88_input input[MAX_CX88_INPUT];
|
2005-04-17 06:20:36 +08:00
|
|
|
struct cx88_input radio;
|
2006-09-25 23:43:45 +08:00
|
|
|
enum cx88_board_type mpeg;
|
2008-07-23 16:09:15 +08:00
|
|
|
unsigned int audio_chip;
|
2008-10-11 22:05:50 +08:00
|
|
|
int num_frontends;
|
2011-02-07 04:46:12 +08:00
|
|
|
|
|
|
|
/* Used for I2S devices */
|
|
|
|
int i2sinputcntl;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct cx88_subid {
|
|
|
|
u16 subvendor;
|
|
|
|
u16 subdevice;
|
|
|
|
u32 card;
|
|
|
|
};
|
|
|
|
|
2010-08-23 18:49:58 +08:00
|
|
|
enum cx88_tvaudio {
|
|
|
|
WW_NONE = 1,
|
|
|
|
WW_BTSC,
|
|
|
|
WW_BG,
|
|
|
|
WW_DK,
|
|
|
|
WW_I,
|
|
|
|
WW_L,
|
|
|
|
WW_EIAJ,
|
|
|
|
WW_I2SPT,
|
|
|
|
WW_FM,
|
|
|
|
WW_I2SADC,
|
|
|
|
WW_M
|
|
|
|
};
|
|
|
|
|
2007-08-16 01:41:57 +08:00
|
|
|
#define INPUT(nr) (core->board.input[nr])
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* device / file handle status */
|
|
|
|
|
|
|
|
#define RESOURCE_OVERLAY 1
|
|
|
|
#define RESOURCE_VIDEO 2
|
|
|
|
#define RESOURCE_VBI 4
|
|
|
|
|
2010-02-25 00:23:36 +08:00
|
|
|
#define BUFFER_TIMEOUT msecs_to_jiffies(2000)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* buffer for one video frame */
|
|
|
|
struct cx88_buffer {
|
|
|
|
/* common v4l buffer stuff -- must be first */
|
|
|
|
struct videobuf_buffer vb;
|
|
|
|
|
|
|
|
/* cx88 specific */
|
|
|
|
unsigned int bpl;
|
|
|
|
struct btcx_riscmem risc;
|
2010-08-25 20:50:20 +08:00
|
|
|
const struct cx8800_fmt *fmt;
|
2005-04-17 06:20:36 +08:00
|
|
|
u32 count;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cx88_dmaqueue {
|
|
|
|
struct list_head active;
|
|
|
|
struct list_head queued;
|
|
|
|
struct timer_list timeout;
|
|
|
|
struct btcx_riscmem stopper;
|
|
|
|
u32 count;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cx88_core {
|
|
|
|
struct list_head devlist;
|
|
|
|
atomic_t refcount;
|
|
|
|
|
|
|
|
/* board name */
|
|
|
|
int nr;
|
|
|
|
char name[32];
|
|
|
|
|
|
|
|
/* pci stuff */
|
|
|
|
int pci_bus;
|
|
|
|
int pci_slot;
|
2005-11-09 13:37:43 +08:00
|
|
|
u32 __iomem *lmmio;
|
|
|
|
u8 __iomem *bmmio;
|
2005-04-17 06:20:36 +08:00
|
|
|
u32 shadow[SHADOW_MAX];
|
|
|
|
int pci_irqmask;
|
|
|
|
|
|
|
|
/* i2c i/o */
|
|
|
|
struct i2c_adapter i2c_adap;
|
|
|
|
struct i2c_algo_bit_data i2c_algo;
|
|
|
|
struct i2c_client i2c_client;
|
|
|
|
u32 i2c_state, i2c_rc;
|
|
|
|
|
|
|
|
/* config info -- analog */
|
2009-03-14 23:40:51 +08:00
|
|
|
struct v4l2_device v4l2_dev;
|
2009-03-29 19:26:01 +08:00
|
|
|
struct i2c_client *i2c_rtc;
|
2007-08-16 01:41:57 +08:00
|
|
|
unsigned int boardnr;
|
|
|
|
struct cx88_board board;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-01-10 01:25:17 +08:00
|
|
|
/* Supported V4L _STD_ tuner formats */
|
|
|
|
unsigned int tuner_formats;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* config info -- dvb */
|
2007-10-04 15:54:11 +08:00
|
|
|
#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
|
V4L/DVB (10190): cx88: Fix some Kbuild troubles
As Randy Dunlap <randy.dunlap@oracle.com> reported, cx88 has some compilation issues:
drivers/built-in.o: In function `cx88_call_i2c_clients':
(.text+0x20af17): undefined reference to `videobuf_dvb_get_frontend'
drivers/built-in.o: In function `cx8802_probe':
cx88-mpeg.c:(.devinit.text+0x268c4): undefined reference to `videobuf_dvb_alloc_frontend'
cx88-mpeg.c:(.devinit.text+0x268ea): undefined reference to `videobuf_dvb_dealloc_frontends'
With those configs:
CONFIG_VIDEO_CX88=y
CONFIG_VIDEO_CX88_BLACKBIRD=y
CONFIG_VIDEO_CX88_DVB=m
CONFIG_DVB_CORE=m
After carefully examining the code, with the current code, several cx88 drivers
(cx8800, cx8802, cx88_dvb and cx88_blackbird) should be compiled as a module,
if one of them is marked as such. Just fixing Kconfig could create a very complex
set of rules. Also, this hides a problem with the current approach where the dvb
functionality weren't confined inside dvb module.
What happens is that:
- cx88-i2c (part of cx8800) has some special rules if DVB;
- cx88-mpeg (cx8802 module) has also part of DVB init code;
- cx88-dvb has the rest of the dvb code;
- cx88-blackbird can be used with cx88-mpeg, having cx88-dvb or not.
So, instead of doing some tricks at Kconfig and wait for a next breakage,
this patch moves the dvb code inside cx88-i2c and cx88-mpeg into cx88-dvb.
Another problem is that cx8802 were being compiled, even without cx88-dvb
and cx88-blackbird modules.
While on this code, let's fix also a reported problem:
http://www.linuxtv.org/pipermail/linux-dvb/2009-January/031225.html
A solution for the issue were proposed here:
http://www.mail-archive.com/linux-media@vger.kernel.org/msg00021.html
Thanks to Randy, Andy, Gregoire and Thomas for helping us to detect
and solve the issues.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-07 03:06:07 +08:00
|
|
|
int (*prev_set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage);
|
2007-01-31 10:26:01 +08:00
|
|
|
#endif
|
2009-01-09 04:13:53 +08:00
|
|
|
void (*gate_ctrl)(struct cx88_core *core, int open);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* state info */
|
|
|
|
struct task_struct *kthread;
|
2007-01-21 00:58:33 +08:00
|
|
|
v4l2_std_id tvnorm;
|
2010-08-23 18:49:58 +08:00
|
|
|
enum cx88_tvaudio tvaudio;
|
2005-04-17 06:20:36 +08:00
|
|
|
u32 audiomode_manual;
|
|
|
|
u32 audiomode_current;
|
|
|
|
u32 input;
|
2011-07-14 23:44:46 +08:00
|
|
|
u32 last_analog_input;
|
2005-04-17 06:20:36 +08:00
|
|
|
u32 astat;
|
2005-11-09 13:36:27 +08:00
|
|
|
u32 use_nicam;
|
2009-04-01 06:01:51 +08:00
|
|
|
unsigned long last_change;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* IR remote control state */
|
|
|
|
struct cx88_IR *ir;
|
2005-09-10 04:03:41 +08:00
|
|
|
|
2010-09-23 11:51:44 +08:00
|
|
|
/* I2C remote data */
|
|
|
|
struct IR_i2c_init_data init_data;
|
2011-02-07 04:46:12 +08:00
|
|
|
struct wm8775_platform_data wm8775_data;
|
2010-09-23 11:51:44 +08:00
|
|
|
|
2006-02-07 16:49:14 +08:00
|
|
|
struct mutex lock;
|
2005-09-10 04:03:41 +08:00
|
|
|
/* various v4l controls */
|
|
|
|
u32 freq;
|
2011-05-01 17:31:40 +08:00
|
|
|
int users;
|
2011-05-01 17:31:04 +08:00
|
|
|
int mpeg_users;
|
2006-01-10 01:25:12 +08:00
|
|
|
|
|
|
|
/* cx88-video needs to access cx8802 for hybrid tuner pll access. */
|
|
|
|
struct cx8802_dev *dvbdev;
|
2006-12-03 07:15:51 +08:00
|
|
|
enum cx88_board_type active_type_id;
|
2008-02-12 00:00:34 +08:00
|
|
|
int active_ref;
|
2008-10-11 22:05:50 +08:00
|
|
|
int active_fe_id;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2009-03-14 23:40:51 +08:00
|
|
|
static inline struct cx88_core *to_core(struct v4l2_device *v4l2_dev)
|
|
|
|
{
|
|
|
|
return container_of(v4l2_dev, struct cx88_core, v4l2_dev);
|
|
|
|
}
|
|
|
|
|
2011-02-07 04:46:12 +08:00
|
|
|
#define WM8775_GID (1 << 0)
|
|
|
|
|
|
|
|
#define call_hw(core, grpid, o, f, args...) \
|
2009-03-29 19:26:01 +08:00
|
|
|
do { \
|
|
|
|
if (!core->i2c_rc) { \
|
|
|
|
if (core->gate_ctrl) \
|
|
|
|
core->gate_ctrl(core, 1); \
|
2011-02-07 04:46:12 +08:00
|
|
|
v4l2_device_call_all(&core->v4l2_dev, grpid, o, f, ##args); \
|
2009-03-29 19:26:01 +08:00
|
|
|
if (core->gate_ctrl) \
|
|
|
|
core->gate_ctrl(core, 0); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2011-02-07 04:46:12 +08:00
|
|
|
#define call_all(core, o, f, args...) call_hw(core, 0, o, f, ##args)
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
struct cx8800_dev;
|
|
|
|
struct cx8802_dev;
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* function 0: video stuff */
|
|
|
|
|
|
|
|
struct cx8800_fh {
|
|
|
|
struct cx8800_dev *dev;
|
|
|
|
enum v4l2_buf_type type;
|
|
|
|
int radio;
|
|
|
|
unsigned int resources;
|
|
|
|
|
|
|
|
/* video overlay */
|
|
|
|
struct v4l2_window win;
|
|
|
|
struct v4l2_clip *clips;
|
|
|
|
unsigned int nclips;
|
|
|
|
|
|
|
|
/* video capture */
|
2010-08-25 20:50:20 +08:00
|
|
|
const struct cx8800_fmt *fmt;
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned int width,height;
|
|
|
|
struct videobuf_queue vidq;
|
|
|
|
|
|
|
|
/* vbi capture */
|
|
|
|
struct videobuf_queue vbiq;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cx8800_suspend_state {
|
|
|
|
int disabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cx8800_dev {
|
|
|
|
struct cx88_core *core;
|
2005-09-10 04:03:41 +08:00
|
|
|
spinlock_t slock;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* various device info */
|
|
|
|
unsigned int resources;
|
|
|
|
struct video_device *video_dev;
|
|
|
|
struct video_device *vbi_dev;
|
|
|
|
struct video_device *radio_dev;
|
|
|
|
|
|
|
|
/* pci i/o */
|
|
|
|
struct pci_dev *pci;
|
|
|
|
unsigned char pci_rev,pci_lat;
|
|
|
|
|
|
|
|
|
|
|
|
/* capture queues */
|
|
|
|
struct cx88_dmaqueue vidq;
|
|
|
|
struct cx88_dmaqueue vbiq;
|
|
|
|
|
|
|
|
/* various v4l controls */
|
|
|
|
|
|
|
|
/* other global state info */
|
|
|
|
struct cx8800_suspend_state state;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* function 1: audio/alsa stuff */
|
2005-09-10 04:03:41 +08:00
|
|
|
/* =============> moved to cx88-alsa.c <====================== */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* function 2: mpeg stuff */
|
|
|
|
|
|
|
|
struct cx8802_fh {
|
|
|
|
struct cx8802_dev *dev;
|
|
|
|
struct videobuf_queue mpegq;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cx8802_suspend_state {
|
|
|
|
int disabled;
|
|
|
|
};
|
|
|
|
|
2006-12-03 07:15:51 +08:00
|
|
|
struct cx8802_driver {
|
|
|
|
struct cx88_core *core;
|
V4L/DVB (6334): cx88: Change (struct cx8802_dev)->drvlist to a list_head and fix bugs
It was a struct cx8802_driver for no apparent reason. Nothing uses a
cx8802_driver in the cx8802_dev struct. The only field that was used was
devlist, a list_head.
The code in cx8802_remove() that removed any loaded sub-drivers was broken.
It would delete the current list entry, but didn't use list_for_each_safe. It
also called list_del() on the list _head_ inside the list_for_each loop? It
would crash if it was run, which I don't think can ever happen.
Since the cx8802 sub-drivers use the cx8802 driver, they have to be unloaded
first. So there isn't any way for a sub-driver to still be loaded when
cx8802_remove() is called... Except maybe with PCI hot-plug, if one removes
the PCI card while the drivers are loaded?
So I left some code in to handle that if it's actually possible. It will
remove the sub-drivers from the device cx8802_remove() was called on, and only
that device. If one has two DVB cards and unplugs one, there is no reason to
unload the DVB drivers for both cards. I have no way to test this, but it
can't be worse than what was there before.
cx8802_get_driver() is passed a cx8802_dev pointer and looks for the requested
driver on that device. It first loops over the cx8802 device list looking for
the device it was passed, which is pointless. It doesn't need to find the
device pointer in the list, as it already has the pointer.
The list_head in the cx8802_driver struct, which joins all the _drivers_
attached to a device, was named devlist. Changed that to drvlist, since the
devlist is used for a list of _devices_ in other cx8802 structs.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Reviewed-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-14 13:52:17 +08:00
|
|
|
|
|
|
|
/* List of drivers attached to device */
|
|
|
|
struct list_head drvlist;
|
2006-12-03 07:15:51 +08:00
|
|
|
|
|
|
|
/* Type of driver and access required */
|
|
|
|
enum cx88_board_type type_id;
|
|
|
|
enum cx8802_board_access hw_access;
|
|
|
|
|
|
|
|
/* MPEG 8802 internal only */
|
|
|
|
int (*suspend)(struct pci_dev *pci_dev, pm_message_t state);
|
|
|
|
int (*resume)(struct pci_dev *pci_dev);
|
|
|
|
|
2011-05-01 17:29:37 +08:00
|
|
|
/* Callers to the following functions must hold core->lock */
|
|
|
|
|
2011-05-01 17:29:56 +08:00
|
|
|
/* MPEG 8802 -> mini driver - Driver probe and configuration */
|
|
|
|
int (*probe)(struct cx8802_driver *drv);
|
2006-12-03 07:15:51 +08:00
|
|
|
int (*remove)(struct cx8802_driver *drv);
|
|
|
|
|
|
|
|
/* MPEG 8802 -> mini driver - Access for hardware control */
|
|
|
|
int (*advise_acquire)(struct cx8802_driver *drv);
|
|
|
|
int (*advise_release)(struct cx8802_driver *drv);
|
|
|
|
|
|
|
|
/* MPEG 8802 <- mini driver - Access for hardware control */
|
|
|
|
int (*request_acquire)(struct cx8802_driver *drv);
|
|
|
|
int (*request_release)(struct cx8802_driver *drv);
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
struct cx8802_dev {
|
|
|
|
struct cx88_core *core;
|
2005-09-10 04:03:41 +08:00
|
|
|
spinlock_t slock;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* pci i/o */
|
|
|
|
struct pci_dev *pci;
|
|
|
|
unsigned char pci_rev,pci_lat;
|
|
|
|
|
|
|
|
/* dma queues */
|
|
|
|
struct cx88_dmaqueue mpegq;
|
|
|
|
u32 ts_packet_size;
|
|
|
|
u32 ts_packet_count;
|
|
|
|
|
|
|
|
/* other global state info */
|
|
|
|
struct cx8802_suspend_state state;
|
|
|
|
|
|
|
|
/* for blackbird only */
|
|
|
|
struct list_head devlist;
|
2007-10-14 13:52:16 +08:00
|
|
|
#if defined(CONFIG_VIDEO_CX88_BLACKBIRD) || \
|
|
|
|
defined(CONFIG_VIDEO_CX88_BLACKBIRD_MODULE)
|
2005-04-17 06:20:36 +08:00
|
|
|
struct video_device *mpeg_dev;
|
|
|
|
u32 mailbox;
|
|
|
|
int width;
|
|
|
|
int height;
|
2007-05-22 01:36:01 +08:00
|
|
|
unsigned char mpeg_active; /* nonzero if mpeg encoder is active */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-10-14 13:52:16 +08:00
|
|
|
/* mpeg params */
|
|
|
|
struct cx2341x_mpeg_params params;
|
|
|
|
#endif
|
|
|
|
|
2007-10-04 15:54:11 +08:00
|
|
|
#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
|
2005-04-17 06:20:36 +08:00
|
|
|
/* for dvb only */
|
2008-10-11 22:05:50 +08:00
|
|
|
struct videobuf_dvb_frontends frontends;
|
2007-10-14 13:52:16 +08:00
|
|
|
#endif
|
2006-01-10 01:25:35 +08:00
|
|
|
|
2007-10-14 13:52:16 +08:00
|
|
|
#if defined(CONFIG_VIDEO_CX88_VP3054) || \
|
|
|
|
defined(CONFIG_VIDEO_CX88_VP3054_MODULE)
|
|
|
|
/* For VP3045 secondary I2C bus support */
|
|
|
|
struct vp3054_i2c_state *vp3054;
|
2007-01-31 10:26:01 +08:00
|
|
|
#endif
|
2005-04-17 06:20:36 +08:00
|
|
|
/* for switching modulation types */
|
|
|
|
unsigned char ts_gen_cntrl;
|
2005-11-09 13:36:17 +08:00
|
|
|
|
2011-05-01 17:29:16 +08:00
|
|
|
/* List of attached drivers; must hold core->lock to access */
|
V4L/DVB (6334): cx88: Change (struct cx8802_dev)->drvlist to a list_head and fix bugs
It was a struct cx8802_driver for no apparent reason. Nothing uses a
cx8802_driver in the cx8802_dev struct. The only field that was used was
devlist, a list_head.
The code in cx8802_remove() that removed any loaded sub-drivers was broken.
It would delete the current list entry, but didn't use list_for_each_safe. It
also called list_del() on the list _head_ inside the list_for_each loop? It
would crash if it was run, which I don't think can ever happen.
Since the cx8802 sub-drivers use the cx8802 driver, they have to be unloaded
first. So there isn't any way for a sub-driver to still be loaded when
cx8802_remove() is called... Except maybe with PCI hot-plug, if one removes
the PCI card while the drivers are loaded?
So I left some code in to handle that if it's actually possible. It will
remove the sub-drivers from the device cx8802_remove() was called on, and only
that device. If one has two DVB cards and unplugs one, there is no reason to
unload the DVB drivers for both cards. I have no way to test this, but it
can't be worse than what was there before.
cx8802_get_driver() is passed a cx8802_dev pointer and looks for the requested
driver on that device. It first loops over the cx8802 device list looking for
the device it was passed, which is pointless. It doesn't need to find the
device pointer in the list, as it already has the pointer.
The list_head in the cx8802_driver struct, which joins all the _drivers_
attached to a device, was named devlist. Changed that to drvlist, since the
devlist is used for a list of _devices_ in other cx8802 structs.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Reviewed-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-14 13:52:17 +08:00
|
|
|
struct list_head drvlist;
|
2011-05-01 17:29:16 +08:00
|
|
|
|
V4L/DVB (6334): cx88: Change (struct cx8802_dev)->drvlist to a list_head and fix bugs
It was a struct cx8802_driver for no apparent reason. Nothing uses a
cx8802_driver in the cx8802_dev struct. The only field that was used was
devlist, a list_head.
The code in cx8802_remove() that removed any loaded sub-drivers was broken.
It would delete the current list entry, but didn't use list_for_each_safe. It
also called list_del() on the list _head_ inside the list_for_each loop? It
would crash if it was run, which I don't think can ever happen.
Since the cx8802 sub-drivers use the cx8802 driver, they have to be unloaded
first. So there isn't any way for a sub-driver to still be loaded when
cx8802_remove() is called... Except maybe with PCI hot-plug, if one removes
the PCI card while the drivers are loaded?
So I left some code in to handle that if it's actually possible. It will
remove the sub-drivers from the device cx8802_remove() was called on, and only
that device. If one has two DVB cards and unplugs one, there is no reason to
unload the DVB drivers for both cards. I have no way to test this, but it
can't be worse than what was there before.
cx8802_get_driver() is passed a cx8802_dev pointer and looks for the requested
driver on that device. It first loops over the cx8802 device list looking for
the device it was passed, which is pointless. It doesn't need to find the
device pointer in the list, as it already has the pointer.
The list_head in the cx8802_driver struct, which joins all the _drivers_
attached to a device, was named devlist. Changed that to drvlist, since the
devlist is used for a list of _devices_ in other cx8802 structs.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Reviewed-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-14 13:52:17 +08:00
|
|
|
struct work_struct request_module_wk;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
|
|
|
|
#define cx_read(reg) readl(core->lmmio + ((reg)>>2))
|
|
|
|
#define cx_write(reg,value) writel((value), core->lmmio + ((reg)>>2))
|
|
|
|
#define cx_writeb(reg,value) writeb((value), core->bmmio + (reg))
|
|
|
|
|
|
|
|
#define cx_andor(reg,mask,value) \
|
|
|
|
writel((readl(core->lmmio+((reg)>>2)) & ~(mask)) |\
|
|
|
|
((value) & (mask)), core->lmmio+((reg)>>2))
|
|
|
|
#define cx_set(reg,bit) cx_andor((reg),(bit),(bit))
|
|
|
|
#define cx_clear(reg,bit) cx_andor((reg),(bit),0)
|
|
|
|
|
|
|
|
#define cx_wait(d) { if (need_resched()) schedule(); else udelay(d); }
|
|
|
|
|
|
|
|
/* shadow registers */
|
|
|
|
#define cx_sread(sreg) (core->shadow[sreg])
|
|
|
|
#define cx_swrite(sreg,reg,value) \
|
|
|
|
(core->shadow[sreg] = value, \
|
|
|
|
writel(core->shadow[sreg], core->lmmio + ((reg)>>2)))
|
|
|
|
#define cx_sandor(sreg,reg,mask,value) \
|
|
|
|
(core->shadow[sreg] = (core->shadow[sreg] & ~(mask)) | ((value) & (mask)), \
|
|
|
|
writel(core->shadow[sreg], core->lmmio + ((reg)>>2)))
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* cx88-core.c */
|
|
|
|
|
2010-08-25 20:50:20 +08:00
|
|
|
extern void cx88_print_irqbits(const char *name, const char *tag, const char *strings[],
|
2007-03-29 19:47:04 +08:00
|
|
|
int len, u32 bits, u32 mask);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
extern int cx88_core_irq(struct cx88_core *core, u32 status);
|
|
|
|
extern void cx88_wakeup(struct cx88_core *core,
|
|
|
|
struct cx88_dmaqueue *q, u32 count);
|
|
|
|
extern void cx88_shutdown(struct cx88_core *core);
|
|
|
|
extern int cx88_reset(struct cx88_core *core);
|
|
|
|
|
|
|
|
extern int
|
|
|
|
cx88_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
|
|
|
|
struct scatterlist *sglist,
|
|
|
|
unsigned int top_offset, unsigned int bottom_offset,
|
|
|
|
unsigned int bpl, unsigned int padding, unsigned int lines);
|
|
|
|
extern int
|
|
|
|
cx88_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc,
|
|
|
|
struct scatterlist *sglist, unsigned int bpl,
|
V4L/DVB (6083): cx88-alsa: Rework buffer handling
Rework the way the DMA buffer is handled and IRQs are generated.
ALSA uses a ring-buffer of multiple periods. Each period is supposed to
corrispond to one IRQ.
The existing driver was generating one interrupt per ring-buffer, as opposed
to per period. This meant that as soon as the IRQ was generated, the hardware
was already starting to re-write the beginning of the buffer. Since the DMA
happens on a per-line basis, there was only a narrow window to copy the data
out before the buffer was overwritten.
The cx88 core RISC program generator is modified so that it can set the IRQ
and counter flags to count every X lines of DMA transfer. This way we can
generate an interrupt every period instead of every full ring-buffer. Right
now only period of one line are supported, but it should be possible to
support longer periods. Note that a WRITE instruction generates an IRQ when
it starts, not when the transfer is finished. Thus to generate an IRQ when
line X is done, one must set the IRQ flag on the instruction that starts line
X+1, not the one that ends line X.
Change the line size so that there are four lines in the SRAM FIFO. If there
are not four lines, the analog output from the cx88's internal DACs is full of
clicks and pops.
Try to handle FIFO sync errors. Sometimes the chip generates many of these
errors before audio data starts. Up to 50 sync errors will be ignored and the
counter reset.
Have the IRQ handler save the RISC counter to the chip struct, and then have
the pointer callback use this to calculate the pointer position. We could
read the counter from the pointer callback, but sometimes the sync errors on
start up cause the counter to go crazy. ALSA sees this and thinks there has
been an overrun. The IRQ hander can avoid saving the counter position on
sync errors.
The chip "opened" flag wasn't necessary. ALSA won't try to open the same
substream multiple times. Probably this code was cut&pasted from the bt87x
driver, which has multiple sub-streams for one chip.
Do error checking for the videobuf mapping functions.
snd_card_cx88_runtime_free() is useless and can be deleted.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-08-24 12:06:34 +08:00
|
|
|
unsigned int lines, unsigned int lpi);
|
2005-04-17 06:20:36 +08:00
|
|
|
extern int
|
|
|
|
cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
|
|
|
|
u32 reg, u32 mask, u32 value);
|
|
|
|
extern void
|
2006-03-10 23:29:15 +08:00
|
|
|
cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
extern void cx88_risc_disasm(struct cx88_core *core,
|
|
|
|
struct btcx_riscmem *risc);
|
|
|
|
extern int cx88_sram_channel_setup(struct cx88_core *core,
|
2010-08-25 20:50:20 +08:00
|
|
|
const struct sram_channel *ch,
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned int bpl, u32 risc);
|
|
|
|
extern void cx88_sram_channel_dump(struct cx88_core *core,
|
2010-08-25 20:50:20 +08:00
|
|
|
const struct sram_channel *ch);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
extern int cx88_set_scale(struct cx88_core *core, unsigned int width,
|
|
|
|
unsigned int height, enum v4l2_field field);
|
2007-01-21 00:58:33 +08:00
|
|
|
extern int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
extern struct video_device *cx88_vdev_init(struct cx88_core *core,
|
|
|
|
struct pci_dev *pci,
|
2010-08-25 20:50:20 +08:00
|
|
|
const struct video_device *template_,
|
|
|
|
const char *type);
|
2005-04-17 06:20:36 +08:00
|
|
|
extern struct cx88_core* cx88_core_get(struct pci_dev *pci);
|
|
|
|
extern void cx88_core_put(struct cx88_core *core,
|
|
|
|
struct pci_dev *pci);
|
|
|
|
|
2005-12-01 16:51:34 +08:00
|
|
|
extern int cx88_start_audio_dma(struct cx88_core *core);
|
|
|
|
extern int cx88_stop_audio_dma(struct cx88_core *core);
|
|
|
|
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* cx88-vbi.c */
|
|
|
|
|
2007-01-21 00:58:17 +08:00
|
|
|
/* Can be used as g_vbi_fmt, try_vbi_fmt and s_vbi_fmt */
|
|
|
|
int cx8800_vbi_fmt (struct file *file, void *priv,
|
|
|
|
struct v4l2_format *f);
|
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
/*
|
|
|
|
int cx8800_start_vbi_dma(struct cx8800_dev *dev,
|
|
|
|
struct cx88_dmaqueue *q,
|
|
|
|
struct cx88_buffer *buf);
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
int cx8800_stop_vbi_dma(struct cx8800_dev *dev);
|
|
|
|
int cx8800_restart_vbi_queue(struct cx8800_dev *dev,
|
|
|
|
struct cx88_dmaqueue *q);
|
|
|
|
void cx8800_vbi_timeout(unsigned long data);
|
|
|
|
|
2010-08-25 20:50:20 +08:00
|
|
|
extern const struct videobuf_queue_ops cx8800_vbi_qops;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* cx88-i2c.c */
|
|
|
|
|
|
|
|
extern int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci);
|
|
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* cx88-cards.c */
|
|
|
|
|
2008-09-13 00:31:45 +08:00
|
|
|
extern int cx88_tuner_callback(void *dev, int component, int command, int arg);
|
2007-08-16 01:41:58 +08:00
|
|
|
extern int cx88_get_resources(const struct cx88_core *core,
|
|
|
|
struct pci_dev *pci);
|
|
|
|
extern struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr);
|
V4L/DVB (7448): Add support for Kworld ATSC 120
This board has a s5h1409 demod, plus a xc30x8 tuner (probably, xc3018).
This patch adds proper support for radio, video, s-video, composite and ATSC.
However, support for radio and video depends on having s5h1409 i2c gate open,
otherwise, xc30x8 chip won't be visible.
For a better support, some rework is needed on cx88 driver, to allow adding
xc30x8 to i2c bus without sending i2c 0 byte reading to 0xc2 address.
Thanks to Vanessa Ezekowitz <vanessaezekowitz@gmail.com> for helping to figure
out the proper parameters for s5h1409 and the GPIO pins used by each
configuration.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-03-28 10:18:30 +08:00
|
|
|
extern void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* cx88-tvaudio.c */
|
|
|
|
|
|
|
|
void cx88_set_tvaudio(struct cx88_core *core);
|
|
|
|
void cx88_newstation(struct cx88_core *core);
|
|
|
|
void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t);
|
|
|
|
void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual);
|
|
|
|
int cx88_audio_thread(void *data);
|
|
|
|
|
2006-12-03 07:15:51 +08:00
|
|
|
int cx8802_register_driver(struct cx8802_driver *drv);
|
|
|
|
int cx8802_unregister_driver(struct cx8802_driver *drv);
|
2011-05-01 17:29:16 +08:00
|
|
|
|
|
|
|
/* Caller must hold core->lock */
|
2006-12-03 07:15:51 +08:00
|
|
|
struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype);
|
|
|
|
|
2009-04-01 06:01:51 +08:00
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* cx88-dsp.c */
|
|
|
|
|
|
|
|
s32 cx88_dsp_detect_stereo_sap(struct cx88_core *core);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* cx88-input.c */
|
|
|
|
|
|
|
|
int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci);
|
|
|
|
int cx88_ir_fini(struct cx88_core *core);
|
|
|
|
void cx88_ir_irq(struct cx88_core *core);
|
2010-04-01 03:07:49 +08:00
|
|
|
int cx88_ir_start(struct cx88_core *core);
|
|
|
|
void cx88_ir_stop(struct cx88_core *core);
|
2010-09-23 11:51:44 +08:00
|
|
|
extern void cx88_i2c_init_ir(struct cx88_core *core);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* cx88-mpeg.c */
|
|
|
|
|
2006-03-10 23:29:15 +08:00
|
|
|
int cx8802_buf_prepare(struct videobuf_queue *q,struct cx8802_dev *dev,
|
|
|
|
struct cx88_buffer *buf, enum v4l2_field field);
|
2005-04-17 06:20:36 +08:00
|
|
|
void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf);
|
|
|
|
void cx8802_cancel_buffers(struct cx8802_dev *dev);
|
|
|
|
|
2005-09-10 04:03:41 +08:00
|
|
|
/* ----------------------------------------------------------- */
|
2007-01-21 00:58:26 +08:00
|
|
|
/* cx88-video.c*/
|
2006-06-27 10:42:39 +08:00
|
|
|
extern const u32 cx88_user_ctrls[];
|
2008-03-24 09:43:21 +08:00
|
|
|
extern int cx8800_ctrl_query(struct cx88_core *core,
|
|
|
|
struct v4l2_queryctrl *qctrl);
|
2007-01-21 00:58:26 +08:00
|
|
|
int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i);
|
|
|
|
int cx88_set_freq (struct cx88_core *core,struct v4l2_frequency *f);
|
|
|
|
int cx88_get_control(struct cx88_core *core, struct v4l2_control *ctl);
|
|
|
|
int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl);
|
|
|
|
int cx88_video_mux(struct cx88_core *core, unsigned int input);
|