Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (505 commits)
  [media] af9015: Fix max I2C message size when used with tda18271
  [media] IR: initialize ir_raw_event in few more drivers
  [media] Guard a divide in v4l1 compat layer
  [media] imon: fix nomouse modprobe option
  [media] imon: remove redundant change_protocol call
  [media] imon: fix my egregious brown paper bag w/rdev/idev split
  [media] cafe_ccic: Configure ov7670 correctly
  [media] ov7670: allow configuration of image size, clock speed, and I/O method
  [media] af9015: support for DigitalNow TinyTwin v3 [1f4d:9016]
  [media] af9015: map DigitalNow TinyTwin v2 remote
  [media] DigitalNow TinyTwin remote controller
  [media] af9015: RC fixes and improvements
  videodev2.h.xml: Update to reflect the latest changes at videodev2.h
  [media] v4l: document new Bayer and monochrome pixel formats
  [media] DocBook/v4l: Add missing formats used on gspca cpia1 and sn9c2028
  [media] firedtv: add parameter to fake ca_system_ids in CA_INFO
  [media] tm6000: fix a macro coding style issue
  tm6000: Remove some ugly debug code
  [media] Nova-S-Plus audio line input
  [media] [RFC,1/1] V4L2: Use new CAP bits in existing RDS capable drivers
  ...
This commit is contained in:
Linus Torvalds
2010-10-28 09:35:11 -07:00
531 changed files with 41168 additions and 13122 deletions

View File

@@ -53,7 +53,7 @@ config LIRC_ITE8709
config LIRC_PARALLEL
tristate "Homebrew Parallel Port Receiver"
depends on LIRC_STAGING && PARPORT && !SMP
depends on LIRC_STAGING && PARPORT
help
Driver for Homebrew Parallel Port Receivers

View File

@@ -54,10 +54,10 @@
/* module identification */
#define DRIVER_VERSION "0.1"
#define DRIVER_VERSION "0.2"
#define DRIVER_AUTHOR \
"Jan M. Hochstein <hochstein@algo.informatik.tu-darmstadt.de>"
#define DRIVER_DESC "USB remote driver for LIRC"
#define DRIVER_DESC "Igorplug USB remote driver for LIRC"
#define DRIVER_NAME "lirc_igorplugusb"
/* debugging support */
@@ -201,7 +201,6 @@ struct igorplug {
/* usb */
struct usb_device *usbdev;
struct urb *urb_in;
int devnum;
unsigned char *buf_in;
@@ -216,28 +215,36 @@ struct igorplug {
/* handle sending (init strings) */
int send_flags;
wait_queue_head_t wait_out;
};
static int unregister_from_lirc(struct igorplug *ir)
{
struct lirc_driver *d = ir->d;
struct lirc_driver *d;
int devnum;
if (!ir->d)
if (!ir) {
printk(KERN_ERR "%s: called with NULL device struct!\n",
__func__);
return -EINVAL;
}
devnum = ir->devnum;
dprintk(DRIVER_NAME "[%d]: unregister from lirc called\n", devnum);
d = ir->d;
if (!d) {
printk(KERN_ERR "%s: called with NULL lirc driver struct!\n",
__func__);
return -EINVAL;
}
dprintk(DRIVER_NAME "[%d]: calling lirc_unregister_driver\n", devnum);
lirc_unregister_driver(d->minor);
printk(DRIVER_NAME "[%d]: usb remote disconnected\n", devnum);
kfree(d);
ir->d = NULL;
kfree(ir);
return 0;
return devnum;
}
static int set_use_inc(void *data)
@@ -248,6 +255,7 @@ static int set_use_inc(void *data)
printk(DRIVER_NAME "[?]: set_use_inc called with no context\n");
return -EIO;
}
dprintk(DRIVER_NAME "[%d]: set use inc\n", ir->devnum);
if (!ir->usbdev)
@@ -264,9 +272,29 @@ static void set_use_dec(void *data)
printk(DRIVER_NAME "[?]: set_use_dec called with no context\n");
return;
}
dprintk(DRIVER_NAME "[%d]: set use dec\n", ir->devnum);
}
static void send_fragment(struct igorplug *ir, struct lirc_buffer *buf,
int i, int max)
{
int code;
/* MODE2: pulse/space (PULSE_BIT) in 1us units */
while (i < max) {
/* 1 Igor-tick = 85.333333 us */
code = (unsigned int)ir->buf_in[i] * 85 +
(unsigned int)ir->buf_in[i] / 3;
ir->last_time.tv_usec += code;
if (ir->in_space)
code |= PULSE_BIT;
lirc_buffer_write(buf, (unsigned char *)&code);
/* 1 chunk = CODE_LENGTH bytes */
ir->in_space ^= 1;
++i;
}
}
/**
* Called in user context.
@@ -274,41 +302,32 @@ static void set_use_dec(void *data)
* -ENODATA if none was available. This should add some number of bits
* evenly divisible by code_length to the buffer
*/
static int usb_remote_poll(void *data, struct lirc_buffer *buf)
static int igorplugusb_remote_poll(void *data, struct lirc_buffer *buf)
{
int ret;
struct igorplug *ir = (struct igorplug *)data;
if (!ir->usbdev) /* Has the device been removed? */
if (!ir || !ir->usbdev) /* Has the device been removed? */
return -ENODEV;
memset(ir->buf_in, 0, ir->len_in);
ret = usb_control_msg(
ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0),
GET_INFRACODE, USB_TYPE_VENDOR|USB_DIR_IN,
0/* offset */, /*unused*/0,
ir->buf_in, ir->len_in,
/*timeout*/HZ * USB_CTRL_GET_TIMEOUT);
ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0),
GET_INFRACODE, USB_TYPE_VENDOR | USB_DIR_IN,
0/* offset */, /*unused*/0,
ir->buf_in, ir->len_in,
/*timeout*/HZ * USB_CTRL_GET_TIMEOUT);
if (ret > 0) {
int i = DEVICE_HEADERLEN;
int code, timediff;
struct timeval now;
if (ret <= 1) /* ACK packet has 1 byte --> ignore */
/* ACK packet has 1 byte --> ignore */
if (ret < DEVICE_HEADERLEN)
return -ENODATA;
dprintk(DRIVER_NAME ": Got %d bytes. Header: %02x %02x %02x\n",
ret, ir->buf_in[0], ir->buf_in[1], ir->buf_in[2]);
if (ir->buf_in[2] != 0) {
printk(DRIVER_NAME "[%d]: Device buffer overrun.\n",
ir->devnum);
/* start at earliest byte */
i = DEVICE_HEADERLEN + ir->buf_in[2];
/* where are we now? space, gap or pulse? */
}
do_gettimeofday(&now);
timediff = now.tv_sec - ir->last_time.tv_sec;
if (timediff + 1 > PULSE_MASK / 1000000)
@@ -325,18 +344,20 @@ static int usb_remote_poll(void *data, struct lirc_buffer *buf)
lirc_buffer_write(buf, (unsigned char *)&code);
ir->in_space = 1; /* next comes a pulse */
/* MODE2: pulse/space (PULSE_BIT) in 1us units */
while (i < ret) {
/* 1 Igor-tick = 85.333333 us */
code = (unsigned int)ir->buf_in[i] * 85
+ (unsigned int)ir->buf_in[i] / 3;
if (ir->in_space)
code |= PULSE_BIT;
lirc_buffer_write(buf, (unsigned char *)&code);
/* 1 chunk = CODE_LENGTH bytes */
ir->in_space ^= 1;
++i;
if (ir->buf_in[2] == 0)
send_fragment(ir, buf, DEVICE_HEADERLEN, ret);
else {
printk(KERN_WARNING DRIVER_NAME
"[%d]: Device buffer overrun.\n", ir->devnum);
/* HHHNNNNNNNNNNNOOOOOOOO H = header
<---[2]---> N = newer
<---------ret--------> O = older */
ir->buf_in[2] %= ret - DEVICE_HEADERLEN; /* sanitize */
/* keep even-ness to not desync pulse/pause */
send_fragment(ir, buf, DEVICE_HEADERLEN +
ir->buf_in[2] - (ir->buf_in[2] & 1), ret);
send_fragment(ir, buf, DEVICE_HEADERLEN,
DEVICE_HEADERLEN + ir->buf_in[2]);
}
ret = usb_control_msg(
@@ -358,12 +379,12 @@ static int usb_remote_poll(void *data, struct lirc_buffer *buf)
static int usb_remote_probe(struct usb_interface *intf,
const struct usb_device_id *id)
static int igorplugusb_remote_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct usb_device *dev = NULL;
struct usb_host_interface *idesc = NULL;
struct usb_host_endpoint *ep_ctl2;
struct usb_endpoint_descriptor *ep;
struct igorplug *ir = NULL;
struct lirc_driver *driver = NULL;
int devnum, pipe, maxp;
@@ -380,20 +401,21 @@ static int usb_remote_probe(struct usb_interface *intf,
if (idesc->desc.bNumEndpoints != 1)
return -ENODEV;
ep_ctl2 = idesc->endpoint;
if (((ep_ctl2->desc.bEndpointAddress & USB_ENDPOINT_DIR_MASK)
ep = &idesc->endpoint->desc;
if (((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
!= USB_DIR_IN)
|| (ep_ctl2->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
|| (ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
!= USB_ENDPOINT_XFER_CONTROL)
return -ENODEV;
pipe = usb_rcvctrlpipe(dev, ep_ctl2->desc.bEndpointAddress);
pipe = usb_rcvctrlpipe(dev, ep->bEndpointAddress);
devnum = dev->devnum;
maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
dprintk(DRIVER_NAME "[%d]: bytes_in_key=%lu maxp=%d\n",
dprintk(DRIVER_NAME "[%d]: bytes_in_key=%zu maxp=%d\n",
devnum, CODE_LENGTH, maxp);
mem_failure = 0;
ir = kzalloc(sizeof(struct igorplug), GFP_KERNEL);
if (!ir) {
@@ -406,9 +428,8 @@ static int usb_remote_probe(struct usb_interface *intf,
goto mem_failure_switch;
}
ir->buf_in = usb_alloc_coherent(dev,
DEVICE_BUFLEN+DEVICE_HEADERLEN,
GFP_ATOMIC, &ir->dma_in);
ir->buf_in = usb_alloc_coherent(dev, DEVICE_BUFLEN + DEVICE_HEADERLEN,
GFP_ATOMIC, &ir->dma_in);
if (!ir->buf_in) {
mem_failure = 3;
goto mem_failure_switch;
@@ -424,12 +445,10 @@ static int usb_remote_probe(struct usb_interface *intf,
driver->set_use_inc = &set_use_inc;
driver->set_use_dec = &set_use_dec;
driver->sample_rate = sample_rate; /* per second */
driver->add_to_buf = &usb_remote_poll;
driver->add_to_buf = &igorplugusb_remote_poll;
driver->dev = &intf->dev;
driver->owner = THIS_MODULE;
init_waitqueue_head(&ir->wait_out);
minor = lirc_register_driver(driver);
if (minor < 0)
mem_failure = 9;
@@ -438,7 +457,7 @@ mem_failure_switch:
switch (mem_failure) {
case 9:
usb_free_coherent(dev, DEVICE_BUFLEN+DEVICE_HEADERLEN,
usb_free_coherent(dev, DEVICE_BUFLEN + DEVICE_HEADERLEN,
ir->buf_in, ir->dma_in);
case 3:
kfree(driver);
@@ -454,7 +473,7 @@ mem_failure_switch:
ir->d = driver;
ir->devnum = devnum;
ir->usbdev = dev;
ir->len_in = DEVICE_BUFLEN+DEVICE_HEADERLEN;
ir->len_in = DEVICE_BUFLEN + DEVICE_HEADERLEN;
ir->in_space = 1; /* First mode2 event is a space. */
do_gettimeofday(&ir->last_time);
@@ -484,63 +503,64 @@ mem_failure_switch:
}
static void usb_remote_disconnect(struct usb_interface *intf)
static void igorplugusb_remote_disconnect(struct usb_interface *intf)
{
struct usb_device *dev = interface_to_usbdev(intf);
struct usb_device *usbdev = interface_to_usbdev(intf);
struct igorplug *ir = usb_get_intfdata(intf);
struct device *dev = &intf->dev;
int devnum;
usb_set_intfdata(intf, NULL);
if (!ir || !ir->d)
return;
ir->usbdev = NULL;
wake_up_all(&ir->wait_out);
usb_free_coherent(dev, ir->len_in, ir->buf_in, ir->dma_in);
usb_free_coherent(usbdev, ir->len_in, ir->buf_in, ir->dma_in);
unregister_from_lirc(ir);
devnum = unregister_from_lirc(ir);
dev_info(dev, DRIVER_NAME "[%d]: %s done\n", devnum, __func__);
}
static struct usb_device_id usb_remote_id_table[] = {
static struct usb_device_id igorplugusb_remote_id_table[] = {
/* Igor Plug USB (Atmel's Manufact. ID) */
{ USB_DEVICE(0x03eb, 0x0002) },
/* Fit PC2 Infrared Adapter */
{ USB_DEVICE(0x03eb, 0x21fe) },
/* Terminating entry */
{ }
};
static struct usb_driver usb_remote_driver = {
static struct usb_driver igorplugusb_remote_driver = {
.name = DRIVER_NAME,
.probe = usb_remote_probe,
.disconnect = usb_remote_disconnect,
.id_table = usb_remote_id_table
.probe = igorplugusb_remote_probe,
.disconnect = igorplugusb_remote_disconnect,
.id_table = igorplugusb_remote_id_table
};
static int __init usb_remote_init(void)
static int __init igorplugusb_remote_init(void)
{
int i;
int ret = 0;
printk(KERN_INFO "\n"
DRIVER_NAME ": " DRIVER_DESC " v" DRIVER_VERSION "\n");
printk(DRIVER_NAME ": " DRIVER_AUTHOR "\n");
dprintk(DRIVER_NAME ": debug mode enabled\n");
dprintk(DRIVER_NAME ": loaded, debug mode enabled\n");
i = usb_register(&usb_remote_driver);
if (i < 0) {
printk(DRIVER_NAME ": usb register failed, result = %d\n", i);
return -ENODEV;
}
ret = usb_register(&igorplugusb_remote_driver);
if (ret)
printk(KERN_ERR DRIVER_NAME ": usb register failed!\n");
return 0;
return ret;
}
static void __exit usb_remote_exit(void)
static void __exit igorplugusb_remote_exit(void)
{
usb_deregister(&usb_remote_driver);
usb_deregister(&igorplugusb_remote_driver);
}
module_init(usb_remote_init);
module_exit(usb_remote_exit);
module_init(igorplugusb_remote_init);
module_exit(igorplugusb_remote_exit);
#include <linux/vermagic.h>
MODULE_INFO(vermagic, VERMAGIC_STRING);
@@ -548,8 +568,10 @@ MODULE_INFO(vermagic, VERMAGIC_STRING);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_LICENSE("GPL");
MODULE_DEVICE_TABLE(usb, usb_remote_id_table);
MODULE_DEVICE_TABLE(usb, igorplugusb_remote_id_table);
module_param(sample_rate, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(sample_rate, "Sampling rate in Hz (default: 100)");
module_param(debug, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(debug, "Debug enabled or not");

View File

@@ -239,8 +239,7 @@ static ssize_t lirc_write(struct file *file, const char *buf,
static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
{
int retval = 0;
unsigned long value = 0;
unsigned int ivalue;
__u32 value = 0;
unsigned long hw_flags;
if (cmd == LIRC_GET_FEATURES)
@@ -256,24 +255,24 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
case LIRC_GET_FEATURES:
case LIRC_GET_SEND_MODE:
case LIRC_GET_REC_MODE:
retval = put_user(value, (unsigned long *) arg);
retval = put_user(value, (__u32 *) arg);
break;
case LIRC_SET_SEND_MODE:
case LIRC_SET_REC_MODE:
retval = get_user(value, (unsigned long *) arg);
retval = get_user(value, (__u32 *) arg);
break;
case LIRC_SET_SEND_CARRIER:
retval = get_user(ivalue, (unsigned int *) arg);
retval = get_user(value, (__u32 *) arg);
if (retval)
return retval;
ivalue /= 1000;
if (ivalue > IT87_CIR_FREQ_MAX ||
ivalue < IT87_CIR_FREQ_MIN)
value /= 1000;
if (value > IT87_CIR_FREQ_MAX ||
value < IT87_CIR_FREQ_MIN)
return -EINVAL;
it87_freq = ivalue;
it87_freq = value;
spin_lock_irqsave(&hardware_lock, hw_flags);
outb(((inb(io + IT87_CIR_TCR2) & IT87_CIR_TCR2_TXMPW) |
@@ -340,6 +339,9 @@ static const struct file_operations lirc_fops = {
.write = lirc_write,
.poll = lirc_poll,
.unlocked_ioctl = lirc_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = lirc_ioctl,
#endif
.open = lirc_open,
.release = lirc_close,
.llseek = noop_llseek,
@@ -964,10 +966,11 @@ static void __exit lirc_it87_exit(void)
printk(KERN_INFO LIRC_DRIVER_NAME ": Uninstalled.\n");
}
/* SECTION: PNP for ITE8704/18 */
/* SECTION: PNP for ITE8704/13/18 */
static const struct pnp_device_id pnp_dev_table[] = {
{"ITE8704", 0},
{"ITE8713", 0},
{}
};

View File

@@ -102,8 +102,8 @@ struct ite8709_device {
int io;
int irq;
spinlock_t hardware_lock;
unsigned long long acc_pulse;
unsigned long long acc_space;
__u64 acc_pulse;
__u64 acc_space;
char lastbit;
struct timeval last_tv;
struct lirc_driver driver;
@@ -220,7 +220,7 @@ static void ite8709_set_use_dec(void *data)
}
static void ite8709_add_read_queue(struct ite8709_device *dev, int flag,
unsigned long long val)
__u64 val)
{
int value;

View File

@@ -24,10 +24,6 @@
/*** Includes ***/
#ifdef CONFIG_SMP
#error "--- Sorry, this driver is not SMP safe. ---"
#endif
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/errno.h>
@@ -301,9 +297,9 @@ static void irq_handler(void *blah)
if (signal != 0) {
/* ajust value to usecs */
unsigned long long helper;
__u64 helper;
helper = ((unsigned long long) signal)*1000000;
helper = ((__u64) signal)*1000000;
do_div(helper, timer);
signal = (long) helper;
@@ -404,9 +400,9 @@ static ssize_t lirc_write(struct file *filep, const char *buf, size_t n,
/* adjust values from usecs */
for (i = 0; i < count; i++) {
unsigned long long helper;
__u64 helper;
helper = ((unsigned long long) wbuf[i])*timer;
helper = ((__u64) wbuf[i])*timer;
do_div(helper, 1000000);
wbuf[i] = (int) helper;
}
@@ -464,48 +460,48 @@ static unsigned int lirc_poll(struct file *file, poll_table *wait)
static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
{
int result;
unsigned long features = LIRC_CAN_SET_TRANSMITTER_MASK |
LIRC_CAN_SEND_PULSE | LIRC_CAN_REC_MODE2;
unsigned long mode;
unsigned int ivalue;
__u32 features = LIRC_CAN_SET_TRANSMITTER_MASK |
LIRC_CAN_SEND_PULSE | LIRC_CAN_REC_MODE2;
__u32 mode;
__u32 value;
switch (cmd) {
case LIRC_GET_FEATURES:
result = put_user(features, (unsigned long *) arg);
result = put_user(features, (__u32 *) arg);
if (result)
return result;
break;
case LIRC_GET_SEND_MODE:
result = put_user(LIRC_MODE_PULSE, (unsigned long *) arg);
result = put_user(LIRC_MODE_PULSE, (__u32 *) arg);
if (result)
return result;
break;
case LIRC_GET_REC_MODE:
result = put_user(LIRC_MODE_MODE2, (unsigned long *) arg);
result = put_user(LIRC_MODE_MODE2, (__u32 *) arg);
if (result)
return result;
break;
case LIRC_SET_SEND_MODE:
result = get_user(mode, (unsigned long *) arg);
result = get_user(mode, (__u32 *) arg);
if (result)
return result;
if (mode != LIRC_MODE_PULSE)
return -EINVAL;
break;
case LIRC_SET_REC_MODE:
result = get_user(mode, (unsigned long *) arg);
result = get_user(mode, (__u32 *) arg);
if (result)
return result;
if (mode != LIRC_MODE_MODE2)
return -ENOSYS;
break;
case LIRC_SET_TRANSMITTER_MASK:
result = get_user(ivalue, (unsigned int *) arg);
result = get_user(value, (__u32 *) arg);
if (result)
return result;
if ((ivalue & LIRC_PARALLEL_TRANSMITTER_MASK) != ivalue)
if ((value & LIRC_PARALLEL_TRANSMITTER_MASK) != value)
return LIRC_PARALLEL_MAX_TRANSMITTERS;
tx_mask = ivalue;
tx_mask = value;
break;
default:
return -ENOIOCTLCMD;
@@ -546,6 +542,9 @@ static const struct file_operations lirc_fops = {
.write = lirc_write,
.poll = lirc_poll,
.unlocked_ioctl = lirc_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = lirc_ioctl,
#endif
.open = lirc_open,
.release = lirc_close
};
@@ -576,28 +575,6 @@ static struct lirc_driver driver = {
static int pf(void *handle);
static void kf(void *handle);
static struct timer_list poll_timer;
static void poll_state(unsigned long ignored);
static void poll_state(unsigned long ignored)
{
printk(KERN_NOTICE "%s: time\n",
LIRC_DRIVER_NAME);
del_timer(&poll_timer);
if (is_claimed)
return;
kf(NULL);
if (!is_claimed) {
printk(KERN_NOTICE "%s: could not claim port, giving up\n",
LIRC_DRIVER_NAME);
init_timer(&poll_timer);
poll_timer.expires = jiffies + HZ;
poll_timer.data = (unsigned long)current;
poll_timer.function = poll_state;
add_timer(&poll_timer);
}
}
static int pf(void *handle)
{
parport_disable_irq(pport);

View File

@@ -372,7 +372,7 @@ static unsigned long conv_us_to_clocks;
static int init_timing_params(unsigned int new_duty_cycle,
unsigned int new_freq)
{
unsigned long long loops_per_sec, work;
__u64 loops_per_sec, work;
duty_cycle = new_duty_cycle;
freq = new_freq;
@@ -987,8 +987,7 @@ static ssize_t lirc_write(struct file *file, const char *buf,
static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
{
int result;
unsigned long value;
unsigned int ivalue;
__u32 value;
switch (cmd) {
case LIRC_GET_SEND_MODE:
@@ -997,7 +996,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
result = put_user(LIRC_SEND2MODE
(hardware[type].features&LIRC_CAN_SEND_MASK),
(unsigned long *) arg);
(__u32 *) arg);
if (result)
return result;
break;
@@ -1006,7 +1005,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
if (!(hardware[type].features&LIRC_CAN_SEND_MASK))
return -ENOIOCTLCMD;
result = get_user(value, (unsigned long *) arg);
result = get_user(value, (__u32 *) arg);
if (result)
return result;
/* only LIRC_MODE_PULSE supported */
@@ -1023,12 +1022,12 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
if (!(hardware[type].features&LIRC_CAN_SET_SEND_DUTY_CYCLE))
return -ENOIOCTLCMD;
result = get_user(ivalue, (unsigned int *) arg);
result = get_user(value, (__u32 *) arg);
if (result)
return result;
if (ivalue <= 0 || ivalue > 100)
if (value <= 0 || value > 100)
return -EINVAL;
return init_timing_params(ivalue, freq);
return init_timing_params(value, freq);
break;
case LIRC_SET_SEND_CARRIER:
@@ -1036,12 +1035,12 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
if (!(hardware[type].features&LIRC_CAN_SET_SEND_CARRIER))
return -ENOIOCTLCMD;
result = get_user(ivalue, (unsigned int *) arg);
result = get_user(value, (__u32 *) arg);
if (result)
return result;
if (ivalue > 500000 || ivalue < 20000)
if (value > 500000 || value < 20000)
return -EINVAL;
return init_timing_params(duty_cycle, ivalue);
return init_timing_params(duty_cycle, value);
break;
default:
@@ -1054,6 +1053,9 @@ static const struct file_operations lirc_fops = {
.owner = THIS_MODULE,
.write = lirc_write,
.unlocked_ioctl = lirc_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = lirc_ioctl,
#endif
.read = lirc_dev_fop_read,
.poll = lirc_dev_fop_poll,
.open = lirc_dev_fop_open,

View File

@@ -336,9 +336,8 @@ static ssize_t lirc_write(struct file *file, const char *buf, size_t n,
static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
{
int retval = 0;
unsigned long value = 0;
__u32 value = 0;
#ifdef LIRC_ON_SA1100
unsigned int ivalue;
if (cmd == LIRC_GET_FEATURES)
value = LIRC_CAN_SEND_PULSE |
@@ -362,22 +361,22 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
case LIRC_GET_FEATURES:
case LIRC_GET_SEND_MODE:
case LIRC_GET_REC_MODE:
retval = put_user(value, (unsigned long *) arg);
retval = put_user(value, (__u32 *) arg);
break;
case LIRC_SET_SEND_MODE:
case LIRC_SET_REC_MODE:
retval = get_user(value, (unsigned long *) arg);
retval = get_user(value, (__u32 *) arg);
break;
#ifdef LIRC_ON_SA1100
case LIRC_SET_SEND_DUTY_CYCLE:
retval = get_user(ivalue, (unsigned int *) arg);
retval = get_user(value, (__u32 *) arg);
if (retval)
return retval;
if (ivalue <= 0 || ivalue > 100)
if (value <= 0 || value > 100)
return -EINVAL;
/* (ivalue/100)*(1000000/freq) */
duty_cycle = ivalue;
/* (value/100)*(1000000/freq) */
duty_cycle = value;
pulse_width = (unsigned long) duty_cycle*10000/freq;
space_width = (unsigned long) 1000000L/freq-pulse_width;
if (pulse_width >= LIRC_ON_SA1100_TRANSMITTER_LATENCY)
@@ -386,12 +385,12 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
space_width -= LIRC_ON_SA1100_TRANSMITTER_LATENCY;
break;
case LIRC_SET_SEND_CARRIER:
retval = get_user(ivalue, (unsigned int *) arg);
retval = get_user(value, (__u32 *) arg);
if (retval)
return retval;
if (ivalue > 500000 || ivalue < 20000)
if (value > 500000 || value < 20000)
return -EINVAL;
freq = ivalue;
freq = value;
pulse_width = (unsigned long) duty_cycle*10000/freq;
space_width = (unsigned long) 1000000L/freq-pulse_width;
if (pulse_width >= LIRC_ON_SA1100_TRANSMITTER_LATENCY)
@@ -457,6 +456,9 @@ static const struct file_operations lirc_fops = {
.write = lirc_write,
.poll = lirc_poll,
.unlocked_ioctl = lirc_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = lirc_ioctl,
#endif
.open = lirc_dev_fop_open,
.release = lirc_dev_fop_close,
.llseek = no_llseek,

View File

@@ -1139,6 +1139,9 @@ static const struct file_operations lirc_fops = {
.write = write,
.poll = poll,
.unlocked_ioctl = ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = ioctl,
#endif
.open = open,
.release = close
};