/*
* i2c IR lirc driver for devices with zilog IR processors
*
* Copyright (c) 2000 Gerd Knorr <kraxel@goldbach.in-berlin.de>
* modified for PixelView (BT878P+W/FM) by
* Michal Kochanowicz <mkochano@pld.org.pl>
* Christoph Bartelmus <lirc@bartelmus.de>
* modified for KNC ONE TV Station/Anubis Typhoon TView Tuner by
* Ulrich Mueller <ulrich.mueller42@web.de>
* modified for Asus TV-Box and Creative/VisionTek BreakOut-Box by
* Stefan Jahn <stefan@lkcc.org>
* modified for inclusion into kernel sources by
* Jerome Brock <jbrock@users.sourceforge.net>
* modified for Leadtek Winfast PVR2000 by
* Thomas Reitmayr (treitmayr@yahoo.com)
* modified for Hauppauge PVR-150 IR TX device by
* Mark Weaver <mark@npsl.co.uk>
* changed name from lirc_pvr150 to lirc_zilog, works on more than pvr-150
* Jarod Wilson <jarod@redhat.com>
*
* parts are cut&pasted from the lirc_i2c.c driver
*
* 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/version.h>
#include <linux/module.h>
#include <linux/kmod.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/poll.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/delay.h>
#include <linux/completion.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/firmware.h>
#include <linux/vmalloc.h>
#include <linux/mutex.h>
#include <linux/kthread.h>
#include <media/lirc_dev.h>
#include <media/lirc.h>
struct IR {
struct lirc_driver l;
/* Device info */
struct mutex ir_lock;
int open;
/* RX device */
struct i2c_client c_rx;
int have_rx;
/* RX device buffer & lock */
struct lirc_buffer buf;
struct mutex buf_lock;
/* RX polling thread data */
struct completion *t_notify;
struct completion *t_notify2;
int shutdown;
struct task_struct *task;
/* RX read data */
unsigned char b[3];
/* TX device */
struct i2c_client c_tx;
int need_boot;
int have_tx;
};
/* Minor -> data mapping */
static struct IR *ir_devices[MAX_IRCTL_DEVICES];
/* Block size for IR transmitter */
#define TX_BLOCK_SIZE 99
/* Hauppauge IR transmitter data */
struct