Merge kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git with fixups

This merges the DVB tree, but fixes up the history that had gotten
screwed up by a broken commit.

The history is fixed up by re-doing the commit properly (taking the
resolve from the final result of the original), and then cherry-picking
the commits that followed the broken merge.

* dvb: (190 commits)
  V4L/DVB (3545): Fixed no_overlay option and quirks on saa7134 driver
  V4L/DVB (3543): Fix Makefile to adapt to bt8xx/ conversion
  V4L/DVB (3538): Bt8xx documentation update
  V4L/DVB (3537a): Whitespace cleanup
  V4L/DVB (3533): Add WSS (wide screen signalling) module parameters
  V4L/DVB (3532): Moved duplicated code of ALPS BSRU6 tuner to a standalone file.
  V4L/DVB (3530): Kconfig: remove VIDEO_AUDIO_DECODER
  V4L/DVB (3529): Kconfig: add menu items for cs53l32a and wm8775 A/D converters
  V4L/DVB (3528): Kconfig: fix ATSC frontend menu item names by manufacturer
  V4L/DVB (3527): VIDEO_CPIA2 must depend on USB
  V4L/DVB (3525): Kconfig: remove VIDEO_DECODER
  V4L/DVB (3524): Kconfig: add menu items for saa7115 and saa7127
  V4L/DVB (3494): Kconfig: select VIDEO_MSP3400 to build msp3400.ko
  V4L/DVB (3522): Fixed a trouble with other PAL standards
  V4L/DVB (3521): Avoid warnings at video-buf.c
  V4L/DVB (3514): SAA7113 doesn't have auto std chroma detection mode
  V4L/DVB (3513): Remove saa711x driver
  V4L/DVB (3509): Make a needlessly global function static.
  V4L/DVB (3506): Cinergy T2 dmx cleanup on disconnect
  V4L/DVB (3504): Medion 7134: Autodetect second bridge chip
  ...

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Linus Torvalds 2006-03-21 09:01:08 -08:00
commit f0481730c8
176 changed files with 14610 additions and 5912 deletions

2
.gitignore vendored
View File

@ -30,3 +30,5 @@ include/linux/autoconf.h
include/linux/compile.h
include/linux/version.h
# stgit generated dirs
patches-*

View File

@ -1,4 +1,3 @@
HOWTO: Get An Avermedia DVB-T working under Linux
______________________________________________
@ -137,11 +136,8 @@ Getting the card going
To power up the card, load the following modules in the
following order:
* insmod dvb-core.o
* modprobe bttv.o
* insmod bt878.o
* insmod dvb-bt8xx.o
* insmod sp887x.o
* modprobe bttv (normally loaded automatically)
* modprobe dvb-bt8xx (or place dvb-bt8xx in /etc/modules)
Insertion of these modules into the running kernel will
activate the appropriate DVB device nodes. It is then possible
@ -302,4 +298,4 @@ Further Update
Many thanks to Nigel Pearson for the updates to this document
since the recent revision of the driver.
January 29th 2004
February 14th 2006

View File

@ -1,118 +1,78 @@
How to get the Nebula, PCTV, FusionHDTV Lite and Twinhan DST cards working
==========================================================================
How to get the bt8xx cards working
==================================
This class of cards has a bt878a as the PCI interface, and
require the bttv driver.
1) General information
======================
Please pay close attention to the warning about the bttv module
options below for the DST card.
This class of cards has a bt878a as the PCI interface, and require the bttv driver
for accessing the i2c bus and the gpio pins of the bt8xx chipset.
Please see Documentation/dvb/cards.txt => o Cards based on the Conexant Bt8xx PCI bridge:
1) General informations
=======================
These drivers require the bttv driver to provide the means to access
the i2c bus and the gpio pins of the bt8xx chipset.
Because of this, you need to enable
"Device drivers" => "Multimedia devices"
=> "Video For Linux" => "BT848 Video For Linux"
Furthermore you need to enable
"Device drivers" => "Multimedia devices" => "Digital Video Broadcasting Devices"
=> "DVB for Linux" "DVB Core Support" "BT8xx based PCI cards"
Compiling kernel please enable:
a.)"Device drivers" => "Multimedia devices" => "Video For Linux" => "BT848 Video For Linux"
b.)"Device drivers" => "Multimedia devices" => "Digital Video Broadcasting Devices"
=> "DVB for Linux" "DVB Core Support" "Bt8xx based PCI Cards"
2) Loading Modules
==================
In general you need to load the bttv driver, which will handle the gpio and
i2c communication for us, plus the common dvb-bt8xx device driver.
The frontends for Nebula (nxt6000), Pinnacle PCTV (cx24110), TwinHan (dst),
FusionHDTV DVB-T Lite (mt352) and FusionHDTV5 Lite (lgdt330x) are loaded
automatically by the dvb-bt8xx device driver.
In default cases bttv is loaded automatically.
To load the backend either place dvb-bt8xx in etc/modules, or apply manually:
3a) Nebula / Pinnacle PCTV / FusionHDTV Lite
---------------------------------------------
$ modprobe dvb-bt8xx
$ modprobe bttv (normally bttv is being loaded automatically by kmod)
$ modprobe dvb-bt8xx
All frontends will be loaded automatically.
People running udev please see Documentation/dvb/udev.txt.
(or just place dvb-bt8xx in /etc/modules for automatic loading)
In the following cases overriding the PCI type detection for dvb-bt8xx might be necessary:
2a) Running TwinHan and Clones
------------------------------
3b) TwinHan and Clones
$ modprobe bttv card=113
$ modprobe dvb-bt8xx
$ modprobe dst
Useful parameters for verbosity level and debugging the dst module:
verbose=0: messages are disabled
1: only error messages are displayed
2: notifications are displayed
3: other useful messages are displayed
4: debug setting
dst_addons=0: card is a free to air (FTA) card only
0x20: card has a conditional access slot for scrambled channels
The autodetected values are determined by the cards' "response string".
In your logs see f. ex.: dst_get_device_id: Recognize [DSTMCI].
For bug reports please send in a complete log with verbose=4 activated.
Please also see Documentation/dvb/ci.txt.
2b) Running multiple cards
--------------------------
$ modprobe bttv card=0x71
$ modprobe dvb-bt8xx
$ modprobe dst
Examples of card ID's:
The value 0x71 will override the PCI type detection for dvb-bt8xx,
which is necessary for TwinHan cards. Omission of this parameter might result
in a system lockup.
If you're having an older card (blue color PCB) and card=0x71 locks up
your machine, try using 0x68, too. If that does not work, ask on the
mailing list.
The DST module takes a couple of useful parameters.
verbose takes values 0 to 4. These values control the verbosity level,
and can be used to debug also.
verbose=0 means complete disabling of messages
1 only error messages are displayed
2 notifications are also displayed
3 informational messages are also displayed
4 debug setting
dst_addons takes values 0 and 0x20. A value of 0 means it is a FTA card.
0x20 means it has a Conditional Access slot.
The autodetected values are determined by the cards 'response string'
which you can see in your logs e.g.
dst_get_device_id: Recognise [DSTMCI]
If you need to sent in bug reports on the dst, please do send in a complete
log with the verbose=4 module parameter. For general usage, the default setting
of verbose=1 is ideal.
4) Multiple cards
--------------------------
If you happen to be running multiple cards, it would be advisable to load
the bttv module with the card id. This would help to solve any module loading
problems that you might face.
For example, if you have a Twinhan and Clones card along with a FusionHDTV5 Lite
$ modprobe bttv card=0x71 card=0x87
Here the order of the card id is important and should be the same as that of the
physical order of the cards. Here card=0x71 represents the Twinhan and clones
and card=0x87 represents Fusion HDTV5 Lite. These arguments can also be
specified in decimal, rather than hex:
Pinnacle PCTV Sat: 94
Nebula Electronics Digi TV: 104
pcHDTV HD-2000 TV: 112
Twinhan DST and clones: 113
Avermedia AverTV DVB-T 771: 123
Avermedia AverTV DVB-T 761: 124
DViCO FusionHDTV DVB-T Lite: 128
DViCO FusionHDTV 5 Lite: 135
Notice: The order of the card ID should be uprising:
Example:
$ modprobe bttv card=113 card=135
$ modprobe dvb-bt8xx
Some examples of card-id's
For a full list of card ID's please see Documentation/video4linux/CARDLIST.bttv.
In case of further problems send questions to the mailing list: www.linuxdvb.org.
Pinnacle Sat 0x5e (94)
Nebula Digi TV 0x68 (104)
PC HDTV 0x70 (112)
Twinhan 0x71 (113)
FusionHDTV DVB-T Lite 0x80 (128)
FusionHDTV5 Lite 0x87 (135)
For a full list of card-id's, see the V4L Documentation within the kernel
source: linux/Documentation/video4linux/CARDLIST.bttv
If you have problems with this please do ask on the mailing list.
--
Authors: Richard Walker,
Jamie Honan,
Michael Hunold,
Manu Abraham,
Uwe Bugla,
Michael Krufky

View File

@ -21,8 +21,9 @@
use File::Temp qw/ tempdir /;
use IO::Handle;
@components = ( "sp8870", "sp887x", "tda10045", "tda10046", "av7110", "dec2000t",
"dec2540t", "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004",
@components = ( "sp8870", "sp887x", "tda10045", "tda10046",
"tda10046lifeview", "av7110", "dec2000t", "dec2540t",
"dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004",
"or51211", "or51132_qam", "or51132_vsb", "bluebird");
# Check args
@ -126,6 +127,24 @@ sub tda10046 {
$outfile;
}
sub tda10046lifeview {
my $sourcefile = "Drv_2.11.02.zip";
my $url = "http://www.lifeview.com.tw/drivers/pci_card/FlyDVB-T/$sourcefile";
my $hash = "1ea24dee4eea8fe971686981f34fd2e0";
my $outfile = "dvb-fe-tda10046.fw";
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
checkstandard();
wgetfile($sourcefile, $url);
unzip($sourcefile, $tmpdir);
extract("$tmpdir/LVHybrid.sys", 0x8b088, 24602, "$tmpdir/fwtmp");
verify("$tmpdir/fwtmp", $hash);
copy("$tmpdir/fwtmp", $outfile);
$outfile;
}
sub av7110 {
my $sourcefile = "dvb-ttpci-01.fw-261d";
my $url = "http://www.linuxtv.org/downloads/firmware/$sourcefile";

View File

@ -20,11 +20,23 @@ http://linuxtv.org/downloads/
What's inside this directory:
"avermedia.txt"
contains detailed information about the
Avermedia DVB-T cards. See also "bt8xx.txt".
"bt8xx.txt"
contains detailed information about the
various bt8xx based "budget" DVB cards.
"cards.txt"
contains a list of supported hardware.
"ci.txt"
contains detailed information about the
CI module as part from TwinHan cards and Clones.
"contributors.txt"
is the who-is-who of DVB development
is the who-is-who of DVB development.
"faq.txt"
contains frequently asked questions and their answers.
@ -34,19 +46,17 @@ script to download and extract firmware for those devices
that require it.
"ttusb-dec.txt"
contains detailed informations about the
contains detailed information about the
TT DEC2000/DEC3000 USB DVB hardware.
"bt8xx.txt"
contains detailed installation instructions for the
various bt8xx based "budget" DVB cards
(Nebula, Pinnacle PCTV, Twinhan DST)
"README.dibusb"
contains detailed information about adapters
based on DiBcom reference design.
"udev.txt"
how to get DVB and udev up and running.
"README.dvb-usb"
contains detailed information about the DVB USB cards.
"README.flexcop"
contains detailed information about the
Technisat- and Flexcop B2C2 drivers.
Good luck and have fun!

View File

@ -43,3 +43,5 @@
42 -> digitalnow DNTV Live! DVB-T Pro [1822:0025]
43 -> KWorld/VStream XPert DVB-T with cx22702 [17de:08a1]
44 -> DViCO FusionHDTV DVB-T Dual Digital [18ac:db50,18ac:db54]
45 -> KWorld HardwareMpegTV XPert [17de:0840]
46 -> DViCO FusionHDTV DVB-T Hybrid [18ac:db40,18ac:db44]

View File

@ -8,3 +8,4 @@
7 -> Leadtek Winfast USB II (em2800)
8 -> Kworld USB2800 (em2800)
9 -> Pinnacle Dazzle DVC 90 (em2820/em2840) [2304:0207]
12 -> Kworld PVR TV 2800 RF (em2820/em2840)

View File

@ -83,3 +83,12 @@
82 -> MSI TV@Anywhere plus [1462:6231]
83 -> Terratec Cinergy 250 PCI TV [153b:1160]
84 -> LifeView FlyDVB Trio [5168:0319]
85 -> AverTV DVB-T 777 [1461:2c05]
86 -> LifeView FlyDVB-T [5168:0301]
87 -> ADS Instant TV Duo Cardbus PTV331 [0331:1421]
88 -> Tevion/KWorld DVB-T 220RF [17de:7201]
89 -> ELSA EX-VISION 700TV [1048:226c]
90 -> Kworld ATSC110 [17de:7350]
91 -> AVerMedia A169 B [1461:7360]
92 -> AVerMedia A169 B1 [1461:6360]
93 -> Medion 7134 Bridge #2 [16be:0005]

View File

@ -64,8 +64,10 @@ tuner=62 - Philips TEA5767HN FM Radio
tuner=63 - Philips FMD1216ME MK3 Hybrid Tuner
tuner=64 - LG TDVS-H062F/TUA6034
tuner=65 - Ymec TVF66T5-B/DFF
tuner=66 - LG NTSC (TALN mini series)
tuner=66 - LG TALN series
tuner=67 - Philips TD1316 Hybrid Tuner
tuner=68 - Philips TUV1236D ATSC/NTSC dual in
tuner=69 - Tena TNF 5335 MF
tuner=69 - Tena TNF 5335 and similar models
tuner=70 - Samsung TCPN 2121P30A
tuner=71 - Xceive xc3028
tuner=72 - Thomson FE6600

View File

@ -0,0 +1,130 @@
$Id: README,v 1.7 2005/08/29 23:39:57 sbertin Exp $
1. Introduction
This is a driver for STMicroelectronics's CPiA2 (second generation
Colour Processor Interface ASIC) based cameras. This camera outputs an MJPEG
stream at up to vga size. It implements the Video4Linux interface as much as
possible. Since the V4L interface does not support compressed formats, only
an mjpeg enabled application can be used with the camera. We have modified the
gqcam application to view this stream.
The driver is implemented as two kernel modules. The cpia2 module
contains the camera functions and the V4L interface. The cpia2_usb module
contains usb specific functions. The main reason for this was the size of the
module was getting out of hand, so I separted them. It is not likely that
there will be a parallel port version.
FEATURES:
- Supports cameras with the Vision stv6410 (CIF) and stv6500 (VGA) cmos
sensors. I only have the vga sensor, so can't test the other.
- Image formats: VGA, QVGA, CIF, QCIF, and a number of sizes in between.
VGA and QVGA are the native image sizes for the VGA camera. CIF is done
in the coprocessor by scaling QVGA. All other sizes are done by clipping.
- Palette: YCrCb, compressed with MJPEG.
- Some compression parameters are settable.
- Sensor framerate is adjustable (up to 30 fps CIF, 15 fps VGA).
- Adjust brightness, color, contrast while streaming.
- Flicker control settable for 50 or 60 Hz mains frequency.
2. Making and installing the stv672 driver modules:
Requirements:
-------------
This should work with 2.4 (2.4.23 and later) and 2.6 kernels, but has
only been tested on 2.6. Video4Linux must be either compiled into the kernel or
available as a module. Video4Linux2 is automatically detected and made
available at compile time.
Compiling:
----------
As root, do a make install. This will compile and install the modules
into the media/video directory in the module tree. For 2.4 kernels, use
Makefile_2.4 (aka do make -f Makefile_2.4 install).
Setup:
------
Use 'modprobe cpia2' to load and 'modprobe -r cpia2' to unload. This
may be done automatically by your distribution.
3. Driver options
Option Description
------ -----------
video_nr video device to register (0=/dev/video0, etc)
range -1 to 64. default is -1 (first available)
If you have more than 1 camera, this MUST be -1.
buffer_size Size for each frame buffer in bytes (default 68k)
num_buffers Number of frame buffers (1-32, default 3)
alternate USB Alternate (2-7, default 7)
flicker_freq Frequency for flicker reduction(50 or 60, default 60)
flicker_mode 0 to disable, or 1 to enable flicker reduction.
(default 0). This is only effective if the camera
uses a stv0672 coprocessor.
Setting the options:
--------------------
If you are using modules, edit /etc/modules.conf and add an options
line like this:
options cpia2 num_buffers=3 buffer_size=65535
If the driver is compiled into the kernel, at boot time specify them
like this:
cpia2.num_buffers=3 cpia2.buffer_size=65535
What buffer size should I use?
------------------------------
The maximum image size depends on the alternate you choose, and the
frame rate achieved by the camera. If the compression engine is able to
keep up with the frame rate, the maximum image size is given by the table
below.
The compression engine starts out at maximum compression, and will
increase image quality until it is close to the size in the table. As long
as the compression engine can keep up with the frame rate, after a short time
the images will all be about the size in the table, regardless of resolution.
At low alternate settings, the compression engine may not be able to
compress the image enough and will reduce the frame rate by producing larger
images.
The default of 68k should be good for most users. This will handle
any alternate at frame rates down to 15fps. For lower frame rates, it may
be necessary to increase the buffer size to avoid having frames dropped due
to insufficient space.
Image size(bytes)
Alternate bytes/ms 15fps 30fps
2 128 8533 4267
3 384 25600 12800
4 640 42667 21333
5 768 51200 25600
6 896 59733 29867
7 1023 68200 34100
How many buffers should I use?
------------------------------
For normal streaming, 3 should give the best results. With only 2,
it is possible for the camera to finish sending one image just after a
program has started reading the other. If this happens, the driver must drop
a frame. The exception to this is if you have a heavily loaded machine. In
this case use 2 buffers. You are probably not reading at the full frame rate.
If the camera can send multiple images before a read finishes, it could
overwrite the third buffer before the read finishes, leading to a corrupt
image. Single and double buffering have extra checks to avoid overwriting.
4. Using the camera
We are providing a modified gqcam application to view the output. In
order to avoid confusion, here it is called mview. There is also the qx5view
program which can also control the lights on the qx5 microscope. MJPEG Tools
(http://mjpeg.sourceforge.net) can also be used to record from the camera.
5. Notes to developers:
- This is a driver version stripped of the 2.4 back compatibility
and old MJPEG ioctl API. See cpia2.sf.net for 2.4 support.
6. Thanks:
- Peter Pregler <Peter_Pregler@email.com>,
Scott J. Bertin <scottbertin@yahoo.com>, and
Jarl Totland <Jarl.Totland@bdc.no> for the original cpia driver, which
this one was modelled from.

View File

@ -0,0 +1,38 @@
Programmer's View of Cpia2
Cpia2 is the second generation video coprocessor from VLSI Vision Ltd (now a
division of ST Microelectronics). There are two versions. The first is the
STV0672, which is capable of up to 30 frames per second (fps) in frame sizes
up to CIF, and 15 fps for VGA frames. The STV0676 is an improved version,
which can handle up to 30 fps VGA. Both coprocessors can be attached to two
CMOS sensors - the vvl6410 CIF sensor and the vvl6500 VGA sensor. These will
be referred to as the 410 and the 500 sensors, or the CIF and VGA sensors.
The two chipsets operate almost identically. The core is an 8051 processor,
running two different versions of firmware. The 672 runs the VP4 video
processor code, the 676 runs VP5. There are a few differences in register
mappings for the two chips. In these cases, the symbols defined in the
header files are marked with VP4 or VP5 as part of the symbol name.
The cameras appear externally as three sets of registers. Setting register
values is the only way to control the camera. Some settings are
interdependant, such as the sequence required to power up the camera. I will
try to make note of all of these cases.
The register sets are called blocks. Block 0 is the system block. This
section is always powered on when the camera is plugged in. It contains
registers that control housekeeping functions such as powering up the video
processor. The video processor is the VP block. These registers control
how the video from the sensor is processed. Examples are timing registers,
user mode (vga, qvga), scaling, cropping, framerates, and so on. The last
block is the video compressor (VC). The video stream sent from the camera is
compressed as Motion JPEG (JPEGA). The VC controls all of the compression
parameters. Looking at the file cpia2_registers.h, you can get a full view
of these registers and the possible values for most of them.
One or more registers can be set or read by sending a usb control message to
the camera. There are three modes for this. Block mode requests a number
of contiguous registers. Random mode reads or writes random registers with
a tuple structure containing address/value pairs. The repeat mode is only
used by VP4 to load a firmware patch. It contains a starting address and
a sequence of bytes to be written into a gpio port.

View File

@ -1,5 +1,6 @@
saa7146-objs := saa7146_i2c.o saa7146_core.o
saa7146_vv-objs := saa7146_vv_ksyms.o saa7146_fops.o saa7146_video.o saa7146_hlp.o saa7146_vbi.o
ir-common-objs := ir-functions.o ir-keymaps.o
obj-$(CONFIG_VIDEO_SAA7146) += saa7146.o
obj-$(CONFIG_VIDEO_SAA7146_VV) += saa7146_vv.o

View File

@ -1,519 +0,0 @@
/*
*
* some common structs and functions to handle infrared remotes via
* input layer ...
*
* (c) 2003 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/string.h>
#include <media/ir-common.h>
/* -------------------------------------------------------------------------- */
MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
MODULE_LICENSE("GPL");
static int repeat = 1;
module_param(repeat, int, 0444);
MODULE_PARM_DESC(repeat,"auto-repeat for IR keys (default: on)");
static int debug = 0; /* debug level (0,1,2) */
module_param(debug, int, 0644);
#define dprintk(level, fmt, arg...) if (debug >= level) \
printk(KERN_DEBUG fmt , ## arg)
/* -------------------------------------------------------------------------- */
/* generic RC5 keytable */
/* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */
/* used by old (black) Hauppauge remotes */
IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE] = {
/* Keys 0 to 9 */
[ 0x00 ] = KEY_KP0,
[ 0x01 ] = KEY_KP1,
[ 0x02 ] = KEY_KP2,
[ 0x03 ] = KEY_KP3,
[ 0x04 ] = KEY_KP4,
[ 0x05 ] = KEY_KP5,
[ 0x06 ] = KEY_KP6,
[ 0x07 ] = KEY_KP7,
[ 0x08 ] = KEY_KP8,
[ 0x09 ] = KEY_KP9,
[ 0x0b ] = KEY_CHANNEL, /* channel / program (japan: 11) */
[ 0x0c ] = KEY_POWER, /* standby */
[ 0x0d ] = KEY_MUTE, /* mute / demute */
[ 0x0f ] = KEY_TV, /* display */
[ 0x10 ] = KEY_VOLUMEUP,
[ 0x11 ] = KEY_VOLUMEDOWN,
[ 0x12 ] = KEY_BRIGHTNESSUP,
[ 0x13 ] = KEY_BRIGHTNESSDOWN,
[ 0x1e ] = KEY_SEARCH, /* search + */
[ 0x20 ] = KEY_CHANNELUP, /* channel / program + */
[ 0x21 ] = KEY_CHANNELDOWN, /* channel / program - */
[ 0x22 ] = KEY_CHANNEL, /* alt / channel */
[ 0x23 ] = KEY_LANGUAGE, /* 1st / 2nd language */
[ 0x26 ] = KEY_SLEEP, /* sleeptimer */
[ 0x2e ] = KEY_MENU, /* 2nd controls (USA: menu) */
[ 0x30 ] = KEY_PAUSE,
[ 0x32 ] = KEY_REWIND,
[ 0x33 ] = KEY_GOTO,
[ 0x35 ] = KEY_PLAY,
[ 0x36 ] = KEY_STOP,
[ 0x37 ] = KEY_RECORD, /* recording */
[ 0x3c ] = KEY_TEXT, /* teletext submode (Japan: 12) */
[ 0x3d ] = KEY_SUSPEND, /* system standby */
};
EXPORT_SYMBOL_GPL(ir_codes_rc5_tv);
/* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */
IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = {
/* Keys 0 to 9 */
[ 18 ] = KEY_KP0,
[ 5 ] = KEY_KP1,
[ 6 ] = KEY_KP2,
[ 7 ] = KEY_KP3,
[ 9 ] = KEY_KP4,
[ 10 ] = KEY_KP5,
[ 11 ] = KEY_KP6,
[ 13 ] = KEY_KP7,
[ 14 ] = KEY_KP8,
[ 15 ] = KEY_KP9,
[ 0 ] = KEY_POWER,
[ 2 ] = KEY_TUNER, /* TV/FM */
[ 30 ] = KEY_VIDEO,
[ 4 ] = KEY_VOLUMEUP,
[ 8 ] = KEY_VOLUMEDOWN,
[ 12 ] = KEY_CHANNELUP,
[ 16 ] = KEY_CHANNELDOWN,
[ 3 ] = KEY_ZOOM, /* fullscreen */
[ 31 ] = KEY_SUBTITLE, /* closed caption/teletext */
[ 32 ] = KEY_SLEEP,
[ 20 ] = KEY_MUTE,
[ 43 ] = KEY_RED,
[ 44 ] = KEY_GREEN,
[ 45 ] = KEY_YELLOW,
[ 46 ] = KEY_BLUE,
[ 24 ] = KEY_KPPLUS, /* fine tune + */
[ 25 ] = KEY_KPMINUS, /* fine tune - */
[ 33 ] = KEY_KPDOT,
[ 19 ] = KEY_KPENTER,
[ 34 ] = KEY_BACK,
[ 35 ] = KEY_PLAYPAUSE,
[ 36 ] = KEY_NEXT,
[ 38 ] = KEY_STOP,
[ 39 ] = KEY_RECORD
};
EXPORT_SYMBOL_GPL(ir_codes_winfast);
IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE] = {
[ 0x59 ] = KEY_MUTE,
[ 0x4a ] = KEY_POWER,
[ 0x18 ] = KEY_TEXT,
[ 0x26 ] = KEY_TV,
[ 0x3d ] = KEY_PRINT,
[ 0x48 ] = KEY_RED,
[ 0x04 ] = KEY_GREEN,
[ 0x11 ] = KEY_YELLOW,
[ 0x00 ] = KEY_BLUE,
[ 0x2d ] = KEY_VOLUMEUP,
[ 0x1e ] = KEY_VOLUMEDOWN,
[ 0x49 ] = KEY_MENU,
[ 0x16 ] = KEY_CHANNELUP,
[ 0x17 ] = KEY_CHANNELDOWN,
[ 0x20 ] = KEY_UP,
[ 0x21 ] = KEY_DOWN,
[ 0x22 ] = KEY_LEFT,
[ 0x23 ] = KEY_RIGHT,
[ 0x0d ] = KEY_SELECT,
[ 0x08 ] = KEY_BACK,
[ 0x07 ] = KEY_REFRESH,
[ 0x2f ] = KEY_ZOOM,
[ 0x29 ] = KEY_RECORD,
[ 0x4b ] = KEY_PAUSE,
[ 0x4d ] = KEY_REWIND,
[ 0x2e ] = KEY_PLAY,
[ 0x4e ] = KEY_FORWARD,
[ 0x53 ] = KEY_PREVIOUS,
[ 0x4c ] = KEY_STOP,
[ 0x54 ] = KEY_NEXT,
[ 0x69 ] = KEY_KP0,
[ 0x6a ] = KEY_KP1,
[ 0x6b ] = KEY_KP2,
[ 0x6c ] = KEY_KP3,
[ 0x6d ] = KEY_KP4,
[ 0x6e ] = KEY_KP5,
[ 0x6f ] = KEY_KP6,
[ 0x70 ] = KEY_KP7,
[ 0x71 ] = KEY_KP8,
[ 0x72 ] = KEY_KP9,
[ 0x74 ] = KEY_CHANNEL,
[ 0x0a ] = KEY_BACKSPACE,
};
EXPORT_SYMBOL_GPL(ir_codes_pinnacle);
/* empty keytable, can be used as placeholder for not-yet created keytables */
IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE] = {
[ 42 ] = KEY_COFFEE,
};
EXPORT_SYMBOL_GPL(ir_codes_empty);
/* Hauppauge: the newer, gray remotes (seems there are multiple
* slightly different versions), shipped with cx88+ivtv cards.
* almost rc5 coding, but some non-standard keys */
IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE] = {
/* Keys 0 to 9 */
[ 0x00 ] = KEY_KP0,
[ 0x01 ] = KEY_KP1,
[ 0x02 ] = KEY_KP2,
[ 0x03 ] = KEY_KP3,
[ 0x04 ] = KEY_KP4,
[ 0x05 ] = KEY_KP5,
[ 0x06 ] = KEY_KP6,
[ 0x07 ] = KEY_KP7,
[ 0x08 ] = KEY_KP8,
[ 0x09 ] = KEY_KP9,
[ 0x0a ] = KEY_TEXT, /* keypad asterisk as well */
[ 0x0b ] = KEY_RED, /* red button */
[ 0x0c ] = KEY_RADIO,
[ 0x0d ] = KEY_MENU,
[ 0x0e ] = KEY_SUBTITLE, /* also the # key */
[ 0x0f ] = KEY_MUTE,
[ 0x10 ] = KEY_VOLUMEUP,
[ 0x11 ] = KEY_VOLUMEDOWN,
[ 0x12 ] = KEY_PREVIOUS, /* previous channel */
[ 0x14 ] = KEY_UP,
[ 0x15 ] = KEY_DOWN,
[ 0x16 ] = KEY_LEFT,
[ 0x17 ] = KEY_RIGHT,
[ 0x18 ] = KEY_VIDEO, /* Videos */
[ 0x19 ] = KEY_AUDIO, /* Music */
/* 0x1a: Pictures - presume this means
"Multimedia Home Platform" -
no "PICTURES" key in input.h
*/
[ 0x1a ] = KEY_MHP,
[ 0x1b ] = KEY_EPG, /* Guide */
[ 0x1c ] = KEY_TV,
[ 0x1e ] = KEY_NEXTSONG, /* skip >| */
[ 0x1f ] = KEY_EXIT, /* back/exit */
[ 0x20 ] = KEY_CHANNELUP, /* channel / program + */
[ 0x21 ] = KEY_CHANNELDOWN, /* channel / program - */
[ 0x22 ] = KEY_CHANNEL, /* source (old black remote) */
[ 0x24 ] = KEY_PREVIOUSSONG, /* replay |< */
[ 0x25 ] = KEY_ENTER, /* OK */
[ 0x26 ] = KEY_SLEEP, /* minimize (old black remote) */
[ 0x29 ] = KEY_BLUE, /* blue key */
[ 0x2e ] = KEY_GREEN, /* green button */
[ 0x30 ] = KEY_PAUSE, /* pause */
[ 0x32 ] = KEY_REWIND, /* backward << */
[ 0x34 ] = KEY_FASTFORWARD, /* forward >> */
[ 0x35 ] = KEY_PLAY,
[ 0x36 ] = KEY_STOP,
[ 0x37 ] = KEY_RECORD, /* recording */
[ 0x38 ] = KEY_YELLOW, /* yellow key */
[ 0x3b ] = KEY_SELECT, /* top right button */
[ 0x3c ] = KEY_ZOOM, /* full */
[ 0x3d ] = KEY_POWER, /* system power (green button) */
};
EXPORT_SYMBOL(ir_codes_hauppauge_new);
IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE] = {
[ 2 ] = KEY_KP0,
[ 1 ] = KEY_KP1,
[ 11 ] = KEY_KP2,
[ 27 ] = KEY_KP3,
[ 5 ] = KEY_KP4,
[ 9 ] = KEY_KP5,
[ 21 ] = KEY_KP6,
[ 6 ] = KEY_KP7,
[ 10 ] = KEY_KP8,
[ 18 ] = KEY_KP9,
[ 3 ] = KEY_TUNER, /* TV/FM */
[ 7 ] = KEY_SEARCH, /* scan */
[ 28 ] = KEY_ZOOM, /* full screen */
[ 30 ] = KEY_POWER,
[ 23 ] = KEY_VOLUMEDOWN,
[ 31 ] = KEY_VOLUMEUP,
[ 20 ] = KEY_CHANNELDOWN,
[ 22 ] = KEY_CHANNELUP,
[ 24 ] = KEY_MUTE,
[ 0 ] = KEY_LIST, /* source */
[ 19 ] = KEY_INFO, /* loop */
[ 16 ] = KEY_LAST, /* +100 */
[ 13 ] = KEY_CLEAR, /* reset */
[ 12 ] = BTN_RIGHT, /* fun++ */
[ 4 ] = BTN_LEFT, /* fun-- */
[ 14 ] = KEY_GOTO, /* function */
[ 15 ] = KEY_STOP, /* freeze */
};
EXPORT_SYMBOL(ir_codes_pixelview);
/* -------------------------------------------------------------------------- */
static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir)
{
if (KEY_RESERVED == ir->keycode) {
printk(KERN_INFO "%s: unknown key: key=0x%02x raw=0x%02x down=%d\n",
dev->name,ir->ir_key,ir->ir_raw,ir->keypressed);
return;
}
dprintk(1,"%s: key event code=%d down=%d\n",
dev->name,ir->keycode,ir->keypressed);
input_report_key(dev,ir->keycode,ir->keypressed);
input_sync(dev);
}
/* -------------------------------------------------------------------------- */
void ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
int ir_type, IR_KEYTAB_TYPE *ir_codes)
{
int i;
ir->ir_type = ir_type;
if (ir_codes)
memcpy(ir->ir_codes, ir_codes, sizeof(ir->ir_codes));
dev->keycode = ir->ir_codes;
dev->keycodesize = sizeof(IR_KEYTAB_TYPE);
dev->keycodemax = IR_KEYTAB_SIZE;
for (i = 0; i < IR_KEYTAB_SIZE; i++)
set_bit(ir->ir_codes[i], dev->keybit);
clear_bit(0, dev->keybit);
set_bit(EV_KEY, dev->evbit);
if (repeat)
set_bit(EV_REP, dev->evbit);
}
void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir)
{
if (ir->keypressed) {
ir->keypressed = 0;
ir_input_key_event(dev,ir);
}
}
void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
u32 ir_key, u32 ir_raw)
{
u32 keycode = IR_KEYCODE(ir->ir_codes, ir_key);
if (ir->keypressed && ir->keycode != keycode) {
ir->keypressed = 0;
ir_input_key_event(dev,ir);
}
if (!ir->keypressed) {
ir->ir_key = ir_key;
ir->ir_raw = ir_raw;
ir->keycode = keycode;
ir->keypressed = 1;
ir_input_key_event(dev,ir);
}
}
/* -------------------------------------------------------------------------- */
u32 ir_extract_bits(u32 data, u32 mask)
{
int mbit, vbit;
u32 value;
value = 0;
vbit = 0;
for (mbit = 0; mbit < 32; mbit++) {
if (!(mask & ((u32)1 << mbit)))
continue;
if (data & ((u32)1 << mbit))
value |= (1 << vbit);
vbit++;
}
return value;
}
static int inline getbit(u32 *samples, int bit)
{
return (samples[bit/32] & (1 << (31-(bit%32)))) ? 1 : 0;
}
/* sump raw samples for visual debugging ;) */
int ir_dump_samples(u32 *samples, int count)
{
int i, bit, start;
printk(KERN_DEBUG "ir samples: ");
start = 0;
for (i = 0; i < count * 32; i++) {
bit = getbit(samples,i);
if (bit)
start = 1;
if (0 == start)
continue;
printk("%s", bit ? "#" : "_");
}
printk("\n");
return 0;
}
/* decode raw samples, pulse distance coding used by NEC remotes */
int ir_decode_pulsedistance(u32 *samples, int count, int low, int high)
{
int i,last,bit,len;
u32 curBit;
u32 value;
/* find start burst */
for (i = len = 0; i < count * 32; i++) {
bit = getbit(samples,i);
if (bit) {
len++;
} else {
if (len >= 29)
break;
len = 0;
}
}
/* start burst to short */
if (len < 29)
return 0xffffffff;
/* find start silence */
for (len = 0; i < count * 32; i++) {
bit = getbit(samples,i);
if (bit) {
break;
} else {
len++;
}
}
/* silence to short */
if (len < 7)
return 0xffffffff;
/* go decoding */
len = 0;
last = 1;
value = 0; curBit = 1;
for (; i < count * 32; i++) {
bit = getbit(samples,i);
if (last) {
if(bit) {
continue;
} else {
len = 1;
}
} else {
if (bit) {
if (len > (low + high) /2)
value |= curBit;
curBit <<= 1;
if (curBit == 1)
break;
} else {
len++;
}
}
last = bit;
}
return value;
}
/* decode raw samples, biphase coding, used by rc5 for example */
int ir_decode_biphase(u32 *samples, int count, int low, int high)
{
int i,last,bit,len,flips;
u32 value;
/* find start bit (1) */
for (i = 0; i < 32; i++) {
bit = getbit(samples,i);
if (bit)
break;
}
/* go decoding */
len = 0;
flips = 0;
value = 1;
for (; i < count * 32; i++) {
if (len > high)
break;
if (flips > 1)
break;
last = bit;
bit = getbit(samples,i);
if (last == bit) {
len++;
continue;
}
if (len < low) {
len++;
flips++;
continue;
}
value <<= 1;
value |= bit;
flips = 0;
len = 1;
}
return value;
}
EXPORT_SYMBOL_GPL(ir_input_init);
EXPORT_SYMBOL_GPL(ir_input_nokey);
EXPORT_SYMBOL_GPL(ir_input_keydown);
EXPORT_SYMBOL_GPL(ir_extract_bits);
EXPORT_SYMBOL_GPL(ir_dump_samples);
EXPORT_SYMBOL_GPL(ir_decode_biphase);
EXPORT_SYMBOL_GPL(ir_decode_pulsedistance);
/*
* Local variables:
* c-basic-offset: 8
* End:
*/

View File

@ -0,0 +1,272 @@
/*
*
* some common structs and functions to handle infrared remotes via
* input layer ...
*
* (c) 2003 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/string.h>
#include <media/ir-common.h>
/* -------------------------------------------------------------------------- */
MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
MODULE_LICENSE("GPL");
static int repeat = 1;
module_param(repeat, int, 0444);
MODULE_PARM_DESC(repeat,"auto-repeat for IR keys (default: on)");
static int debug = 0; /* debug level (0,1,2) */
module_param(debug, int, 0644);
#define dprintk(level, fmt, arg...) if (debug >= level) \
printk(KERN_DEBUG fmt , ## arg)
/* -------------------------------------------------------------------------- */
static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir)
{
if (KEY_RESERVED == ir->keycode) {
printk(KERN_INFO "%s: unknown key: key=0x%02x raw=0x%02x down=%d\n",
dev->name,ir->ir_key,ir->ir_raw,ir->keypressed);
return;
}
dprintk(1,"%s: key event code=%d down=%d\n",
dev->name,ir->keycode,ir->keypressed);
input_report_key(dev,ir->keycode,ir->keypressed);
input_sync(dev);
}
/* -------------------------------------------------------------------------- */
void ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
int ir_type, IR_KEYTAB_TYPE *ir_codes)
{
int i;
ir->ir_type = ir_type;
if (ir_codes)
memcpy(ir->ir_codes, ir_codes, sizeof(ir->ir_codes));
dev->keycode = ir->ir_codes;
dev->keycodesize = sizeof(IR_KEYTAB_TYPE);
dev->keycodemax = IR_KEYTAB_SIZE;
for (i = 0; i < IR_KEYTAB_SIZE; i++)
set_bit(ir->ir_codes[i], dev->keybit);
clear_bit(0, dev->keybit);
set_bit(EV_KEY, dev->evbit);
if (repeat)
set_bit(EV_REP, dev->evbit);
}
void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir)
{
if (ir->keypressed) {
ir->keypressed = 0;
ir_input_key_event(dev,ir);
}
}
void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
u32 ir_key, u32 ir_raw)
{
u32 keycode = IR_KEYCODE(ir->ir_codes, ir_key);
if (ir->keypressed && ir->keycode != keycode) {
ir->keypressed = 0;
ir_input_key_event(dev,ir);
}
if (!ir->keypressed) {
ir->ir_key = ir_key;
ir->ir_raw = ir_raw;
ir->keycode = keycode;
ir->keypressed = 1;
ir_input_key_event(dev,ir);
}
}
/* -------------------------------------------------------------------------- */
u32 ir_extract_bits(u32 data, u32 mask)
{
int mbit, vbit;
u32 value;
value = 0;
vbit = 0;
for (mbit = 0; mbit < 32; mbit++) {
if (!(mask & ((u32)1 << mbit)))
continue;
if (data & ((u32)1 << mbit))
value |= (1 << vbit);
vbit++;
}
return value;
}
static int inline getbit(u32 *samples, int bit)
{
return (samples[bit/32] & (1 << (31-(bit%32)))) ? 1 : 0;
}
/* sump raw samples for visual debugging ;) */
int ir_dump_samples(u32 *samples, int count)
{
int i, bit, start;
printk(KERN_DEBUG "ir samples: ");
start = 0;
for (i = 0; i < count * 32; i++) {
bit = getbit(samples,i);
if (bit)
start = 1;
if (0 == start)
continue;
printk("%s", bit ? "#" : "_");
}
printk("\n");
return 0;
}
/* decode raw samples, pulse distance coding used by NEC remotes */
int ir_decode_pulsedistance(u32 *samples, int count, int low, int high)
{
int i,last,bit,len;
u32 curBit;
u32 value;
/* find start burst */
for (i = len = 0; i < count * 32; i++) {
bit = getbit(samples,i);
if (bit) {
len++;
} else {
if (len >= 29)
break;
len = 0;
}
}
/* start burst to short */
if (len < 29)
return 0xffffffff;
/* find start silence */
for (len = 0; i < count * 32; i++) {
bit = getbit(samples,i);
if (bit) {
break;
} else {
len++;
}
}
/* silence to short */
if (len < 7)
return 0xffffffff;
/* go decoding */
len = 0;
last = 1;
value = 0; curBit = 1;
for (; i < count * 32; i++) {
bit = getbit(samples,i);
if (last) {
if(bit) {
continue;
} else {
len = 1;
}
} else {
if (bit) {
if (len > (low + high) /2)
value |= curBit;
curBit <<= 1;
if (curBit == 1)
break;
} else {
len++;
}
}
last = bit;
}
return value;
}
/* decode raw samples, biphase coding, used by rc5 for example */
int ir_decode_biphase(u32 *samples, int count, int low, int high)
{
int i,last,bit,len,flips;
u32 value;
/* find start bit (1) */
for (i = 0; i < 32; i++) {
bit = getbit(samples,i);
if (bit)
break;
}
/* go decoding */
len = 0;
flips = 0;
value = 1;
for (; i < count * 32; i++) {
if (len > high)
break;
if (flips > 1)
break;
last = bit;
bit = getbit(samples,i);
if (last == bit) {
len++;
continue;
}
if (len < low) {
len++;
flips++;
continue;
}
value <<= 1;
value |= bit;
flips = 0;
len = 1;
}
return value;
}
EXPORT_SYMBOL_GPL(ir_input_init);
EXPORT_SYMBOL_GPL(ir_input_nokey);
EXPORT_SYMBOL_GPL(ir_input_keydown);
EXPORT_SYMBOL_GPL(ir_extract_bits);
EXPORT_SYMBOL_GPL(ir_dump_samples);
EXPORT_SYMBOL_GPL(ir_decode_biphase);
EXPORT_SYMBOL_GPL(ir_decode_pulsedistance);
/*
* Local variables:
* c-basic-offset: 8
* End:
*/

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@
#include <media/saa7146.h>
LIST_HEAD(saa7146_devices);
DECLARE_MUTEX(saa7146_devices_lock);
DEFINE_MUTEX(saa7146_devices_lock);
static int saa7146_num;
@ -116,8 +116,7 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages)
pg = vmalloc_to_page(virt);
if (NULL == pg)
goto err;
if (PageHighMem(pg))
BUG();
BUG_ON(PageHighMem(pg));
sglist[i].page = pg;
sglist[i].length = PAGE_SIZE;
}
@ -402,11 +401,11 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
pci_set_drvdata(pci, dev);
init_MUTEX(&dev->lock);
mutex_init(&dev->lock);
spin_lock_init(&dev->int_slock);
spin_lock_init(&dev->slock);
init_MUTEX(&dev->i2c_lock);
mutex_init(&dev->i2c_lock);
dev->module = THIS_MODULE;
init_waitqueue_head(&dev->i2c_wq);

View File

@ -17,18 +17,18 @@ int saa7146_res_get(struct saa7146_fh *fh, unsigned int bit)
}
/* is it free? */
down(&dev->lock);
mutex_lock(&dev->lock);
if (vv->resources & bit) {
DEB_D(("locked! vv->resources:0x%02x, we want:0x%02x\n",vv->resources,bit));
/* no, someone else uses it */
up(&dev->lock);
mutex_unlock(&dev->lock);
return 0;
}
/* it's free, grab it */
fh->resources |= bit;
vv->resources |= bit;
DEB_D(("res: get 0x%02x, cur:0x%02x\n",bit,vv->resources));
up(&dev->lock);
mutex_unlock(&dev->lock);
return 1;
}
@ -37,14 +37,13 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits)
struct saa7146_dev *dev = fh->dev;
struct saa7146_vv *vv = dev->vv_data;
if ((fh->resources & bits) != bits)
BUG();
BUG_ON((fh->resources & bits) != bits);
down(&dev->lock);
mutex_lock(&dev->lock);
fh->resources &= ~bits;
vv->resources &= ~bits;
DEB_D(("res: put 0x%02x, cur:0x%02x\n",bits,vv->resources));
up(&dev->lock);
mutex_unlock(&dev->lock);
}
@ -55,8 +54,7 @@ void saa7146_dma_free(struct saa7146_dev *dev,struct saa7146_buf *buf)
{
DEB_EE(("dev:%p, buf:%p\n",dev,buf));
if (in_interrupt())
BUG();
BUG_ON(in_interrupt());
videobuf_waiton(&buf->vb,0,0);
videobuf_dma_pci_unmap(dev->pci, &buf->vb.dma);
@ -204,7 +202,7 @@ static int fops_open(struct inode *inode, struct file *file)
DEB_EE(("inode:%p, file:%p, minor:%d\n",inode,file,minor));
if (down_interruptible(&saa7146_devices_lock))
if (mutex_lock_interruptible(&saa7146_devices_lock))
return -ERESTARTSYS;
list_for_each(list,&saa7146_devices) {
@ -276,7 +274,7 @@ static int fops_open(struct inode *inode, struct file *file)
kfree(fh);
file->private_data = NULL;
}
up(&saa7146_devices_lock);
mutex_unlock(&saa7146_devices_lock);
return result;
}
@ -287,7 +285,7 @@ static int fops_release(struct inode *inode, struct file *file)
DEB_EE(("inode:%p, file:%p\n",inode,file));
if (down_interruptible(&saa7146_devices_lock))
if (mutex_lock_interruptible(&saa7146_devices_lock))
return -ERESTARTSYS;
if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
@ -303,7 +301,7 @@ static int fops_release(struct inode *inode, struct file *file)
file->private_data = NULL;
kfree(fh);
up(&saa7146_devices_lock);
mutex_unlock(&saa7146_devices_lock);
return 0;
}

View File

@ -279,7 +279,7 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *msgs, in
int address_err = 0;
int short_delay = 0;
if (down_interruptible (&dev->i2c_lock))
if (mutex_lock_interruptible(&dev->i2c_lock))
return -ERESTARTSYS;
for(i=0;i<num;i++) {
@ -366,7 +366,7 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *msgs, in
}
}
up(&dev->i2c_lock);
mutex_unlock(&dev->i2c_lock);
return err;
}

View File

@ -410,7 +410,7 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
V4L2_FIELD_SEQ_TB, // FIXME: does this really work?
sizeof(struct saa7146_buf),
file);
init_MUTEX(&fh->vbi_q.lock);
mutex_init(&fh->vbi_q.lock);
init_timer(&fh->vbi_read_timeout);
fh->vbi_read_timeout.function = vbi_read_timeout;

View File

@ -378,20 +378,20 @@ static int s_fmt(struct saa7146_fh *fh, struct v4l2_format *f)
err = try_win(dev,&f->fmt.win);
if (0 != err)
return err;
down(&dev->lock);
mutex_lock(&dev->lock);
fh->ov.win = f->fmt.win;
fh->ov.nclips = f->fmt.win.clipcount;
if (fh->ov.nclips > 16)
fh->ov.nclips = 16;
if (copy_from_user(fh->ov.clips,f->fmt.win.clips,sizeof(struct v4l2_clip)*fh->ov.nclips)) {
up(&dev->lock);
mutex_unlock(&dev->lock);
return -EFAULT;
}
/* fh->ov.fh is used to indicate that we have valid overlay informations, too */
fh->ov.fh = fh;
up(&dev->lock);
mutex_unlock(&dev->lock);
/* check if our current overlay is active */
if (IS_OVERLAY_ACTIVE(fh) != 0) {
@ -516,7 +516,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c)
return -EINVAL;
}
down(&dev->lock);
mutex_lock(&dev->lock);
switch (ctrl->type) {
case V4L2_CTRL_TYPE_BOOLEAN:
@ -560,7 +560,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c)
/* fixme: we can support changing VFLIP and HFLIP here... */
if (IS_CAPTURE_ACTIVE(fh) != 0) {
DEB_D(("V4L2_CID_HFLIP while active capture.\n"));
up(&dev->lock);
mutex_unlock(&dev->lock);
return -EINVAL;
}
vv->hflip = c->value;
@ -568,7 +568,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c)
case V4L2_CID_VFLIP:
if (IS_CAPTURE_ACTIVE(fh) != 0) {
DEB_D(("V4L2_CID_VFLIP while active capture.\n"));
up(&dev->lock);
mutex_unlock(&dev->lock);
return -EINVAL;
}
vv->vflip = c->value;
@ -577,7 +577,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c)
return -EINVAL;
}
}
up(&dev->lock);
mutex_unlock(&dev->lock);
if (IS_OVERLAY_ACTIVE(fh) != 0) {
saa7146_stop_preview(fh);
@ -939,7 +939,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
}
}
down(&dev->lock);
mutex_lock(&dev->lock);
/* ok, accept it */
vv->ov_fb = *fb;
@ -948,7 +948,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
vv->ov_fb.fmt.bytesperline =
vv->ov_fb.fmt.width*fmt->depth/8;
up(&dev->lock);
mutex_unlock(&dev->lock);
return 0;
}
@ -1086,7 +1086,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
}
}
down(&dev->lock);
mutex_lock(&dev->lock);
for(i = 0; i < dev->ext_vv_data->num_stds; i++)
if (*id & dev->ext_vv_data->stds[i].id)
@ -1098,7 +1098,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
found = 1;
}
up(&dev->lock);
mutex_unlock(&dev->lock);
if (vv->ov_suspend != NULL) {
saa7146_start_preview(vv->ov_suspend);
@ -1201,11 +1201,11 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
DEB_D(("VIDIOCGMBUF \n"));
q = &fh->video_q;
down(&q->lock);
mutex_lock(&q->lock);
err = videobuf_mmap_setup(q,gbuffers,gbufsize,
V4L2_MEMORY_MMAP);
if (err < 0) {
up(&q->lock);
mutex_unlock(&q->lock);
return err;
}
memset(mbuf,0,sizeof(*mbuf));
@ -1213,7 +1213,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
mbuf->size = gbuffers * gbufsize;
for (i = 0; i < gbuffers; i++)
mbuf->offsets[i] = i * gbufsize;
up(&q->lock);
mutex_unlock(&q->lock);
return 0;
}
default:
@ -1414,7 +1414,7 @@ static int video_open(struct saa7146_dev *dev, struct file *file)
sizeof(struct saa7146_buf),
file);
init_MUTEX(&fh->video_q.lock);
mutex_init(&fh->video_q.lock);
return 0;
}

View File

@ -10,6 +10,7 @@
#include <linux/config.h>
#include <linux/pci.h>
#include <linux/mutex.h>
#include "flexcop-reg.h"
@ -73,8 +74,7 @@ struct flexcop_device {
int (*fe_sleep) (struct dvb_frontend *);
struct i2c_adapter i2c_adap;
struct semaphore i2c_sem;
struct mutex i2c_mutex;
struct module *owner;
/* options and status */

View File

@ -135,7 +135,7 @@ static int flexcop_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs
struct flexcop_device *fc = i2c_get_adapdata(i2c_adap);
int i, ret = 0;
if (down_interruptible(&fc->i2c_sem))
if (mutex_lock_interruptible(&fc->i2c_mutex))
return -ERESTARTSYS;
/* reading */
@ -161,7 +161,7 @@ static int flexcop_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs
else
ret = num;
up(&fc->i2c_sem);
mutex_unlock(&fc->i2c_mutex);
return ret;
}
@ -180,7 +180,7 @@ int flexcop_i2c_init(struct flexcop_device *fc)
{
int ret;
sema_init(&fc->i2c_sem,1);
mutex_init(&fc->i2c_mutex);
memset(&fc->i2c_adap, 0, sizeof(struct i2c_adapter));
strncpy(fc->i2c_adap.name, "B2C2 FlexCop device",I2C_NAME_SIZE);

View File

@ -1,3 +1,3 @@
obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o dst.o dst_ca.o
EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/video -Idrivers/media/dvb/frontends
EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/video/bt8xx -Idrivers/media/dvb/frontends

View File

@ -344,7 +344,7 @@ bt878_device_control(struct bt878 *bt, unsigned int cmd, union dst_gpio_packet *
int retval;
retval = 0;
if (down_interruptible (&bt->gpio_lock))
if (mutex_lock_interruptible(&bt->gpio_lock))
return -ERESTARTSYS;
/* special gpio signal */
switch (cmd) {
@ -375,7 +375,7 @@ bt878_device_control(struct bt878 *bt, unsigned int cmd, union dst_gpio_packet *
retval = -EINVAL;
break;
}
up(&bt->gpio_lock);
mutex_unlock(&bt->gpio_lock);
return retval;
}

View File

@ -25,6 +25,8 @@
#include <linux/pci.h>
#include <linux/sched.h>
#include <linux/spinlock.h>
#include <linux/mutex.h>
#include "bt848.h"
#include "bttv.h"
@ -108,7 +110,7 @@ struct cards {
extern int bt878_num;
struct bt878 {
struct semaphore gpio_lock;
struct mutex gpio_lock;
unsigned int nr;
unsigned int bttv_nr;
struct i2c_adapter *adapter;

View File

@ -910,7 +910,7 @@ static int dst_get_device_id(struct dst_state *state)
static int dst_probe(struct dst_state *state)
{
sema_init(&state->dst_mutex, 1);
mutex_init(&state->dst_mutex);
if ((rdc_8820_reset(state)) < 0) {
dprintk(verbose, DST_ERROR, 1, "RDC 8820 RESET Failed.");
return -1;
@ -962,7 +962,7 @@ int dst_command(struct dst_state *state, u8 *data, u8 len)
{
u8 reply;
down(&state->dst_mutex);
mutex_lock(&state->dst_mutex);
if ((dst_comm_init(state)) < 0) {
dprintk(verbose, DST_NOTICE, 1, "DST Communication Initialization Failed.");
goto error;
@ -1013,11 +1013,11 @@ int dst_command(struct dst_state *state, u8 *data, u8 len)
dprintk(verbose, DST_INFO, 1, "checksum failure");
goto error;
}
up(&state->dst_mutex);
mutex_unlock(&state->dst_mutex);
return 0;
error:
up(&state->dst_mutex);
mutex_unlock(&state->dst_mutex);
return -EIO;
}
@ -1128,7 +1128,7 @@ static int dst_write_tuna(struct dvb_frontend *fe)
dst_set_voltage(fe, SEC_VOLTAGE_13);
}
state->diseq_flags &= ~(HAS_LOCK | ATTEMPT_TUNE);
down(&state->dst_mutex);
mutex_lock(&state->dst_mutex);
if ((dst_comm_init(state)) < 0) {
dprintk(verbose, DST_DEBUG, 1, "DST Communication initialization failed.");
goto error;
@ -1160,11 +1160,11 @@ static int dst_write_tuna(struct dvb_frontend *fe)
state->diseq_flags |= ATTEMPT_TUNE;
retval = dst_get_tuna(state);
werr:
up(&state->dst_mutex);
mutex_unlock(&state->dst_mutex);
return retval;
error:
up(&state->dst_mutex);
mutex_unlock(&state->dst_mutex);
return -EIO;
}

View File

@ -81,7 +81,7 @@ static int dst_ci_command(struct dst_state* state, u8 * data, u8 *ca_string, u8
{
u8 reply;
down(&state->dst_mutex);
mutex_lock(&state->dst_mutex);
dst_comm_init(state);
msleep(65);
@ -110,11 +110,11 @@ static int dst_ci_command(struct dst_state* state, u8 * data, u8 *ca_string, u8
goto error;
}
}
up(&state->dst_mutex);
mutex_unlock(&state->dst_mutex);
return 0;
error:
up(&state->dst_mutex);
mutex_unlock(&state->dst_mutex);
return -EIO;
}

View File

@ -25,6 +25,7 @@
#include <linux/smp_lock.h>
#include <linux/dvb/frontend.h>
#include <linux/device.h>
#include <linux/mutex.h>
#include "bt878.h"
#include "dst_ca.h"
@ -121,7 +122,7 @@ struct dst_state {
u8 vendor[8];
u8 board_info[8];
struct semaphore dst_mutex;
struct mutex dst_mutex;
};
struct dst_types {

View File

@ -76,13 +76,13 @@ static int dvb_bt8xx_start_feed(struct dvb_demux_feed *dvbdmxfeed)
if (!dvbdmx->dmx.frontend)
return -EINVAL;
down(&card->lock);
mutex_lock(&card->lock);
card->nfeeds++;
rc = card->nfeeds;
if (card->nfeeds == 1)
bt878_start(card->bt, card->gpio_mode,
card->op_sync_orin, card->irq_err_ignore);
up(&card->lock);
mutex_unlock(&card->lock);
return rc;
}
@ -96,11 +96,11 @@ static int dvb_bt8xx_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
if (!dvbdmx->dmx.frontend)
return -EINVAL;
down(&card->lock);
mutex_lock(&card->lock);
card->nfeeds--;
if (card->nfeeds == 0)
bt878_stop(card->bt);
up(&card->lock);
mutex_unlock(&card->lock);
return 0;
}
@ -239,6 +239,20 @@ static int cx24108_pll_set(struct dvb_frontend* fe, struct dvb_frontend_paramete
static int pinnsat_pll_init(struct dvb_frontend* fe)
{
struct dvb_bt8xx_card *card = fe->dvb->priv;
bttv_gpio_enable(card->bttv_nr, 1, 1); /* output */
bttv_write_gpio(card->bttv_nr, 1, 1); /* relay on */
return 0;
}
static int pinnsat_pll_sleep(struct dvb_frontend* fe)
{
struct dvb_bt8xx_card *card = fe->dvb->priv;
bttv_write_gpio(card->bttv_nr, 1, 0); /* relay off */
return 0;
}
@ -246,6 +260,7 @@ static struct cx24110_config pctvsat_config = {
.demod_address = 0x55,
.pll_init = pinnsat_pll_init,
.pll_set = cx24108_pll_set,
.pll_sleep = pinnsat_pll_sleep,
};
static int microtune_mt7202dtf_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
@ -788,7 +803,7 @@ static int dvb_bt8xx_probe(struct bttv_sub_device *sub)
if (!(card = kzalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL)))
return -ENOMEM;
init_MUTEX(&card->lock);
mutex_init(&card->lock);
card->bttv_nr = sub->core->nr;
strncpy(card->card_name, sub->core->name, sizeof(sub->core->name));
card->i2c_adapter = &sub->core->i2c_adap;
@ -798,14 +813,14 @@ static int dvb_bt8xx_probe(struct bttv_sub_device *sub)
card->gpio_mode = 0x0400c060;
/* should be: BT878_A_GAIN=0,BT878_A_PWRDN,BT878_DA_DPM,BT878_DA_SBR,
BT878_DA_IOM=1,BT878_DA_APP to enable serial highspeed mode. */
card->op_sync_orin = 0;
card->irq_err_ignore = 0;
card->op_sync_orin = BT878_RISC_SYNC_MASK;
card->irq_err_ignore = BT878_AFBUS | BT878_AFDSR;
break;
case BTTV_BOARD_DVICO_DVBT_LITE:
card->gpio_mode = 0x0400C060;
card->op_sync_orin = 0;
card->irq_err_ignore = 0;
card->op_sync_orin = BT878_RISC_SYNC_MASK;
card->irq_err_ignore = BT878_AFBUS | BT878_AFDSR;
/* 26, 15, 14, 6, 5
* A_PWRDN DA_DPM DA_SBR DA_IOM_DA
* DA_APP(parallel) */
@ -820,15 +835,15 @@ static int dvb_bt8xx_probe(struct bttv_sub_device *sub)
case BTTV_BOARD_NEBULA_DIGITV:
case BTTV_BOARD_AVDVBT_761:
card->gpio_mode = (1 << 26) | (1 << 14) | (1 << 5);
card->op_sync_orin = 0;
card->irq_err_ignore = 0;
card->op_sync_orin = BT878_RISC_SYNC_MASK;
card->irq_err_ignore = BT878_AFBUS | BT878_AFDSR;
/* A_PWRDN DA_SBR DA_APP (high speed serial) */
break;
case BTTV_BOARD_AVDVBT_771: //case 0x07711461:
card->gpio_mode = 0x0400402B;
card->op_sync_orin = BT878_RISC_SYNC_MASK;
card->irq_err_ignore = 0;
card->irq_err_ignore = BT878_AFBUS | BT878_AFDSR;
/* A_PWRDN DA_SBR DA_APP[0] PKTP=10 RISC_ENABLE FIFO_ENABLE*/
break;
@ -852,8 +867,8 @@ static int dvb_bt8xx_probe(struct bttv_sub_device *sub)
case BTTV_BOARD_PC_HDTV:
card->gpio_mode = 0x0100EC7B;
card->op_sync_orin = 0;
card->irq_err_ignore = 0;
card->op_sync_orin = BT878_RISC_SYNC_MASK;
card->irq_err_ignore = BT878_AFBUS | BT878_AFDSR;
break;
default:
@ -881,7 +896,7 @@ static int dvb_bt8xx_probe(struct bttv_sub_device *sub)
return -EFAULT;
}
init_MUTEX(&card->bt->gpio_lock);
mutex_init(&card->bt->gpio_lock);
card->bt->bttv_nr = sub->core->nr;
if ( (ret = dvb_bt8xx_load_card(card, sub->core->type)) ) {

View File

@ -26,6 +26,7 @@
#define DVB_BT8XX_H
#include <linux/i2c.h>
#include <linux/mutex.h>
#include "dvbdev.h"
#include "dvb_net.h"
#include "bttv.h"
@ -38,7 +39,7 @@
#include "lgdt330x.h"
struct dvb_bt8xx_card {
struct semaphore lock;
struct mutex lock;
int nfeeds;
char card_name[32];
struct dvb_adapter dvb_adapter;

View File

@ -30,6 +30,7 @@
#include <linux/pci.h>
#include <linux/input.h>
#include <linux/dvb/frontend.h>
#include <linux/mutex.h>
#include "dmxdev.h"
#include "dvb_demux.h"
@ -116,7 +117,7 @@ static struct dvb_frontend_info cinergyt2_fe_info = {
struct cinergyt2 {
struct dvb_demux demux;
struct usb_device *udev;
struct semaphore sem;
struct mutex sem;
struct dvb_adapter adapter;
struct dvb_device *fedev;
struct dmxdev dmxdev;
@ -345,14 +346,14 @@ static int cinergyt2_start_feed(struct dvb_demux_feed *dvbdmxfeed)
struct dvb_demux *demux = dvbdmxfeed->demux;
struct cinergyt2 *cinergyt2 = demux->priv;
if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem))
if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem))
return -ERESTARTSYS;
if (cinergyt2->streaming == 0)
cinergyt2_start_stream_xfer(cinergyt2);
cinergyt2->streaming++;
up(&cinergyt2->sem);
mutex_unlock(&cinergyt2->sem);
return 0;
}
@ -361,13 +362,13 @@ static int cinergyt2_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
struct dvb_demux *demux = dvbdmxfeed->demux;
struct cinergyt2 *cinergyt2 = demux->priv;
if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem))
if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem))
return -ERESTARTSYS;
if (--cinergyt2->streaming == 0)
cinergyt2_stop_stream_xfer(cinergyt2);
up(&cinergyt2->sem);
mutex_unlock(&cinergyt2->sem);
return 0;
}
@ -483,11 +484,11 @@ static int cinergyt2_open (struct inode *inode, struct file *file)
struct cinergyt2 *cinergyt2 = dvbdev->priv;
int err = -ERESTARTSYS;
if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem))
if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem))
return -ERESTARTSYS;
if ((err = dvb_generic_open(inode, file))) {
up(&cinergyt2->sem);
mutex_unlock(&cinergyt2->sem);
return err;
}
@ -499,12 +500,15 @@ static int cinergyt2_open (struct inode *inode, struct file *file)
atomic_inc(&cinergyt2->inuse);
up(&cinergyt2->sem);
mutex_unlock(&cinergyt2->sem);
return 0;
}
static void cinergyt2_unregister(struct cinergyt2 *cinergyt2)
{
dvb_net_release(&cinergyt2->dvbnet);
dvb_dmxdev_release(&cinergyt2->dmxdev);
dvb_dmx_release(&cinergyt2->demux);
dvb_unregister_device(cinergyt2->fedev);
dvb_unregister_adapter(&cinergyt2->adapter);
@ -517,7 +521,7 @@ static int cinergyt2_release (struct inode *inode, struct file *file)
struct dvb_device *dvbdev = file->private_data;
struct cinergyt2 *cinergyt2 = dvbdev->priv;
if (down_interruptible(&cinergyt2->sem))
if (mutex_lock_interruptible(&cinergyt2->sem))
return -ERESTARTSYS;
if (!cinergyt2->disconnect_pending && (file->f_flags & O_ACCMODE) != O_RDONLY) {
@ -526,7 +530,7 @@ static int cinergyt2_release (struct inode *inode, struct file *file)
cinergyt2_sleep(cinergyt2, 1);
}
up(&cinergyt2->sem);
mutex_unlock(&cinergyt2->sem);
if (atomic_dec_and_test(&cinergyt2->inuse) && cinergyt2->disconnect_pending) {
warn("delayed unregister in release");
@ -541,12 +545,12 @@ static unsigned int cinergyt2_poll (struct file *file, struct poll_table_struct
struct dvb_device *dvbdev = file->private_data;
struct cinergyt2 *cinergyt2 = dvbdev->priv;
if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem))
if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem))
return -ERESTARTSYS;
poll_wait(file, &cinergyt2->poll_wq, wait);
up(&cinergyt2->sem);
mutex_unlock(&cinergyt2->sem);
return (POLLIN | POLLRDNORM | POLLPRI);
}
@ -613,7 +617,7 @@ static int cinergyt2_ioctl (struct inode *inode, struct file *file,
if (copy_from_user(&p, (void __user*) arg, sizeof(p)))
return -EFAULT;
if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem))
if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem))
return -ERESTARTSYS;
param->cmd = CINERGYT2_EP1_SET_TUNER_PARAMETERS;
@ -629,7 +633,7 @@ static int cinergyt2_ioctl (struct inode *inode, struct file *file,
(char *) param, sizeof(*param),
NULL, 0);
up(&cinergyt2->sem);
mutex_unlock(&cinergyt2->sem);
return (err < 0) ? err : 0;
}
@ -724,7 +728,7 @@ static void cinergyt2_query_rc (void *data)
struct cinergyt2_rc_event rc_events[12];
int n, len, i;
if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem))
if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem))
return;
len = cinergyt2_command(cinergyt2, buf, sizeof(buf),
@ -784,7 +788,7 @@ static void cinergyt2_query_rc (void *data)
schedule_delayed_work(&cinergyt2->rc_query_work,
msecs_to_jiffies(RC_QUERY_INTERVAL));
up(&cinergyt2->sem);
mutex_unlock(&cinergyt2->sem);
}
static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2)
@ -849,7 +853,7 @@ static void cinergyt2_query (void *data)
uint8_t lock_bits;
uint32_t unc;
if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem))
if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem))
return;
unc = s->uncorrected_block_count;
@ -868,7 +872,7 @@ static void cinergyt2_query (void *data)
schedule_delayed_work(&cinergyt2->query_work,
msecs_to_jiffies(QUERY_INTERVAL));
up(&cinergyt2->sem);
mutex_unlock(&cinergyt2->sem);
}
static int cinergyt2_probe (struct usb_interface *intf,
@ -885,7 +889,7 @@ static int cinergyt2_probe (struct usb_interface *intf,
memset (cinergyt2, 0, sizeof (struct cinergyt2));
usb_set_intfdata (intf, (void *) cinergyt2);
init_MUTEX(&cinergyt2->sem);
mutex_init(&cinergyt2->sem);
init_waitqueue_head (&cinergyt2->poll_wq);
INIT_WORK(&cinergyt2->query_work, cinergyt2_query, cinergyt2);
@ -937,6 +941,7 @@ static int cinergyt2_probe (struct usb_interface *intf,
return 0;
bailout:
dvb_net_release(&cinergyt2->dvbnet);
dvb_dmxdev_release(&cinergyt2->dmxdev);
dvb_dmx_release(&cinergyt2->demux);
dvb_unregister_adapter(&cinergyt2->adapter);
@ -967,7 +972,7 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state)
{
struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf);
if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem))
if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem))
return -ERESTARTSYS;
if (state.event > PM_EVENT_ON) {
@ -981,7 +986,7 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state)
cinergyt2_sleep(cinergyt2, 1);
}
up(&cinergyt2->sem);
mutex_unlock(&cinergyt2->sem);
return 0;
}
@ -990,7 +995,7 @@ static int cinergyt2_resume (struct usb_interface *intf)
struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf);
struct dvbt_set_parameters_msg *param = &cinergyt2->param;
if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem))
if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem))
return -ERESTARTSYS;
if (!cinergyt2->sleeping) {
@ -1003,7 +1008,7 @@ static int cinergyt2_resume (struct usb_interface *intf)
cinergyt2_resume_rc(cinergyt2);
up(&cinergyt2->sem);
mutex_unlock(&cinergyt2->sem);
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -30,14 +30,15 @@
#include <linux/wait.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>
#include <linux/dvb/dmx.h>
#include "dvbdev.h"
#include "demux.h"
#include "dvb_ringbuffer.h"
enum dmxdevype {
enum dmxdev_type {
DMXDEV_TYPE_NONE,
DMXDEV_TYPE_SEC,
DMXDEV_TYPE_PES,
@ -52,18 +53,7 @@ enum dmxdev_state {
DMXDEV_STATE_TIMEDOUT
};
struct dmxdev_buffer {
u8 *data;
int size;
int pread;
int pwrite;
wait_queue_head_t queue;
int error;
};
struct dmxdev_filter {
struct dvb_device *dvbdev;
union {
struct dmx_section_filter *sec;
} filter;
@ -78,26 +68,17 @@ struct dmxdev_filter {
struct dmx_pes_filter_params pes;
} params;
int type;
enum dmxdev_type type;
enum dmxdev_state state;
struct dmxdev *dev;
struct dmxdev_buffer buffer;
struct dvb_ringbuffer buffer;
struct semaphore mutex;
struct mutex mutex;
/* only for sections */
struct timer_list timer;
int todo;
u8 secheader[3];
u16 pid;
};
struct dmxdev_dvr {
int state;
struct dmxdev *dev;
struct dmxdev_buffer buffer;
};
@ -106,7 +87,6 @@ struct dmxdev {
struct dvb_device *dvr_dvbdev;
struct dmxdev_filter *filter;
struct dmxdev_dvr *dvr;
struct dmx_demux *demux;
int filternum;
@ -114,10 +94,10 @@ struct dmxdev {
#define DMXDEV_CAP_DUPLEX 1
struct dmx_frontend *dvr_orig_fe;
struct dmxdev_buffer dvr_buffer;
struct dvb_ringbuffer dvr_buffer;
#define DVR_BUFFER_SIZE (10*188*1024)
struct semaphore mutex;
struct mutex mutex;
spinlock_t lock;
};

View File

@ -589,18 +589,18 @@ static int dmx_ts_feed_set(struct dmx_ts_feed *ts_feed, u16 pid, int ts_type,
if (pid > DMX_MAX_PID)
return -EINVAL;
if (down_interruptible(&demux->mutex))
if (mutex_lock_interruptible(&demux->mutex))
return -ERESTARTSYS;
if (ts_type & TS_DECODER) {
if (pes_type >= DMX_TS_PES_OTHER) {
up(&demux->mutex);
mutex_unlock(&demux->mutex);
return -EINVAL;
}
if (demux->pesfilter[pes_type] &&
demux->pesfilter[pes_type] != feed) {
up(&demux->mutex);
mutex_unlock(&demux->mutex);
return -EINVAL;
}
@ -622,14 +622,14 @@ static int dmx_ts_feed_set(struct dmx_ts_feed *ts_feed, u16 pid, int ts_type,
#else
feed->buffer = vmalloc(feed->buffer_size);
if (!feed->buffer) {
up(&demux->mutex);
mutex_unlock(&demux->mutex);
return -ENOMEM;
}
#endif
}
feed->state = DMX_STATE_READY;
up(&demux->mutex);
mutex_unlock(&demux->mutex);
return 0;
}
@ -640,21 +640,21 @@ static int dmx_ts_feed_start_filtering(struct dmx_ts_feed *ts_feed)
struct dvb_demux *demux = feed->demux;
int ret;
if (down_interruptible(&demux->mutex))
if (mutex_lock_interruptible(&demux->mutex))
return -ERESTARTSYS;
if (feed->state != DMX_STATE_READY || feed->type != DMX_TYPE_TS) {
up(&demux->mutex);
mutex_unlock(&demux->mutex);
return -EINVAL;
}
if (!demux->start_feed) {
up(&demux->mutex);
mutex_unlock(&demux->mutex);
return -ENODEV;
}
if ((ret = demux->start_feed(feed)) < 0) {
up(&demux->mutex);
mutex_unlock(&demux->mutex);
return ret;
}
@ -662,7 +662,7 @@ static int dmx_ts_feed_start_filtering(struct dmx_ts_feed *ts_feed)
ts_feed->is_filtering = 1;
feed->state = DMX_STATE_GO;
spin_unlock_irq(&demux->lock);
up(&demux->mutex);
mutex_unlock(&demux->mutex);
return 0;
}
@ -673,16 +673,16 @@ static int dmx_ts_feed_stop_filtering(struct dmx_ts_feed *ts_feed)
struct dvb_demux *demux = feed->demux;
int ret;
if (down_interruptible(&demux->mutex))
if (mutex_lock_interruptible(&demux->mutex))
return -ERESTARTSYS;
if (feed->state < DMX_STATE_GO) {
up(&demux->mutex);
mutex_unlock(&demux->mutex);
return -EINVAL;
}
if (!demux->stop_feed) {
up(&demux->mutex);
mutex_unlock(&demux->mutex);
return -ENODEV;
}
@ -692,7 +692,7 @@ static int dmx_ts_feed_stop_filtering(struct dmx_ts_feed *ts_feed)
ts_feed->is_filtering = 0;
feed->state = DMX_STATE_ALLOCATED;
spin_unlock_irq(&demux->lock);
up(&demux->mutex);
mutex_unlock(&demux->mutex);
return ret;
}
@ -704,11 +704,11 @@ static int dvbdmx_allocate_ts_feed(struct dmx_demux *dmx,
struct dvb_demux *demux = (struct dvb_demux *)dmx;
struct dvb_demux_feed *feed;
if (down_interruptible(&demux->mutex))
if (mutex_lock_interruptible(&demux->mutex))
return -ERESTARTSYS;
if (!(feed = dvb_dmx_feed_alloc(demux))) {
up(&demux->mutex);
mutex_unlock(&demux->mutex);
return -EBUSY;
}
@ -729,7 +729,7 @@ static int dvbdmx_allocate_ts_feed(struct dmx_demux *dmx,
if (!(feed->filter = dvb_dmx_filter_alloc(demux))) {
feed->state = DMX_STATE_FREE;
up(&demux->mutex);
mutex_unlock(&demux->mutex);
return -EBUSY;
}
@ -737,7 +737,7 @@ static int dvbdmx_allocate_ts_feed(struct dmx_demux *dmx,
feed->filter->feed = feed;
feed->filter->state = DMX_STATE_READY;
up(&demux->mutex);
mutex_unlock(&demux->mutex);
return 0;
}
@ -748,11 +748,11 @@ static int dvbdmx_release_ts_feed(struct dmx_demux *dmx,
struct dvb_demux *demux = (struct dvb_demux *)dmx;
struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed;
if (down_interruptible(&demux->mutex))
if (mutex_lock_interruptible(&demux->mutex))
return -ERESTARTSYS;
if (feed->state == DMX_STATE_FREE) {
up(&demux->mutex);
mutex_unlock(&demux->mutex);
return -EINVAL;
}
#ifndef NOBUFS
@ -770,7 +770,7 @@ static int dvbdmx_release_ts_feed(struct dmx_demux *dmx,
if (feed->ts_type & TS_DECODER && feed->pes_type < DMX_TS_PES_OTHER)
demux->pesfilter[feed->pes_type] = NULL;
up(&demux->mutex);
mutex_unlock(&demux->mutex);
return 0;
}
@ -785,12 +785,12 @@ static int dmx_section_feed_allocate_filter(struct dmx_section_feed *feed,
struct dvb_demux *dvbdemux = dvbdmxfeed->demux;
struct dvb_demux_filter *dvbdmxfilter;
if (down_interruptible(&dvbdemux->mutex))
if (mutex_lock_interruptible(&dvbdemux->mutex))
return -ERESTARTSYS;
dvbdmxfilter = dvb_dmx_filter_alloc(dvbdemux);
if (!dvbdmxfilter) {
up(&dvbdemux->mutex);
mutex_unlock(&dvbdemux->mutex);
return -EBUSY;
}
@ -805,7 +805,7 @@ static int dmx_section_feed_allocate_filter(struct dmx_section_feed *feed,
dvbdmxfeed->filter = dvbdmxfilter;
spin_unlock_irq(&dvbdemux->lock);
up(&dvbdemux->mutex);
mutex_unlock(&dvbdemux->mutex);
return 0;
}
@ -819,7 +819,7 @@ static int dmx_section_feed_set(struct dmx_section_feed *feed,
if (pid > 0x1fff)
return -EINVAL;
if (down_interruptible(&dvbdmx->mutex))
if (mutex_lock_interruptible(&dvbdmx->mutex))
return -ERESTARTSYS;
dvb_demux_feed_add(dvbdmxfeed);
@ -833,13 +833,13 @@ static int dmx_section_feed_set(struct dmx_section_feed *feed,
#else
dvbdmxfeed->buffer = vmalloc(dvbdmxfeed->buffer_size);
if (!dvbdmxfeed->buffer) {
up(&dvbdmx->mutex);
mutex_unlock(&dvbdmx->mutex);
return -ENOMEM;
}
#endif
dvbdmxfeed->state = DMX_STATE_READY;
up(&dvbdmx->mutex);
mutex_unlock(&dvbdmx->mutex);
return 0;
}
@ -871,16 +871,16 @@ static int dmx_section_feed_start_filtering(struct dmx_section_feed *feed)
struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
int ret;
if (down_interruptible(&dvbdmx->mutex))
if (mutex_lock_interruptible(&dvbdmx->mutex))
return -ERESTARTSYS;
if (feed->is_filtering) {
up(&dvbdmx->mutex);
mutex_unlock(&dvbdmx->mutex);
return -EBUSY;
}
if (!dvbdmxfeed->filter) {
up(&dvbdmx->mutex);
mutex_unlock(&dvbdmx->mutex);
return -EINVAL;
}
@ -890,14 +890,14 @@ static int dmx_section_feed_start_filtering(struct dmx_section_feed *feed)
dvbdmxfeed->feed.sec.seclen = 0;
if (!dvbdmx->start_feed) {
up(&dvbdmx->mutex);
mutex_unlock(&dvbdmx->mutex);
return -ENODEV;
}
prepare_secfilters(dvbdmxfeed);
if ((ret = dvbdmx->start_feed(dvbdmxfeed)) < 0) {
up(&dvbdmx->mutex);
mutex_unlock(&dvbdmx->mutex);
return ret;
}
@ -906,7 +906,7 @@ static int dmx_section_feed_start_filtering(struct dmx_section_feed *feed)
dvbdmxfeed->state = DMX_STATE_GO;
spin_unlock_irq(&dvbdmx->lock);
up(&dvbdmx->mutex);
mutex_unlock(&dvbdmx->mutex);
return 0;
}
@ -916,11 +916,11 @@ static int dmx_section_feed_stop_filtering(struct dmx_section_feed *feed)
struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
int ret;
if (down_interruptible(&dvbdmx->mutex))
if (mutex_lock_interruptible(&dvbdmx->mutex))
return -ERESTARTSYS;
if (!dvbdmx->stop_feed) {
up(&dvbdmx->mutex);
mutex_unlock(&dvbdmx->mutex);
return -ENODEV;
}
@ -931,7 +931,7 @@ static int dmx_section_feed_stop_filtering(struct dmx_section_feed *feed)
feed->is_filtering = 0;
spin_unlock_irq(&dvbdmx->lock);
up(&dvbdmx->mutex);
mutex_unlock(&dvbdmx->mutex);
return ret;
}
@ -942,11 +942,11 @@ static int dmx_section_feed_release_filter(struct dmx_section_feed *feed,
struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed;
struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
if (down_interruptible(&dvbdmx->mutex))
if (mutex_lock_interruptible(&dvbdmx->mutex))
return -ERESTARTSYS;
if (dvbdmxfilter->feed != dvbdmxfeed) {
up(&dvbdmx->mutex);
mutex_unlock(&dvbdmx->mutex);
return -EINVAL;
}
@ -966,7 +966,7 @@ static int dmx_section_feed_release_filter(struct dmx_section_feed *feed,
dvbdmxfilter->state = DMX_STATE_FREE;
spin_unlock_irq(&dvbdmx->lock);
up(&dvbdmx->mutex);
mutex_unlock(&dvbdmx->mutex);
return 0;
}
@ -977,11 +977,11 @@ static int dvbdmx_allocate_section_feed(struct dmx_demux *demux,
struct dvb_demux *dvbdmx = (struct dvb_demux *)demux;
struct dvb_demux_feed *dvbdmxfeed;
if (down_interruptible(&dvbdmx->mutex))
if (mutex_lock_interruptible(&dvbdmx->mutex))
return -ERESTARTSYS;
if (!(dvbdmxfeed = dvb_dmx_feed_alloc(dvbdmx))) {
up(&dvbdmx->mutex);
mutex_unlock(&dvbdmx->mutex);
return -EBUSY;
}
@ -1006,7 +1006,7 @@ static int dvbdmx_allocate_section_feed(struct dmx_demux *demux,
(*feed)->stop_filtering = dmx_section_feed_stop_filtering;
(*feed)->release_filter = dmx_section_feed_release_filter;
up(&dvbdmx->mutex);
mutex_unlock(&dvbdmx->mutex);
return 0;
}
@ -1016,11 +1016,11 @@ static int dvbdmx_release_section_feed(struct dmx_demux *demux,
struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed;
struct dvb_demux *dvbdmx = (struct dvb_demux *)demux;
if (down_interruptible(&dvbdmx->mutex))
if (mutex_lock_interruptible(&dvbdmx->mutex))
return -ERESTARTSYS;
if (dvbdmxfeed->state == DMX_STATE_FREE) {
up(&dvbdmx->mutex);
mutex_unlock(&dvbdmx->mutex);
return -EINVAL;
}
#ifndef NOBUFS
@ -1033,7 +1033,7 @@ static int dvbdmx_release_section_feed(struct dmx_demux *demux,
dvbdmxfeed->pid = 0xffff;
up(&dvbdmx->mutex);
mutex_unlock(&dvbdmx->mutex);
return 0;
}
@ -1071,10 +1071,10 @@ static int dvbdmx_write(struct dmx_demux *demux, const char *buf, size_t count)
if ((!demux->frontend) || (demux->frontend->source != DMX_MEMORY_FE))
return -EINVAL;
if (down_interruptible(&dvbdemux->mutex))
if (mutex_lock_interruptible(&dvbdemux->mutex))
return -ERESTARTSYS;
dvb_dmx_swfilter(dvbdemux, buf, count);
up(&dvbdemux->mutex);
mutex_unlock(&dvbdemux->mutex);
if (signal_pending(current))
return -EINTR;
@ -1126,11 +1126,11 @@ static int dvbdmx_connect_frontend(struct dmx_demux *demux,
if (demux->frontend)
return -EINVAL;
if (down_interruptible(&dvbdemux->mutex))
if (mutex_lock_interruptible(&dvbdemux->mutex))
return -ERESTARTSYS;
demux->frontend = frontend;
up(&dvbdemux->mutex);
mutex_unlock(&dvbdemux->mutex);
return 0;
}
@ -1138,11 +1138,11 @@ static int dvbdmx_disconnect_frontend(struct dmx_demux *demux)
{
struct dvb_demux *dvbdemux = (struct dvb_demux *)demux;
if (down_interruptible(&dvbdemux->mutex))
if (mutex_lock_interruptible(&dvbdemux->mutex))
return -ERESTARTSYS;
demux->frontend = NULL;
up(&dvbdemux->mutex);
mutex_unlock(&dvbdemux->mutex);
return 0;
}
@ -1215,7 +1215,7 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux)
dmx->disconnect_frontend = dvbdmx_disconnect_frontend;
dmx->get_pes_pids = dvbdmx_get_pes_pids;
sema_init(&dvbdemux->mutex, 1);
mutex_init(&dvbdemux->mutex);
spin_lock_init(&dvbdemux->lock);
return 0;

View File

@ -26,7 +26,7 @@
#include <linux/time.h>
#include <linux/timer.h>
#include <linux/spinlock.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>
#include "demux.h"
@ -125,7 +125,7 @@ struct dvb_demux {
u8 tsbuf[204];
int tsbufp;
struct semaphore mutex;
struct mutex mutex;
spinlock_t lock;
};

View File

@ -37,7 +37,6 @@
#include <linux/suspend.h>
#include <linux/jiffies.h>
#include <asm/processor.h>
#include <asm/semaphore.h>
#include "dvb_frontend.h"
#include "dvbdev.h"
@ -50,13 +49,13 @@ static int dvb_powerdown_on_sleep = 1;
module_param_named(frontend_debug, dvb_frontend_debug, int, 0644);
MODULE_PARM_DESC(frontend_debug, "Turn on/off frontend core debugging (default:off).");
module_param(dvb_shutdown_timeout, int, 0444);
module_param(dvb_shutdown_timeout, int, 0644);
MODULE_PARM_DESC(dvb_shutdown_timeout, "wait <shutdown_timeout> seconds after close() before suspending hardware");
module_param(dvb_force_auto_inversion, int, 0444);
module_param(dvb_force_auto_inversion, int, 0644);
MODULE_PARM_DESC(dvb_force_auto_inversion, "0: normal (default), 1: INVERSION_AUTO forced always");
module_param(dvb_override_tune_delay, int, 0444);
module_param(dvb_override_tune_delay, int, 0644);
MODULE_PARM_DESC(dvb_override_tune_delay, "0: normal (default), >0 => delay in milliseconds to wait for lock after a tune attempt");
module_param(dvb_powerdown_on_sleep, int, 0444);
module_param(dvb_powerdown_on_sleep, int, 0644);
MODULE_PARM_DESC(dvb_powerdown_on_sleep, "0: do not power down, 1: turn LNB volatage off on sleep (default)");
#define dprintk if (dvb_frontend_debug) printk
@ -88,7 +87,7 @@ MODULE_PARM_DESC(dvb_powerdown_on_sleep, "0: do not power down, 1: turn LNB vola
* FESTATE_LOSTLOCK. When the lock has been lost, and we're searching it again.
*/
static DECLARE_MUTEX(frontend_mutex);
static DEFINE_MUTEX(frontend_mutex);
struct dvb_frontend_private {
@ -1021,12 +1020,12 @@ int dvb_register_frontend(struct dvb_adapter* dvb,
dprintk ("%s\n", __FUNCTION__);
if (down_interruptible (&frontend_mutex))
if (mutex_lock_interruptible(&frontend_mutex))
return -ERESTARTSYS;
fe->frontend_priv = kzalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL);
if (fe->frontend_priv == NULL) {
up(&frontend_mutex);
mutex_unlock(&frontend_mutex);
return -ENOMEM;
}
fepriv = fe->frontend_priv;
@ -1045,7 +1044,7 @@ int dvb_register_frontend(struct dvb_adapter* dvb,
dvb_register_device (fe->dvb, &fepriv->dvbdev, &dvbdev_template,
fe, DVB_DEVICE_FRONTEND);
up (&frontend_mutex);
mutex_unlock(&frontend_mutex);
return 0;
}
EXPORT_SYMBOL(dvb_register_frontend);
@ -1055,7 +1054,7 @@ int dvb_unregister_frontend(struct dvb_frontend* fe)
struct dvb_frontend_private *fepriv = fe->frontend_priv;
dprintk ("%s\n", __FUNCTION__);
down (&frontend_mutex);
mutex_lock(&frontend_mutex);
dvb_unregister_device (fepriv->dvbdev);
dvb_frontend_stop (fe);
if (fe->ops->release)
@ -1064,7 +1063,7 @@ int dvb_unregister_frontend(struct dvb_frontend* fe)
printk("dvb_frontend: Demodulator (%s) does not have a release callback!\n", fe->ops->info.name);
/* fe is invalid now */
kfree(fepriv);
up (&frontend_mutex);
mutex_unlock(&frontend_mutex);
return 0;
}
EXPORT_SYMBOL(dvb_unregister_frontend);

View File

@ -104,6 +104,7 @@ struct dvb_frontend {
struct dvb_adapter *dvb;
void* demodulator_priv;
void* frontend_priv;
void* misc_priv;
};
extern int dvb_register_frontend(struct dvb_adapter* dvb,

View File

@ -62,6 +62,7 @@
#include <linux/uio.h>
#include <asm/uaccess.h>
#include <linux/crc32.h>
#include <linux/mutex.h>
#include "dvb_demux.h"
#include "dvb_net.h"
@ -151,8 +152,7 @@ struct dvb_net_priv {
unsigned char ule_bridged; /* Whether the ULE_BRIDGED extension header was found. */
int ule_sndu_remain; /* Nr. of bytes still required for current ULE SNDU. */
unsigned long ts_count; /* Current ts cell counter. */
struct semaphore mutex;
struct mutex mutex;
};
@ -889,7 +889,7 @@ static int dvb_net_feed_start(struct net_device *dev)
unsigned char *mac = (unsigned char *) dev->dev_addr;
dprintk("%s: rx_mode %i\n", __FUNCTION__, priv->rx_mode);
down(&priv->mutex);
mutex_lock(&priv->mutex);
if (priv->tsfeed || priv->secfeed || priv->secfilter || priv->multi_secfilter[0])
printk("%s: BUG %d\n", __FUNCTION__, __LINE__);
@ -974,7 +974,7 @@ static int dvb_net_feed_start(struct net_device *dev)
ret = -EINVAL;
error:
up(&priv->mutex);
mutex_unlock(&priv->mutex);
return ret;
}
@ -984,7 +984,7 @@ static int dvb_net_feed_stop(struct net_device *dev)
int i, ret = 0;
dprintk("%s\n", __FUNCTION__);
down(&priv->mutex);
mutex_lock(&priv->mutex);
if (priv->feedtype == DVB_NET_FEEDTYPE_MPE) {
if (priv->secfeed) {
if (priv->secfeed->is_filtering) {
@ -1026,7 +1026,7 @@ static int dvb_net_feed_stop(struct net_device *dev)
printk("%s: no ts feed to stop\n", dev->name);
} else
ret = -EINVAL;
up(&priv->mutex);
mutex_unlock(&priv->mutex);
return ret;
}
@ -1208,7 +1208,7 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid, u8 feedtype)
INIT_WORK(&priv->set_multicast_list_wq, wq_set_multicast_list, net);
INIT_WORK(&priv->restart_net_feed_wq, wq_restart_net_feed, net);
init_MUTEX(&priv->mutex);
mutex_init(&priv->mutex);
net->base_addr = pid;

View File

@ -45,6 +45,7 @@ void dvb_ringbuffer_init(struct dvb_ringbuffer *rbuf, void *data, size_t len)
rbuf->pread=rbuf->pwrite=0;
rbuf->data=data;
rbuf->size=len;
rbuf->error=0;
init_waitqueue_head(&rbuf->queue);
@ -87,6 +88,7 @@ ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf)
void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf)
{
rbuf->pread = rbuf->pwrite;
rbuf->error = 0;
}

View File

@ -35,6 +35,7 @@ struct dvb_ringbuffer {
ssize_t size;
ssize_t pread;
ssize_t pwrite;
int error;
wait_queue_head_t queue;
spinlock_t lock;

View File

@ -77,7 +77,7 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num)
struct dvb_usb_device *d = i2c_get_adapdata(adap);
int i;
if (down_interruptible(&d->i2c_sem) < 0)
if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
return -EAGAIN;
if (num > 2)
@ -126,7 +126,7 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num)
}
}
up(&d->i2c_sem);
mutex_unlock(&d->i2c_mutex);
return i;
}

View File

@ -128,7 +128,7 @@ static int dibusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num
struct dvb_usb_device *d = i2c_get_adapdata(adap);
int i;
if (down_interruptible(&d->i2c_sem) < 0)
if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
return -EAGAIN;
if (num > 2)
@ -146,7 +146,7 @@ static int dibusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num
break;
}
up(&d->i2c_sem);
mutex_unlock(&d->i2c_mutex);
return i;
}

View File

@ -48,7 +48,7 @@ static int digitv_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num
struct dvb_usb_device *d = i2c_get_adapdata(adap);
int i;
if (down_interruptible(&d->i2c_sem) < 0)
if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
return -EAGAIN;
if (num > 2)
@ -67,7 +67,7 @@ static int digitv_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num
break;
}
up(&d->i2c_sem);
mutex_unlock(&d->i2c_mutex);
return i;
}

View File

@ -42,8 +42,8 @@ static int dvb_usb_init(struct dvb_usb_device *d)
{
int ret = 0;
sema_init(&d->usb_sem, 1);
sema_init(&d->i2c_sem, 1);
mutex_init(&d->usb_mutex);
mutex_init(&d->i2c_mutex);
d->state = DVB_USB_STATE_INIT;

View File

@ -21,7 +21,7 @@ int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf,
if (wbuf == NULL || wlen == 0)
return -EINVAL;
if ((ret = down_interruptible(&d->usb_sem)))
if ((ret = mutex_lock_interruptible(&d->usb_mutex)))
return ret;
deb_xfer(">>> ");
@ -53,7 +53,7 @@ int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf,
}
}
up(&d->usb_sem);
mutex_unlock(&d->usb_mutex);
return ret;
}
EXPORT_SYMBOL(dvb_usb_generic_rw);

View File

@ -12,6 +12,7 @@
#include <linux/input.h>
#include <linux/usb.h>
#include <linux/firmware.h>
#include <linux/mutex.h>
#include "dvb_frontend.h"
#include "dvb_demux.h"
@ -227,8 +228,8 @@ struct dvb_usb_properties {
* @feedcount: number of reqested feeds (used for streaming-activation)
* @pid_filtering: is hardware pid_filtering used or not.
*
* @usb_sem: semaphore of USB control messages (reading needs two messages)
* @i2c_sem: semaphore for i2c-transfers
* @usb_mutex: semaphore of USB control messages (reading needs two messages)
* @i2c_mutex: semaphore for i2c-transfers
*
* @i2c_adap: device's i2c_adapter if it uses I2CoverUSB
* @pll_addr: I2C address of the tuner for programming
@ -283,10 +284,10 @@ struct dvb_usb_device {
int pid_filtering;
/* locking */
struct semaphore usb_sem;
struct mutex usb_mutex;
/* i2c */
struct semaphore i2c_sem;
struct mutex i2c_mutex;
struct i2c_adapter i2c_adap;
/* tuner programming information */

View File

@ -75,7 +75,7 @@ int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int il
{
int ret;
if ((ret = down_interruptible(&d->usb_sem)))
if ((ret = mutex_lock_interruptible(&d->usb_mutex)))
return ret;
if ((ret = vp702x_usb_out_op(d,REQUEST_OUT,0,0,o,olen)) < 0)
@ -84,7 +84,7 @@ int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int il
ret = vp702x_usb_in_op(d,REQUEST_IN,0,0,i,ilen);
unlock:
up(&d->usb_sem);
mutex_unlock(&d->usb_mutex);
return ret;
}

View File

@ -38,7 +38,7 @@ int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in,
deb_xfer("out buffer: ");
debug_dump(outbuf,outlen+1,deb_xfer);
if ((ret = down_interruptible(&d->usb_sem)))
if ((ret = mutex_lock_interruptible(&d->usb_mutex)))
return ret;
if (usb_control_msg(d->udev,
@ -68,7 +68,7 @@ int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in,
memcpy(in,&inbuf[1],inlen);
unlock:
up(&d->usb_sem);
mutex_unlock(&d->usb_mutex);
return ret;
}

View File

@ -116,6 +116,12 @@ config DVB_MT352
help
A DVB-T tuner module. Say Y when you want to support this frontend.
config DVB_ZL10353
tristate "Zarlink ZL10353 based"
depends on DVB_CORE
help
A DVB-T tuner module. Say Y when you want to support this frontend.
config DVB_DIB3000MB
tristate "DiBcom 3000M-B"
depends on DVB_CORE
@ -155,7 +161,7 @@ comment "ATSC (North American/Korean Terresterial DTV) frontends"
depends on DVB_CORE
config DVB_NXT200X
tristate "Nextwave NXT2002/NXT2004 based"
tristate "NxtWave Communications NXT2002/NXT2004 based"
depends on DVB_CORE
select FW_LOADER
help
@ -169,14 +175,14 @@ config DVB_NXT200X
or /lib/firmware (depending on configuration of firmware hotplug).
config DVB_OR51211
tristate "or51211 based (pcHDTV HD2000 card)"
tristate "Oren OR51211 based"
depends on DVB_CORE
select FW_LOADER
help
An ATSC 8VSB tuner module. Say Y when you want to support this frontend.
config DVB_OR51132
tristate "OR51132 based (pcHDTV HD3000 card)"
tristate "Oren OR51132 based"
depends on DVB_CORE
select FW_LOADER
help

View File

@ -20,6 +20,7 @@ obj-$(CONFIG_DVB_TDA1004X) += tda1004x.o
obj-$(CONFIG_DVB_SP887X) += sp887x.o
obj-$(CONFIG_DVB_NXT6000) += nxt6000.o
obj-$(CONFIG_DVB_MT352) += mt352.o
obj-$(CONFIG_DVB_ZL10353) += zl10353.o
obj-$(CONFIG_DVB_CX22702) += cx22702.o
obj-$(CONFIG_DVB_TDA10021) += tda10021.o
obj-$(CONFIG_DVB_STV0297) += stv0297.o

View File

@ -39,6 +39,7 @@
#include <linux/jiffies.h>
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include "dvb_frontend.h"
#include "bcm3510.h"
@ -52,7 +53,7 @@ struct bcm3510_state {
struct dvb_frontend frontend;
/* demodulator private data */
struct semaphore hab_sem;
struct mutex hab_mutex;
u8 firmware_loaded:1;
unsigned long next_status_check;
@ -213,7 +214,7 @@ static int bcm3510_do_hab_cmd(struct bcm3510_state *st, u8 cmd, u8 msgid, u8 *ob
dbufout(ob,olen+2,deb_hab);
deb_hab("\n");
if (down_interruptible(&st->hab_sem) < 0)
if (mutex_lock_interruptible(&st->hab_mutex) < 0)
return -EAGAIN;
if ((ret = bcm3510_hab_send_request(st, ob, olen+2)) < 0 ||
@ -226,7 +227,7 @@ static int bcm3510_do_hab_cmd(struct bcm3510_state *st, u8 cmd, u8 msgid, u8 *ob
memcpy(ibuf,&ib[2],ilen);
error:
up(&st->hab_sem);
mutex_unlock(&st->hab_mutex);
return ret;
}
@ -796,7 +797,7 @@ struct dvb_frontend* bcm3510_attach(const struct bcm3510_config *config,
state->frontend.ops = &state->ops;
state->frontend.demodulator_priv = state;
sema_init(&state->hab_sem, 1);
mutex_init(&state->hab_mutex);
if ((ret = bcm3510_readB(state,0xe0,&v)) < 0)
goto error;

View File

@ -0,0 +1,123 @@
/*
* bsbe1.h - ALPS BSBE1 tuner support (moved from av7110.c)
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*
*
* the project's page is at http://www.linuxtv.org
*/
#ifndef BSBE1_H
#define BSBE1_H
static u8 alps_bsbe1_inittab[] = {
0x01, 0x15,
0x02, 0x30,
0x03, 0x00,
0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */
0x06, 0x40, /* DAC not used, set to high impendance mode */
0x07, 0x00, /* DAC LSB */
0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */
0x09, 0x00, /* FIFO */
0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */
0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */
0x10, 0x3f, // AGC2 0x3d
0x11, 0x84,
0x12, 0xb9,
0x15, 0xc9, // lock detector threshold
0x16, 0x00,
0x17, 0x00,
0x18, 0x00,
0x19, 0x00,
0x1a, 0x00,
0x1f, 0x50,
0x20, 0x00,
0x21, 0x00,
0x22, 0x00,
0x23, 0x00,
0x28, 0x00, // out imp: normal out type: parallel FEC mode:0
0x29, 0x1e, // 1/2 threshold
0x2a, 0x14, // 2/3 threshold
0x2b, 0x0f, // 3/4 threshold
0x2c, 0x09, // 5/6 threshold
0x2d, 0x05, // 7/8 threshold
0x2e, 0x01,
0x31, 0x1f, // test all FECs
0x32, 0x19, // viterbi and synchro search
0x33, 0xfc, // rs control
0x34, 0x93, // error control
0x0f, 0x92,
0xff, 0xff
};
static int alps_bsbe1_set_symbol_rate(struct dvb_frontend* fe, u32 srate, u32 ratio)
{
u8 aclk = 0;
u8 bclk = 0;
if (srate < 1500000) { aclk = 0xb7; bclk = 0x47; }
else if (srate < 3000000) { aclk = 0xb7; bclk = 0x4b; }
else if (srate < 7000000) { aclk = 0xb7; bclk = 0x4f; }
else if (srate < 14000000) { aclk = 0xb7; bclk = 0x53; }
else if (srate < 30000000) { aclk = 0xb6; bclk = 0x53; }
else if (srate < 45000000) { aclk = 0xb4; bclk = 0x51; }
stv0299_writereg(fe, 0x13, aclk);
stv0299_writereg(fe, 0x14, bclk);
stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff);
stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff);
stv0299_writereg(fe, 0x21, (ratio ) & 0xf0);
return 0;
}
static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params)
{
int ret;
u8 data[4];
u32 div;
struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
if ((params->frequency < 950000) || (params->frequency > 2150000))
return -EINVAL;
div = (params->frequency + (125 - 1)) / 125; // round correctly
data[0] = (div >> 8) & 0x7f;
data[1] = div & 0xff;
data[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4;
ret = i2c_transfer(i2c, &msg, 1);
return (ret != 1) ? -EIO : 0;
}
static struct stv0299_config alps_bsbe1_config = {
.demod_address = 0x68,
.inittab = alps_bsbe1_inittab,
.mclk = 88000000UL,
.invert = 1,
.skip_reinit = 0,
.min_delay_ms = 100,
.set_symbol_rate = alps_bsbe1_set_symbol_rate,
.pll_set = alps_bsbe1_pll_set,
};
#endif

View File

@ -0,0 +1,140 @@
/*
* bsru6.h - ALPS BSRU6 tuner support (moved from budget-ci.c)
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*
*
* the project's page is at http://www.linuxtv.org
*/
#ifndef BSRU6_H
#define BSRU6_H
static u8 alps_bsru6_inittab[] = {
0x01, 0x15,
0x02, 0x00,
0x03, 0x00,
0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */
0x06, 0x40, /* DAC not used, set to high impendance mode */
0x07, 0x00, /* DAC LSB */
0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */
0x09, 0x00, /* FIFO */
0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */
0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */
0x10, 0x3f, // AGC2 0x3d
0x11, 0x84,
0x12, 0xb9,
0x15, 0xc9, // lock detector threshold
0x16, 0x00,
0x17, 0x00,
0x18, 0x00,
0x19, 0x00,
0x1a, 0x00,
0x1f, 0x50,
0x20, 0x00,
0x21, 0x00,
0x22, 0x00,
0x23, 0x00,
0x28, 0x00, // out imp: normal out type: parallel FEC mode:0
0x29, 0x1e, // 1/2 threshold
0x2a, 0x14, // 2/3 threshold
0x2b, 0x0f, // 3/4 threshold
0x2c, 0x09, // 5/6 threshold
0x2d, 0x05, // 7/8 threshold
0x2e, 0x01,
0x31, 0x1f, // test all FECs
0x32, 0x19, // viterbi and synchro search
0x33, 0xfc, // rs control
0x34, 0x93, // error control
0x0f, 0x52,
0xff, 0xff
};
static int alps_bsru6_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 ratio)
{
u8 aclk = 0;
u8 bclk = 0;
if (srate < 1500000) {
aclk = 0xb7;
bclk = 0x47;
} else if (srate < 3000000) {
aclk = 0xb7;
bclk = 0x4b;
} else if (srate < 7000000) {
aclk = 0xb7;
bclk = 0x4f;
} else if (srate < 14000000) {
aclk = 0xb7;
bclk = 0x53;
} else if (srate < 30000000) {
aclk = 0xb6;
bclk = 0x53;
} else if (srate < 45000000) {
aclk = 0xb4;
bclk = 0x51;
}
stv0299_writereg(fe, 0x13, aclk);
stv0299_writereg(fe, 0x14, bclk);
stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff);
stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff);
stv0299_writereg(fe, 0x21, ratio & 0xf0);
return 0;
}
static int alps_bsru6_pll_set(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters *params)
{
u8 buf[4];
u32 div;
struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) };
if ((params->frequency < 950000) || (params->frequency > 2150000))
return -EINVAL;
div = (params->frequency + (125 - 1)) / 125; // round correctly
buf[0] = (div >> 8) & 0x7f;
buf[1] = div & 0xff;
buf[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
buf[3] = 0xC4;
if (params->frequency > 1530000)
buf[3] = 0xc0;
if (i2c_transfer(i2c, &msg, 1) != 1)
return -EIO;
return 0;
}
static struct stv0299_config alps_bsru6_config = {
.demod_address = 0x68,
.inittab = alps_bsru6_inittab,
.mclk = 88000000UL,
.invert = 1,
.skip_reinit = 0,
.lock_output = STV0229_LOCKOUTPUT_1,
.volt13_op0_op1 = STV0299_VOLT13_OP1,
.min_delay_ms = 100,
.set_symbol_rate = alps_bsru6_set_symbol_rate,
.pll_set = alps_bsru6_pll_set,
};
#endif

View File

@ -371,6 +371,15 @@ static int cx24110_initfe(struct dvb_frontend* fe)
return 0;
}
static int cx24110_sleep(struct dvb_frontend *fe)
{
struct cx24110_state *state = fe->demodulator_priv;
if (state->config->pll_sleep)
return state->config->pll_sleep(fe);
return 0;
}
static int cx24110_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage)
{
struct cx24110_state *state = fe->demodulator_priv;
@ -418,6 +427,9 @@ static int cx24110_send_diseqc_msg(struct dvb_frontend* fe,
struct cx24110_state *state = fe->demodulator_priv;
unsigned long timeout;
if (cmd->msg_len < 3 || cmd->msg_len > 6)
return -EINVAL; /* not implemented */
for (i = 0; i < cmd->msg_len; i++)
cx24110_writereg(state, 0x79 + i, cmd->msg[i]);
@ -639,6 +651,7 @@ static struct dvb_frontend_ops cx24110_ops = {
.release = cx24110_release,
.init = cx24110_initfe,
.sleep = cx24110_sleep,
.set_frontend = cx24110_set_frontend,
.get_frontend = cx24110_get_frontend,
.read_status = cx24110_read_status,

View File

@ -35,6 +35,7 @@ struct cx24110_config
/* PLL maintenance */
int (*pll_init)(struct dvb_frontend* fe);
int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
int (*pll_sleep)(struct dvb_frontend* fe);
};
extern struct dvb_frontend* cx24110_attach(const struct cx24110_config* config,

View File

@ -362,6 +362,63 @@ struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261 = {
};
EXPORT_SYMBOL(dvb_pll_philips_sd1878_tda8261);
/*
* Philips TD1316 Tuner.
*/
static void td1316_bw(u8 *buf, u32 freq, int bandwidth)
{
u8 band;
/* determine band */
if (freq < 161000000)
band = 1;
else if (freq < 444000000)
band = 2;
else
band = 4;
buf[3] |= band;
/* setup PLL filter */
if (bandwidth == BANDWIDTH_8_MHZ)
buf[3] |= 1 << 3;
}
struct dvb_pll_desc dvb_pll_philips_td1316 = {
.name = "Philips TD1316",
.min = 87000000,
.max = 895000000,
.setbw = td1316_bw,
.count = 9,
.entries = {
{ 93834000, 36166000, 166666, 0xca, 0x60},
{ 123834000, 36166000, 166666, 0xca, 0xa0},
{ 163834000, 36166000, 166666, 0xca, 0xc0},
{ 253834000, 36166000, 166666, 0xca, 0x60},
{ 383834000, 36166000, 166666, 0xca, 0xa0},
{ 443834000, 36166000, 166666, 0xca, 0xc0},
{ 583834000, 36166000, 166666, 0xca, 0x60},
{ 793834000, 36166000, 166666, 0xca, 0xa0},
{ 858834000, 36166000, 166666, 0xca, 0xe0},
},
};
EXPORT_SYMBOL(dvb_pll_philips_td1316);
/* FE6600 used on DViCO Hybrid */
struct dvb_pll_desc dvb_pll_thomson_fe6600 = {
.name = "Thomson FE6600",
.min = 44250000,
.max = 858000000,
.count = 4,
.entries = {
{ 250000000, 36213333, 166667, 0xb4, 0x12 },
{ 455000000, 36213333, 166667, 0xfe, 0x11 },
{ 775500000, 36213333, 166667, 0xbc, 0x18 },
{ 999999999, 36213333, 166667, 0xf4, 0x18 },
}
};
EXPORT_SYMBOL(dvb_pll_thomson_fe6600);
/* ----------------------------------------------------------- */
/* code */
@ -391,8 +448,8 @@ int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf,
div = (freq + desc->entries[i].offset) / desc->entries[i].stepsize;
buf[0] = div >> 8;
buf[1] = div & 0xff;
buf[2] = desc->entries[i].cb1;
buf[3] = desc->entries[i].cb2;
buf[2] = desc->entries[i].config;
buf[3] = desc->entries[i].cb;
if (desc->setbw)
desc->setbw(buf, freq, bandwidth);

View File

@ -15,8 +15,8 @@ struct dvb_pll_desc {
u32 limit;
u32 offset;
u32 stepsize;
u8 cb1;
u8 cb2;
u8 config;
u8 cb;
} entries[12];
};
@ -40,6 +40,9 @@ extern struct dvb_pll_desc dvb_pll_tuv1236d;
extern struct dvb_pll_desc dvb_pll_tdhu2;
extern struct dvb_pll_desc dvb_pll_samsung_tbmv;
extern struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261;
extern struct dvb_pll_desc dvb_pll_philips_td1316;
extern struct dvb_pll_desc dvb_pll_thomson_fe6600;
int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf,
u32 freq, int bandwidth);

View File

@ -0,0 +1,139 @@
/*
* lnbp21.h - driver for lnb supply and control ic lnbp21
*
* Copyright (C) 2006 Oliver Endriss
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*
*
* the project's page is at http://www.linuxtv.org
*/
#ifndef _LNBP21_H
#define _LNBP21_H
/* system register */
#define LNBP21_OLF 0x01
#define LNBP21_OTF 0x02
#define LNBP21_EN 0x04
#define LNBP21_VSEL 0x08
#define LNBP21_LLC 0x10
#define LNBP21_TEN 0x20
#define LNBP21_ISEL 0x40
#define LNBP21_PCL 0x80
struct lnbp21 {
u8 config;
u8 override_or;
u8 override_and;
struct i2c_adapter *i2c;
void (*release_chain)(struct dvb_frontend* fe);
};
static int lnbp21_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
{
struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv;
struct i2c_msg msg = { .addr = 0x08, .flags = 0,
.buf = &lnbp21->config,
.len = sizeof(lnbp21->config) };
lnbp21->config &= ~(LNBP21_VSEL | LNBP21_EN);
switch(voltage) {
case SEC_VOLTAGE_OFF:
break;
case SEC_VOLTAGE_13:
lnbp21->config |= LNBP21_EN;
break;
case SEC_VOLTAGE_18:
lnbp21->config |= (LNBP21_EN | LNBP21_VSEL);
break;
default:
return -EINVAL;
};
lnbp21->config |= lnbp21->override_or;
lnbp21->config &= lnbp21->override_and;
return (i2c_transfer(lnbp21->i2c, &msg, 1) == 1) ? 0 : -EIO;
}
static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg)
{
struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv;
struct i2c_msg msg = { .addr = 0x08, .flags = 0,
.buf = &lnbp21->config,
.len = sizeof(lnbp21->config) };
if (arg)
lnbp21->config |= LNBP21_LLC;
else
lnbp21->config &= ~LNBP21_LLC;
lnbp21->config |= lnbp21->override_or;
lnbp21->config &= lnbp21->override_and;
return (i2c_transfer(lnbp21->i2c, &msg, 1) == 1) ? 0 : -EIO;
}
static void lnbp21_exit(struct dvb_frontend *fe)
{
struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv;
/* LNBP power off */
lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF);
/* free data & call next release routine */
fe->ops->release = lnbp21->release_chain;
kfree(fe->misc_priv);
fe->misc_priv = NULL;
if (fe->ops->release)
fe->ops->release(fe);
}
static int lnbp21_init(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear)
{
struct lnbp21 *lnbp21 = kmalloc(sizeof(struct lnbp21), GFP_KERNEL);
if (!lnbp21)
return -ENOMEM;
/* default configuration */
lnbp21->config = LNBP21_ISEL;
/* bits which should be forced to '1' */
lnbp21->override_or = override_set;
/* bits which should be forced to '0' */
lnbp21->override_and = ~override_clear;
/* install release callback */
lnbp21->release_chain = fe->ops->release;
fe->ops->release = lnbp21_exit;
/* override frontend ops */
fe->ops->set_voltage = lnbp21_set_voltage;
fe->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage;
lnbp21->i2c = i2c;
fe->misc_priv = lnbp21;
return lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF);
}
#endif

View File

@ -229,7 +229,7 @@ static int tda1004x_enable_tuner_i2c(struct tda1004x_state *state)
dprintk("%s\n", __FUNCTION__);
result = tda1004x_write_mask(state, TDA1004X_CONFC4, 2, 2);
msleep(1);
msleep(20);
return result;
}
@ -502,7 +502,12 @@ static int tda10046_fwupload(struct dvb_frontend* fe)
const struct firmware *fw;
/* reset + wake up chip */
tda1004x_write_byteI(state, TDA1004X_CONFC4, 0);
if (state->config->xtal_freq == TDA10046_XTAL_4M) {
tda1004x_write_byteI(state, TDA1004X_CONFC4, 0);
} else {
dprintk("%s: 16MHz Xtal, reducing I2C speed\n", __FUNCTION__);
tda1004x_write_byteI(state, TDA1004X_CONFC4, 0x80);
}
tda1004x_write_mask(state, TDA10046H_CONF_TRISTATE1, 1, 0);
/* let the clocks recover from sleep */
msleep(5);
@ -651,7 +656,7 @@ static int tda10046_init(struct dvb_frontend* fe)
// tda setup
tda1004x_write_mask(state, TDA1004X_CONFC4, 0x20, 0); // disable DSP watchdog timer
tda1004x_write_byteI(state, TDA1004X_AUTO, 0x87); // 100 ppm crystal, select HP stream
tda1004x_write_byteI(state, TDA1004X_CONFC1, 8); // disable pulse killer
tda1004x_write_byteI(state, TDA1004X_CONFC1, 0x88); // enable pulse killer
switch (state->config->agc_config) {
case TDA10046_AGC_DEFAULT:
@ -672,6 +677,12 @@ static int tda10046_init(struct dvb_frontend* fe)
tda1004x_write_byteI(state, TDA10046H_AGC_RENORM, 0x08); // Gain Renormalize
tda1004x_write_byteI(state, TDA10046H_CONF_POLARITY, 0x6a); // set AGC polarities
break;
case TDA10046_AGC_TDA827X_GPL:
tda1004x_write_byteI(state, TDA10046H_AGC_CONF, 0x02); // AGC setup
tda1004x_write_byteI(state, TDA10046H_AGC_THR, 0x70); // AGC Threshold
tda1004x_write_byteI(state, TDA10046H_AGC_RENORM, 0x08); // Gain Renormalize
tda1004x_write_byteI(state, TDA10046H_CONF_POLARITY, 0x60); // set AGC polarities
break;
}
tda1004x_write_byteI(state, TDA1004X_CONFADC2, 0x38);
tda1004x_write_byteI(state, TDA10046H_CONF_TRISTATE1, 0x61); // Turn both AGC outputs on
@ -683,6 +694,7 @@ static int tda10046_init(struct dvb_frontend* fe)
tda1004x_write_byteI(state, TDA10046H_CVBER_CTRL, 0x1a); // 10^6 VBER measurement bits
tda1004x_write_byteI(state, TDA1004X_CONF_TS1, 7); // MPEG2 interface config
tda1004x_write_byteI(state, TDA1004X_CONF_TS2, 0xc0); // MPEG2 interface config
// tda1004x_write_mask(state, 0x50, 0x80, 0x80); // handle out of guard echoes
tda1004x_write_mask(state, 0x3a, 0x80, state->config->invert_oclk << 7);
state->initialised = 1;
@ -1027,6 +1039,7 @@ static int tda1004x_read_status(struct dvb_frontend* fe, fe_status_t * fe_status
if (status == -1)
return -EIO;
cber |= (status << 8);
// The address 0x20 should be read to cope with a TDA10046 bug
tda1004x_read_byte(state, TDA1004X_CBER_RESET);
if (cber != 65535)
@ -1047,7 +1060,8 @@ static int tda1004x_read_status(struct dvb_frontend* fe, fe_status_t * fe_status
status = tda1004x_read_byte(state, TDA1004X_VBER_MSB);
if (status == -1)
return -EIO;
vber |= ((status << 16) & 0x0f);
vber |= (status & 0x0f) << 16;
// The CVBER_LUT should be read to cope with TDA10046 hardware bug
tda1004x_read_byte(state, TDA1004X_CVBER_LUT);
// if RS has passed some valid TS packets, then we must be
@ -1161,6 +1175,7 @@ static int tda1004x_read_ber(struct dvb_frontend* fe, u32* ber)
if (tmp < 0)
return -EIO;
*ber |= (tmp << 9);
// The address 0x20 should be read to cope with a TDA10046 bug
tda1004x_read_byte(state, TDA1004X_CBER_RESET);
dprintk("%s: ber=0x%x\n", __FUNCTION__, *ber);
@ -1187,6 +1202,8 @@ static int tda1004x_sleep(struct dvb_frontend* fe)
tda1004x_disable_tuner_i2c(state);
}
}
/* set outputs to tristate */
tda1004x_write_byteI(state, TDA10046H_CONF_TRISTATE1, 0xff);
tda1004x_write_mask(state, TDA1004X_CONFC4, 1, 1);
break;
}

View File

@ -35,7 +35,8 @@ enum tda10046_agc {
TDA10046_AGC_DEFAULT, /* original configuration */
TDA10046_AGC_IFO_AUTO_NEG, /* IF AGC only, automatic, negtive */
TDA10046_AGC_IFO_AUTO_POS, /* IF AGC only, automatic, positive */
TDA10046_AGC_TDA827X, /* IF AGC only, special setup for tda827x */
TDA10046_AGC_TDA827X, /* IF AGC only, special setup for tda827x */
TDA10046_AGC_TDA827X_GPL, /* same as above, but GPIOs 0 */
};
enum tda10046_if {

View File

@ -0,0 +1,311 @@
/*
* Driver for Zarlink DVB-T ZL10353 demodulator
*
* Copyright (C) 2006 Christopher Pascoe <c.pascoe@itee.uq.edu.au>
*
* 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/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/string.h>
#include <linux/slab.h>
#include "dvb_frontend.h"
#include "zl10353_priv.h"
#include "zl10353.h"
struct zl10353_state {
struct i2c_adapter *i2c;
struct dvb_frontend frontend;
struct dvb_frontend_ops ops;
struct zl10353_config config;
};
static int debug_regs = 0;
static int zl10353_single_write(struct dvb_frontend *fe, u8 reg, u8 val)
{
struct zl10353_state *state = fe->demodulator_priv;
u8 buf[2] = { reg, val };
struct i2c_msg msg = { .addr = state->config.demod_address, .flags = 0,
.buf = buf, .len = 2 };
int err = i2c_transfer(state->i2c, &msg, 1);
if (err != 1) {
printk("zl10353: write to reg %x failed (err = %d)!\n", reg, err);
return err;
}
return 0;
}
int zl10353_write(struct dvb_frontend *fe, u8 *ibuf, int ilen)
{
int err, i;
for (i = 0; i < ilen - 1; i++)
if ((err = zl10353_single_write(fe, ibuf[0] + i, ibuf[i + 1])))
return err;
return 0;
}
static int zl10353_read_register(struct zl10353_state *state, u8 reg)
{
int ret;
u8 b0[1] = { reg };
u8 b1[1] = { 0 };
struct i2c_msg msg[2] = { { .addr = state->config.demod_address,
.flags = 0,
.buf = b0, .len = 1 },
{ .addr = state->config.demod_address,
.flags = I2C_M_RD,
.buf = b1, .len = 1 } };
ret = i2c_transfer(state->i2c, msg, 2);
if (ret != 2) {
printk("%s: readreg error (reg=%d, ret==%i)\n",
__FUNCTION__, reg, ret);
return ret;
}
return b1[0];
}
static void zl10353_dump_regs(struct dvb_frontend *fe)
{
struct zl10353_state *state = fe->demodulator_priv;
char buf[52], buf2[4];
int ret;
u8 reg;
/* Dump all registers. */
for (reg = 0; ; reg++) {
if (reg % 16 == 0) {
if (reg)
printk(KERN_DEBUG "%s\n", buf);
sprintf(buf, "%02x: ", reg);
}
ret = zl10353_read_register(state, reg);
if (ret >= 0)
sprintf(buf2, "%02x ", (u8)ret);
else
strcpy(buf2, "-- ");
strcat(buf, buf2);
if (reg == 0xff)
break;
}
printk(KERN_DEBUG "%s\n", buf);
}
static int zl10353_sleep(struct dvb_frontend *fe)
{
static u8 zl10353_softdown[] = { 0x50, 0x0C, 0x44 };
zl10353_write(fe, zl10353_softdown, sizeof(zl10353_softdown));
return 0;
}
static int zl10353_set_parameters(struct dvb_frontend *fe,
struct dvb_frontend_parameters *param)
{
struct zl10353_state *state = fe->demodulator_priv;
u8 pllbuf[6] = { 0x67 };
/* These settings set "auto-everything" and start the FSM. */
zl10353_single_write(fe, 0x55, 0x80);
udelay(200);
zl10353_single_write(fe, 0xEA, 0x01);
udelay(200);
zl10353_single_write(fe, 0xEA, 0x00);
zl10353_single_write(fe, 0x56, 0x28);
zl10353_single_write(fe, 0x89, 0x20);
zl10353_single_write(fe, 0x5E, 0x00);
zl10353_single_write(fe, 0x65, 0x5A);
zl10353_single_write(fe, 0x66, 0xE9);
zl10353_single_write(fe, 0x62, 0x0A);
state->config.pll_set(fe, param, pllbuf + 1);
zl10353_write(fe, pllbuf, sizeof(pllbuf));
zl10353_single_write(fe, 0x70, 0x01);
udelay(250);
zl10353_single_write(fe, 0xE4, 0x00);
zl10353_single_write(fe, 0xE5, 0x2A);
zl10353_single_write(fe, 0xE9, 0x02);
zl10353_single_write(fe, 0xE7, 0x40);
zl10353_single_write(fe, 0xE8, 0x10);
return 0;
}
static int zl10353_read_status(struct dvb_frontend *fe, fe_status_t *status)
{
struct zl10353_state *state = fe->demodulator_priv;
int s6, s7, s8;
if ((s6 = zl10353_read_register(state, STATUS_6)) < 0)
return -EREMOTEIO;
if ((s7 = zl10353_read_register(state, STATUS_7)) < 0)
return -EREMOTEIO;
if ((s8 = zl10353_read_register(state, STATUS_8)) < 0)
return -EREMOTEIO;
*status = 0;
if (s6 & (1 << 2))
*status |= FE_HAS_CARRIER;
if (s6 & (1 << 1))
*status |= FE_HAS_VITERBI;
if (s6 & (1 << 5))
*status |= FE_HAS_LOCK;
if (s7 & (1 << 4))
*status |= FE_HAS_SYNC;
if (s8 & (1 << 6))
*status |= FE_HAS_SIGNAL;
if ((*status & (FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC)) !=
(FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC))
*status &= ~FE_HAS_LOCK;
return 0;
}
static int zl10353_read_snr(struct dvb_frontend *fe, u16 *snr)
{
struct zl10353_state *state = fe->demodulator_priv;
u8 _snr;
if (debug_regs)
zl10353_dump_regs(fe);
_snr = zl10353_read_register(state, SNR);
*snr = (_snr << 8) | _snr;
return 0;
}
static int zl10353_get_tune_settings(struct dvb_frontend *fe,
struct dvb_frontend_tune_settings
*fe_tune_settings)
{
fe_tune_settings->min_delay_ms = 1000;
fe_tune_settings->step_size = 0;
fe_tune_settings->max_drift = 0;
return 0;
}
static int zl10353_init(struct dvb_frontend *fe)
{
struct zl10353_state *state = fe->demodulator_priv;
u8 zl10353_reset_attach[6] = { 0x50, 0x03, 0x64, 0x46, 0x15, 0x0F };
int rc = 0;
if (debug_regs)
zl10353_dump_regs(fe);
/* Do a "hard" reset if not already done */
if (zl10353_read_register(state, 0x50) != 0x03) {
rc = zl10353_write(fe, zl10353_reset_attach,
sizeof(zl10353_reset_attach));
if (debug_regs)
zl10353_dump_regs(fe);
}
return 0;
}
static void zl10353_release(struct dvb_frontend *fe)
{
struct zl10353_state *state = fe->demodulator_priv;
kfree(state);
}
static struct dvb_frontend_ops zl10353_ops;
struct dvb_frontend *zl10353_attach(const struct zl10353_config *config,
struct i2c_adapter *i2c)
{
struct zl10353_state *state = NULL;
/* allocate memory for the internal state */
state = kzalloc(sizeof(struct zl10353_state), GFP_KERNEL);
if (state == NULL)
goto error;
/* setup the state */
state->i2c = i2c;
memcpy(&state->config, config, sizeof(struct zl10353_config));
memcpy(&state->ops, &zl10353_ops, sizeof(struct dvb_frontend_ops));
/* check if the demod is there */
if (zl10353_read_register(state, CHIP_ID) != ID_ZL10353)
goto error;
/* create dvb_frontend */
state->frontend.ops = &state->ops;
state->frontend.demodulator_priv = state;
return &state->frontend;
error:
kfree(state);
return NULL;
}
static struct dvb_frontend_ops zl10353_ops = {
.info = {
.name = "Zarlink ZL10353 DVB-T",
.type = FE_OFDM,
.frequency_min = 174000000,
.frequency_max = 862000000,
.frequency_stepsize = 166667,
.frequency_tolerance = 0,
.caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 |
FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 |
FE_CAN_FEC_AUTO |
FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO |
FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO |
FE_CAN_HIERARCHY_AUTO | FE_CAN_RECOVER |
FE_CAN_MUTE_TS
},
.release = zl10353_release,
.init = zl10353_init,
.sleep = zl10353_sleep,
.set_frontend = zl10353_set_parameters,
.get_tune_settings = zl10353_get_tune_settings,
.read_status = zl10353_read_status,
.read_snr = zl10353_read_snr,
};
module_param(debug_regs, int, 0644);
MODULE_PARM_DESC(debug_regs, "Turn on/off frontend register dumps (default:off).");
MODULE_DESCRIPTION("Zarlink ZL10353 DVB-T demodulator driver");
MODULE_AUTHOR("Chris Pascoe");
MODULE_LICENSE("GPL");
EXPORT_SYMBOL(zl10353_attach);
EXPORT_SYMBOL(zl10353_write);

View File

@ -0,0 +1,43 @@
/*
* Driver for Zarlink DVB-T ZL10353 demodulator
*
* Copyright (C) 2006 Christopher Pascoe <c.pascoe@itee.uq.edu.au>
*
* 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.=
*/
#ifndef ZL10353_H
#define ZL10353_H
#include <linux/dvb/frontend.h>
struct zl10353_config
{
/* demodulator's I2C address */
u8 demod_address;
/* function which configures the PLL buffer (for secondary I2C
* connected tuner) or tunes the PLL (for direct connected tuner) */
int (*pll_set)(struct dvb_frontend *fe,
struct dvb_frontend_parameters *params, u8 *pllbuf);
};
extern struct dvb_frontend* zl10353_attach(const struct zl10353_config *config,
struct i2c_adapter *i2c);
extern int zl10353_write(struct dvb_frontend *fe, u8 *ibuf, int ilen);
#endif /* ZL10353_H */

View File

@ -0,0 +1,42 @@
/*
* Driver for Zarlink DVB-T ZL10353 demodulator
*
* Copyright (C) 2006 Christopher Pascoe <c.pascoe@itee.uq.edu.au>
*
* 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.=
*/
#ifndef _ZL10353_PRIV_
#define _ZL10353_PRIV_
#define ID_ZL10353 0x14
enum zl10353_reg_addr {
INTERRUPT_0 = 0x00,
INTERRUPT_1 = 0x01,
INTERRUPT_2 = 0x02,
INTERRUPT_3 = 0x03,
INTERRUPT_4 = 0x04,
INTERRUPT_5 = 0x05,
STATUS_6 = 0x06,
STATUS_7 = 0x07,
STATUS_8 = 0x08,
STATUS_9 = 0x09,
SNR = 0x10,
CHIP_ID = 0x7F,
};
#endif /* _ZL10353_PRIV_ */

View File

@ -54,7 +54,6 @@
#include <linux/i2c.h>
#include <asm/system.h>
#include <asm/semaphore.h>
#include <linux/dvb/frontend.h>
@ -67,6 +66,10 @@
#include "av7110_ca.h"
#include "av7110_ipack.h"
#include "bsbe1.h"
#include "lnbp21.h"
#include "bsru6.h"
#define TS_WIDTH 376
#define TS_HEIGHT 512
#define TS_BUFLEN (TS_WIDTH*TS_HEIGHT)
@ -82,6 +85,8 @@ static int hw_sections;
static int rgb_on;
static int volume = 255;
static int budgetpatch;
static int wss_cfg_4_3 = 0x4008;
static int wss_cfg_16_9 = 0x0007;
module_param_named(debug, av7110_debug, int, 0644);
MODULE_PARM_DESC(debug, "debug level (bitmask, default 0)");
@ -100,6 +105,10 @@ module_param(volume, int, 0444);
MODULE_PARM_DESC(volume, "initial volume: default 255 (range 0-255)");
module_param(budgetpatch, int, 0444);
MODULE_PARM_DESC(budgetpatch, "use budget-patch hardware modification: default 0 (0 no, 1 autodetect, 2 always)");
module_param(wss_cfg_4_3, int, 0444);
MODULE_PARM_DESC(wss_cfg_4_3, "WSS 4:3 - default 0x4008 - bit 15: disable, 14: burst mode, 13..0: wss data");
module_param(wss_cfg_16_9, int, 0444);
MODULE_PARM_DESC(wss_cfg_16_9, "WSS 16:9 - default 0x0007 - bit 15: disable, 14: burst mode, 13..0: wss data");
static void restart_feeds(struct av7110 *av7110);
@ -125,6 +134,13 @@ static void init_av7110_av(struct av7110 *av7110)
if (ret < 0)
printk("dvb-ttpci:cannot set internal volume to maximum:%d\n",ret);
ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetWSSConfig, 2, 2, wss_cfg_4_3);
if (ret < 0)
printk("dvb-ttpci: unable to configure 4:3 wss\n");
ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetWSSConfig, 2, 3, wss_cfg_16_9);
if (ret < 0)
printk("dvb-ttpci: unable to configure 16:9 wss\n");
ret = av7710_set_video_mode(av7110, vidmode);
if (ret < 0)
printk("dvb-ttpci:cannot set video mode:%d\n",ret);
@ -242,10 +258,10 @@ static int arm_thread(void *data)
if (!av7110->arm_ready)
continue;
if (down_interruptible(&av7110->dcomlock))
if (mutex_lock_interruptible(&av7110->dcomlock))
break;
newloops = rdebi(av7110, DEBINOSWAP, STATUS_LOOPS, 0, 2);
up(&av7110->dcomlock);
mutex_unlock(&av7110->dcomlock);
if (newloops == av7110->arm_loops || av7110->arm_errors > 3) {
printk(KERN_ERR "dvb-ttpci: ARM crashed @ card %d\n",
@ -253,10 +269,10 @@ static int arm_thread(void *data)
recover_arm(av7110);
if (down_interruptible(&av7110->dcomlock))
if (mutex_lock_interruptible(&av7110->dcomlock))
break;
newloops = rdebi(av7110, DEBINOSWAP, STATUS_LOOPS, 0, 2) - 1;
up(&av7110->dcomlock);
mutex_unlock(&av7110->dcomlock);
}
av7110->arm_loops = newloops;
av7110->arm_errors = 0;
@ -741,7 +757,7 @@ int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid,
int ret = 0;
dprintk(4, "%p\n", av7110);
if (down_interruptible(&av7110->pid_mutex))
if (mutex_lock_interruptible(&av7110->pid_mutex))
return -ERESTARTSYS;
if (!(vpid & 0x8000))
@ -760,7 +776,7 @@ int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid,
ret = SetPIDs(av7110, vpid, apid, ttpid, subpid, pcrpid);
}
up(&av7110->pid_mutex);
mutex_unlock(&av7110->pid_mutex);
return ret;
}
@ -1088,11 +1104,9 @@ static int dvb_get_stc(struct dmx_demux *demux, unsigned int num,
struct av7110 *av7110;
/* pointer casting paranoia... */
if (!demux)
BUG();
BUG_ON(!demux);
dvbdemux = (struct dvb_demux *) demux->priv;
if (!dvbdemux)
BUG();
BUG_ON(!dvbdemux);
av7110 = (struct av7110 *) dvbdemux->priv;
dprintk(4, "%p\n", av7110);
@ -1570,208 +1584,6 @@ static struct ves1x93_config alps_bsrv2_config = {
.pll_set = alps_bsrv2_pll_set,
};
static u8 alps_bsru6_inittab[] = {
0x01, 0x15,
0x02, 0x30,
0x03, 0x00,
0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */
0x06, 0x40, /* DAC not used, set to high impendance mode */
0x07, 0x00, /* DAC LSB */
0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */
0x09, 0x00, /* FIFO */
0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */
0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */
0x10, 0x3f, // AGC2 0x3d
0x11, 0x84,
0x12, 0xb9,
0x15, 0xc9, // lock detector threshold
0x16, 0x00,
0x17, 0x00,
0x18, 0x00,
0x19, 0x00,
0x1a, 0x00,
0x1f, 0x50,
0x20, 0x00,
0x21, 0x00,
0x22, 0x00,
0x23, 0x00,
0x28, 0x00, // out imp: normal out type: parallel FEC mode:0
0x29, 0x1e, // 1/2 threshold
0x2a, 0x14, // 2/3 threshold
0x2b, 0x0f, // 3/4 threshold
0x2c, 0x09, // 5/6 threshold
0x2d, 0x05, // 7/8 threshold
0x2e, 0x01,
0x31, 0x1f, // test all FECs
0x32, 0x19, // viterbi and synchro search
0x33, 0xfc, // rs control
0x34, 0x93, // error control
0x0f, 0x52,
0xff, 0xff
};
static int alps_bsru6_set_symbol_rate(struct dvb_frontend* fe, u32 srate, u32 ratio)
{
u8 aclk = 0;
u8 bclk = 0;
if (srate < 1500000) { aclk = 0xb7; bclk = 0x47; }
else if (srate < 3000000) { aclk = 0xb7; bclk = 0x4b; }
else if (srate < 7000000) { aclk = 0xb7; bclk = 0x4f; }
else if (srate < 14000000) { aclk = 0xb7; bclk = 0x53; }
else if (srate < 30000000) { aclk = 0xb6; bclk = 0x53; }
else if (srate < 45000000) { aclk = 0xb4; bclk = 0x51; }
stv0299_writereg(fe, 0x13, aclk);
stv0299_writereg(fe, 0x14, bclk);
stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff);
stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff);
stv0299_writereg(fe, 0x21, (ratio ) & 0xf0);
return 0;
}
static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params)
{
int ret;
u8 data[4];
u32 div;
struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
if ((params->frequency < 950000) || (params->frequency > 2150000))
return -EINVAL;
div = (params->frequency + (125 - 1)) / 125; // round correctly
data[0] = (div >> 8) & 0x7f;
data[1] = div & 0xff;
data[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
data[3] = 0xC4;
if (params->frequency > 1530000) data[3] = 0xc0;
ret = i2c_transfer(i2c, &msg, 1);
if (ret != 1)
return -EIO;
return 0;
}
static struct stv0299_config alps_bsru6_config = {
.demod_address = 0x68,
.inittab = alps_bsru6_inittab,
.mclk = 88000000UL,
.invert = 1,
.skip_reinit = 0,
.lock_output = STV0229_LOCKOUTPUT_1,
.volt13_op0_op1 = STV0299_VOLT13_OP1,
.min_delay_ms = 100,
.set_symbol_rate = alps_bsru6_set_symbol_rate,
.pll_set = alps_bsru6_pll_set,
};
static u8 alps_bsbe1_inittab[] = {
0x01, 0x15,
0x02, 0x30,
0x03, 0x00,
0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */
0x06, 0x40, /* DAC not used, set to high impendance mode */
0x07, 0x00, /* DAC LSB */
0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */
0x09, 0x00, /* FIFO */
0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */
0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */
0x10, 0x3f, // AGC2 0x3d
0x11, 0x84,
0x12, 0xb9,
0x15, 0xc9, // lock detector threshold
0x16, 0x00,
0x17, 0x00,
0x18, 0x00,
0x19, 0x00,
0x1a, 0x00,
0x1f, 0x50,
0x20, 0x00,
0x21, 0x00,
0x22, 0x00,
0x23, 0x00,
0x28, 0x00, // out imp: normal out type: parallel FEC mode:0
0x29, 0x1e, // 1/2 threshold
0x2a, 0x14, // 2/3 threshold
0x2b, 0x0f, // 3/4 threshold
0x2c, 0x09, // 5/6 threshold
0x2d, 0x05, // 7/8 threshold
0x2e, 0x01,
0x31, 0x1f, // test all FECs
0x32, 0x19, // viterbi and synchro search
0x33, 0xfc, // rs control
0x34, 0x93, // error control
0x0f, 0x92,
0xff, 0xff
};
static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params)
{
int ret;
u8 data[4];
u32 div;
struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
if ((params->frequency < 950000) || (params->frequency > 2150000))
return -EINVAL;
div = (params->frequency + (125 - 1)) / 125; // round correctly
data[0] = (div >> 8) & 0x7f;
data[1] = div & 0xff;
data[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4;
ret = i2c_transfer(i2c, &msg, 1);
return (ret != 1) ? -EIO : 0;
}
static struct stv0299_config alps_bsbe1_config = {
.demod_address = 0x68,
.inittab = alps_bsbe1_inittab,
.mclk = 88000000UL,
.invert = 1,
.skip_reinit = 0,
.min_delay_ms = 100,
.set_symbol_rate = alps_bsru6_set_symbol_rate,
.pll_set = alps_bsbe1_pll_set,
};
static int lnbp21_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage)
{
struct av7110* av7110 = (struct av7110*) fe->dvb->priv;
int ret;
u8 data[1];
struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = data, .len = sizeof(data) };
switch(voltage) {
case SEC_VOLTAGE_OFF:
data[0] = 0x00;
break;
case SEC_VOLTAGE_13:
data[0] = 0x44;
break;
case SEC_VOLTAGE_18:
data[0] = 0x4c;
break;
default:
return -EINVAL;
};
ret = i2c_transfer(&av7110->i2c_adap, &msg, 1);
return (ret != 1) ? -EIO : 0;
}
static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
{
struct av7110* av7110 = fe->dvb->priv;
@ -2096,7 +1908,7 @@ static int av7110_fe_lock_fix(struct av7110* av7110, fe_status_t status)
if (av7110->playing)
return 0;
if (down_interruptible(&av7110->pid_mutex))
if (mutex_lock_interruptible(&av7110->pid_mutex))
return -ERESTARTSYS;
if (synced) {
@ -2118,7 +1930,7 @@ static int av7110_fe_lock_fix(struct av7110* av7110, fe_status_t status)
if (!ret)
av7110->fe_synced = synced;
up(&av7110->pid_mutex);
mutex_unlock(&av7110->pid_mutex);
return ret;
}
@ -2374,9 +2186,15 @@ static int frontend_init(struct av7110 *av7110)
/* ALPS BSBE1 */
av7110->fe = stv0299_attach(&alps_bsbe1_config, &av7110->i2c_adap);
if (av7110->fe) {
av7110->fe->ops->set_voltage = lnbp21_set_voltage;
av7110->fe->ops->dishnetwork_send_legacy_command = NULL;
av7110->recover = dvb_s_recover;
if (lnbp21_init(av7110->fe, &av7110->i2c_adap, 0, 0)) {
printk("dvb-ttpci: LNBP21 not found!\n");
if (av7110->fe->ops->release)
av7110->fe->ops->release(av7110->fe);
av7110->fe = NULL;
} else {
av7110->fe->ops->dishnetwork_send_legacy_command = NULL;
av7110->recover = dvb_s_recover;
}
}
break;
}
@ -2714,16 +2532,16 @@ static int __devinit av7110_attach(struct saa7146_dev* dev,
tasklet_init (&av7110->debi_tasklet, debiirq, (unsigned long) av7110);
tasklet_init (&av7110->gpio_tasklet, gpioirq, (unsigned long) av7110);
sema_init(&av7110->pid_mutex, 1);
mutex_init(&av7110->pid_mutex);
/* locks for data transfers from/to AV7110 */
spin_lock_init(&av7110->debilock);
sema_init(&av7110->dcomlock, 1);
mutex_init(&av7110->dcomlock);
av7110->debitype = -1;
/* default OSD window */
av7110->osdwin = 1;
sema_init(&av7110->osd_sema, 1);
mutex_init(&av7110->osd_mutex);
/* ARM "watchdog" */
init_waitqueue_head(&av7110->arm_wait);

View File

@ -16,6 +16,7 @@
#include <linux/dvb/ca.h>
#include <linux/dvb/osd.h>
#include <linux/dvb/net.h>
#include <linux/mutex.h>
#include "dvbdev.h"
#include "demux.h"
@ -127,7 +128,7 @@ struct av7110 {
/* DEBI and polled command interface */
spinlock_t debilock;
struct semaphore dcomlock;
struct mutex dcomlock;
volatile int debitype;
volatile int debilen;
@ -146,7 +147,7 @@ struct av7110 {
int osdwin; /* currently active window */
u16 osdbpp[8];
struct semaphore osd_sema;
struct mutex osd_mutex;
/* CA */
@ -172,7 +173,7 @@ struct av7110 {
struct tasklet_struct vpe_tasklet;
int fe_synced;
struct semaphore pid_mutex;
struct mutex pid_mutex;
int video_blank;
struct video_status videostate;

View File

@ -327,10 +327,10 @@ int av7110_wait_msgstate(struct av7110 *av7110, u16 flags)
start = jiffies;
for (;;) {
err = time_after(jiffies, start + ARM_WAIT_FREE);
if (down_interruptible(&av7110->dcomlock))
if (mutex_lock_interruptible(&av7110->dcomlock))
return -ERESTARTSYS;
stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2);
up(&av7110->dcomlock);
mutex_unlock(&av7110->dcomlock);
if ((stat & flags) == 0)
break;
if (err) {
@ -487,11 +487,11 @@ static int av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length)
dprintk(1, "arm not ready.\n");
return -1;
}
if (down_interruptible(&av7110->dcomlock))
if (mutex_lock_interruptible(&av7110->dcomlock))
return -ERESTARTSYS;
ret = __av7110_send_fw_cmd(av7110, buf, length);
up(&av7110->dcomlock);
mutex_unlock(&av7110->dcomlock);
if (ret && ret!=-ERESTARTSYS)
printk(KERN_ERR "dvb-ttpci: %s(): av7110_send_fw_cmd error %d\n",
__FUNCTION__, ret);
@ -563,11 +563,11 @@ int av7110_fw_request(struct av7110 *av7110, u16 *request_buf,
return -1;
}
if (down_interruptible(&av7110->dcomlock))
if (mutex_lock_interruptible(&av7110->dcomlock))
return -ERESTARTSYS;
if ((err = __av7110_send_fw_cmd(av7110, request_buf, request_buf_len)) < 0) {
up(&av7110->dcomlock);
mutex_unlock(&av7110->dcomlock);
printk(KERN_ERR "dvb-ttpci: av7110_fw_request error %d\n", err);
return err;
}
@ -579,7 +579,7 @@ int av7110_fw_request(struct av7110 *av7110, u16 *request_buf,
break;
if (err) {
printk(KERN_ERR "%s: timeout waiting for COMMAND to complete\n", __FUNCTION__);
up(&av7110->dcomlock);
mutex_unlock(&av7110->dcomlock);
return -ETIMEDOUT;
}
#ifdef _NOHANDSHAKE
@ -595,7 +595,7 @@ int av7110_fw_request(struct av7110 *av7110, u16 *request_buf,
break;
if (err) {
printk(KERN_ERR "%s: timeout waiting for HANDSHAKE_REG\n", __FUNCTION__);
up(&av7110->dcomlock);
mutex_unlock(&av7110->dcomlock);
return -ETIMEDOUT;
}
msleep(1);
@ -606,12 +606,12 @@ int av7110_fw_request(struct av7110 *av7110, u16 *request_buf,
stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2);
if (stat & GPMQOver) {
printk(KERN_ERR "%s: GPMQOver\n", __FUNCTION__);
up(&av7110->dcomlock);
mutex_unlock(&av7110->dcomlock);
return -1;
}
else if (stat & OSDQOver) {
printk(KERN_ERR "%s: OSDQOver\n", __FUNCTION__);
up(&av7110->dcomlock);
mutex_unlock(&av7110->dcomlock);
return -1;
}
#endif
@ -619,7 +619,7 @@ int av7110_fw_request(struct av7110 *av7110, u16 *request_buf,
for (i = 0; i < reply_buf_len; i++)
reply_buf[i] = rdebi(av7110, DEBINOSWAP, COM_BUFF + 2 * i, 0, 2);
up(&av7110->dcomlock);
mutex_unlock(&av7110->dcomlock);
return 0;
}
@ -735,7 +735,7 @@ static int FlushText(struct av7110 *av7110)
unsigned long start;
int err;
if (down_interruptible(&av7110->dcomlock))
if (mutex_lock_interruptible(&av7110->dcomlock))
return -ERESTARTSYS;
start = jiffies;
while (1) {
@ -745,12 +745,12 @@ static int FlushText(struct av7110 *av7110)
if (err) {
printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for BUFF1_BASE == 0\n",
__FUNCTION__);
up(&av7110->dcomlock);
mutex_unlock(&av7110->dcomlock);
return -ETIMEDOUT;
}
msleep(1);
}
up(&av7110->dcomlock);
mutex_unlock(&av7110->dcomlock);
return 0;
}
@ -761,7 +761,7 @@ static int WriteText(struct av7110 *av7110, u8 win, u16 x, u16 y, u8* buf)
int length = strlen(buf) + 1;
u16 cbuf[5] = { (COMTYPE_OSD << 8) + DText, 3, win, x, y };
if (down_interruptible(&av7110->dcomlock))
if (mutex_lock_interruptible(&av7110->dcomlock))
return -ERESTARTSYS;
start = jiffies;
@ -772,7 +772,7 @@ static int WriteText(struct av7110 *av7110, u8 win, u16 x, u16 y, u8* buf)
if (ret) {
printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for BUFF1_BASE == 0\n",
__FUNCTION__);
up(&av7110->dcomlock);
mutex_unlock(&av7110->dcomlock);
return -ETIMEDOUT;
}
msleep(1);
@ -786,7 +786,7 @@ static int WriteText(struct av7110 *av7110, u8 win, u16 x, u16 y, u8* buf)
if (ret) {
printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for HANDSHAKE_REG\n",
__FUNCTION__);
up(&av7110->dcomlock);
mutex_unlock(&av7110->dcomlock);
return -ETIMEDOUT;
}
msleep(1);
@ -798,7 +798,7 @@ static int WriteText(struct av7110 *av7110, u8 win, u16 x, u16 y, u8* buf)
if (length & 1)
wdebi(av7110, DEBINOSWAP, BUFF1_BASE + i * 2, 0, 2);
ret = __av7110_send_fw_cmd(av7110, cbuf, 5);
up(&av7110->dcomlock);
mutex_unlock(&av7110->dcomlock);
if (ret && ret!=-ERESTARTSYS)
printk(KERN_ERR "dvb-ttpci: WriteText error %d\n", ret);
return ret;
@ -1062,7 +1062,7 @@ int av7110_osd_cmd(struct av7110 *av7110, osd_cmd_t *dc)
{
int ret;
if (down_interruptible(&av7110->osd_sema))
if (mutex_lock_interruptible(&av7110->osd_mutex))
return -ERESTARTSYS;
switch (dc->cmd) {
@ -1198,7 +1198,7 @@ int av7110_osd_cmd(struct av7110 *av7110, osd_cmd_t *dc)
break;
}
up(&av7110->osd_sema);
mutex_unlock(&av7110->osd_mutex);
if (ret==-ERESTARTSYS)
dprintk(1, "av7110_osd_cmd(%d) returns with -ERESTARTSYS\n",dc->cmd);
else if (ret)

View File

@ -579,14 +579,11 @@ static ssize_t av7110_vbi_write(struct file *file, const char __user *data, size
return -EFAULT;
if ((d.id != 0 && d.id != V4L2_SLICED_WSS_625) || d.field != 0 || d.line != 23)
return -EINVAL;
if (d.id) {
if (d.id)
av7110->wssData = ((d.data[1] << 8) & 0x3f00) | d.data[0];
rc = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetWSSConfig,
2, 1, av7110->wssData);
} else {
av7110->wssData = 0;
rc = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetWSSConfig, 1, 0);
}
else
av7110->wssData = 0x8000;
rc = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetWSSConfig, 2, 1, av7110->wssData);
return (rc < 0) ? rc : count;
}

View File

@ -1000,6 +1000,7 @@ static u8 read_pwm(struct budget_av *budget_av)
#define SUBID_DVBS_TV_STAR 0x0014
#define SUBID_DVBS_TV_STAR_CI 0x0016
#define SUBID_DVBS_EASYWATCH 0x001e
#define SUBID_DVBC_KNC1 0x0020
#define SUBID_DVBC_KNC1_PLUS 0x0021
#define SUBID_DVBC_CINERGY1200 0x1156
@ -1038,6 +1039,7 @@ static void frontend_init(struct budget_av *budget_av)
case SUBID_DVBS_TV_STAR:
case SUBID_DVBS_TV_STAR_CI:
case SUBID_DVBS_CYNERGY1200N:
case SUBID_DVBS_EASYWATCH:
fe = stv0299_attach(&philips_sd1878_config,
&budget_av->budget.i2c_adap);
break;
@ -1285,6 +1287,7 @@ MAKE_BUDGET_INFO(knc1s, "KNC1 DVB-S", BUDGET_KNC1S);
MAKE_BUDGET_INFO(knc1c, "KNC1 DVB-C", BUDGET_KNC1C);
MAKE_BUDGET_INFO(knc1t, "KNC1 DVB-T", BUDGET_KNC1T);
MAKE_BUDGET_INFO(kncxs, "KNC TV STAR DVB-S", BUDGET_TVSTAR);
MAKE_BUDGET_INFO(satewpls, "Satelco EasyWatch DVB-S light", BUDGET_TVSTAR);
MAKE_BUDGET_INFO(knc1sp, "KNC1 DVB-S Plus", BUDGET_KNC1SP);
MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP);
MAKE_BUDGET_INFO(knc1tp, "KNC1 DVB-T Plus", BUDGET_KNC1TP);
@ -1300,6 +1303,7 @@ static struct pci_device_id pci_tbl[] = {
MAKE_EXTENSION_PCI(knc1sp, 0x1131, 0x0011),
MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0014),
MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0016),
MAKE_EXTENSION_PCI(satewpls, 0x1894, 0x001e),
MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020),
MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021),
MAKE_EXTENSION_PCI(knc1t, 0x1894, 0x0030),

View File

@ -42,6 +42,9 @@
#include "stv0299.h"
#include "stv0297.h"
#include "tda1004x.h"
#include "lnbp21.h"
#include "bsbe1.h"
#include "bsru6.h"
#define DEBIADDR_IR 0x1234
#define DEBIADDR_CICONTROL 0x0000
@ -474,123 +477,6 @@ static void budget_ci_irq(struct saa7146_dev *dev, u32 * isr)
tasklet_schedule(&budget_ci->ciintf_irq_tasklet);
}
static u8 alps_bsru6_inittab[] = {
0x01, 0x15,
0x02, 0x00,
0x03, 0x00,
0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */
0x06, 0x40, /* DAC not used, set to high impendance mode */
0x07, 0x00, /* DAC LSB */
0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */
0x09, 0x00, /* FIFO */
0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */
0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */
0x10, 0x3f, // AGC2 0x3d
0x11, 0x84,
0x12, 0xb9,
0x15, 0xc9, // lock detector threshold
0x16, 0x00,
0x17, 0x00,
0x18, 0x00,
0x19, 0x00,
0x1a, 0x00,
0x1f, 0x50,
0x20, 0x00,
0x21, 0x00,
0x22, 0x00,
0x23, 0x00,
0x28, 0x00, // out imp: normal out type: parallel FEC mode:0
0x29, 0x1e, // 1/2 threshold
0x2a, 0x14, // 2/3 threshold
0x2b, 0x0f, // 3/4 threshold
0x2c, 0x09, // 5/6 threshold
0x2d, 0x05, // 7/8 threshold
0x2e, 0x01,
0x31, 0x1f, // test all FECs
0x32, 0x19, // viterbi and synchro search
0x33, 0xfc, // rs control
0x34, 0x93, // error control
0x0f, 0x52,
0xff, 0xff
};
static int alps_bsru6_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 ratio)
{
u8 aclk = 0;
u8 bclk = 0;
if (srate < 1500000) {
aclk = 0xb7;
bclk = 0x47;
} else if (srate < 3000000) {
aclk = 0xb7;
bclk = 0x4b;
} else if (srate < 7000000) {
aclk = 0xb7;
bclk = 0x4f;
} else if (srate < 14000000) {
aclk = 0xb7;
bclk = 0x53;
} else if (srate < 30000000) {
aclk = 0xb6;
bclk = 0x53;
} else if (srate < 45000000) {
aclk = 0xb4;
bclk = 0x51;
}
stv0299_writereg(fe, 0x13, aclk);
stv0299_writereg(fe, 0x14, bclk);
stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff);
stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff);
stv0299_writereg(fe, 0x21, (ratio) & 0xf0);
return 0;
}
static int alps_bsru6_pll_set(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters *params)
{
u8 buf[4];
u32 div;
struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) };
if ((params->frequency < 950000) || (params->frequency > 2150000))
return -EINVAL;
div = (params->frequency + (125 - 1)) / 125; // round correctly
buf[0] = (div >> 8) & 0x7f;
buf[1] = div & 0xff;
buf[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
buf[3] = 0xC4;
if (params->frequency > 1530000)
buf[3] = 0xc0;
if (i2c_transfer(i2c, &msg, 1) != 1)
return -EIO;
return 0;
}
static struct stv0299_config alps_bsru6_config = {
.demod_address = 0x68,
.inittab = alps_bsru6_inittab,
.mclk = 88000000UL,
.invert = 1,
.skip_reinit = 0,
.lock_output = STV0229_LOCKOUTPUT_1,
.volt13_op0_op1 = STV0299_VOLT13_OP1,
.min_delay_ms = 100,
.set_symbol_rate = alps_bsru6_set_symbol_rate,
.pll_set = alps_bsru6_pll_set,
};
static u8 philips_su1278_tt_inittab[] = {
0x01, 0x0f,
0x02, 0x30,
@ -1069,6 +955,20 @@ static void frontend_init(struct budget_ci *budget_ci)
break;
}
break;
case 0x1017: // TT S-1500 PCI
budget_ci->budget.dvb_frontend = stv0299_attach(&alps_bsbe1_config, &budget_ci->budget.i2c_adap);
if (budget_ci->budget.dvb_frontend) {
budget_ci->budget.dvb_frontend->ops->dishnetwork_send_legacy_command = NULL;
if (lnbp21_init(budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, LNBP21_LLC, 0)) {
printk("%s: No LNBP21 found!\n", __FUNCTION__);
if (budget_ci->budget.dvb_frontend->ops->release)
budget_ci->budget.dvb_frontend->ops->release(budget_ci->budget.dvb_frontend);
budget_ci->budget.dvb_frontend = NULL;
}
}
break;
}
if (budget_ci->budget.dvb_frontend == NULL) {
@ -1146,6 +1046,7 @@ static int budget_ci_detach(struct saa7146_dev *dev)
static struct saa7146_extension budget_extension;
MAKE_BUDGET_INFO(ttbs2, "TT-Budget/S-1500 PCI", BUDGET_TT);
MAKE_BUDGET_INFO(ttbci, "TT-Budget/WinTV-NOVA-CI PCI", BUDGET_TT_HW_DISEQC);
MAKE_BUDGET_INFO(ttbt2, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT);
MAKE_BUDGET_INFO(ttbtci, "TT-Budget-T-CI PCI", BUDGET_TT);
@ -1157,6 +1058,7 @@ static struct pci_device_id pci_tbl[] = {
MAKE_EXTENSION_PCI(ttbcci, 0x13c2, 0x1010),
MAKE_EXTENSION_PCI(ttbt2, 0x13c2, 0x1011),
MAKE_EXTENSION_PCI(ttbtci, 0x13c2, 0x1012),
MAKE_EXTENSION_PCI(ttbs2, 0x13c2, 0x1017),
{
.vendor = 0,
}

View File

@ -37,6 +37,8 @@
#include "ves1x93.h"
#include "tda8083.h"
#include "bsru6.h"
#define budget_patch budget
static struct saa7146_extension budget_extension;
@ -290,103 +292,6 @@ static struct ves1x93_config alps_bsrv2_config = {
.pll_set = alps_bsrv2_pll_set,
};
static u8 alps_bsru6_inittab[] = {
0x01, 0x15,
0x02, 0x00,
0x03, 0x00,
0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */
0x06, 0x40, /* DAC not used, set to high impendance mode */
0x07, 0x00, /* DAC LSB */
0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */
0x09, 0x00, /* FIFO */
0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */
0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */
0x10, 0x3f, // AGC2 0x3d
0x11, 0x84,
0x12, 0xb9,
0x15, 0xc9, // lock detector threshold
0x16, 0x00,
0x17, 0x00,
0x18, 0x00,
0x19, 0x00,
0x1a, 0x00,
0x1f, 0x50,
0x20, 0x00,
0x21, 0x00,
0x22, 0x00,
0x23, 0x00,
0x28, 0x00, // out imp: normal out type: parallel FEC mode:0
0x29, 0x1e, // 1/2 threshold
0x2a, 0x14, // 2/3 threshold
0x2b, 0x0f, // 3/4 threshold
0x2c, 0x09, // 5/6 threshold
0x2d, 0x05, // 7/8 threshold
0x2e, 0x01,
0x31, 0x1f, // test all FECs
0x32, 0x19, // viterbi and synchro search
0x33, 0xfc, // rs control
0x34, 0x93, // error control
0x0f, 0x52,
0xff, 0xff
};
static int alps_bsru6_set_symbol_rate(struct dvb_frontend* fe, u32 srate, u32 ratio)
{
u8 aclk = 0;
u8 bclk = 0;
if (srate < 1500000) { aclk = 0xb7; bclk = 0x47; }
else if (srate < 3000000) { aclk = 0xb7; bclk = 0x4b; }
else if (srate < 7000000) { aclk = 0xb7; bclk = 0x4f; }
else if (srate < 14000000) { aclk = 0xb7; bclk = 0x53; }
else if (srate < 30000000) { aclk = 0xb6; bclk = 0x53; }
else if (srate < 45000000) { aclk = 0xb4; bclk = 0x51; }
stv0299_writereg (fe, 0x13, aclk);
stv0299_writereg (fe, 0x14, bclk);
stv0299_writereg (fe, 0x1f, (ratio >> 16) & 0xff);
stv0299_writereg (fe, 0x20, (ratio >> 8) & 0xff);
stv0299_writereg (fe, 0x21, (ratio ) & 0xf0);
return 0;
}
static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params)
{
u8 data[4];
u32 div;
struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
if ((params->frequency < 950000) || (params->frequency > 2150000)) return -EINVAL;
div = (params->frequency + (125 - 1)) / 125; // round correctly
data[0] = (div >> 8) & 0x7f;
data[1] = div & 0xff;
data[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
data[3] = 0xC4;
if (params->frequency > 1530000) data[3] = 0xc0;
if (i2c_transfer(i2c, &msg, 1) != 1) return -EIO;
return 0;
}
static struct stv0299_config alps_bsru6_config = {
.demod_address = 0x68,
.inittab = alps_bsru6_inittab,
.mclk = 88000000UL,
.invert = 1,
.skip_reinit = 0,
.lock_output = STV0229_LOCKOUTPUT_1,
.volt13_op0_op1 = STV0299_VOLT13_OP1,
.min_delay_ms = 100,
.set_symbol_rate = alps_bsru6_set_symbol_rate,
.pll_set = alps_bsru6_pll_set,
};
static int grundig_29504_451_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
{
struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv;

View File

@ -41,6 +41,8 @@
#include "l64781.h"
#include "tda8083.h"
#include "s5h1420.h"
#include "lnbp21.h"
#include "bsru6.h"
static void Set22K (struct budget *budget, int state)
{
@ -184,64 +186,6 @@ static int budget_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t m
return 0;
}
static int lnbp21_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage)
{
struct budget* budget = (struct budget*) fe->dvb->priv;
u8 buf;
struct i2c_msg msg = { .addr = 0x08, .flags = I2C_M_RD, .buf = &buf, .len = sizeof(buf) };
if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO;
switch(voltage) {
case SEC_VOLTAGE_13:
buf = (buf & 0xf7) | 0x04;
break;
case SEC_VOLTAGE_18:
buf = (buf & 0xf7) | 0x0c;
break;
case SEC_VOLTAGE_OFF:
buf = buf & 0xf0;
break;
}
msg.flags = 0;
if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO;
return 0;
}
static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend* fe, long arg)
{
struct budget* budget = (struct budget*) fe->dvb->priv;
u8 buf;
struct i2c_msg msg = { .addr = 0x08, .flags = I2C_M_RD, .buf = &buf, .len = sizeof(buf) };
if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO;
if (arg) {
buf = buf | 0x10;
} else {
buf = buf & 0xef;
}
msg.flags = 0;
if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO;
return 0;
}
static int lnbp21_init(struct budget* budget)
{
u8 buf = 0x00;
struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = &buf, .len = sizeof(buf) };
if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1)
return -EIO;
return 0;
}
static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
{
struct budget* budget = (struct budget*) fe->dvb->priv;
@ -277,176 +221,6 @@ static struct ves1x93_config alps_bsrv2_config =
.pll_set = alps_bsrv2_pll_set,
};
static u8 alps_bsru6_inittab[] = {
0x01, 0x15,
0x02, 0x00,
0x03, 0x00,
0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */
0x06, 0x40, /* DAC not used, set to high impendance mode */
0x07, 0x00, /* DAC LSB */
0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */
0x09, 0x00, /* FIFO */
0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */
0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */
0x10, 0x3f, // AGC2 0x3d
0x11, 0x84,
0x12, 0xb9,
0x15, 0xc9, // lock detector threshold
0x16, 0x00,
0x17, 0x00,
0x18, 0x00,
0x19, 0x00,
0x1a, 0x00,
0x1f, 0x50,
0x20, 0x00,
0x21, 0x00,
0x22, 0x00,
0x23, 0x00,
0x28, 0x00, // out imp: normal out type: parallel FEC mode:0
0x29, 0x1e, // 1/2 threshold
0x2a, 0x14, // 2/3 threshold
0x2b, 0x0f, // 3/4 threshold
0x2c, 0x09, // 5/6 threshold
0x2d, 0x05, // 7/8 threshold
0x2e, 0x01,
0x31, 0x1f, // test all FECs
0x32, 0x19, // viterbi and synchro search
0x33, 0xfc, // rs control
0x34, 0x93, // error control
0x0f, 0x52,
0xff, 0xff
};
static int alps_bsru6_set_symbol_rate(struct dvb_frontend* fe, u32 srate, u32 ratio)
{
u8 aclk = 0;
u8 bclk = 0;
if (srate < 1500000) { aclk = 0xb7; bclk = 0x47; }
else if (srate < 3000000) { aclk = 0xb7; bclk = 0x4b; }
else if (srate < 7000000) { aclk = 0xb7; bclk = 0x4f; }
else if (srate < 14000000) { aclk = 0xb7; bclk = 0x53; }
else if (srate < 30000000) { aclk = 0xb6; bclk = 0x53; }
else if (srate < 45000000) { aclk = 0xb4; bclk = 0x51; }
stv0299_writereg (fe, 0x13, aclk);
stv0299_writereg (fe, 0x14, bclk);
stv0299_writereg (fe, 0x1f, (ratio >> 16) & 0xff);
stv0299_writereg (fe, 0x20, (ratio >> 8) & 0xff);
stv0299_writereg (fe, 0x21, (ratio ) & 0xf0);
return 0;
}
static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params)
{
u8 data[4];
u32 div;
struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
if ((params->frequency < 950000) || (params->frequency > 2150000)) return -EINVAL;
div = (params->frequency + (125 - 1)) / 125; // round correctly
data[0] = (div >> 8) & 0x7f;
data[1] = div & 0xff;
data[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
data[3] = 0xC4;
if (params->frequency > 1530000) data[3] = 0xc0;
if (i2c_transfer(i2c, &msg, 1) != 1) return -EIO;
return 0;
}
static struct stv0299_config alps_bsru6_config = {
.demod_address = 0x68,
.inittab = alps_bsru6_inittab,
.mclk = 88000000UL,
.invert = 1,
.skip_reinit = 0,
.lock_output = STV0229_LOCKOUTPUT_1,
.volt13_op0_op1 = STV0299_VOLT13_OP1,
.min_delay_ms = 100,
.set_symbol_rate = alps_bsru6_set_symbol_rate,
.pll_set = alps_bsru6_pll_set,
};
static u8 alps_bsbe1_inittab[] = {
0x01, 0x15,
0x02, 0x30,
0x03, 0x00,
0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */
0x06, 0x40, /* DAC not used, set to high impendance mode */
0x07, 0x00, /* DAC LSB */
0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */
0x09, 0x00, /* FIFO */
0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */
0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */
0x10, 0x3f, // AGC2 0x3d
0x11, 0x84,
0x12, 0xb9,
0x15, 0xc9, // lock detector threshold
0x16, 0x00,
0x17, 0x00,
0x18, 0x00,
0x19, 0x00,
0x1a, 0x00,
0x1f, 0x50,
0x20, 0x00,
0x21, 0x00,
0x22, 0x00,
0x23, 0x00,
0x28, 0x00, // out imp: normal out type: parallel FEC mode:0
0x29, 0x1e, // 1/2 threshold
0x2a, 0x14, // 2/3 threshold
0x2b, 0x0f, // 3/4 threshold
0x2c, 0x09, // 5/6 threshold
0x2d, 0x05, // 7/8 threshold
0x2e, 0x01,
0x31, 0x1f, // test all FECs
0x32, 0x19, // viterbi and synchro search
0x33, 0xfc, // rs control
0x34, 0x93, // error control
0x0f, 0x92, // 0x80 = inverse AGC
0xff, 0xff
};
static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params)
{
int ret;
u8 data[4];
u32 div;
struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
if ((params->frequency < 950000) || (params->frequency > 2150000))
return -EINVAL;
div = (params->frequency + (125 - 1)) / 125; // round correctly
data[0] = (div >> 8) & 0x7f;
data[1] = div & 0xff;
data[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4;
ret = i2c_transfer(i2c, &msg, 1);
return (ret != 1) ? -EIO : 0;
}
static struct stv0299_config alps_bsbe1_config = {
.demod_address = 0x68,
.inittab = alps_bsbe1_inittab,
.mclk = 88000000UL,
.invert = 1,
.skip_reinit = 0,
.min_delay_ms = 100,
.set_symbol_rate = alps_bsru6_set_symbol_rate,
.pll_set = alps_bsbe1_pll_set,
};
static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
{
struct budget* budget = (struct budget*) fe->dvb->priv;
@ -580,20 +354,6 @@ static u8 read_pwm(struct budget* budget)
static void frontend_init(struct budget *budget)
{
switch(budget->dev->pci->subsystem_device) {
case 0x1017:
// try the ALPS BSBE1 now
budget->dvb_frontend = stv0299_attach(&alps_bsbe1_config, &budget->i2c_adap);
if (budget->dvb_frontend) {
budget->dvb_frontend->ops->set_voltage = lnbp21_set_voltage;
budget->dvb_frontend->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage;
budget->dvb_frontend->ops->dishnetwork_send_legacy_command = NULL;
if (lnbp21_init(budget)) {
printk("%s: No LNBP21 found!\n", __FUNCTION__);
goto error_out;
}
}
break;
case 0x1003: // Hauppauge/TT Nova budget (stv0299/ALPS BSRU6(tsa5059) OR ves1893/ALPS BSRV2(sp5659))
case 0x1013:
// try the ALPS BSRV2 first of all
@ -646,9 +406,7 @@ static void frontend_init(struct budget *budget)
case 0x1016: // Hauppauge/TT Nova-S SE (samsung s5h1420/????(tda8260))
budget->dvb_frontend = s5h1420_attach(&s5h1420_config, &budget->i2c_adap);
if (budget->dvb_frontend) {
budget->dvb_frontend->ops->set_voltage = lnbp21_set_voltage;
budget->dvb_frontend->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage;
if (lnbp21_init(budget)) {
if (lnbp21_init(budget->dvb_frontend, &budget->i2c_adap, 0, 0)) {
printk("%s: No LNBP21 found!\n", __FUNCTION__);
goto error_out;
}
@ -719,7 +477,6 @@ static int budget_detach (struct saa7146_dev* dev)
static struct saa7146_extension budget_extension;
MAKE_BUDGET_INFO(ttbs2, "TT-Budget/WinTV-NOVA-S PCI (rev AL/alps bsbe1 lnbp21 frontend)", BUDGET_TT);
MAKE_BUDGET_INFO(ttbs, "TT-Budget/WinTV-NOVA-S PCI", BUDGET_TT);
MAKE_BUDGET_INFO(ttbc, "TT-Budget/WinTV-NOVA-C PCI", BUDGET_TT);
MAKE_BUDGET_INFO(ttbt, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT);
@ -732,7 +489,6 @@ static struct pci_device_id pci_tbl[] = {
MAKE_EXTENSION_PCI(ttbc, 0x13c2, 0x1004),
MAKE_EXTENSION_PCI(ttbt, 0x13c2, 0x1005),
MAKE_EXTENSION_PCI(satel, 0x13c2, 0x1013),
MAKE_EXTENSION_PCI(ttbs2, 0x13c2, 0x1017),
MAKE_EXTENSION_PCI(ttbs, 0x13c2, 0x1016),
MAKE_EXTENSION_PCI(fsacs1,0x1131, 0x4f60),
MAKE_EXTENSION_PCI(fsacs0,0x1131, 0x4f61),

View File

@ -10,6 +10,8 @@
#include "dvb_net.h"
#include <linux/module.h>
#include <linux/mutex.h>
#include <media/saa7146.h>
extern int budget_debug;
@ -51,7 +53,7 @@ struct budget {
struct dmx_frontend mem_frontend;
int fe_synced;
struct semaphore pid_mutex;
struct mutex pid_mutex;
int ci_present;
int video_port;

View File

@ -19,7 +19,7 @@
#include <linux/time.h>
#include <linux/errno.h>
#include <linux/jiffies.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>
#include "dvb_frontend.h"
#include "dmxdev.h"
@ -35,7 +35,6 @@
#include <linux/dvb/dmx.h>
#include <linux/pci.h>
/*
TTUSB_HWSECTIONS:
the DSP supports filtering in hardware, however, since the "muxstream"
@ -83,8 +82,8 @@ struct ttusb {
struct dvb_net dvbnet;
/* and one for USB access. */
struct semaphore semi2c;
struct semaphore semusb;
struct mutex semi2c;
struct mutex semusb;
struct dvb_adapter adapter;
struct usb_device *dev;
@ -150,7 +149,7 @@ static int ttusb_cmd(struct ttusb *ttusb,
printk("\n");
#endif
if (down_interruptible(&ttusb->semusb) < 0)
if (mutex_lock_interruptible(&ttusb->semusb) < 0)
return -EAGAIN;
err = usb_bulk_msg(ttusb->dev, ttusb->bulk_out_pipe,
@ -158,13 +157,13 @@ static int ttusb_cmd(struct ttusb *ttusb,
if (err != 0) {
dprintk("%s: usb_bulk_msg(send) failed, err == %i!\n",
__FUNCTION__, err);
up(&ttusb->semusb);
mutex_unlock(&ttusb->semusb);
return err;
}
if (actual_len != len) {
dprintk("%s: only wrote %d of %d bytes\n", __FUNCTION__,
actual_len, len);
up(&ttusb->semusb);
mutex_unlock(&ttusb->semusb);
return -1;
}
@ -174,7 +173,7 @@ static int ttusb_cmd(struct ttusb *ttusb,
if (err != 0) {
printk("%s: failed, receive error %d\n", __FUNCTION__,
err);
up(&ttusb->semusb);
mutex_unlock(&ttusb->semusb);
return err;
}
#if DEBUG >= 3
@ -185,14 +184,14 @@ static int ttusb_cmd(struct ttusb *ttusb,
printk("\n");
#endif
if (!needresult)
up(&ttusb->semusb);
mutex_unlock(&ttusb->semusb);
return 0;
}
static int ttusb_result(struct ttusb *ttusb, u8 * data, int len)
{
memcpy(data, ttusb->last_result, len);
up(&ttusb->semusb);
mutex_unlock(&ttusb->semusb);
return 0;
}
@ -250,7 +249,7 @@ static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num
int i = 0;
int inc;
if (down_interruptible(&ttusb->semi2c) < 0)
if (mutex_lock_interruptible(&ttusb->semi2c) < 0)
return -EAGAIN;
while (i < num) {
@ -284,7 +283,7 @@ static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num
i += inc;
}
up(&ttusb->semi2c);
mutex_unlock(&ttusb->semi2c);
return i;
}
@ -689,8 +688,7 @@ static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len)
memcpy(ttusb->muxpack + ttusb->muxpack_ptr,
data, avail);
ttusb->muxpack_ptr += avail;
if (ttusb->muxpack_ptr > 264)
BUG();
BUG_ON(ttusb->muxpack_ptr > 264);
data += avail;
len -= avail;
/* determine length */
@ -1495,8 +1493,11 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
ttusb->dev = udev;
ttusb->c = 0;
ttusb->mux_state = 0;
sema_init(&ttusb->semi2c, 0);
sema_init(&ttusb->semusb, 1);
mutex_init(&ttusb->semi2c);
mutex_lock(&ttusb->semi2c);
mutex_init(&ttusb->semusb);
ttusb_setup_interfaces(ttusb);
@ -1504,7 +1505,7 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
if (ttusb_init_controller(ttusb))
printk("ttusb_init_controller: error\n");
up(&ttusb->semi2c);
mutex_unlock(&ttusb->semi2c);
dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE);
ttusb->adapter.priv = ttusb;

View File

@ -20,7 +20,8 @@
*
*/
#include <asm/semaphore.h>
#include <linux/mutex.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
@ -115,7 +116,7 @@ struct ttusb_dec {
unsigned int out_pipe;
unsigned int irq_pipe;
enum ttusb_dec_interface interface;
struct semaphore usb_sem;
struct mutex usb_mutex;
void *irq_buffer;
struct urb *irq_urb;
@ -124,7 +125,7 @@ struct ttusb_dec {
dma_addr_t iso_dma_handle;
struct urb *iso_urb[ISO_BUF_COUNT];
int iso_stream_count;
struct semaphore iso_sem;
struct mutex iso_mutex;
u8 packet[MAX_PVA_LENGTH + 4];
enum ttusb_dec_packet_type packet_type;
@ -273,9 +274,9 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,
if (!b)
return -ENOMEM;
if ((result = down_interruptible(&dec->usb_sem))) {
if ((result = mutex_lock_interruptible(&dec->usb_mutex))) {
kfree(b);
printk("%s: Failed to down usb semaphore.\n", __FUNCTION__);
printk("%s: Failed to lock usb mutex.\n", __FUNCTION__);
return result;
}
@ -300,7 +301,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,
if (result) {
printk("%s: command bulk message failed: error %d\n",
__FUNCTION__, result);
up(&dec->usb_sem);
mutex_unlock(&dec->usb_mutex);
kfree(b);
return result;
}
@ -311,7 +312,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,
if (result) {
printk("%s: result bulk message failed: error %d\n",
__FUNCTION__, result);
up(&dec->usb_sem);
mutex_unlock(&dec->usb_mutex);
kfree(b);
return result;
} else {
@ -327,7 +328,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,
if (cmd_result && b[3] > 0)
memcpy(cmd_result, &b[4], b[3]);
up(&dec->usb_sem);
mutex_unlock(&dec->usb_mutex);
kfree(b);
return 0;
@ -835,7 +836,7 @@ static void ttusb_dec_stop_iso_xfer(struct ttusb_dec *dec)
dprintk("%s\n", __FUNCTION__);
if (down_interruptible(&dec->iso_sem))
if (mutex_lock_interruptible(&dec->iso_mutex))
return;
dec->iso_stream_count--;
@ -845,7 +846,7 @@ static void ttusb_dec_stop_iso_xfer(struct ttusb_dec *dec)
usb_kill_urb(dec->iso_urb[i]);
}
up(&dec->iso_sem);
mutex_unlock(&dec->iso_mutex);
}
/* Setting the interface of the DEC tends to take down the USB communications
@ -890,7 +891,7 @@ static int ttusb_dec_start_iso_xfer(struct ttusb_dec *dec)
dprintk("%s\n", __FUNCTION__);
if (down_interruptible(&dec->iso_sem))
if (mutex_lock_interruptible(&dec->iso_mutex))
return -EAGAIN;
if (!dec->iso_stream_count) {
@ -911,7 +912,7 @@ static int ttusb_dec_start_iso_xfer(struct ttusb_dec *dec)
i--;
}
up(&dec->iso_sem);
mutex_unlock(&dec->iso_mutex);
return result;
}
}
@ -919,7 +920,7 @@ static int ttusb_dec_start_iso_xfer(struct ttusb_dec *dec)
dec->iso_stream_count++;
up(&dec->iso_sem);
mutex_unlock(&dec->iso_mutex);
return 0;
}
@ -1229,8 +1230,8 @@ static int ttusb_dec_init_usb(struct ttusb_dec *dec)
{
dprintk("%s\n", __FUNCTION__);
sema_init(&dec->usb_sem, 1);
sema_init(&dec->iso_sem, 1);
mutex_init(&dec->usb_mutex);
mutex_init(&dec->iso_mutex);
dec->command_pipe = usb_sndbulkpipe(dec->udev, COMMAND_PIPE);
dec->result_pipe = usb_rcvbulkpipe(dec->udev, RESULT_PIPE);

View File

@ -18,14 +18,15 @@
#include <linux/string.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>
#include <asm/io.h>
#include "../../../sound/oss/aci.h"
#include "miropcm20-rds-core.h"
#define DEBUG 0
static struct semaphore aci_rds_sem;
static struct mutex aci_rds_mutex;
#define RDS_DATASHIFT 2 /* Bit 2 */
#define RDS_DATAMASK (1 << RDS_DATASHIFT)
@ -181,7 +182,7 @@ int aci_rds_cmd(unsigned char cmd, unsigned char databuffer[], int datasize)
{
int ret;
if (down_interruptible(&aci_rds_sem))
if (mutex_lock_interruptible(&aci_rds_mutex))
return -EINTR;
rds_write(cmd);
@ -192,7 +193,7 @@ int aci_rds_cmd(unsigned char cmd, unsigned char databuffer[], int datasize)
else
ret = 0;
up(&aci_rds_sem);
mutex_unlock(&aci_rds_mutex);
return ret;
}
@ -200,7 +201,7 @@ EXPORT_SYMBOL(aci_rds_cmd);
int __init attach_aci_rds(void)
{
init_MUTEX(&aci_rds_sem);
mutex_init(&aci_rds_mutex);
return 0;
}

View File

@ -43,7 +43,7 @@
static int io = CONFIG_RADIO_RTRACK_PORT;
static int radio_nr = -1;
static struct semaphore lock;
static struct mutex lock;
struct rt_device
{
@ -83,23 +83,23 @@ static void rt_incvol(void)
static void rt_mute(struct rt_device *dev)
{
dev->muted = 1;
down(&lock);
mutex_lock(&lock);
outb(0xd0, io); /* volume steady, off */
up(&lock);
mutex_unlock(&lock);
}
static int rt_setvol(struct rt_device *dev, int vol)
{
int i;
down(&lock);
mutex_lock(&lock);
if(vol == dev->curvol) { /* requested volume = current */
if (dev->muted) { /* user is unmuting the card */
dev->muted = 0;
outb (0xd8, io); /* enable card */
}
up(&lock);
mutex_unlock(&lock);
return 0;
}
@ -108,7 +108,7 @@ static int rt_setvol(struct rt_device *dev, int vol)
sleep_delay(2000000); /* make sure it's totally down */
outb(0xd0, io); /* volume steady, off */
dev->curvol = 0; /* track the volume state! */
up(&lock);
mutex_unlock(&lock);
return 0;
}
@ -121,7 +121,7 @@ static int rt_setvol(struct rt_device *dev, int vol)
rt_decvol();
dev->curvol = vol;
up(&lock);
mutex_unlock(&lock);
return 0;
}
@ -168,7 +168,7 @@ static int rt_setfreq(struct rt_device *dev, unsigned long freq)
freq += 171200; /* Add 10.7 MHz IF */
freq /= 800; /* Convert to 50 kHz units */
down(&lock); /* Stop other ops interfering */
mutex_lock(&lock); /* Stop other ops interfering */
send_0_byte (io, dev); /* 0: LSB of frequency */
@ -196,7 +196,7 @@ static int rt_setfreq(struct rt_device *dev, unsigned long freq)
else
outb (0xd8, io); /* volume steady + sigstr + on */
up(&lock);
mutex_unlock(&lock);
return 0;
}
@ -337,7 +337,7 @@ static int __init rtrack_init(void)
/* Set up the I/O locking */
init_MUTEX(&lock);
mutex_init(&lock);
/* mute card - prevents noisy bootups */

View File

@ -42,7 +42,7 @@
static int io = CONFIG_RADIO_AZTECH_PORT;
static int radio_nr = -1;
static int radio_wait_time = 1000;
static struct semaphore lock;
static struct mutex lock;
struct az_device
{
@ -87,9 +87,9 @@ static void send_1_byte (struct az_device *dev)
static int az_setvol(struct az_device *dev, int vol)
{
down(&lock);
mutex_lock(&lock);
outb (volconvert(vol), io);
up(&lock);
mutex_unlock(&lock);
return 0;
}
@ -122,7 +122,7 @@ static int az_setfreq(struct az_device *dev, unsigned long frequency)
frequency += 171200; /* Add 10.7 MHz IF */
frequency /= 800; /* Convert to 50 kHz units */
down(&lock);
mutex_lock(&lock);
send_0_byte (dev); /* 0: LSB of frequency */
@ -152,7 +152,7 @@ static int az_setfreq(struct az_device *dev, unsigned long frequency)
udelay (radio_wait_time);
outb_p(128+64+volconvert(dev->curvol), io);
up(&lock);
mutex_unlock(&lock);
return 0;
}
@ -283,7 +283,7 @@ static int __init aztech_init(void)
return -EBUSY;
}
init_MUTEX(&lock);
mutex_init(&lock);
aztech_radio.priv=&aztech_unit;
if(video_register_device(&aztech_radio, VFL_TYPE_RADIO, radio_nr)==-1)

View File

@ -23,10 +23,11 @@
#include <linux/sched.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>
#include <linux/pci.h>
#include <linux/videodev.h>
#define DRIVER_VERSION "0.05"
#define GPIO_DATA 0x60 /* port offset from ESS_IO_BASE */
@ -104,7 +105,7 @@ struct radio_device {
muted, /* VIDEO_AUDIO_MUTE */
stereo, /* VIDEO_TUNER_STEREO_ON */
tuned; /* signal strength (0 or 0xffff) */
struct semaphore lock;
struct mutex lock;
};
static u32 radio_bits_get(struct radio_device *dev)
@ -258,9 +259,9 @@ static int radio_ioctl(struct inode *inode, struct file *file,
struct radio_device *card = video_get_drvdata(dev);
int ret;
down(&card->lock);
mutex_lock(&card->lock);
ret = video_usercopy(inode, file, cmd, arg, radio_function);
up(&card->lock);
mutex_unlock(&card->lock);
return ret;
}
@ -311,7 +312,7 @@ static int __devinit maestro_probe(struct pci_dev *pdev,
}
radio_unit->io = pci_resource_start(pdev, 0) + GPIO_DATA;
init_MUTEX(&radio_unit->lock);
mutex_init(&radio_unit->lock);
maestro_radio_inst = video_device_alloc();
if (maestro_radio_inst == NULL) {

View File

@ -37,7 +37,8 @@
#include <linux/sched.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>
#include <linux/pci.h>
#include <linux/videodev.h>
@ -101,7 +102,7 @@ static struct radio_device
unsigned long freq;
struct semaphore lock;
struct mutex lock;
} radio_unit = {0, 0, 0, 0, };
@ -267,9 +268,9 @@ static int radio_ioctl(struct inode *inode, struct file *file,
struct radio_device *card=dev->priv;
int ret;
down(&card->lock);
mutex_lock(&card->lock);
ret = video_usercopy(inode, file, cmd, arg, radio_function);
up(&card->lock);
mutex_unlock(&card->lock);
return ret;
}
@ -290,7 +291,7 @@ static int __devinit maxiradio_init_one(struct pci_dev *pdev, const struct pci_d
goto err_out_free_region;
radio_unit.io = pci_resource_start(pdev, 0);
init_MUTEX(&radio_unit.lock);
mutex_init(&radio_unit.lock);
maxiradio_radio.priv = &radio_unit;
if(video_register_device(&maxiradio_radio, VFL_TYPE_RADIO, radio_nr)==-1) {

View File

@ -24,7 +24,7 @@
#include <linux/isapnp.h>
#include <asm/io.h> /* outb, outb_p */
#include <asm/uaccess.h> /* copy to/from user */
#include <asm/semaphore.h>
#include <linux/mutex.h>
struct fmi_device
{
@ -37,7 +37,7 @@ struct fmi_device
static int io = -1;
static int radio_nr = -1;
static struct pnp_dev *dev = NULL;
static struct semaphore lock;
static struct mutex lock;
/* freq is in 1/16 kHz to internal number, hw precision is 50 kHz */
/* It is only useful to give freq in intervall of 800 (=0.05Mhz),
@ -68,16 +68,16 @@ static void outbits(int bits, unsigned int data, int port)
static inline void fmi_mute(int port)
{
down(&lock);
mutex_lock(&lock);
outb(0x00, port);
up(&lock);
mutex_unlock(&lock);
}
static inline void fmi_unmute(int port)
{
down(&lock);
mutex_lock(&lock);
outb(0x08, port);
up(&lock);
mutex_unlock(&lock);
}
static inline int fmi_setfreq(struct fmi_device *dev)
@ -85,12 +85,12 @@ static inline int fmi_setfreq(struct fmi_device *dev)
int myport = dev->port;
unsigned long freq = dev->curfreq;
down(&lock);
mutex_lock(&lock);
outbits(16, RSF16_ENCODE(freq), myport);
outbits(8, 0xC0, myport);
msleep(143); /* was schedule_timeout(HZ/7) */
up(&lock);
mutex_unlock(&lock);
if (dev->curvol) fmi_unmute(myport);
return 0;
}
@ -102,7 +102,7 @@ static inline int fmi_getsigstr(struct fmi_device *dev)
int myport = dev->port;
down(&lock);
mutex_lock(&lock);
val = dev->curvol ? 0x08 : 0x00; /* unmute/mute */
outb(val, myport);
outb(val | 0x10, myport);
@ -110,7 +110,7 @@ static inline int fmi_getsigstr(struct fmi_device *dev)
res = (int)inb(myport+1);
outb(val, myport);
up(&lock);
mutex_unlock(&lock);
return (res & 2) ? 0 : 0xFFFF;
}
@ -296,7 +296,7 @@ static int __init fmi_init(void)
fmi_unit.flags = VIDEO_TUNER_LOW;
fmi_radio.priv = &fmi_unit;
init_MUTEX(&lock);
mutex_init(&lock);
if (video_register_device(&fmi_radio, VFL_TYPE_RADIO, radio_nr) == -1) {
release_region(io, 2);

View File

@ -19,9 +19,9 @@
#include <asm/io.h> /* outb, outb_p */
#include <asm/uaccess.h> /* copy to/from user */
#include <linux/videodev.h> /* kernel radio structs */
#include <asm/semaphore.h>
#include <linux/mutex.h>
static struct semaphore lock;
static struct mutex lock;
#undef DEBUG
//#define DEBUG 1
@ -238,9 +238,9 @@ static int fmr2_do_ioctl(struct inode *inode, struct file *file,
if (fmr2->mute)
v->flags |= VIDEO_AUDIO_MUTE;
v->mode=VIDEO_MODE_AUTO;
down(&lock);
mutex_lock(&lock);
v->signal = fmr2_getsigstr(fmr2);
up(&lock);
mutex_unlock(&lock);
return 0;
}
case VIDIOCSTUNER:
@ -274,9 +274,9 @@ static int fmr2_do_ioctl(struct inode *inode, struct file *file,
/* set card freq (if not muted) */
if (fmr2->curvol && !fmr2->mute)
{
down(&lock);
mutex_lock(&lock);
fmr2_setfreq(fmr2);
up(&lock);
mutex_unlock(&lock);
}
return 0;
}
@ -318,14 +318,14 @@ static int fmr2_do_ioctl(struct inode *inode, struct file *file,
else
printk(KERN_DEBUG "mute\n");
#endif
down(&lock);
mutex_lock(&lock);
if (fmr2->curvol && !fmr2->mute)
{
fmr2_setvolume(fmr2);
fmr2_setfreq(fmr2);
}
else fmr2_mute(fmr2->port);
up(&lock);
mutex_unlock(&lock);
return 0;
}
case VIDIOCGUNIT:
@ -380,7 +380,7 @@ static int __init fmr2_init(void)
fmr2_unit.card_type = 0;
fmr2_radio.priv = &fmr2_unit;
init_MUTEX(&lock);
mutex_init(&lock);
if (request_region(io, 2, "sf16fmr2"))
{
@ -397,10 +397,10 @@ static int __init fmr2_init(void)
printk(KERN_INFO "SF16FMR2 radio card driver at 0x%x.\n", io);
debug_print((KERN_DEBUG "Mute %d Low %d\n",VIDEO_AUDIO_MUTE,VIDEO_TUNER_LOW));
/* mute card - prevents noisy bootups */
down(&lock);
mutex_lock(&lock);
fmr2_mute(io);
fmr2_product_info(&fmr2_unit);
up(&lock);
mutex_unlock(&lock);
debug_print((KERN_DEBUG "card_type %d\n", fmr2_unit.card_type));
return 0;
}

View File

@ -59,7 +59,7 @@ struct typhoon_device {
int muted;
unsigned long curfreq;
unsigned long mutefreq;
struct semaphore lock;
struct mutex lock;
};
static void typhoon_setvol_generic(struct typhoon_device *dev, int vol);
@ -77,12 +77,12 @@ static int typhoon_get_info(char *buf, char **start, off_t offset, int len);
static void typhoon_setvol_generic(struct typhoon_device *dev, int vol)
{
down(&dev->lock);
mutex_lock(&dev->lock);
vol >>= 14; /* Map 16 bit to 2 bit */
vol &= 3;
outb_p(vol / 2, dev->iobase); /* Set the volume, high bit. */
outb_p(vol % 2, dev->iobase + 2); /* Set the volume, low bit. */
up(&dev->lock);
mutex_unlock(&dev->lock);
}
static int typhoon_setfreq_generic(struct typhoon_device *dev,
@ -102,7 +102,7 @@ static int typhoon_setfreq_generic(struct typhoon_device *dev,
*
*/
down(&dev->lock);
mutex_lock(&dev->lock);
x = frequency / 160;
outval = (x * x + 2500) / 5000;
outval = (outval * x + 5000) / 10000;
@ -112,7 +112,7 @@ static int typhoon_setfreq_generic(struct typhoon_device *dev,
outb_p((outval >> 8) & 0x01, dev->iobase + 4);
outb_p(outval >> 9, dev->iobase + 6);
outb_p(outval & 0xff, dev->iobase + 8);
up(&dev->lock);
mutex_unlock(&dev->lock);
return 0;
}
@ -337,7 +337,7 @@ static int __init typhoon_init(void)
#endif /* MODULE */
printk(KERN_INFO BANNER);
init_MUTEX(&typhoon_unit.lock);
mutex_init(&typhoon_unit.lock);
io = typhoon_unit.iobase;
if (!request_region(io, 8, "typhoon")) {
printk(KERN_ERR "radio-typhoon: port 0x%x already in use\n",

View File

@ -48,7 +48,7 @@ struct zol_device {
unsigned long curfreq;
int muted;
unsigned int stereo;
struct semaphore lock;
struct mutex lock;
};
static int zol_setvol(struct zol_device *dev, int vol)
@ -57,30 +57,30 @@ static int zol_setvol(struct zol_device *dev, int vol)
if (dev->muted)
return 0;
down(&dev->lock);
mutex_lock(&dev->lock);
if (vol == 0) {
outb(0, io);
outb(0, io);
inb(io + 3); /* Zoltrix needs to be read to confirm */
up(&dev->lock);
mutex_unlock(&dev->lock);
return 0;
}
outb(dev->curvol-1, io);
msleep(10);
inb(io + 2);
up(&dev->lock);
mutex_unlock(&dev->lock);
return 0;
}
static void zol_mute(struct zol_device *dev)
{
dev->muted = 1;
down(&dev->lock);
mutex_lock(&dev->lock);
outb(0, io);
outb(0, io);
inb(io + 3); /* Zoltrix needs to be read to confirm */
up(&dev->lock);
mutex_unlock(&dev->lock);
}
static void zol_unmute(struct zol_device *dev)
@ -104,7 +104,7 @@ static int zol_setfreq(struct zol_device *dev, unsigned long freq)
bitmask = 0xc480402c10080000ull;
i = 45;
down(&dev->lock);
mutex_lock(&dev->lock);
outb(0, io);
outb(0, io);
@ -149,7 +149,7 @@ static int zol_setfreq(struct zol_device *dev, unsigned long freq)
udelay(1000);
}
up(&dev->lock);
mutex_unlock(&dev->lock);
if(!dev->muted)
{
@ -164,7 +164,7 @@ static int zol_getsigstr(struct zol_device *dev)
{
int a, b;
down(&dev->lock);
mutex_lock(&dev->lock);
outb(0x00, io); /* This stuff I found to do nothing */
outb(dev->curvol, io);
msleep(20);
@ -173,7 +173,7 @@ static int zol_getsigstr(struct zol_device *dev)
msleep(10);
b = inb(io);
up(&dev->lock);
mutex_unlock(&dev->lock);
if (a != b)
return (0);
@ -188,7 +188,7 @@ static int zol_is_stereo (struct zol_device *dev)
{
int x1, x2;
down(&dev->lock);
mutex_lock(&dev->lock);
outb(0x00, io);
outb(dev->curvol, io);
@ -198,7 +198,7 @@ static int zol_is_stereo (struct zol_device *dev)
msleep(10);
x2 = inb(io);
up(&dev->lock);
mutex_unlock(&dev->lock);
if ((x1 == x2) && (x1 == 0xcf))
return 1;
@ -350,7 +350,7 @@ static int __init zoltrix_init(void)
}
printk(KERN_INFO "Zoltrix Radio Plus card driver.\n");
init_MUTEX(&zoltrix_unit.lock);
mutex_init(&zoltrix_unit.lock);
/* mute card - prevents noisy bootups */

View File

@ -26,6 +26,7 @@ config VIDEO_BT848
select VIDEO_IR
select VIDEO_TUNER
select VIDEO_TVEEPROM
select VIDEO_MSP3400
---help---
Support for BT848 based frame grabber/overlay boards. This includes
the Miro, Hauppauge and STB boards. Please read the material in
@ -142,6 +143,8 @@ config VIDEO_CPIA_USB
otherwise say N. This will not work with the Creative Webcam III.
It is also available as a module (cpia_usb).
source "drivers/media/video/cpia2/Kconfig"
config VIDEO_SAA5246A
tristate "SAA5246A, SAA5281 Teletext processor"
depends on VIDEO_DEV && I2C
@ -339,18 +342,53 @@ config VIDEO_M32R_AR_M64278
Say Y here to use the Renesas M64278E-800 camera module,
which supports VGA(640x480 pixcels) size of images.
config VIDEO_AUDIO_DECODER
tristate "Add support for additional audio chipsets"
depends on VIDEO_DEV && I2C && EXPERIMENTAL
config VIDEO_MSP3400
tristate "Micronas MSP34xx audio decoders"
depends on VIDEO_DEV && I2C
---help---
Say Y here to compile drivers for WM8775 and CS53L32A audio
decoders.
Support for the Micronas MSP34xx series of audio decoders.
config VIDEO_DECODER
tristate "Add support for additional video chipsets"
To compile this driver as a module, choose M here: the
module will be called msp3400
config VIDEO_CS53L32A
tristate "Cirrus Logic CS53L32A audio ADC"
depends on VIDEO_DEV && I2C && EXPERIMENTAL
---help---
Say Y here to compile drivers for SAA7115, SAA7127 and CX25840
video decoders.
Support for the Cirrus Logic CS53L32A low voltage
stereo A/D converter.
To compile this driver as a module, choose M here: the
module will be called cs53l32a
config VIDEO_WM8775
tristate "Wolfson Microelectronics WM8775 audio ADC"
depends on VIDEO_DEV && I2C && EXPERIMENTAL
---help---
Support for the Wolfson Microelectronics WM8775
high performance stereo A/D Converter.
To compile this driver as a module, choose M here: the
module will be called wm8775
source "drivers/media/video/cx25840/Kconfig"
config VIDEO_SAA711X
tristate "Philips SAA7113/4/5 video decoders"
depends on VIDEO_DEV && I2C && EXPERIMENTAL
---help---
Support for the Philips SAA7113/4/5 video decoders.
To compile this driver as a module, choose M here: the
module will be called saa7115
config VIDEO_SAA7127
tristate "Philips SAA7127/9 digital video encoders"
depends on VIDEO_DEV && I2C && EXPERIMENTAL
---help---
Support for the Philips SAA7127/9 digital video encoders.
To compile this driver as a module, choose M here: the
module will be called saa7127
endmenu

View File

@ -15,7 +15,7 @@ msp3400-objs := msp3400-driver.o msp3400-kthreads.o
obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o compat_ioctl32.o
obj-$(CONFIG_VIDEO_BT848) += bttv.o msp3400.o tvaudio.o \
obj-$(CONFIG_VIDEO_BT848) += bttv.o tvaudio.o \
tda7432.o tda9875.o ir-kbd-i2c.o
obj-$(CONFIG_SOUND_TVMIXER) += tvmixer.o
@ -44,10 +44,13 @@ obj-$(CONFIG_VIDEO_MEYE) += meye.o
obj-$(CONFIG_VIDEO_SAA7134) += ir-kbd-i2c.o saa7134/
obj-$(CONFIG_VIDEO_CX88) += cx88/
obj-$(CONFIG_VIDEO_EM28XX) += em28xx/
obj-$(CONFIG_VIDEO_EM28XX) += saa711x.o tvp5150.o
obj-$(CONFIG_VIDEO_AUDIO_DECODER) += wm8775.o cs53l32a.o
obj-$(CONFIG_VIDEO_EM28XX) += tvp5150.o
obj-$(CONFIG_VIDEO_MSP3400) += msp3400.o
obj-$(CONFIG_VIDEO_CS53L32A) += cs53l32a.o
obj-$(CONFIG_VIDEO_WM8775) += wm8775.o
obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip/
obj-$(CONFIG_VIDEO_MXB) += saa7111.o tuner.o tda9840.o tea6415c.o tea6420.o mxb.o
obj-$(CONFIG_VIDEO_CPIA2) += cpia2/
obj-$(CONFIG_VIDEO_MXB) += saa7111.o tda9840.o tea6415c.o tea6420.o mxb.o
obj-$(CONFIG_VIDEO_HEXIUM_ORION) += hexium_orion.o
obj-$(CONFIG_VIDEO_HEXIUM_GEMINI) += hexium_gemini.o
obj-$(CONFIG_VIDEO_DPC) += saa7111.o dpc7146.o
@ -61,6 +64,8 @@ obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o
obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o
obj-$(CONFIG_VIDEO_DECODER) += saa7115.o cx25840/ saa7127.o
obj-$(CONFIG_VIDEO_CX25840) += cx25840/
obj-$(CONFIG_VIDEO_SAA711X) += saa7115.o
obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o
EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core

View File

@ -31,8 +31,8 @@
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/videodev.h>
#include <linux/mutex.h>
#include <asm/semaphore.h>
#include <asm/uaccess.h>
#include <asm/m32r.h>
#include <asm/io.h>
@ -117,7 +117,7 @@ struct ar_device {
int width, height;
int frame_bytes, line_bytes;
wait_queue_head_t wait;
struct semaphore lock;
struct mutex lock;
};
static int video_nr = -1; /* video device number (first free) */
@ -288,7 +288,7 @@ static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos)
if (ar->mode == AR_MODE_NORMAL)
arvcr1 |= ARVCR1_NORMAL;
down(&ar->lock);
mutex_lock(&ar->lock);
#if USE_INT
local_irq_save(flags);
@ -392,7 +392,7 @@ static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos)
}
DEBUG(1, "ret = %d\n", ret);
out_up:
up(&ar->lock);
mutex_unlock(&ar->lock);
return ret;
}
@ -456,7 +456,7 @@ static int ar_do_ioctl(struct inode *inode, struct file *file,
(w->width != AR_WIDTH_QVGA || w->height != AR_HEIGHT_QVGA))
return -EINVAL;
down(&ar->lock);
mutex_lock(&ar->lock);
ar->width = w->width;
ar->height = w->height;
if (ar->width == AR_WIDTH_VGA) {
@ -473,7 +473,7 @@ static int ar_do_ioctl(struct inode *inode, struct file *file,
ar->line_bytes = AR_LINE_BYTES_QVGA;
ar->mode = AR_MODE_INTERLACE;
}
up(&ar->lock);
mutex_unlock(&ar->lock);
return 0;
}
case VIDIOCGFBUF:
@ -734,7 +734,7 @@ static int ar_initialize(struct video_device *dev)
void ar_release(struct video_device *vfd)
{
struct ar_device *ar = vfd->priv;
down(&ar->lock);
mutex_lock(&ar->lock);
video_device_release(vfd);
}
@ -824,7 +824,7 @@ static int __init ar_init(void)
ar->line_bytes = AR_LINE_BYTES_QVGA;
ar->mode = AR_MODE_INTERLACE;
}
init_MUTEX(&ar->lock);
mutex_init(&ar->lock);
init_waitqueue_head(&ar->wait);
#if USE_INT

View File

@ -137,6 +137,8 @@ MODULE_PARM_DESC(card,"specify TV/grabber card model, see CARDLIST file for a li
MODULE_PARM_DESC(pll,"specify installed crystal (0=none, 28=28 MHz, 35=35 MHz)");
MODULE_PARM_DESC(tuner,"specify installed tuner type");
MODULE_PARM_DESC(autoload,"automatically load i2c modules like tuner.o, default is 1 (yes)");
MODULE_PARM_DESC(no_overlay,"allow override overlay default (0 disables, 1 enables)"
" [some VIA/SIS chipsets are known to have problem with overlay]");
/* ----------------------------------------------------------------------- */
/* list of card IDs for bt878+ cards */
@ -275,7 +277,6 @@ static struct CARD {
{ 0x03116000, BTTV_BOARD_SENSORAY311, "Sensoray 311" },
{ 0x00790e11, BTTV_BOARD_WINDVR, "Canopus WinDVR PCI" },
{ 0xa0fca1a0, BTTV_BOARD_ZOLTRIX, "Face to Face Tvmax" },
{ 0x20007063, BTTV_BOARD_PC_HDTV, "pcHDTV HD-2000 TV"},
{ 0x82b2aa6a, BTTV_BOARD_SIMUS_GVC1100, "SIMUS GVC1100" },
{ 0x146caa0c, BTTV_BOARD_PV951, "ituner spectra8" },
{ 0x200a1295, BTTV_BOARD_PXC200, "ImageNation PXC200A" },
@ -297,13 +298,14 @@ static struct CARD {
* { 0x13eb0070, BTTV_BOARD_HAUPPAUGE_IMPACTVCB, "Hauppauge ImpactVCB" }, */
/* DVB cards (using pci function .1 for mpeg data xfer) */
{ 0x01010071, BTTV_BOARD_NEBULA_DIGITV, "Nebula Electronics DigiTV" },
{ 0x07611461, BTTV_BOARD_AVDVBT_761, "AverMedia AverTV DVB-T 761" },
{ 0x001c11bd, BTTV_BOARD_PINNACLESAT, "Pinnacle PCTV Sat" },
{ 0x01010071, BTTV_BOARD_NEBULA_DIGITV, "Nebula Electronics DigiTV" },
{ 0x20007063, BTTV_BOARD_PC_HDTV, "pcHDTV HD-2000 TV"},
{ 0x002611bd, BTTV_BOARD_TWINHAN_DST, "Pinnacle PCTV SAT CI" },
{ 0x00011822, BTTV_BOARD_TWINHAN_DST, "Twinhan VisionPlus DVB" },
{ 0xfc00270f, BTTV_BOARD_TWINHAN_DST, "ChainTech digitop DST-1000 DVB-S" },
{ 0x07711461, BTTV_BOARD_AVDVBT_771, "AVermedia AverTV DVB-T 771" },
{ 0x07611461, BTTV_BOARD_AVDVBT_761, "AverMedia AverTV DVB-T 761" },
{ 0xdb1018ac, BTTV_BOARD_DVICO_DVBT_LITE, "DViCO FusionHDTV DVB-T Lite" },
{ 0xd50018ac, BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE, "DViCO FusionHDTV 5 Lite" },
@ -4944,12 +4946,14 @@ void __devinit bttv_check_chipset(void)
if (vsfx)
printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n");
if (pcipci_fail) {
printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n");
printk(KERN_INFO "bttv: bttv and your chipset may not work "
"together.\n");
if (!no_overlay) {
printk(KERN_WARNING "bttv: overlay will be disabled.\n");
printk(KERN_INFO "bttv: overlay will be disabled.\n");
no_overlay = 1;
} else {
printk(KERN_WARNING "bttv: overlay forced. Use this option at your own risk.\n");
printk(KERN_INFO "bttv: overlay forced. Use this "
"option at your own risk.\n");
}
}
if (UNSET != latency)

View File

@ -1965,7 +1965,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv,
BUG();
}
down(&fh->cap.lock);
mutex_lock(&fh->cap.lock);
kfree(fh->ov.clips);
fh->ov.clips = clips;
fh->ov.nclips = n;
@ -1986,7 +1986,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv,
bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new);
retval = bttv_switch_overlay(btv,fh,new);
}
up(&fh->cap.lock);
mutex_unlock(&fh->cap.lock);
return retval;
}
@ -2166,7 +2166,7 @@ static int bttv_s_fmt(struct bttv_fh *fh, struct bttv *btv,
fmt = format_by_fourcc(f->fmt.pix.pixelformat);
/* update our state informations */
down(&fh->cap.lock);
mutex_lock(&fh->cap.lock);
fh->fmt = fmt;
fh->cap.field = f->fmt.pix.field;
fh->cap.last = V4L2_FIELD_NONE;
@ -2175,7 +2175,7 @@ static int bttv_s_fmt(struct bttv_fh *fh, struct bttv *btv,
btv->init.fmt = fmt;
btv->init.width = f->fmt.pix.width;
btv->init.height = f->fmt.pix.height;
up(&fh->cap.lock);
mutex_unlock(&fh->cap.lock);
return 0;
}
@ -2282,7 +2282,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
fmt = format_by_palette(pic->palette);
if (NULL == fmt)
return -EINVAL;
down(&fh->cap.lock);
mutex_lock(&fh->cap.lock);
if (fmt->depth != pic->depth) {
retval = -EINVAL;
goto fh_unlock_and_return;
@ -2313,7 +2313,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
bt848_contrast(btv,pic->contrast);
bt848_hue(btv,pic->hue);
bt848_sat(btv,pic->colour);
up(&fh->cap.lock);
mutex_unlock(&fh->cap.lock);
return 0;
}
@ -2379,7 +2379,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
return -EPERM;
end = (unsigned long)fbuf->base +
fbuf->height * fbuf->bytesperline;
down(&fh->cap.lock);
mutex_lock(&fh->cap.lock);
retval = -EINVAL;
switch (fbuf->depth) {
@ -2417,7 +2417,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
btv->fbuf.fmt.bytesperline = fbuf->bytesperline;
else
btv->fbuf.fmt.bytesperline = btv->fbuf.fmt.width*fbuf->depth/8;
up(&fh->cap.lock);
mutex_unlock(&fh->cap.lock);
return 0;
}
@ -2440,7 +2440,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
if (!check_alloc_btres(btv,fh,RESOURCE_OVERLAY))
return -EBUSY;
down(&fh->cap.lock);
mutex_lock(&fh->cap.lock);
if (*on) {
fh->ov.tvnorm = btv->tvnorm;
new = videobuf_alloc(sizeof(*new));
@ -2451,7 +2451,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
/* switch over */
retval = bttv_switch_overlay(btv,fh,new);
up(&fh->cap.lock);
mutex_unlock(&fh->cap.lock);
return retval;
}
@ -2460,7 +2460,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
struct video_mbuf *mbuf = arg;
unsigned int i;
down(&fh->cap.lock);
mutex_lock(&fh->cap.lock);
retval = videobuf_mmap_setup(&fh->cap,gbuffers,gbufsize,
V4L2_MEMORY_MMAP);
if (retval < 0)
@ -2470,7 +2470,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
mbuf->size = gbuffers * gbufsize;
for (i = 0; i < gbuffers; i++)
mbuf->offsets[i] = i * gbufsize;
up(&fh->cap.lock);
mutex_unlock(&fh->cap.lock);
return 0;
}
case VIDIOCMCAPTURE:
@ -2482,7 +2482,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
if (vm->frame >= VIDEO_MAX_FRAME)
return -EINVAL;
down(&fh->cap.lock);
mutex_lock(&fh->cap.lock);
retval = -EINVAL;
buf = (struct bttv_buffer *)fh->cap.bufs[vm->frame];
if (NULL == buf)
@ -2504,7 +2504,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
spin_lock_irqsave(&btv->s_lock,flags);
buffer_queue(&fh->cap,&buf->vb);
spin_unlock_irqrestore(&btv->s_lock,flags);
up(&fh->cap.lock);
mutex_unlock(&fh->cap.lock);
return 0;
}
case VIDIOCSYNC:
@ -2515,7 +2515,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
if (*frame >= VIDEO_MAX_FRAME)
return -EINVAL;
down(&fh->cap.lock);
mutex_lock(&fh->cap.lock);
retval = -EINVAL;
buf = (struct bttv_buffer *)fh->cap.bufs[*frame];
if (NULL == buf)
@ -2535,7 +2535,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
retval = -EINVAL;
break;
}
up(&fh->cap.lock);
mutex_unlock(&fh->cap.lock);
return retval;
}
@ -2719,7 +2719,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
if (0 == (fmt->flags & FORMAT_FLAGS_PACKED))
return -EINVAL;
down(&fh->cap.lock);
mutex_lock(&fh->cap.lock);
retval = -EINVAL;
if (fb->flags & V4L2_FBUF_FLAG_OVERLAY) {
if (fb->fmt.width > bttv_tvnorms[btv->tvnorm].swidth)
@ -2759,7 +2759,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
retval = bttv_switch_overlay(btv,fh,new);
}
}
up(&fh->cap.lock);
mutex_unlock(&fh->cap.lock);
return retval;
}
@ -2890,7 +2890,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
return 0;
fh_unlock_and_return:
up(&fh->cap.lock);
mutex_unlock(&fh->cap.lock);
return retval;
}
@ -2957,16 +2957,16 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream);
} else {
/* read() capture */
down(&fh->cap.lock);
mutex_lock(&fh->cap.lock);
if (NULL == fh->cap.read_buf) {
/* need to capture a new frame */
if (locked_btres(fh->btv,RESOURCE_VIDEO)) {
up(&fh->cap.lock);
mutex_unlock(&fh->cap.lock);
return POLLERR;
}
fh->cap.read_buf = videobuf_alloc(fh->cap.msize);
if (NULL == fh->cap.read_buf) {
up(&fh->cap.lock);
mutex_unlock(&fh->cap.lock);
return POLLERR;
}
fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR;
@ -2974,13 +2974,13 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) {
kfree (fh->cap.read_buf);
fh->cap.read_buf = NULL;
up(&fh->cap.lock);
mutex_unlock(&fh->cap.lock);
return POLLERR;
}
fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf);
fh->cap.read_off = 0;
}
up(&fh->cap.lock);
mutex_unlock(&fh->cap.lock);
buf = (struct bttv_buffer*)fh->cap.read_buf;
}

View File

@ -28,251 +28,6 @@
#include "bttv.h"
#include "bttvp.h"
/* ---------------------------------------------------------------------- */
static IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE] = {
[ 34 ] = KEY_KP0,
[ 40 ] = KEY_KP1,
[ 24 ] = KEY_KP2,
[ 56 ] = KEY_KP3,
[ 36 ] = KEY_KP4,
[ 20 ] = KEY_KP5,
[ 52 ] = KEY_KP6,
[ 44 ] = KEY_KP7,
[ 28 ] = KEY_KP8,
[ 60 ] = KEY_KP9,
[ 48 ] = KEY_EJECTCD, // Unmarked on my controller
[ 0 ] = KEY_POWER,
[ 18 ] = BTN_LEFT, // DISPLAY/L
[ 50 ] = BTN_RIGHT, // LOOP/R
[ 10 ] = KEY_MUTE,
[ 38 ] = KEY_RECORD,
[ 22 ] = KEY_PAUSE,
[ 54 ] = KEY_STOP,
[ 30 ] = KEY_VOLUMEDOWN,
[ 62 ] = KEY_VOLUMEUP,
[ 32 ] = KEY_TUNER, // TV/FM
[ 16 ] = KEY_CD,
[ 8 ] = KEY_VIDEO,
[ 4 ] = KEY_AUDIO,
[ 12 ] = KEY_ZOOM, // full screen
[ 2 ] = KEY_INFO, // preview
[ 42 ] = KEY_SEARCH, // autoscan
[ 26 ] = KEY_STOP, // freeze
[ 58 ] = KEY_RECORD, // capture
[ 6 ] = KEY_PLAY, // unmarked
[ 46 ] = KEY_RED, // unmarked
[ 14 ] = KEY_GREEN, // unmarked
[ 33 ] = KEY_YELLOW, // unmarked
[ 17 ] = KEY_CHANNELDOWN,
[ 49 ] = KEY_CHANNELUP,
[ 1 ] = KEY_BLUE, // unmarked
};
/* Matt Jesson <dvb@jesson.eclipse.co.uk */
static IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE] = {
[ 0x28 ] = KEY_KP0, //'0' / 'enter'
[ 0x22 ] = KEY_KP1, //'1'
[ 0x12 ] = KEY_KP2, //'2' / 'up arrow'
[ 0x32 ] = KEY_KP3, //'3'
[ 0x24 ] = KEY_KP4, //'4' / 'left arrow'
[ 0x14 ] = KEY_KP5, //'5'
[ 0x34 ] = KEY_KP6, //'6' / 'right arrow'
[ 0x26 ] = KEY_KP7, //'7'
[ 0x16 ] = KEY_KP8, //'8' / 'down arrow'
[ 0x36 ] = KEY_KP9, //'9'
[ 0x20 ] = KEY_LIST, // 'source'
[ 0x10 ] = KEY_TEXT, // 'teletext'
[ 0x00 ] = KEY_POWER, // 'power'
[ 0x04 ] = KEY_AUDIO, // 'audio'
[ 0x06 ] = KEY_ZOOM, // 'full screen'
[ 0x18 ] = KEY_VIDEO, // 'display'
[ 0x38 ] = KEY_SEARCH, // 'loop'
[ 0x08 ] = KEY_INFO, // 'preview'
[ 0x2a ] = KEY_REWIND, // 'backward <<'
[ 0x1a ] = KEY_FASTFORWARD, // 'forward >>'
[ 0x3a ] = KEY_RECORD, // 'capture'
[ 0x0a ] = KEY_MUTE, // 'mute'
[ 0x2c ] = KEY_RECORD, // 'record'
[ 0x1c ] = KEY_PAUSE, // 'pause'
[ 0x3c ] = KEY_STOP, // 'stop'
[ 0x0c ] = KEY_PLAY, // 'play'
[ 0x2e ] = KEY_RED, // 'red'
[ 0x01 ] = KEY_BLUE, // 'blue' / 'cancel'
[ 0x0e ] = KEY_YELLOW, // 'yellow' / 'ok'
[ 0x21 ] = KEY_GREEN, // 'green'
[ 0x11 ] = KEY_CHANNELDOWN, // 'channel -'
[ 0x31 ] = KEY_CHANNELUP, // 'channel +'
[ 0x1e ] = KEY_VOLUMEDOWN, // 'volume -'
[ 0x3e ] = KEY_VOLUMEUP, // 'volume +'
};
/* Attila Kondoros <attila.kondoros@chello.hu> */
static IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE] = {
[ 1 ] = KEY_KP1,
[ 2 ] = KEY_KP2,
[ 3 ] = KEY_KP3,
[ 4 ] = KEY_KP4,
[ 5 ] = KEY_KP5,
[ 6 ] = KEY_KP6,
[ 7 ] = KEY_KP7,
[ 8 ] = KEY_KP8,
[ 9 ] = KEY_KP9,
[ 0 ] = KEY_KP0,
[ 23 ] = KEY_LAST, // +100
[ 10 ] = KEY_LIST, // recall
[ 28 ] = KEY_TUNER, // TV/FM
[ 21 ] = KEY_SEARCH, // scan
[ 18 ] = KEY_POWER, // power
[ 31 ] = KEY_VOLUMEDOWN, // vol up
[ 27 ] = KEY_VOLUMEUP, // vol down
[ 30 ] = KEY_CHANNELDOWN, // chn up
[ 26 ] = KEY_CHANNELUP, // chn down
[ 17 ] = KEY_VIDEO, // video
[ 15 ] = KEY_ZOOM, // full screen
[ 19 ] = KEY_MUTE, // mute/unmute
[ 16 ] = KEY_TEXT, // min
[ 13 ] = KEY_STOP, // freeze
[ 14 ] = KEY_RECORD, // record
[ 29 ] = KEY_PLAYPAUSE, // stop
[ 25 ] = KEY_PLAY, // play
[ 22 ] = KEY_GOTO, // osd
[ 20 ] = KEY_REFRESH, // default
[ 12 ] = KEY_KPPLUS, // fine tune >>>>
[ 24 ] = KEY_KPMINUS // fine tune <<<<
};
/* ---------------------------------------------------------------------- */
static IR_KEYTAB_TYPE ir_codes_conceptronic[IR_KEYTAB_SIZE] = {
[ 30 ] = KEY_POWER, // power
[ 7 ] = KEY_MEDIA, // source
[ 28 ] = KEY_SEARCH, // scan
/* FIXME: duplicate keycodes?
*
* These four keys seem to share the same GPIO as CH+, CH-, <<< and >>>
* The GPIO values are
* 6397fb for both "Scan <" and "CH -",
* 639ffb for "Scan >" and "CH+",
* 6384fb for "Tune <" and "<<<",
* 638cfb for "Tune >" and ">>>", regardless of the mask.
*
* [ 23 ] = KEY_BACK, // fm scan <<
* [ 31 ] = KEY_FORWARD, // fm scan >>
*
* [ 4 ] = KEY_LEFT, // fm tuning <
* [ 12 ] = KEY_RIGHT, // fm tuning >
*
* For now, these four keys are disabled. Pressing them will generate
* the CH+/CH-/<<</>>> events
*/
[ 3 ] = KEY_TUNER, // TV/FM
[ 0 ] = KEY_RECORD,
[ 8 ] = KEY_STOP,
[ 17 ] = KEY_PLAY,
[ 26 ] = KEY_PLAYPAUSE, // freeze
[ 25 ] = KEY_ZOOM, // zoom
[ 15 ] = KEY_TEXT, // min
[ 1 ] = KEY_KP1,
[ 11 ] = KEY_KP2,
[ 27 ] = KEY_KP3,
[ 5 ] = KEY_KP4,
[ 9 ] = KEY_KP5,
[ 21 ] = KEY_KP6,
[ 6 ] = KEY_KP7,
[ 10 ] = KEY_KP8,
[ 18 ] = KEY_KP9,
[ 2 ] = KEY_KP0,
[ 16 ] = KEY_LAST, // +100
[ 19 ] = KEY_LIST, // recall
[ 31 ] = KEY_CHANNELUP, // chn down
[ 23 ] = KEY_CHANNELDOWN, // chn up
[ 22 ] = KEY_VOLUMEUP, // vol down
[ 20 ] = KEY_VOLUMEDOWN, // vol up
[ 4 ] = KEY_KPMINUS, // <<<
[ 14 ] = KEY_SETUP, // function
[ 12 ] = KEY_KPPLUS, // >>>
[ 13 ] = KEY_GOTO, // mts
[ 29 ] = KEY_REFRESH, // reset
[ 24 ] = KEY_MUTE // mute/unmute
};
static IR_KEYTAB_TYPE ir_codes_nebula[IR_KEYTAB_SIZE] = {
[0x00] = KEY_KP0,
[0x01] = KEY_KP1,
[0x02] = KEY_KP2,
[0x03] = KEY_KP3,
[0x04] = KEY_KP4,
[0x05] = KEY_KP5,
[0x06] = KEY_KP6,
[0x07] = KEY_KP7,
[0x08] = KEY_KP8,
[0x09] = KEY_KP9,
[0x0a] = KEY_TV,
[0x0b] = KEY_AUX,
[0x0c] = KEY_DVD,
[0x0d] = KEY_POWER,
[0x0e] = KEY_MHP, /* labelled 'Picture' */
[0x0f] = KEY_AUDIO,
[0x10] = KEY_INFO,
[0x11] = KEY_F13, /* 16:9 */
[0x12] = KEY_F14, /* 14:9 */
[0x13] = KEY_EPG,
[0x14] = KEY_EXIT,
[0x15] = KEY_MENU,
[0x16] = KEY_UP,
[0x17] = KEY_DOWN,
[0x18] = KEY_LEFT,
[0x19] = KEY_RIGHT,
[0x1a] = KEY_ENTER,
[0x1b] = KEY_CHANNELUP,
[0x1c] = KEY_CHANNELDOWN,
[0x1d] = KEY_VOLUMEUP,
[0x1e] = KEY_VOLUMEDOWN,
[0x1f] = KEY_RED,
[0x20] = KEY_GREEN,
[0x21] = KEY_YELLOW,
[0x22] = KEY_BLUE,
[0x23] = KEY_SUBTITLE,
[0x24] = KEY_F15, /* AD */
[0x25] = KEY_TEXT,
[0x26] = KEY_MUTE,
[0x27] = KEY_REWIND,
[0x28] = KEY_STOP,
[0x29] = KEY_PLAY,
[0x2a] = KEY_FASTFORWARD,
[0x2b] = KEY_F16, /* chapter */
[0x2c] = KEY_PAUSE,
[0x2d] = KEY_PLAY,
[0x2e] = KEY_RECORD,
[0x2f] = KEY_F17, /* picture in picture */
[0x30] = KEY_KPPLUS, /* zoom in */
[0x31] = KEY_KPMINUS, /* zoom out */
[0x32] = KEY_F18, /* capture */
[0x33] = KEY_F19, /* web */
[0x34] = KEY_EMAIL,
[0x35] = KEY_PHONE,
[0x36] = KEY_PC
};
static int debug;
module_param(debug, int, 0644); /* debug level (0,1,2) */
@ -573,7 +328,8 @@ int bttv_input_init(struct bttv *btv)
ir->polling = 50; // ms
break;
case BTTV_BOARD_CONCEPTRONIC_CTVFMI2:
ir_codes = ir_codes_conceptronic;
case BTTV_BOARD_CONTVFMI:
ir_codes = ir_codes_pixelview;
ir->mask_keycode = 0x001F00;
ir->mask_keyup = 0x006000;
ir->polling = 50; // ms

View File

@ -51,8 +51,10 @@ bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,
int rc;
/* estimate risc mem: worst case is one write per page border +
one write per scan line + sync + jump (all 2 dwords) */
instructions = (bpl * lines) / PAGE_SIZE + lines;
one write per scan line + sync + jump (all 2 dwords). padding
can cause next bpl to start close to a page border. First DMA
region may be smaller than PAGE_SIZE */
instructions = 1 + ((bpl + padding) * lines) / PAGE_SIZE + lines;
instructions += 2;
if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,instructions*8)) < 0)
return rc;
@ -104,7 +106,7 @@ bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,
/* save pointer to jmp instruction address */
risc->jmp = rp;
BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
return 0;
}
@ -222,7 +224,7 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
/* save pointer to jmp instruction address */
risc->jmp = rp;
BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
return 0;
}
@ -274,6 +276,8 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc,
if (line > maxy)
btcx_calc_skips(line, ov->w.width, &maxy,
skips, &nskips, ov->clips, ov->nclips);
else
nskips = 0;
/* write out risc code */
for (start = 0, skip = 0; start < ov->w.width; start = end) {
@ -307,7 +311,7 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc,
/* save pointer to jmp instruction address */
risc->jmp = rp;
BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
kfree(skips);
return 0;
}
@ -507,8 +511,7 @@ bttv_risc_hook(struct bttv *btv, int slot, struct btcx_riscmem *risc,
void
bttv_dma_free(struct bttv *btv, struct bttv_buffer *buf)
{
if (in_interrupt())
BUG();
BUG_ON(in_interrupt());
videobuf_waiton(&buf->vb,0,0);
videobuf_dma_pci_unmap(btv->c.pci, &buf->vb.dma);
videobuf_dma_free(&buf->vb.dma);

View File

@ -73,7 +73,7 @@ OTHER DEALINGS IN THE SOFTWARE.
#include <linux/parport.h>
#include <linux/sched.h>
#include <linux/videodev.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>
#include <asm/uaccess.h>
#include "bw-qcam.h"
@ -168,7 +168,7 @@ static struct qcam_device *qcam_init(struct parport *port)
memcpy(&q->vdev, &qcam_template, sizeof(qcam_template));
init_MUTEX(&q->lock);
mutex_init(&q->lock);
q->port_mode = (QC_ANY | QC_NOTSET);
q->width = 320;
@ -772,9 +772,9 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
qcam->whitebal = p->whiteness>>8;
qcam->bpp = p->depth;
down(&qcam->lock);
mutex_lock(&qcam->lock);
qc_setscanmode(qcam);
up(&qcam->lock);
mutex_unlock(&qcam->lock);
qcam->status |= QC_PARAM_CHANGE;
return 0;
@ -805,9 +805,9 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
qcam->height = 240;
qcam->transfer_scale = 1;
}
down(&qcam->lock);
mutex_lock(&qcam->lock);
qc_setscanmode(qcam);
up(&qcam->lock);
mutex_unlock(&qcam->lock);
/* We must update the camera before we grab. We could
just have changed the grab size */
@ -854,7 +854,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf,
int len;
parport_claim_or_block(qcam->pdev);
down(&qcam->lock);
mutex_lock(&qcam->lock);
qc_reset(qcam);
@ -864,7 +864,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf,
len=qc_capture(qcam, buf,count);
up(&qcam->lock);
mutex_unlock(&qcam->lock);
parport_release(qcam->pdev);
return len;

View File

@ -55,7 +55,7 @@ struct qcam_device {
struct video_device vdev;
struct pardevice *pdev;
struct parport *pport;
struct semaphore lock;
struct mutex lock;
int width, height;
int bpp;
int mode;

View File

@ -34,7 +34,8 @@
#include <linux/parport.h>
#include <linux/sched.h>
#include <linux/videodev.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>
#include <asm/uaccess.h>
struct qcam_device {
@ -47,7 +48,7 @@ struct qcam_device {
int contrast, brightness, whitebal;
int top, left;
unsigned int bidirectional;
struct semaphore lock;
struct mutex lock;
};
/* cameras maximum */
@ -581,11 +582,11 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
qcam->contrast = p->contrast>>8;
qcam->whitebal = p->whiteness>>8;
down(&qcam->lock);
mutex_lock(&qcam->lock);
parport_claim_or_block(qcam->pdev);
qc_setup(qcam);
parport_release(qcam->pdev);
up(&qcam->lock);
mutex_unlock(&qcam->lock);
return 0;
}
case VIDIOCSWIN:
@ -628,11 +629,11 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
#endif
/* Ok we figured out what to use from our
wide choice */
down(&qcam->lock);
mutex_lock(&qcam->lock);
parport_claim_or_block(qcam->pdev);
qc_setup(qcam);
parport_release(qcam->pdev);
up(&qcam->lock);
mutex_unlock(&qcam->lock);
return 0;
}
case VIDIOCGWIN:
@ -672,12 +673,12 @@ static ssize_t qcam_read(struct file *file, char __user *buf,
struct qcam_device *qcam=(struct qcam_device *)v;
int len;
down(&qcam->lock);
mutex_lock(&qcam->lock);
parport_claim_or_block(qcam->pdev);
/* Probably should have a semaphore against multiple users */
len = qc_capture(qcam, buf,count);
parport_release(qcam->pdev);
up(&qcam->lock);
mutex_unlock(&qcam->lock);
return len;
}
@ -727,7 +728,7 @@ static struct qcam_device *qcam_init(struct parport *port)
memcpy(&q->vdev, &qcam_template, sizeof(qcam_template));
init_MUTEX(&q->lock);
mutex_init(&q->lock);
q->width = q->ccd_width = 320;
q->height = q->ccd_height = 240;
q->mode = QC_MILLIONS | QC_DECIMATION_1;

View File

@ -39,7 +39,7 @@
#include <linux/pagemap.h>
#include <linux/delay.h>
#include <asm/io.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>
#ifdef CONFIG_KMOD
#include <linux/kmod.h>
@ -622,7 +622,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf,
buffer = page;
if (down_interruptible(&cam->param_lock))
if (mutex_lock_interruptible(&cam->param_lock))
return -ERESTARTSYS;
/*
@ -1350,7 +1350,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf,
} else
DBG("error: %d\n", retval);
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
out:
free_page((unsigned long)page);
@ -1664,7 +1664,7 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d)
case CPIA_COMMAND_GetColourParams:
case CPIA_COMMAND_GetColourBalance:
case CPIA_COMMAND_GetExposure:
down(&cam->param_lock);
mutex_lock(&cam->param_lock);
datasize=8;
break;
case CPIA_COMMAND_ReadMCPorts:
@ -1691,7 +1691,7 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d)
if (command == CPIA_COMMAND_GetColourParams ||
command == CPIA_COMMAND_GetColourBalance ||
command == CPIA_COMMAND_GetExposure)
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
} else {
switch(command) {
case CPIA_COMMAND_GetCPIAVersion:
@ -1726,13 +1726,13 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d)
cam->params.colourParams.brightness = data[0];
cam->params.colourParams.contrast = data[1];
cam->params.colourParams.saturation = data[2];
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
break;
case CPIA_COMMAND_GetColourBalance:
cam->params.colourBalance.redGain = data[0];
cam->params.colourBalance.greenGain = data[1];
cam->params.colourBalance.blueGain = data[2];
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
break;
case CPIA_COMMAND_GetExposure:
cam->params.exposure.gain = data[0];
@ -1743,7 +1743,7 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d)
cam->params.exposure.green1Comp = data[5];
cam->params.exposure.green2Comp = data[6];
cam->params.exposure.blueComp = data[7];
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
break;
case CPIA_COMMAND_ReadMCPorts:
@ -2059,7 +2059,7 @@ static int parse_picture(struct cam_data *cam, int size)
int rows, cols, linesize, subsample_422;
/* make sure params don't change while we are decoding */
down(&cam->param_lock);
mutex_lock(&cam->param_lock);
obuf = cam->decompressed_frame.data;
end_obuf = obuf+CPIA_MAX_FRAME_SIZE;
@ -2069,26 +2069,26 @@ static int parse_picture(struct cam_data *cam, int size)
if ((ibuf[0] != MAGIC_0) || (ibuf[1] != MAGIC_1)) {
LOG("header not found\n");
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
return -1;
}
if ((ibuf[16] != VIDEOSIZE_QCIF) && (ibuf[16] != VIDEOSIZE_CIF)) {
LOG("wrong video size\n");
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
return -1;
}
if (ibuf[17] != SUBSAMPLE_420 && ibuf[17] != SUBSAMPLE_422) {
LOG("illegal subtype %d\n",ibuf[17]);
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
return -1;
}
subsample_422 = ibuf[17] == SUBSAMPLE_422;
if (ibuf[18] != YUVORDER_YUYV && ibuf[18] != YUVORDER_UYVY) {
LOG("illegal yuvorder %d\n",ibuf[18]);
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
return -1;
}
in_uyvy = ibuf[18] == YUVORDER_UYVY;
@ -2098,7 +2098,7 @@ static int parse_picture(struct cam_data *cam, int size)
(ibuf[26] != cam->params.roi.rowStart) ||
(ibuf[27] != cam->params.roi.rowEnd)) {
LOG("ROI mismatch\n");
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
return -1;
}
cols = 8*(ibuf[25] - ibuf[24]);
@ -2107,14 +2107,14 @@ static int parse_picture(struct cam_data *cam, int size)
if ((ibuf[28] != NOT_COMPRESSED) && (ibuf[28] != COMPRESSED)) {
LOG("illegal compression %d\n",ibuf[28]);
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
return -1;
}
compressed = (ibuf[28] == COMPRESSED);
if (ibuf[29] != NO_DECIMATION && ibuf[29] != DECIMATION_ENAB) {
LOG("illegal decimation %d\n",ibuf[29]);
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
return -1;
}
decimation = (ibuf[29] == DECIMATION_ENAB);
@ -2130,7 +2130,7 @@ static int parse_picture(struct cam_data *cam, int size)
cam->params.status.vpStatus = ibuf[38];
cam->params.status.errorCode = ibuf[39];
cam->fps = ibuf[41];
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
linesize = skipcount(cols, out_fmt);
ibuf += FRAME_HEADER_SIZE;
@ -2271,9 +2271,9 @@ static int find_over_exposure(int brightness)
/* update various camera modes and settings */
static void dispatch_commands(struct cam_data *cam)
{
down(&cam->param_lock);
mutex_lock(&cam->param_lock);
if (cam->cmd_queue==COMMAND_NONE) {
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
return;
}
DEB_BYTE(cam->cmd_queue);
@ -2415,7 +2415,7 @@ static void dispatch_commands(struct cam_data *cam)
}
cam->cmd_queue = COMMAND_NONE;
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
return;
}
@ -2562,7 +2562,7 @@ static void monitor_exposure(struct cam_data *cam)
gain = data[2];
coarseL = data[3];
down(&cam->param_lock);
mutex_lock(&cam->param_lock);
light_exp = cam->params.colourParams.brightness +
TC - 50 + EXP_ACC_LIGHT;
if(light_exp > 255)
@ -2762,7 +2762,7 @@ static void monitor_exposure(struct cam_data *cam)
LOG("Automatically increasing sensor_fps\n");
}
}
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
}
/*-----------------------------------------------------------------*/
@ -2778,10 +2778,10 @@ static void restart_flicker(struct cam_data *cam)
int cam_exposure, old_exp;
if(!FIRMWARE_VERSION(1,2))
return;
down(&cam->param_lock);
mutex_lock(&cam->param_lock);
if(cam->params.flickerControl.flickerMode == 0 ||
cam->raw_image[39] == 0) {
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
return;
}
cam_exposure = cam->raw_image[39]*2;
@ -2810,7 +2810,7 @@ static void restart_flicker(struct cam_data *cam)
cam->exposure_status = EXPOSURE_NORMAL;
}
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
}
#undef FIRMWARE_VERSION
@ -3186,7 +3186,7 @@ static int cpia_open(struct inode *inode, struct file *file)
if (!try_module_get(cam->ops->owner))
return -ENODEV;
down(&cam->busy_lock);
mutex_lock(&cam->busy_lock);
err = -ENOMEM;
if (!cam->raw_image) {
cam->raw_image = rvmalloc(CPIA_MAX_IMAGE_SIZE);
@ -3227,7 +3227,7 @@ static int cpia_open(struct inode *inode, struct file *file)
++cam->open_count;
file->private_data = dev;
up(&cam->busy_lock);
mutex_unlock(&cam->busy_lock);
return 0;
oops:
@ -3239,7 +3239,7 @@ static int cpia_open(struct inode *inode, struct file *file)
rvfree(cam->raw_image, CPIA_MAX_IMAGE_SIZE);
cam->raw_image = NULL;
}
up(&cam->busy_lock);
mutex_unlock(&cam->busy_lock);
put_cam(cam->ops);
return err;
}
@ -3303,24 +3303,24 @@ static ssize_t cpia_read(struct file *file, char __user *buf,
int err;
/* make this _really_ smp and multithread-safe */
if (down_interruptible(&cam->busy_lock))
if (mutex_lock_interruptible(&cam->busy_lock))
return -EINTR;
if (!buf) {
DBG("buf NULL\n");
up(&cam->busy_lock);
mutex_unlock(&cam->busy_lock);
return -EINVAL;
}
if (!count) {
DBG("count 0\n");
up(&cam->busy_lock);
mutex_unlock(&cam->busy_lock);
return 0;
}
if (!cam->ops) {
DBG("ops NULL\n");
up(&cam->busy_lock);
mutex_unlock(&cam->busy_lock);
return -ENODEV;
}
@ -3329,7 +3329,7 @@ static ssize_t cpia_read(struct file *file, char __user *buf,
cam->mmap_kludge=0;
if((err = fetch_frame(cam)) != 0) {
DBG("ERROR from fetch_frame: %d\n", err);
up(&cam->busy_lock);
mutex_unlock(&cam->busy_lock);
return err;
}
cam->decompressed_frame.state = FRAME_UNUSED;
@ -3338,17 +3338,17 @@ static ssize_t cpia_read(struct file *file, char __user *buf,
if (cam->decompressed_frame.count > count) {
DBG("count wrong: %d, %lu\n", cam->decompressed_frame.count,
(unsigned long) count);
up(&cam->busy_lock);
mutex_unlock(&cam->busy_lock);
return -EFAULT;
}
if (copy_to_user(buf, cam->decompressed_frame.data,
cam->decompressed_frame.count)) {
DBG("copy_to_user failed\n");
up(&cam->busy_lock);
mutex_unlock(&cam->busy_lock);
return -EFAULT;
}
up(&cam->busy_lock);
mutex_unlock(&cam->busy_lock);
return cam->decompressed_frame.count;
}
@ -3363,7 +3363,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
return -ENODEV;
/* make this _really_ smp-safe */
if (down_interruptible(&cam->busy_lock))
if (mutex_lock_interruptible(&cam->busy_lock))
return -EINTR;
//DBG("cpia_ioctl: %u\n", ioctlnr);
@ -3439,7 +3439,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
break;
}
down(&cam->param_lock);
mutex_lock(&cam->param_lock);
/* brightness, colour, contrast need no check 0-65535 */
cam->vp = *vp;
/* update cam->params.colourParams */
@ -3466,7 +3466,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
/* queue command to update camera */
cam->cmd_queue |= COMMAND_SETCOLOURPARAMS;
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
DBG("VIDIOCSPICT: %d / %d // %d / %d / %d / %d\n",
vp->depth, vp->palette, vp->brightness, vp->hue, vp->colour,
vp->contrast);
@ -3501,13 +3501,13 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
/* we set the video window to something smaller or equal to what
* is requested by the user???
*/
down(&cam->param_lock);
mutex_lock(&cam->param_lock);
if (vw->width != cam->vw.width || vw->height != cam->vw.height) {
int video_size = match_videosize(vw->width, vw->height);
if (video_size < 0) {
retval = -EINVAL;
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
break;
}
cam->video_size = video_size;
@ -3520,7 +3520,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
cam->cmd_queue |= COMMAND_SETFORMAT;
}
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
/* setformat ignored by camera during streaming,
* so stop/dispatch/start */
@ -3682,7 +3682,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
DBG("%d,%d/%dx%d\n", vc->x,vc->y,vc->width, vc->height);
down(&cam->param_lock);
mutex_lock(&cam->param_lock);
cam->vc.x = vc->x;
cam->vc.y = vc->y;
@ -3692,7 +3692,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
set_vw_size(cam);
cam->cmd_queue |= COMMAND_SETFORMAT;
up(&cam->param_lock);
mutex_unlock(&cam->param_lock);
/* setformat ignored by camera during streaming,
* so stop/dispatch/start */
@ -3736,7 +3736,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
break;
}
up(&cam->busy_lock);
mutex_unlock(&cam->busy_lock);
return retval;
}
@ -3769,12 +3769,12 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma)
return -ENODEV;
/* make this _really_ smp-safe */
if (down_interruptible(&cam->busy_lock))
if (mutex_lock_interruptible(&cam->busy_lock))
return -EINTR;
if (!cam->frame_buf) { /* we do lazy allocation */
if ((retval = allocate_frame_buf(cam))) {
up(&cam->busy_lock);
mutex_unlock(&cam->busy_lock);
return retval;
}
}
@ -3783,7 +3783,7 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma)
while (size > 0) {
page = vmalloc_to_pfn((void *)pos);
if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) {
up(&cam->busy_lock);
mutex_unlock(&cam->busy_lock);
return -EAGAIN;
}
start += PAGE_SIZE;
@ -3795,7 +3795,7 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma)
}
DBG("cpia_mmap: %ld\n", size);
up(&cam->busy_lock);
mutex_unlock(&cam->busy_lock);
return 0;
}
@ -3936,8 +3936,8 @@ static void init_camera_struct(struct cam_data *cam,
memset(cam, 0, sizeof(struct cam_data));
cam->ops = ops;
init_MUTEX(&cam->param_lock);
init_MUTEX(&cam->busy_lock);
mutex_init(&cam->param_lock);
mutex_init(&cam->busy_lock);
reset_camera_struct(cam);

View File

@ -47,6 +47,7 @@
#include <linux/videodev.h>
#include <linux/list.h>
#include <linux/smp_lock.h>
#include <linux/mutex.h>
struct cpia_camera_ops
{
@ -246,7 +247,7 @@ enum v4l_camstates {
struct cam_data {
struct list_head cam_data_list;
struct semaphore busy_lock; /* guard against SMP multithreading */
struct mutex busy_lock; /* guard against SMP multithreading */
struct cpia_camera_ops *ops; /* lowlevel driver operations */
void *lowlevel_data; /* private data for lowlevel driver */
u8 *raw_image; /* buffer for raw image data */
@ -261,7 +262,7 @@ struct cam_data {
u8 mainsFreq; /* for flicker control */
/* proc interface */
struct semaphore param_lock; /* params lock for this camera */
struct mutex param_lock; /* params lock for this camera */
struct cam_params params; /* camera settings */
struct proc_dir_entry *proc_entry; /* /proc/cpia/videoX */

View File

@ -0,0 +1,9 @@
config VIDEO_CPIA2
tristate "CPiA2 Video For Linux"
depends on VIDEO_DEV && USB
---help---
This is the video4linux driver for cameras based on Vision's CPiA2
(Colour Processor Interface ASIC), such as the Digital Blue QX5
Microscope. If you have one of these cameras, say Y here
This driver is also available as a module (cpia2).

View File

@ -0,0 +1,3 @@
cpia2-objs := cpia2_v4l.o cpia2_usb.o cpia2_core.o
obj-$(CONFIG_VIDEO_CPIA2) += cpia2.o

View File

@ -0,0 +1,497 @@
/****************************************************************************
*
* Filename: cpia2.h
*
* Copyright 2001, STMicrolectronics, Inc.
*
* Contact: steve.miller@st.com
*
* Description:
* This is a USB driver for CPiA2 based video cameras.
*
* This driver is modelled on the cpia usb driver by
* Jochen Scharrlach and Johannes Erdfeldt.
*
* 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.
*
****************************************************************************/
#ifndef __CPIA2_H__
#define __CPIA2_H__
#include <linux/version.h>
#include <linux/videodev.h>
#include <linux/usb.h>
#include <linux/poll.h>
#include "cpia2dev.h"
#include "cpia2_registers.h"
/* define for verbose debug output */
//#define _CPIA2_DEBUG_
#define CPIA2_MAJ_VER 2
#define CPIA2_MIN_VER 0
#define CPIA2_PATCH_VER 0
/***
* Image defines
***/
#ifndef true
#define true 1
#define false 0
#endif
/* Misc constants */
#define ALLOW_CORRUPT 0 /* Causes collater to discard checksum */
/* USB Transfer mode */
#define XFER_ISOC 0
#define XFER_BULK 1
/* USB Alternates */
#define USBIF_CMDONLY 0
#define USBIF_BULK 1
#define USBIF_ISO_1 2 /* 128 bytes/ms */
#define USBIF_ISO_2 3 /* 384 bytes/ms */
#define USBIF_ISO_3 4 /* 640 bytes/ms */
#define USBIF_ISO_4 5 /* 768 bytes/ms */
#define USBIF_ISO_5 6 /* 896 bytes/ms */
#define USBIF_ISO_6 7 /* 1023 bytes/ms */
/* Flicker Modes */
#define NEVER_FLICKER 0
#define ANTI_FLICKER_ON 1
#define FLICKER_60 60
#define FLICKER_50 50
/* Debug flags */
#define DEBUG_NONE 0
#define DEBUG_REG 0x00000001
#define DEBUG_DUMP_PATCH 0x00000002
#define DEBUG_DUMP_REGS 0x00000004
/***
* Video frame sizes
***/
enum {
VIDEOSIZE_VGA = 0, /* 640x480 */
VIDEOSIZE_CIF, /* 352x288 */
VIDEOSIZE_QVGA, /* 320x240 */
VIDEOSIZE_QCIF, /* 176x144 */
VIDEOSIZE_288_216,
VIDEOSIZE_256_192,
VIDEOSIZE_224_168,
VIDEOSIZE_192_144,
};
#define STV_IMAGE_CIF_ROWS 288
#define STV_IMAGE_CIF_COLS 352
#define STV_IMAGE_QCIF_ROWS 144
#define STV_IMAGE_QCIF_COLS 176
#define STV_IMAGE_VGA_ROWS 480
#define STV_IMAGE_VGA_COLS 640
#define STV_IMAGE_QVGA_ROWS 240
#define STV_IMAGE_QVGA_COLS 320
#define JPEG_MARKER_COM (1<<6) /* Comment segment */
/***
* Enums
***/
/* Sensor types available with cpia2 asics */
enum sensors {
CPIA2_SENSOR_410,
CPIA2_SENSOR_500
};
/* Asic types available in the CPiA2 architecture */
#define CPIA2_ASIC_672 0x67
/* Device types (stv672, stv676, etc) */
#define DEVICE_STV_672 0x0001
#define DEVICE_STV_676 0x0002
enum frame_status {
FRAME_EMPTY,
FRAME_READING, /* In the process of being grabbed into */
FRAME_READY, /* Ready to be read */
FRAME_ERROR,
};
/***
* Register access (for USB request byte)
***/
enum {
CAMERAACCESS_SYSTEM = 0,
CAMERAACCESS_VC,
CAMERAACCESS_VP,
CAMERAACCESS_IDATA
};
#define CAMERAACCESS_TYPE_BLOCK 0x00
#define CAMERAACCESS_TYPE_RANDOM 0x04
#define CAMERAACCESS_TYPE_MASK 0x08
#define CAMERAACCESS_TYPE_REPEAT 0x0C
#define TRANSFER_READ 0
#define TRANSFER_WRITE 1
#define DEFAULT_ALT USBIF_ISO_6
#define DEFAULT_BRIGHTNESS 0x46
#define DEFAULT_CONTRAST 0x93
#define DEFAULT_SATURATION 0x7f
#define DEFAULT_TARGET_KB 0x30
/* Power state */
#define HI_POWER_MODE CPIA2_SYSTEM_CONTROL_HIGH_POWER
#define LO_POWER_MODE CPIA2_SYSTEM_CONTROL_LOW_POWER
/********
* Commands
*******/
enum {
CPIA2_CMD_NONE = 0,
CPIA2_CMD_GET_VERSION,
CPIA2_CMD_GET_PNP_ID,
CPIA2_CMD_GET_ASIC_TYPE,
CPIA2_CMD_GET_SENSOR,
CPIA2_CMD_GET_VP_DEVICE,
CPIA2_CMD_GET_VP_BRIGHTNESS,
CPIA2_CMD_SET_VP_BRIGHTNESS,
CPIA2_CMD_GET_CONTRAST,
CPIA2_CMD_SET_CONTRAST,
CPIA2_CMD_GET_VP_SATURATION,
CPIA2_CMD_SET_VP_SATURATION,
CPIA2_CMD_GET_VP_GPIO_DIRECTION,
CPIA2_CMD_SET_VP_GPIO_DIRECTION,
CPIA2_CMD_GET_VP_GPIO_DATA,
CPIA2_CMD_SET_VP_GPIO_DATA,
CPIA2_CMD_GET_VC_MP_GPIO_DIRECTION,
CPIA2_CMD_SET_VC_MP_GPIO_DIRECTION,
CPIA2_CMD_GET_VC_MP_GPIO_DATA,
CPIA2_CMD_SET_VC_MP_GPIO_DATA,
CPIA2_CMD_ENABLE_PACKET_CTRL,
CPIA2_CMD_GET_FLICKER_MODES,
CPIA2_CMD_SET_FLICKER_MODES,
CPIA2_CMD_RESET_FIFO, /* clear fifo and enable stream block */
CPIA2_CMD_SET_HI_POWER,
CPIA2_CMD_SET_LOW_POWER,
CPIA2_CMD_CLEAR_V2W_ERR,
CPIA2_CMD_SET_USER_MODE,
CPIA2_CMD_GET_USER_MODE,
CPIA2_CMD_FRAMERATE_REQ,
CPIA2_CMD_SET_COMPRESSION_STATE,
CPIA2_CMD_GET_WAKEUP,
CPIA2_CMD_SET_WAKEUP,
CPIA2_CMD_GET_PW_CONTROL,
CPIA2_CMD_SET_PW_CONTROL,
CPIA2_CMD_GET_SYSTEM_CTRL,
CPIA2_CMD_SET_SYSTEM_CTRL,
CPIA2_CMD_GET_VP_SYSTEM_STATE,
CPIA2_CMD_GET_VP_SYSTEM_CTRL,
CPIA2_CMD_SET_VP_SYSTEM_CTRL,
CPIA2_CMD_GET_VP_EXP_MODES,
CPIA2_CMD_SET_VP_EXP_MODES,
CPIA2_CMD_GET_DEVICE_CONFIG,
CPIA2_CMD_SET_DEVICE_CONFIG,
CPIA2_CMD_SET_SERIAL_ADDR,
CPIA2_CMD_SET_SENSOR_CR1,
CPIA2_CMD_GET_VC_CONTROL,
CPIA2_CMD_SET_VC_CONTROL,
CPIA2_CMD_SET_TARGET_KB,
CPIA2_CMD_SET_DEF_JPEG_OPT,
CPIA2_CMD_REHASH_VP4,
CPIA2_CMD_GET_USER_EFFECTS,
CPIA2_CMD_SET_USER_EFFECTS
};
enum user_cmd {
COMMAND_NONE = 0x00000001,
COMMAND_SET_FPS = 0x00000002,
COMMAND_SET_COLOR_PARAMS = 0x00000004,
COMMAND_GET_COLOR_PARAMS = 0x00000008,
COMMAND_SET_FORMAT = 0x00000010, /* size, etc */
COMMAND_SET_FLICKER = 0x00000020
};
/***
* Some defines specific to the 676 chip
***/
#define CAMACC_CIF 0x01
#define CAMACC_VGA 0x02
#define CAMACC_QCIF 0x04
#define CAMACC_QVGA 0x08
struct cpia2_register {
u8 index;
u8 value;
};
struct cpia2_reg_mask {
u8 index;
u8 and_mask;
u8 or_mask;
u8 fill;
};
struct cpia2_command {
u32 command;
u8 req_mode; /* (Block or random) | registerBank */
u8 reg_count;
u8 direction;
u8 start;
union reg_types {
struct cpia2_register registers[32];
struct cpia2_reg_mask masks[16];
u8 block_data[64];
u8 *patch_data; /* points to function defined block */
} buffer;
};
struct camera_params {
struct {
u8 firmware_revision_hi; /* For system register set (bank 0) */
u8 firmware_revision_lo;
u8 asic_id; /* Video Compressor set (bank 1) */
u8 asic_rev;
u8 vp_device_hi; /* Video Processor set (bank 2) */
u8 vp_device_lo;
u8 sensor_flags;
u8 sensor_rev;
} version;
struct {
u32 device_type; /* enumerated from vendor/product ids.
* Currently, either STV_672 or STV_676 */
u16 vendor;
u16 product;
u16 device_revision;
} pnp_id;
struct {
u8 brightness; /* CPIA2_VP_EXPOSURE_TARGET */
u8 contrast; /* Note: this is CPIA2_VP_YRANGE */
u8 saturation; /* CPIA2_VP_SATURATION */
} color_params;
struct {
u8 cam_register;
u8 flicker_mode_req; /* 1 if flicker on, else never flicker */
int mains_frequency;
} flicker_control;
struct {
u8 jpeg_options;
u8 creep_period;
u8 user_squeeze;
u8 inhibit_htables;
} compression;
struct {
u8 ohsize; /* output image size */
u8 ovsize;
u8 hcrop; /* cropping start_pos/4 */
u8 vcrop;
u8 hphase; /* scaling registers */
u8 vphase;
u8 hispan;
u8 vispan;
u8 hicrop;
u8 vicrop;
u8 hifraction;
u8 vifraction;
} image_size;
struct {
int width; /* actual window width */
int height; /* actual window height */
} roi;
struct {
u8 video_mode;
u8 frame_rate;
u8 video_size; /* Not a register, just a convenience for cropped sizes */
u8 gpio_direction;
u8 gpio_data;
u8 system_ctrl;
u8 system_state;
u8 lowlight_boost; /* Bool: 0 = off, 1 = on */
u8 device_config;
u8 exposure_modes;
u8 user_effects;
} vp_params;
struct {
u8 pw_control;
u8 wakeup;
u8 vc_control;
u8 vc_mp_direction;
u8 vc_mp_data;
u8 target_kb;
} vc_params;
struct {
u8 power_mode;
u8 system_ctrl;
u8 stream_mode; /* This is the current alternate for usb drivers */
u8 allow_corrupt;
} camera_state;
};
#define NUM_SBUF 2
struct cpia2_sbuf {
char *data;
struct urb *urb;
};
struct framebuf {
struct timeval timestamp;
unsigned long seq;
int num;
int length;
int max_length;
volatile enum frame_status status;
u8 *data;
struct framebuf *next;
};
struct cpia2_fh {
enum v4l2_priority prio;
u8 mmapped;
};
struct camera_data {
/* locks */
struct semaphore busy_lock; /* guard against SMP multithreading */
struct v4l2_prio_state prio;
/* camera status */
volatile int present; /* Is the camera still present? */
int open_count; /* # of process that have camera open */
int first_image_seen;
u8 mains_freq; /* for flicker control */
enum sensors sensor_type;
u8 flush;
u8 mmapped;
int streaming; /* 0 = no, 1 = yes */
int xfer_mode; /* XFER_BULK or XFER_ISOC */
struct camera_params params; /* camera settings */
/* v4l */
int video_size; /* VIDEO_SIZE_ */
struct video_device *vdev; /* v4l videodev */
struct video_picture vp; /* v4l camera settings */
struct video_window vw; /* v4l capture area */
__u32 pixelformat; /* Format fourcc */
/* USB */
struct usb_device *dev;
unsigned char iface;
unsigned int cur_alt;
unsigned int old_alt;
struct cpia2_sbuf sbuf[NUM_SBUF]; /* Double buffering */
wait_queue_head_t wq_stream;
/* Buffering */
u32 frame_size;
int num_frames;
unsigned long frame_count;
u8 *frame_buffer; /* frame buffer data */
struct framebuf *buffers;
struct framebuf * volatile curbuff;
struct framebuf *workbuff;
/* MJPEG Extension */
int APPn; /* Number of APP segment to be written, must be 0..15 */
int APP_len; /* Length of data in JPEG APPn segment */
char APP_data[60]; /* Data in the JPEG APPn segment. */
int COM_len; /* Length of data in JPEG COM segment */
char COM_data[60]; /* Data in JPEG COM segment */
};
/* v4l */
int cpia2_register_camera(struct camera_data *cam);
void cpia2_unregister_camera(struct camera_data *cam);
/* core */
int cpia2_reset_camera(struct camera_data *cam);
int cpia2_set_low_power(struct camera_data *cam);
void cpia2_dbg_dump_registers(struct camera_data *cam);
int cpia2_match_video_size(int width, int height);
void cpia2_set_camera_state(struct camera_data *cam);
void cpia2_save_camera_state(struct camera_data *cam);
void cpia2_set_color_params(struct camera_data *cam);
void cpia2_set_brightness(struct camera_data *cam, unsigned char value);
void cpia2_set_contrast(struct camera_data *cam, unsigned char value);
void cpia2_set_saturation(struct camera_data *cam, unsigned char value);
int cpia2_set_flicker_mode(struct camera_data *cam, int mode);
void cpia2_set_format(struct camera_data *cam);
int cpia2_send_command(struct camera_data *cam, struct cpia2_command *cmd);
int cpia2_do_command(struct camera_data *cam,
unsigned int command,
unsigned char direction, unsigned char param);
struct camera_data *cpia2_init_camera_struct(void);
int cpia2_init_camera(struct camera_data *cam);
int cpia2_allocate_buffers(struct camera_data *cam);
void cpia2_free_buffers(struct camera_data *cam);
long cpia2_read(struct camera_data *cam,
char *buf, unsigned long count, int noblock);
unsigned int cpia2_poll(struct camera_data *cam,
struct file *filp, poll_table *wait);
int cpia2_remap_buffer(struct camera_data *cam, struct vm_area_struct *vma);
void cpia2_set_property_flip(struct camera_data *cam, int prop_val);
void cpia2_set_property_mirror(struct camera_data *cam, int prop_val);
int cpia2_set_target_kb(struct camera_data *cam, unsigned char value);
int cpia2_set_gpio(struct camera_data *cam, unsigned char setting);
int cpia2_set_fps(struct camera_data *cam, int framerate);
/* usb */
int cpia2_usb_init(void);
void cpia2_usb_cleanup(void);
int cpia2_usb_transfer_cmd(struct camera_data *cam, void *registers,
u8 request, u8 start, u8 count, u8 direction);
int cpia2_usb_stream_start(struct camera_data *cam, unsigned int alternate);
int cpia2_usb_stream_stop(struct camera_data *cam);
int cpia2_usb_stream_pause(struct camera_data *cam);
int cpia2_usb_stream_resume(struct camera_data *cam);
int cpia2_usb_change_streaming_alternate(struct camera_data *cam,
unsigned int alt);
/* ----------------------- debug functions ---------------------- */
#ifdef _CPIA2_DEBUG_
#define ALOG(lev, fmt, args...) printk(lev "%s:%d %s(): " fmt, __FILE__, __LINE__, __func__, ## args)
#define LOG(fmt, args...) ALOG(KERN_INFO, fmt, ## args)
#define ERR(fmt, args...) ALOG(KERN_ERR, fmt, ## args)
#define DBG(fmt, args...) ALOG(KERN_DEBUG, fmt, ## args)
#else
#define ALOG(fmt,args...) printk(fmt,##args)
#define LOG(fmt,args...) ALOG(KERN_INFO "cpia2: "fmt,##args)
#define ERR(fmt,args...) ALOG(KERN_ERR "cpia2: "fmt,##args)
#define DBG(fmn,args...) do {} while(0)
#endif
/* No function or lineno, for shorter lines */
#define KINFO(fmt, args...) printk(KERN_INFO fmt,##args)
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,476 @@
/****************************************************************************
*
* Filename: cpia2registers.h
*
* Copyright 2001, STMicrolectronics, Inc.
*
* Description:
* Definitions for the CPia2 register set
*
* 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.
*
****************************************************************************/
#ifndef CPIA2_REGISTER_HEADER
#define CPIA2_REGISTER_HEADER
/***
* System register set (Bank 0)
***/
#define CPIA2_SYSTEM_DEVICE_HI 0x00
#define CPIA2_SYSTEM_DEVICE_LO 0x01
#define CPIA2_SYSTEM_SYSTEM_CONTROL 0x02
#define CPIA2_SYSTEM_CONTROL_LOW_POWER 0x00
#define CPIA2_SYSTEM_CONTROL_HIGH_POWER 0x01
#define CPIA2_SYSTEM_CONTROL_SUSPEND 0x02
#define CPIA2_SYSTEM_CONTROL_V2W_ERR 0x10
#define CPIA2_SYSTEM_CONTROL_RB_ERR 0x10
#define CPIA2_SYSTEM_CONTROL_CLEAR_ERR 0x80
#define CPIA2_SYSTEM_INT_PACKET_CTRL 0x04
#define CPIA2_SYSTEM_INT_PACKET_CTRL_ENABLE_SW_XX 0x01
#define CPIA2_SYSTEM_INT_PACKET_CTRL_ENABLE_EOF 0x02
#define CPIA2_SYSTEM_INT_PACKET_CTRL_ENABLE_INT1 0x04
#define CPIA2_SYSTEM_CACHE_CTRL 0x05
#define CPIA2_SYSTEM_CACHE_CTRL_CACHE_RESET 0x01
#define CPIA2_SYSTEM_CACHE_CTRL_CACHE_FLUSH 0x02
#define CPIA2_SYSTEM_SERIAL_CTRL 0x06
#define CPIA2_SYSTEM_SERIAL_CTRL_NULL_CMD 0x00
#define CPIA2_SYSTEM_SERIAL_CTRL_START_CMD 0x01
#define CPIA2_SYSTEM_SERIAL_CTRL_STOP_CMD 0x02
#define CPIA2_SYSTEM_SERIAL_CTRL_WRITE_CMD 0x03
#define CPIA2_SYSTEM_SERIAL_CTRL_READ_ACK_CMD 0x04
#define CPIA2_SYSTEM_SERIAL_CTRL_READ_NACK_CMD 0x05
#define CPIA2_SYSTEM_SERIAL_DATA 0x07
#define CPIA2_SYSTEM_VP_SERIAL_ADDR 0x08
/***
* I2C addresses for various devices in CPiA2
***/
#define CPIA2_SYSTEM_VP_SERIAL_ADDR_SENSOR 0x20
#define CPIA2_SYSTEM_VP_SERIAL_ADDR_VP 0x88
#define CPIA2_SYSTEM_VP_SERIAL_ADDR_676_VP 0x8A
#define CPIA2_SYSTEM_SPARE_REG1 0x09
#define CPIA2_SYSTEM_SPARE_REG2 0x0A
#define CPIA2_SYSTEM_SPARE_REG3 0x0B
#define CPIA2_SYSTEM_MC_PORT_0 0x0C
#define CPIA2_SYSTEM_MC_PORT_1 0x0D
#define CPIA2_SYSTEM_MC_PORT_2 0x0E
#define CPIA2_SYSTEM_MC_PORT_3 0x0F
#define CPIA2_SYSTEM_STATUS_PKT 0x20
#define CPIA2_SYSTEM_STATUS_PKT_END 0x27
#define CPIA2_SYSTEM_DESCRIP_VID_HI 0x30
#define CPIA2_SYSTEM_DESCRIP_VID_LO 0x31
#define CPIA2_SYSTEM_DESCRIP_PID_HI 0x32
#define CPIA2_SYSTEM_DESCRIP_PID_LO 0x33
#define CPIA2_SYSTEM_FW_VERSION_HI 0x34
#define CPIA2_SYSTEM_FW_VERSION_LO 0x35
#define CPIA2_SYSTEM_CACHE_START_INDEX 0x80
#define CPIA2_SYSTEM_CACHE_MAX_WRITES 0x10
/***
* VC register set (Bank 1)
***/
#define CPIA2_VC_ASIC_ID 0x80
#define CPIA2_VC_ASIC_REV 0x81
#define CPIA2_VC_PW_CTRL 0x82
#define CPIA2_VC_PW_CTRL_COLDSTART 0x01
#define CPIA2_VC_PW_CTRL_CP_CLK_EN 0x02
#define CPIA2_VC_PW_CTRL_VP_RESET_N 0x04
#define CPIA2_VC_PW_CTRL_VC_CLK_EN 0x08
#define CPIA2_VC_PW_CTRL_VC_RESET_N 0x10
#define CPIA2_VC_PW_CTRL_GOTO_SUSPEND 0x20
#define CPIA2_VC_PW_CTRL_UDC_SUSPEND 0x40
#define CPIA2_VC_PW_CTRL_PWR_DOWN 0x80
#define CPIA2_VC_WAKEUP 0x83
#define CPIA2_VC_WAKEUP_SW_ENABLE 0x01
#define CPIA2_VC_WAKEUP_XX_ENABLE 0x02
#define CPIA2_VC_WAKEUP_SW_ATWAKEUP 0x04
#define CPIA2_VC_WAKEUP_XX_ATWAKEUP 0x08
#define CPIA2_VC_CLOCK_CTRL 0x84
#define CPIA2_VC_CLOCK_CTRL_TESTUP72 0x01
#define CPIA2_VC_INT_ENABLE 0x88
#define CPIA2_VC_INT_ENABLE_XX_IE 0x01
#define CPIA2_VC_INT_ENABLE_SW_IE 0x02
#define CPIA2_VC_INT_ENABLE_VC_IE 0x04
#define CPIA2_VC_INT_ENABLE_USBDATA_IE 0x08
#define CPIA2_VC_INT_ENABLE_USBSETUP_IE 0x10
#define CPIA2_VC_INT_ENABLE_USBCFG_IE 0x20
#define CPIA2_VC_INT_FLAG 0x89
#define CPIA2_VC_INT_ENABLE_XX_FLAG 0x01
#define CPIA2_VC_INT_ENABLE_SW_FLAG 0x02
#define CPIA2_VC_INT_ENABLE_VC_FLAG 0x04
#define CPIA2_VC_INT_ENABLE_USBDATA_FLAG 0x08
#define CPIA2_VC_INT_ENABLE_USBSETUP_FLAG 0x10
#define CPIA2_VC_INT_ENABLE_USBCFG_FLAG 0x20
#define CPIA2_VC_INT_ENABLE_SET_RESET_BIT 0x80
#define CPIA2_VC_INT_STATE 0x8A
#define CPIA2_VC_INT_STATE_XX_STATE 0x01
#define CPIA2_VC_INT_STATE_SW_STATE 0x02
#define CPIA2_VC_MP_DIR 0x90
#define CPIA2_VC_MP_DIR_INPUT 0x00
#define CPIA2_VC_MP_DIR_OUTPUT 0x01
#define CPIA2_VC_MP_DATA 0x91
#define CPIA2_VC_DP_CTRL 0x98
#define CPIA2_VC_DP_CTRL_MODE_0 0x00
#define CPIA2_VC_DP_CTRL_MODE_A 0x01
#define CPIA2_VC_DP_CTRL_MODE_B 0x02
#define CPIA2_VC_DP_CTRL_MODE_C 0x03
#define CPIA2_VC_DP_CTRL_FAKE_FST 0x04
#define CPIA2_VC_AD_CTRL 0x99
#define CPIA2_VC_AD_CTRL_SRC_0 0x00
#define CPIA2_VC_AD_CTRL_SRC_DIGI_A 0x01
#define CPIA2_VC_AD_CTRL_SRC_REG 0x02
#define CPIA2_VC_AD_CTRL_DST_USB 0x00
#define CPIA2_VC_AD_CTRL_DST_REG 0x04
#define CPIA2_VC_AD_TEST_IN 0x9B
#define CPIA2_VC_AD_TEST_OUT 0x9C
#define CPIA2_VC_AD_STATUS 0x9D
#define CPIA2_VC_AD_STATUS_EMPTY 0x01
#define CPIA2_VC_AD_STATUS_FULL 0x02
#define CPIA2_VC_DP_DATA 0x9E
#define CPIA2_VC_ST_CTRL 0xA0
#define CPIA2_VC_ST_CTRL_SRC_VC 0x00
#define CPIA2_VC_ST_CTRL_SRC_DP 0x01
#define CPIA2_VC_ST_CTRL_SRC_REG 0x02
#define CPIA2_VC_ST_CTRL_RAW_SELECT 0x04
#define CPIA2_VC_ST_CTRL_DST_USB 0x00
#define CPIA2_VC_ST_CTRL_DST_DP 0x08
#define CPIA2_VC_ST_CTRL_DST_REG 0x10
#define CPIA2_VC_ST_CTRL_FIFO_ENABLE 0x20
#define CPIA2_VC_ST_CTRL_EOF_DETECT 0x40
#define CPIA2_VC_ST_TEST 0xA1
#define CPIA2_VC_ST_TEST_MODE_MANUAL 0x00
#define CPIA2_VC_ST_TEST_MODE_INCREMENT 0x02
#define CPIA2_VC_ST_TEST_AUTO_FILL 0x08
#define CPIA2_VC_ST_TEST_REPEAT_FIFO 0x10
#define CPIA2_VC_ST_TEST_IN 0xA2
#define CPIA2_VC_ST_TEST_OUT 0xA3
#define CPIA2_VC_ST_STATUS 0xA4
#define CPIA2_VC_ST_STATUS_EMPTY 0x01
#define CPIA2_VC_ST_STATUS_FULL 0x02
#define CPIA2_VC_ST_FRAME_DETECT_1 0xA5
#define CPIA2_VC_ST_FRAME_DETECT_2 0xA6
#define CPIA2_VC_USB_CTRL 0xA8
#define CPIA2_VC_USB_CTRL_CMD_STALLED 0x01
#define CPIA2_VC_USB_CTRL_CMD_READY 0x02
#define CPIA2_VC_USB_CTRL_CMD_STATUS 0x04
#define CPIA2_VC_USB_CTRL_CMD_STATUS_DIR 0x08
#define CPIA2_VC_USB_CTRL_CMD_NO_CLASH 0x10
#define CPIA2_VC_USB_CTRL_CMD_MICRO_ACCESS 0x80
#define CPIA2_VC_USB_STRM 0xA9
#define CPIA2_VC_USB_STRM_ISO_ENABLE 0x01
#define CPIA2_VC_USB_STRM_BLK_ENABLE 0x02
#define CPIA2_VC_USB_STRM_INT_ENABLE 0x04
#define CPIA2_VC_USB_STRM_AUD_ENABLE 0x08
#define CPIA2_VC_USB_STATUS 0xAA
#define CPIA2_VC_USB_STATUS_CMD_IN_PROGRESS 0x01
#define CPIA2_VC_USB_STATUS_CMD_STATUS_STALL 0x02
#define CPIA2_VC_USB_STATUS_CMD_HANDSHAKE 0x04
#define CPIA2_VC_USB_STATUS_CMD_OVERRIDE 0x08
#define CPIA2_VC_USB_STATUS_CMD_FIFO_BUSY 0x10
#define CPIA2_VC_USB_STATUS_BULK_REPEAT_TXN 0x20
#define CPIA2_VC_USB_STATUS_CONFIG_DONE 0x40
#define CPIA2_VC_USB_STATUS_USB_SUSPEND 0x80
#define CPIA2_VC_USB_CMDW 0xAB
#define CPIA2_VC_USB_DATARW 0xAC
#define CPIA2_VC_USB_INFO 0xAD
#define CPIA2_VC_USB_CONFIG 0xAE
#define CPIA2_VC_USB_SETTINGS 0xAF
#define CPIA2_VC_USB_SETTINGS_CONFIG_MASK 0x03
#define CPIA2_VC_USB_SETTINGS_INTERFACE_MASK 0x0C
#define CPIA2_VC_USB_SETTINGS_ALTERNATE_MASK 0x70
#define CPIA2_VC_USB_ISOLIM 0xB0
#define CPIA2_VC_USB_ISOFAILS 0xB1
#define CPIA2_VC_USB_ISOMAXPKTHI 0xB2
#define CPIA2_VC_USB_ISOMAXPKTLO 0xB3
#define CPIA2_VC_V2W_CTRL 0xB8
#define CPIA2_VC_V2W_SELECT 0x01
#define CPIA2_VC_V2W_SCL 0xB9
#define CPIA2_VC_V2W_SDA 0xBA
#define CPIA2_VC_VC_CTRL 0xC0
#define CPIA2_VC_VC_CTRL_RUN 0x01
#define CPIA2_VC_VC_CTRL_SINGLESHOT 0x02
#define CPIA2_VC_VC_CTRL_IDLING 0x04
#define CPIA2_VC_VC_CTRL_INHIBIT_H_TABLES 0x10
#define CPIA2_VC_VC_CTRL_INHIBIT_Q_TABLES 0x20
#define CPIA2_VC_VC_CTRL_INHIBIT_PRIVATE 0x40
#define CPIA2_VC_VC_RESTART_IVAL_HI 0xC1
#define CPIA2_VC_VC_RESTART_IVAL_LO 0xC2
#define CPIA2_VC_VC_FORMAT 0xC3
#define CPIA2_VC_VC_FORMAT_UFIRST 0x01
#define CPIA2_VC_VC_FORMAT_MONO 0x02
#define CPIA2_VC_VC_FORMAT_DECIMATING 0x04
#define CPIA2_VC_VC_FORMAT_SHORTLINE 0x08
#define CPIA2_VC_VC_FORMAT_SELFTEST 0x10
#define CPIA2_VC_VC_CLOCKS 0xC4
#define CPIA2_VC_VC_CLOCKS_CLKDIV_MASK 0x03
#define CPIA2_VC_VC_672_CLOCKS_CIF_DIV_BY_3 0x04
#define CPIA2_VC_VC_672_CLOCKS_SCALING 0x08
#define CPIA2_VC_VC_CLOCKS_LOGDIV0 0x00
#define CPIA2_VC_VC_CLOCKS_LOGDIV1 0x01
#define CPIA2_VC_VC_CLOCKS_LOGDIV2 0x02
#define CPIA2_VC_VC_CLOCKS_LOGDIV3 0x03
#define CPIA2_VC_VC_676_CLOCKS_CIF_DIV_BY_3 0x08
#define CPIA2_VC_VC_676_CLOCKS_SCALING 0x10
#define CPIA2_VC_VC_IHSIZE_LO 0xC5
#define CPIA2_VC_VC_XLIM_HI 0xC6
#define CPIA2_VC_VC_XLIM_LO 0xC7
#define CPIA2_VC_VC_YLIM_HI 0xC8
#define CPIA2_VC_VC_YLIM_LO 0xC9
#define CPIA2_VC_VC_OHSIZE 0xCA
#define CPIA2_VC_VC_OVSIZE 0xCB
#define CPIA2_VC_VC_HCROP 0xCC
#define CPIA2_VC_VC_VCROP 0xCD
#define CPIA2_VC_VC_HPHASE 0xCE
#define CPIA2_VC_VC_VPHASE 0xCF
#define CPIA2_VC_VC_HISPAN 0xD0
#define CPIA2_VC_VC_VISPAN 0xD1
#define CPIA2_VC_VC_HICROP 0xD2
#define CPIA2_VC_VC_VICROP 0xD3
#define CPIA2_VC_VC_HFRACT 0xD4
#define CPIA2_VC_VC_HFRACT_DEN_MASK 0x0F
#define CPIA2_VC_VC_HFRACT_NUM_MASK 0xF0
#define CPIA2_VC_VC_VFRACT 0xD5
#define CPIA2_VC_VC_VFRACT_DEN_MASK 0x0F
#define CPIA2_VC_VC_VFRACT_NUM_MASK 0xF0
#define CPIA2_VC_VC_JPEG_OPT 0xD6
#define CPIA2_VC_VC_JPEG_OPT_DOUBLE_SQUEEZE 0x01
#define CPIA2_VC_VC_JPEG_OPT_NO_DC_AUTO_SQUEEZE 0x02
#define CPIA2_VC_VC_JPEG_OPT_AUTO_SQUEEZE 0x04
#define CPIA2_VC_VC_JPEG_OPT_DEFAULT (CPIA2_VC_VC_JPEG_OPT_DOUBLE_SQUEEZE|\
CPIA2_VC_VC_JPEG_OPT_AUTO_SQUEEZE)
#define CPIA2_VC_VC_CREEP_PERIOD 0xD7
#define CPIA2_VC_VC_USER_SQUEEZE 0xD8
#define CPIA2_VC_VC_TARGET_KB 0xD9
#define CPIA2_VC_VC_AUTO_SQUEEZE 0xE6
/***
* VP register set (Bank 2)
***/
#define CPIA2_VP_DEVICEH 0
#define CPIA2_VP_DEVICEL 1
#define CPIA2_VP_SYSTEMSTATE 0x02
#define CPIA2_VP_SYSTEMSTATE_HK_ALIVE 0x01
#define CPIA2_VP_SYSTEMCTRL 0x03
#define CPIA2_VP_SYSTEMCTRL_REQ_CLEAR_ERROR 0x80
#define CPIA2_VP_SYSTEMCTRL_POWER_DOWN_PLL 0x20
#define CPIA2_VP_SYSTEMCTRL_REQ_SUSPEND_STATE 0x10
#define CPIA2_VP_SYSTEMCTRL_REQ_SERIAL_WAKEUP 0x08
#define CPIA2_VP_SYSTEMCTRL_REQ_AUTOLOAD 0x04
#define CPIA2_VP_SYSTEMCTRL_HK_CONTROL 0x02
#define CPIA2_VP_SYSTEMCTRL_POWER_CONTROL 0x01
#define CPIA2_VP_SENSOR_FLAGS 0x05
#define CPIA2_VP_SENSOR_FLAGS_404 0x01
#define CPIA2_VP_SENSOR_FLAGS_407 0x02
#define CPIA2_VP_SENSOR_FLAGS_409 0x04
#define CPIA2_VP_SENSOR_FLAGS_410 0x08
#define CPIA2_VP_SENSOR_FLAGS_500 0x10
#define CPIA2_VP_SENSOR_REV 0x06
#define CPIA2_VP_DEVICE_CONFIG 0x07
#define CPIA2_VP_DEVICE_CONFIG_SERIAL_BRIDGE 0x01
#define CPIA2_VP_GPIO_DIRECTION 0x08
#define CPIA2_VP_GPIO_READ 0xFF
#define CPIA2_VP_GPIO_WRITE 0x00
#define CPIA2_VP_GPIO_DATA 0x09
#define CPIA2_VP_RAM_ADDR_H 0x0A
#define CPIA2_VP_RAM_ADDR_L 0x0B
#define CPIA2_VP_RAM_DATA 0x0C
#define CPIA2_VP_PATCH_REV 0x0F
#define CPIA2_VP4_USER_MODE 0x10
#define CPIA2_VP5_USER_MODE 0x13
#define CPIA2_VP_USER_MODE_CIF 0x01
#define CPIA2_VP_USER_MODE_QCIFDS 0x02
#define CPIA2_VP_USER_MODE_QCIFPTC 0x04
#define CPIA2_VP_USER_MODE_QVGADS 0x08
#define CPIA2_VP_USER_MODE_QVGAPTC 0x10
#define CPIA2_VP_USER_MODE_VGA 0x20
#define CPIA2_VP4_FRAMERATE_REQUEST 0x11
#define CPIA2_VP5_FRAMERATE_REQUEST 0x14
#define CPIA2_VP_FRAMERATE_60 0x80
#define CPIA2_VP_FRAMERATE_50 0x40
#define CPIA2_VP_FRAMERATE_30 0x20
#define CPIA2_VP_FRAMERATE_25 0x10
#define CPIA2_VP_FRAMERATE_15 0x08
#define CPIA2_VP_FRAMERATE_12_5 0x04
#define CPIA2_VP_FRAMERATE_7_5 0x02
#define CPIA2_VP_FRAMERATE_6_25 0x01
#define CPIA2_VP4_USER_EFFECTS 0x12
#define CPIA2_VP5_USER_EFFECTS 0x15
#define CPIA2_VP_USER_EFFECTS_COLBARS 0x01
#define CPIA2_VP_USER_EFFECTS_COLBARS_GRAD 0x02
#define CPIA2_VP_USER_EFFECTS_MIRROR 0x04
#define CPIA2_VP_USER_EFFECTS_FLIP 0x40 // VP5 only
/* NOTE: CPIA2_VP_EXPOSURE_MODES shares the same register as VP5 User
* Effects */
#define CPIA2_VP_EXPOSURE_MODES 0x15
#define CPIA2_VP_EXPOSURE_MODES_INHIBIT_FLICKER 0x20
#define CPIA2_VP_EXPOSURE_MODES_COMPILE_EXP 0x10
#define CPIA2_VP4_EXPOSURE_TARGET 0x16 // VP4
#define CPIA2_VP5_EXPOSURE_TARGET 0x20 // VP5
#define CPIA2_VP_FLICKER_MODES 0x1B
#define CPIA2_VP_FLICKER_MODES_50HZ 0x80
#define CPIA2_VP_FLICKER_MODES_CUSTOM_FLT_FFREQ 0x40
#define CPIA2_VP_FLICKER_MODES_NEVER_FLICKER 0x20
#define CPIA2_VP_FLICKER_MODES_INHIBIT_RUB 0x10
#define CPIA2_VP_FLICKER_MODES_ADJUST_LINE_FREQ 0x08
#define CPIA2_VP_FLICKER_MODES_CUSTOM_INT_FFREQ 0x04
#define CPIA2_VP_UMISC 0x1D
#define CPIA2_VP_UMISC_FORCE_MONO 0x80
#define CPIA2_VP_UMISC_FORCE_ID_MASK 0x40
#define CPIA2_VP_UMISC_INHIBIT_AUTO_FGS 0x20
#define CPIA2_VP_UMISC_INHIBIT_AUTO_DIMS 0x08
#define CPIA2_VP_UMISC_OPT_FOR_SENSOR_DS 0x04
#define CPIA2_VP_UMISC_INHIBIT_AUTO_MODE_INT 0x02
#define CPIA2_VP5_ANTIFLKRSETUP 0x22 //34
#define CPIA2_VP_INTERPOLATION 0x24
#define CPIA2_VP_INTERPOLATION_EVEN_FIRST 0x40
#define CPIA2_VP_INTERPOLATION_HJOG 0x20
#define CPIA2_VP_INTERPOLATION_VJOG 0x10
#define CPIA2_VP_GAMMA 0x25
#define CPIA2_VP_DEFAULT_GAMMA 0x10
#define CPIA2_VP_YRANGE 0x26
#define CPIA2_VP_SATURATION 0x27
#define CPIA2_VP5_MYBLACK_LEVEL 0x3A //58
#define CPIA2_VP5_MCYRANGE 0x3B //59
#define CPIA2_VP5_MYCEILING 0x3C //60
#define CPIA2_VP5_MCUVSATURATION 0x3D //61
#define CPIA2_VP_REHASH_VALUES 0x60
/***
* Common sensor registers
***/
#define CPIA2_SENSOR_DEVICE_H 0x00
#define CPIA2_SENSOR_DEVICE_L 0x01
#define CPIA2_SENSOR_DATA_FORMAT 0x16
#define CPIA2_SENSOR_DATA_FORMAT_HMIRROR 0x08
#define CPIA2_SENSOR_DATA_FORMAT_VMIRROR 0x10
#define CPIA2_SENSOR_CR1 0x76
#define CPIA2_SENSOR_CR1_STAND_BY 0x01
#define CPIA2_SENSOR_CR1_DOWN_RAMP_GEN 0x02
#define CPIA2_SENSOR_CR1_DOWN_COLUMN_ADC 0x04
#define CPIA2_SENSOR_CR1_DOWN_CAB_REGULATOR 0x08
#define CPIA2_SENSOR_CR1_DOWN_AUDIO_REGULATOR 0x10
#define CPIA2_SENSOR_CR1_DOWN_VRT_AMP 0x20
#define CPIA2_SENSOR_CR1_DOWN_BAND_GAP 0x40
#endif

Some files were not shown because too many files have changed in this diff Show More