UPSTREAM: media: lirc: remove LIRCCODE and LIRC_GET_LENGTH

LIRCCODE is a lirc mode where a driver produces driver-dependent
codes for receive and transmit. No driver uses this any more. The
LIRC_GET_LENGTH ioctl was used for this mode only.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 4e3cd001fd)
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
This commit is contained in:
Sean Young
2017-06-08 05:10:41 -04:00
committed by Tao Huang
parent 9893fd05e5
commit 399617ff19
9 changed files with 431 additions and 19 deletions

View File

@ -0,0 +1,47 @@
# Ignore header name
ignore define _LINUX_LIRC_H
# Ignore helper macros
ignore define lirc_t
ignore define LIRC_SPACE
ignore define LIRC_PULSE
ignore define LIRC_FREQUENCY
ignore define LIRC_TIMEOUT
ignore define LIRC_VALUE
ignore define LIRC_MODE2
ignore define LIRC_IS_SPACE
ignore define LIRC_IS_PULSE
ignore define LIRC_IS_FREQUENCY
ignore define LIRC_IS_TIMEOUT
ignore define LIRC_MODE2SEND
ignore define LIRC_SEND2MODE
ignore define LIRC_MODE2REC
ignore define LIRC_REC2MODE
ignore define LIRC_CAN_SEND
ignore define LIRC_CAN_REC
ignore define LIRC_CAN_SEND_MASK
ignore define LIRC_CAN_REC_MASK
ignore define LIRC_CAN_SET_REC_DUTY_CYCLE
# Obsolete ioctls
ignore ioctl LIRC_GET_LENGTH
# Undocumented macros
ignore define PULSE_BIT
ignore define PULSE_MASK
ignore define LIRC_MODE2_SPACE
ignore define LIRC_MODE2_PULSE
ignore define LIRC_VALUE_MASK
ignore define LIRC_MODE2_MASK
ignore define LIRC_MODE_RAW
ignore define LIRC_MODE_LIRCCODE

View File

@ -0,0 +1,86 @@
.. -*- coding: utf-8; mode: rst -*-
.. _lirc_dev_intro:
************
Introduction
************
The LIRC device interface is a bi-directional interface for transporting
raw IR data between userspace and kernelspace. Fundamentally, it is just
a chardev (/dev/lircX, for X = 0, 1, 2, ...), with a number of standard
struct file_operations defined on it. With respect to transporting raw
IR data to and fro, the essential fops are read, write and ioctl.
Example dmesg output upon a driver registering w/LIRC:
.. code-block:: none
$ dmesg |grep lirc_dev
lirc_dev: IR Remote Control driver registered, major 248
rc rc0: lirc_dev: driver ir-lirc-codec (mceusb) registered at minor = 0
What you should see for a chardev:
.. code-block:: none
$ ls -l /dev/lirc*
crw-rw---- 1 root root 248, 0 Jul 2 22:20 /dev/lirc0
.. _lirc_modes:
**********
LIRC modes
**********
LIRC supports some modes of receiving and sending IR codes, as shown
on the following table.
.. _lirc-mode-mode2:
``LIRC_MODE_MODE2``
The driver returns a sequence of pulse and space codes to userspace,
as a series of u32 values.
This mode is used only for IR receive.
The upper 8 bits determine the packet type, and the lower 24 bits
the payload. Use ``LIRC_VALUE()`` macro to get the payload, and
the macro ``LIRC_MODE2()`` will give you the type, which
is one of:
``LIRC_MODE2_PULSE``
Signifies the presence of IR in microseconds.
``LIRC_MODE2_SPACE``
Signifies absence of IR in microseconds.
``LIRC_MODE2_FREQUENCY``
If measurement of the carrier frequency was enabled with
:ref:`lirc_set_measure_carrier_mode` then this packet gives you
the carrier frequency in Hertz.
``LIRC_MODE2_TIMEOUT``
If timeout reports are enabled with
:ref:`lirc_set_rec_timeout_reports`, when the timeout set with
:ref:`lirc_set_rec_timeout` expires due to no IR being detected,
this packet will be sent, with the number of microseconds with
no IR.
.. _lirc-mode-pulse:
``LIRC_MODE_PULSE``
In pulse mode, a sequence of pulse/space integer values are written to the
lirc device using :ref:`lirc-write`.
The values are alternating pulse and space lengths, in microseconds. The
first and last entry must be a pulse, so there must be an odd number
of entries.
This mode is used only for IR send.

View File

@ -0,0 +1,27 @@
.. -*- coding: utf-8; mode: rst -*-
.. _lirc_func:
LIRC Function Reference
=======================
.. toctree::
:maxdepth: 1
lirc-read
lirc-write
lirc-get-features
lirc-get-send-mode
lirc-get-rec-mode
lirc-get-rec-resolution
lirc-set-send-duty-cycle
lirc-get-timeout
lirc-set-rec-timeout
lirc-set-rec-carrier
lirc-set-rec-carrier-range
lirc-set-send-carrier
lirc-set-transmitter-mask
lirc-set-rec-timeout-reports
lirc-set-measure-carrier-mode
lirc-set-wideband-receiver

View File

@ -0,0 +1,179 @@
.. -*- coding: utf-8; mode: rst -*-
.. _lirc_get_features:
***********************
ioctl LIRC_GET_FEATURES
***********************
Name
====
LIRC_GET_FEATURES - Get the underlying hardware device's features
Synopsis
========
.. c:function:: int ioctl( int fd, LIRC_GET_FEATURES, __u32 *features)
:name: LIRC_GET_FEATURES
Arguments
=========
``fd``
File descriptor returned by open().
``features``
Bitmask with the LIRC features.
Description
===========
Get the underlying hardware device's features. If a driver does not
announce support of certain features, calling of the corresponding ioctls
is undefined.
LIRC features
=============
.. _LIRC-CAN-REC-RAW:
``LIRC_CAN_REC_RAW``
Unused. Kept just to avoid breaking uAPI.
.. _LIRC-CAN-REC-PULSE:
``LIRC_CAN_REC_PULSE``
Unused. Kept just to avoid breaking uAPI.
:ref:`LIRC_MODE_PULSE <lirc-mode-pulse>` can only be used for transmitting.
.. _LIRC-CAN-REC-MODE2:
``LIRC_CAN_REC_MODE2``
The driver is capable of receiving using
:ref:`LIRC_MODE_MODE2 <lirc-mode-MODE2>`.
.. _LIRC-CAN-REC-LIRCCODE:
``LIRC_CAN_REC_LIRCCODE``
Unused. Kept just to avoid breaking uAPI.
.. _LIRC-CAN-SET-SEND-CARRIER:
``LIRC_CAN_SET_SEND_CARRIER``
The driver supports changing the modulation frequency via
:ref:`ioctl LIRC_SET_SEND_CARRIER <LIRC_SET_SEND_CARRIER>`.
.. _LIRC-CAN-SET-SEND-DUTY-CYCLE:
``LIRC_CAN_SET_SEND_DUTY_CYCLE``
The driver supports changing the duty cycle using
:ref:`ioctl LIRC_SET_SEND_DUTY_CYCLE <LIRC_SET_SEND_DUTY_CYCLE>`.
.. _LIRC-CAN-SET-TRANSMITTER-MASK:
``LIRC_CAN_SET_TRANSMITTER_MASK``
The driver supports changing the active transmitter(s) using
:ref:`ioctl LIRC_SET_TRANSMITTER_MASK <LIRC_SET_TRANSMITTER_MASK>`.
.. _LIRC-CAN-SET-REC-CARRIER:
``LIRC_CAN_SET_REC_CARRIER``
The driver supports setting the receive carrier frequency using
:ref:`ioctl LIRC_SET_REC_CARRIER <LIRC_SET_REC_CARRIER>`.
.. _LIRC-CAN-SET-REC-DUTY-CYCLE-RANGE:
``LIRC_CAN_SET_REC_DUTY_CYCLE_RANGE``
Unused. Kept just to avoid breaking uAPI.
.. _LIRC-CAN-SET-REC-CARRIER-RANGE:
``LIRC_CAN_SET_REC_CARRIER_RANGE``
The driver supports
:ref:`ioctl LIRC_SET_REC_CARRIER_RANGE <LIRC_SET_REC_CARRIER_RANGE>`.
.. _LIRC-CAN-GET-REC-RESOLUTION:
``LIRC_CAN_GET_REC_RESOLUTION``
The driver supports
:ref:`ioctl LIRC_GET_REC_RESOLUTION <LIRC_GET_REC_RESOLUTION>`.
.. _LIRC-CAN-SET-REC-TIMEOUT:
``LIRC_CAN_SET_REC_TIMEOUT``
The driver supports
:ref:`ioctl LIRC_SET_REC_TIMEOUT <LIRC_SET_REC_TIMEOUT>`.
.. _LIRC-CAN-SET-REC-FILTER:
``LIRC_CAN_SET_REC_FILTER``
Unused. Kept just to avoid breaking uAPI.
.. _LIRC-CAN-MEASURE-CARRIER:
``LIRC_CAN_MEASURE_CARRIER``
The driver supports measuring of the modulation frequency using
:ref:`ioctl LIRC_SET_MEASURE_CARRIER_MODE <LIRC_SET_MEASURE_CARRIER_MODE>`.
.. _LIRC-CAN-USE-WIDEBAND-RECEIVER:
``LIRC_CAN_USE_WIDEBAND_RECEIVER``
The driver supports learning mode using
:ref:`ioctl LIRC_SET_WIDEBAND_RECEIVER <LIRC_SET_WIDEBAND_RECEIVER>`.
.. _LIRC-CAN-NOTIFY-DECODE:
``LIRC_CAN_NOTIFY_DECODE``
Unused. Kept just to avoid breaking uAPI.
.. _LIRC-CAN-SEND-RAW:
``LIRC_CAN_SEND_RAW``
Unused. Kept just to avoid breaking uAPI.
.. _LIRC-CAN-SEND-PULSE:
``LIRC_CAN_SEND_PULSE``
The driver supports sending (also called as IR blasting or IR TX) using
:ref:`LIRC_MODE_PULSE <lirc-mode-pulse>`.
.. _LIRC-CAN-SEND-MODE2:
``LIRC_CAN_SEND_MODE2``
Unused. Kept just to avoid breaking uAPI.
:ref:`LIRC_MODE_MODE2 <lirc-mode-mode2>` can only be used for receiving.
.. _LIRC-CAN-SEND-LIRCCODE:
``LIRC_CAN_SEND_LIRCCODE``
Unused. Kept just to avoid breaking uAPI.
Return Value
============
On success 0 is returned, on error -1 and the ``errno`` variable is set
appropriately. The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.

View File

@ -0,0 +1,44 @@
.. -*- coding: utf-8; mode: rst -*-
.. _lirc_get_rec_mode:
.. _lirc_set_rec_mode:
**********************************************
ioctls LIRC_GET_REC_MODE and LIRC_SET_REC_MODE
**********************************************
Name
====
LIRC_GET_REC_MODE/LIRC_SET_REC_MODE - Get/set supported receive modes.
Synopsis
========
.. c:function:: int ioctl( int fd, LIRC_GET_REC_MODE, __u32 rx_modes)
:name: LIRC_GET_REC_MODE
.. c:function:: int ioctl( int fd, LIRC_SET_REC_MODE, __u32 rx_modes)
:name: LIRC_SET_REC_MODE
Arguments
=========
``fd``
File descriptor returned by open().
``rx_modes``
Bitmask with the supported transmit modes.
Description
===========
Get/set supported receive modes. Only :ref:`LIRC_MODE_MODE2 <lirc-mode-mode2>`
is supported for IR receive.
Return Value
============
On success 0 is returned, on error -1 and the ``errno`` variable is set
appropriately. The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.

View File

@ -0,0 +1,48 @@
.. -*- coding: utf-8; mode: rst -*-
.. _lirc_get_send_mode:
.. _lirc_set_send_mode:
************************************************
ioctls LIRC_GET_SEND_MODE and LIRC_SET_SEND_MODE
************************************************
Name
====
LIRC_GET_SEND_MODE/LIRC_SET_SEND_MODE - Get/set supported transmit mode.
Synopsis
========
.. c:function:: int ioctl( int fd, LIRC_GET_SEND_MODE, __u32 *tx_modes )
:name: LIRC_GET_SEND_MODE
.. c:function:: int ioctl( int fd, LIRC_SET_SEND_MODE, __u32 *tx_modes )
:name: LIRC_SET_SEND_MODE
Arguments
=========
``fd``
File descriptor returned by open().
``tx_modes``
Bitmask with the supported transmit modes.
Description
===========
Get/set current transmit mode.
Only :ref:`LIRC_MODE_PULSE <lirc-mode-pulse>` is supported by for IR send,
depending on the driver. Use :ref:`lirc_get_features` to find out which
modes the driver supports.
Return Value
============
On success 0 is returned, on error -1 and the ``errno`` variable is set
appropriately. The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.

View File

@ -388,7 +388,6 @@ static int ir_lirc_register(struct rc_dev *dev)
ldev->features = features;
ldev->data = &dev->raw->lirc;
ldev->buf = NULL;
ldev->code_length = sizeof(struct ir_raw_event) * 8;
ldev->chunk_size = sizeof(int);
ldev->buffer_size = LIRCBUF_SIZE;
ldev->fops = &lirc_fops;

View File

@ -143,12 +143,6 @@ int lirc_register_device(struct lirc_dev *d)
return -EINVAL;
}
if (d->code_length < 1 || d->code_length > (BUFLEN * 8)) {
dev_err(&d->dev, "code length must be less than %d bits\n",
BUFLEN * 8);
return -EBADRQC;
}
if (!d->buf && !(d->fops && d->fops->read &&
d->fops->poll && d->fops->unlocked_ioctl)) {
dev_err(&d->dev, "undefined read, poll, ioctl\n");
@ -158,9 +152,6 @@ int lirc_register_device(struct lirc_dev *d)
/* some safety check 8-) */
d->name[sizeof(d->name) - 1] = '\0';
if (d->features == 0)
d->features = LIRC_CAN_REC_LIRCCODE;
if (LIRC_CAN_REC(d->features)) {
err = lirc_allocate_buffer(d);
if (err)
@ -349,9 +340,6 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
* for now, lirc_serial doesn't support mode changing either
*/
break;
case LIRC_GET_LENGTH:
result = put_user(d->code_length, (__u32 __user *)arg);
break;
default:
result = -ENOTTY;
}

View File

@ -9,10 +9,6 @@
#ifndef _LINUX_LIRC_DEV_H
#define _LINUX_LIRC_DEV_H
#define BUFLEN 16
#define mod(n, div) ((n) % (div))
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/ioctl.h>
@ -124,7 +120,6 @@ static inline unsigned int lirc_buffer_write(struct lirc_buffer *buf,
*
* @name: used for logging
* @minor: the minor device (/dev/lircX) number for the device
* @code_length: length of a remote control key code expressed in bits
* @features: lirc compatible hardware features, like LIRC_MODE_RAW,
* LIRC_CAN\_\*, as defined at include/media/lirc.h.
* @buffer_size: Number of FIFO buffers with @chunk_size size.
@ -149,7 +144,6 @@ static inline unsigned int lirc_buffer_write(struct lirc_buffer *buf,
struct lirc_dev {
char name[40];
unsigned int minor;
__u32 code_length;
__u32 features;
unsigned int buffer_size; /* in chunks holding one code each */