/* saa7115 - Philips SAA7114/SAA7115 video decoder driver
*
* Based on saa7114 driver by Maxim Yevtyushkin, which is based on
* the saa7111 driver by Dave Perks.
*
* Copyright (C) 1998 Dave Perks <dperks@ibm.net>
* Copyright (C) 2002 Maxim Yevtyushkin <max@linuxmedialabs.com>
*
* Slight changes for video timing and attachment output by
* Wolfgang Scherr <scherr@net4you.net>
*
* Moved over to the linux >= 2.4.x i2c protocol (1/1/2003)
* by Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* Added saa7115 support by Kevin Thayer <nufan_wfk at yahoo.com>
* (2/17/2003)
*
* VBI support (2004) and cleanups (2005) by Hans Verkuil <hverkuil@xs4all.nl>
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/videodev2.h>
#include <media/v4l2-common.h>
#include <media/audiochip.h>
#include <asm/div64.h>
MODULE_DESCRIPTION("Philips SAA7114/SAA7115 video decoder driver");
MODULE_AUTHOR("Maxim Yevtyushkin, Kevin Thayer, Chris Kennedy, Hans Verkuil");
MODULE_LICENSE("GPL");
static int debug = 0;
module_param(debug, bool, 0644);
MODULE_PARM_DESC(debug, "Debug level (0-1)");
static unsigned short normal_i2c[] = { 0x42 >> 1, 0x40 >> 1, I2C_CLIENT_END };
I2C_CLIENT_INSMOD;
struct saa7115_state {
v4l2_std_id std;
int input;
int enable;
int radio;
int bright;
int contrast;
int hue;
int sat;
enum v4l2_chip_ident ident;
u32 audclk_freq;
};
/* ----------------------------------------------------------------------- */
static inline int saa7115_write(struct i2c_client *client, u8 reg, u8 value)
{
return i2c_smbus_write_byte_data(client, reg, value);
}
static int saa7115_writeregs(struct i2c_client *client, const unsigned char *regs)
{
unsigned char reg, data;
while (*regs != 0x00) {
reg = *(regs++);
data = *(regs++);
if (saa7115_write(client, reg