summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorAndi Shyti <andi.shyti@samsung.com>2016-06-14 10:16:43 +0900
committerSeung-Woo Kim <sw0312.kim@samsung.com>2016-12-14 13:51:03 +0900
commitdd238d70a1f3639cd6a54a4ae504bb1e68a39952 (patch)
treed632eca5e922fd24fd11965f6999c8404119fda6 /Documentation
parentf63147121cc85fe1d2b708c8b62e0c72a5cc34a4 (diff)
[media] rc: ir-spi: add support for IR LEDs connected with SPI
The ir-spi is a simple device driver which supports the connection between an IR LED and the MOSI line of an SPI device. The driver, indeed, uses the SPI framework to stream the raw data provided by userspace through a character device. The chardev is handled by the LIRC framework and its functionality basically provides: - raw write: data to be sent to the SPI and then streamed to the MOSI line; - set frequency: sets the frequency whith which the data should be sent; - set length: sets the data length. This information is optional, if the length is set, then userspace should send raw data only with that length; while if the length is set to '0', then the driver will figure out himself the length of the data based on the length of the data written on the character device. The latter is not recommended, though, as the driver, at any write, allocates and deallocates a buffer where the data from userspace are stored. The driver provides three feedback commands: - get length: reads the length set and (as mentioned), if the length is '0' it will be calculated at any write - get frequency: the driver reports the frequency. If userpace doesn't set the frequency, the driver will use a default value of 38000Hz. The character device is created under /dev/lircX name, where X is and ID assigned by the LIRC framework. Example of usage: int fd, ret; ssize_t n; uint32_t val = 0; fd = open("/dev/lirc0", O_RDWR); if (fd < 0) { fprintf(stderr, "unable to open the device\n"); return -1; } /* ioctl set frequency and length parameters */ val = 6430; ret = ioctl(fd, LIRC_SET_LENGTH, &val); if (ret < 0) fprintf(stderr, "LIRC_SET_LENGTH failed\n"); val = 608000; ret = ioctl(fd, LIRC_SET_FREQUENCY, &val); if (ret < 0) fprintf(stderr, "LIRC_SET_FREQUENCY failed\n"); /* read back length and frequency parameters */ ret = ioctl(fd, LIRC_GET_LENGTH, &val); if (ret < 0) fprintf(stderr, "LIRC_GET_LENGTH failed\n"); else fprintf(stdout, "legnth = %u\n", val); ret = ioctl(fd, LIRC_GET_FREQUENCY, &val); if (ret < 0) fprintf(stderr, "LIRC_GET_FREQUENCY failed\n"); else fprintf(stdout, "frequency = %u\n", val); /* write data to device */ n = write(fd, b, 6430); if (n < 0) { fprintf(stderr, "unable to write to the device\n"); ret = -1; } else if (n != 6430) { fprintf(stderr, "failed to write everything, wrote %ld instead\n", n); ret = -1; } else { fprintf(stdout, "written all the %ld data\n", n); } close(fd); The driver supports multi task access, but all the processes which hold the driver should use the same length and frequency parameters. Change-Id: I323d7dd4a56d6dcf48f2c695293822eb04bdb85f Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/devicetree/bindings/media/spi-ir.txt24
1 files changed, 24 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/media/spi-ir.txt b/Documentation/devicetree/bindings/media/spi-ir.txt
new file mode 100644
index 000000000000..2232d92bcc00
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/spi-ir.txt
@@ -0,0 +1,24 @@
+Device tree bindings for IR LED connected through SPI bus which is used as
+remote controller.
+
+The IR LED switch is connected to the MOSI line of the SPI device and the data
+are delivered thourgh that.
+
+Required properties:
+ - compatible: should be "ir-spi"
+
+Optional properties:
+ - irled,switch: specifies the gpio switch which enables the irled
+
+Example:
+
+ irled@0 {
+ compatible = "ir-spi";
+ reg = <0x0>;
+ spi-max-frequency = <5000000>;
+ irled,switch = <&gpr3 3 0>;
+
+ controller-data {
+ samsung,spi-feedback-delay = <0>;
+ };
+ };