Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1474667 > unrolled thread
| Started by | Andi Shyti <andi.shyti@samsung.com> |
|---|---|
| First post | 2016-09-01 23:30 +0200 |
| Last post | 2016-09-02 02:30 +0200 |
| Articles | 7 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH v2 0/7] Add support for IR transmitters Andi Shyti <andi.shyti@samsung.com> - 2016-09-01 23:30 +0200
[PATCH v2 7/7] [media] rc: add support for IR LEDs driven through SPI Andi Shyti <andi.shyti@samsung.com> - 2016-09-01 23:30 +0200
[PATCH v2 5/7] [media] ir-lirc-codec: don't wait any transmitting time for tx only devices Andi Shyti <andi.shyti@samsung.com> - 2016-09-01 23:40 +0200
Re: [PATCH v2 5/7] [media] ir-lirc-codec: don't wait any transmitting time for tx only devices Sean Young <sean@mess.org> - 2016-09-02 10:50 +0200
[PATCH v2 3/7] [media] rc-core: add support for IR raw transmitters Andi Shyti <andi.shyti@samsung.com> - 2016-09-01 23:40 +0200
Re: [PATCH v2 3/7] [media] rc-core: add support for IR raw transmitters Sean Young <sean@mess.org> - 2016-09-01 23:40 +0200
Re: [PATCH v2 3/7] [media] rc-core: add support for IR raw transmitters kbuild test robot <lkp@intel.com> - 2016-09-02 02:30 +0200
| From | Andi Shyti <andi.shyti@samsung.com> |
|---|---|
| Date | 2016-09-01 23:30 +0200 |
| Subject | [PATCH v2 0/7] Add support for IR transmitters |
| Message-ID | <scHIB-79t-9@gated-at.bofh.it> |
Hi,
The main goal is to add support in the rc framework for IR
transmitters, which currently is only supported by lirc but that
is not the preferred way.
The last patch adds support for an IR transmitter driven by
the MOSI line of an SPI controller, it's the case of the Samsung
TM2(e) board which support is currently ongoing.
Changelog from version 1:
The RFC is now PATCH. The main difference is that this version
doesn't try to add the any bit streaming protocol and doesn't
modify any LIRC interface specification.
patch 1: updates all the drivers using rc_allocate_device
patch 2: fixed errors and warning reported from the kbuild test
robot
patch 5: this patch has been dropped and replaced with a new one
which avoids waiting for transmitters.
patch 6: added new properties to the dts specification
patch 7: the driver uses the pulse/space input and converts it to
a bit stream.
Thanks,
Andi
Andi Shyti (7):
[media] rc-main: assign driver type during allocation
[media] rc-main: split setup and unregister functions
[media] rc-core: add support for IR raw transmitters
[media] rc-ir-raw: do not generate any receiving thread for raw
transmitters
[media] ir-lirc-codec: don't wait any transmitting time for tx only
devices
Documentation: bindings: add documentation for ir-spi device driver
[media] rc: add support for IR LEDs driven through SPI
Documentation/devicetree/bindings/media/spi-ir.txt | 26 +++
drivers/hid/hid-picolcd_cir.c | 3 +-
drivers/media/common/siano/smsir.c | 3 +-
drivers/media/i2c/ir-kbd-i2c.c | 2 +-
drivers/media/pci/bt8xx/bttv-input.c | 2 +-
drivers/media/pci/cx23885/cx23885-input.c | 11 +-
drivers/media/pci/cx88/cx88-input.c | 3 +-
drivers/media/pci/dm1105/dm1105.c | 3 +-
drivers/media/pci/mantis/mantis_input.c | 2 +-
drivers/media/pci/saa7134/saa7134-input.c | 2 +-
drivers/media/pci/smipcie/smipcie-ir.c | 3 +-
drivers/media/pci/ttpci/budget-ci.c | 2 +-
drivers/media/rc/Kconfig | 9 +
drivers/media/rc/Makefile | 1 +
drivers/media/rc/ati_remote.c | 3 +-
drivers/media/rc/ene_ir.c | 3 +-
drivers/media/rc/fintek-cir.c | 3 +-
drivers/media/rc/gpio-ir-recv.c | 3 +-
drivers/media/rc/igorplugusb.c | 3 +-
drivers/media/rc/iguanair.c | 3 +-
drivers/media/rc/img-ir/img-ir-hw.c | 2 +-
drivers/media/rc/img-ir/img-ir-raw.c | 3 +-
drivers/media/rc/imon.c | 3 +-
drivers/media/rc/ir-hix5hd2.c | 3 +-
drivers/media/rc/ir-lirc-codec.c | 2 +-
drivers/media/rc/ir-spi.c | 221 +++++++++++++++++++++
drivers/media/rc/ite-cir.c | 3 +-
drivers/media/rc/mceusb.c | 3 +-
drivers/media/rc/meson-ir.c | 3 +-
drivers/media/rc/nuvoton-cir.c | 3 +-
drivers/media/rc/rc-ir-raw.c | 17 +-
drivers/media/rc/rc-loopback.c | 3 +-
drivers/media/rc/rc-main.c | 179 ++++++++++-------
drivers/media/rc/redrat3.c | 3 +-
drivers/media/rc/st_rc.c | 3 +-
drivers/media/rc/streamzap.c | 3 +-
drivers/media/rc/sunxi-cir.c | 3 +-
drivers/media/rc/ttusbir.c | 3 +-
drivers/media/rc/winbond-cir.c | 3 +-
drivers/media/usb/au0828/au0828-input.c | 3 +-
drivers/media/usb/cx231xx/cx231xx-input.c | 2 +-
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 3 +-
drivers/media/usb/dvb-usb/dvb-usb-remote.c | 3 +-
drivers/media/usb/em28xx/em28xx-input.c | 2 +-
drivers/media/usb/tm6000/tm6000-input.c | 3 +-
drivers/staging/media/cec/cec-core.c | 3 +-
include/media/rc-core.h | 13 +-
47 files changed, 421 insertions(+), 164 deletions(-)
create mode 100644 Documentation/devicetree/bindings/media/spi-ir.txt
create mode 100644 drivers/media/rc/ir-spi.c
--
2.9.3
[toc] | [next] | [standalone]
| From | Andi Shyti <andi.shyti@samsung.com> |
|---|---|
| Date | 2016-09-01 23:30 +0200 |
| Subject | [PATCH v2 7/7] [media] rc: add support for IR LEDs driven through SPI |
| Message-ID | <scHID-79t-73@gated-at.bofh.it> |
| In reply to | #1474667 |
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 an rc character device. The chardev
is handled by the LIRC framework and its functionality basically
provides:
- write: the driver gets a pulse/space signal and translates it
to a binary signal that will be streamed to the IR led through
the SPI framework.
- set frequency: sets the frequency whith which the data should
be sent. This is handle with ioctl with the
LIRC_SET_SEND_CARRIER flag (as per lirc documentation)
- set duty cycle: this is also handled with ioctl with the
LIRC_SET_SEND_DUTY_CYCLE flag. The driver handles duty cycles
of 50%, 60%, 70%, 75%, 80% and 90%, calculated on 16bit data.
The character device is created under /dev/lircX name, where X is
and ID assigned by the LIRC framework.
Example of usage:
fd = open("/dev/lirc0", O_RDWR);
if (fd < 0)
return -1;
val = 608000;
ret = ioctl(fd, LIRC_SET_SEND_CARRIER, &val);
if (ret < 0)
return -1;
val = 60;
ret = ioctl(fd, LIRC_SET_SEND_DUTY_CYCLE, &val);
if (ret < 0)
return -1;
n = write(fd, buffer, BUF_LEN);
if (n < 0 || n != BUF_LEN)
ret = -1;
close(fd);
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
drivers/media/rc/Kconfig | 9 ++
drivers/media/rc/Makefile | 1 +
drivers/media/rc/ir-spi.c | 221 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 231 insertions(+)
create mode 100644 drivers/media/rc/ir-spi.c
diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index 370e16e..207dfcc 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -261,6 +261,15 @@ config IR_REDRAT3
To compile this driver as a module, choose M here: the
module will be called redrat3.
+config IR_SPI
+ tristate "SPI connected IR LED"
+ depends on SPI && LIRC
+ ---help---
+ Say Y if you want to use an IR LED connected through SPI bus.
+
+ To compile this driver as a module, choose M here: the module will be
+ called ir-spi.
+
config IR_STREAMZAP
tristate "Streamzap PC Remote IR Receiver"
depends on USB_ARCH_HAS_HCD
diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile
index 379a5c0..1417c8d 100644
--- a/drivers/media/rc/Makefile
+++ b/drivers/media/rc/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_IR_NUVOTON) += nuvoton-cir.o
obj-$(CONFIG_IR_ENE) += ene_ir.o
obj-$(CONFIG_IR_REDRAT3) += redrat3.o
obj-$(CONFIG_IR_RX51) += ir-rx51.o
+obj-$(CONFIG_IR_SPI) += ir-spi.o
obj-$(CONFIG_IR_STREAMZAP) += streamzap.o
obj-$(CONFIG_IR_WINBOND_CIR) += winbond-cir.o
obj-$(CONFIG_RC_LOOPBACK) += rc-loopback.o
diff --git a/drivers/media/rc/ir-spi.c b/drivers/media/rc/ir-spi.c
new file mode 100644
index 0000000..34d5a0c
--- /dev/null
+++ b/drivers/media/rc/ir-spi.c
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Author: Andi Shyti <andi.shyti@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * SPI driven IR LED device driver
+ */
+
+#include <linux/delay.h>
+#include <linux/fs.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/of_gpio.h>
+#include <linux/regulator/consumer.h>
+#include <linux/spi/spi.h>
+#include <media/rc-core.h>
+
+#define IR_SPI_DRIVER_NAME "ir-spi"
+
+/* pulse value for different duty cycles */
+#define IR_SPI_PULSE_DC_50 0xff00
+#define IR_SPI_PULSE_DC_60 0xfc00
+#define IR_SPI_PULSE_DC_70 0xf800
+#define IR_SPI_PULSE_DC_75 0xf000
+#define IR_SPI_PULSE_DC_80 0xc000
+#define IR_SPI_PULSE_DC_90 0x8000
+
+/* duty cycles values */
+#define IR_SPI_DUTY_CYCLE_50 50
+#define IR_SPI_DUTY_CYCLE_60 60
+#define IR_SPI_DUTY_CYCLE_70 70
+#define IR_SPI_DUTY_CYCLE_75 75
+#define IR_SPI_DUTY_CYCLE_80 80
+#define IR_SPI_DUTY_CYCLE_90 90
+
+#define IR_SPI_DEFAULT_FREQUENCY 38000
+#define IR_SPI_BIT_PER_WORD 8
+#define IR_SPI_MAX_BUFSIZE 4096
+
+struct ir_spi_data {
+ u32 freq;
+ u8 duty_cycle;
+ bool negated;
+
+ u16 tx_buf[IR_SPI_MAX_BUFSIZE];
+ u16 pulse;
+ u16 space;
+
+ struct rc_dev *rc;
+ struct spi_device *spi;
+ struct regulator *regulator;
+};
+
+static int ir_spi_tx(struct rc_dev *dev, unsigned int *buffer, unsigned int count)
+{
+ int i;
+ int ret;
+ unsigned int len = 0;
+ struct ir_spi_data *idata = dev->priv;
+ struct spi_transfer xfer;
+
+ /* convert the pulse/space signal to raw binary signal */
+ for (i = 0; i < count; i++) {
+ int j;
+ u16 val = ((i+1) % 2) ? idata->pulse : idata->space;
+
+ if (len + buffer[i] >= IR_SPI_MAX_BUFSIZE)
+ return -EINVAL;
+
+ /*
+ * the first value in buffer is a pulse, so that 0, 2, 4, ...
+ * contain a pulse duration. On the contrary, 1, 3, 5, ...
+ * contain a space duration.
+ */
+ val = (i % 2) ? idata->space : idata->pulse;
+ for (j = 0; j < buffer[i]; j++)
+ idata->tx_buf[len++] = val;
+ }
+
+ pr_info("from %u data, we originated %u raw data\n", count, len);
+
+ memset(&xfer, 0, sizeof(xfer));
+
+ xfer.speed_hz = idata->freq;
+ xfer.len = len * sizeof(*idata->tx_buf);
+ xfer.tx_buf = idata->tx_buf;
+
+ ret = regulator_enable(idata->regulator);
+ if (ret)
+ return ret;
+
+ ret = spi_sync_transfer(idata->spi, &xfer, 1);
+ if (ret)
+ dev_err(&idata->spi->dev, "unable to deliver the signal\n");
+
+ regulator_disable(idata->regulator);
+
+ return ret ? ret : len;
+}
+
+static int ir_spi_set_tx_carrier(struct rc_dev *dev, u32 carrier)
+{
+ struct ir_spi_data *idata = dev->priv;
+
+ if (!carrier)
+ return -EINVAL;
+
+ idata->freq = carrier;
+
+ return 0;
+}
+
+static int ir_spi_set_duty_cycle(struct rc_dev *dev, u32 duty_cycle)
+{
+ struct ir_spi_data *idata = dev->priv;
+
+ switch (duty_cycle) {
+ case IR_SPI_DUTY_CYCLE_90:
+ idata->pulse = IR_SPI_PULSE_DC_90;
+ break;
+ case IR_SPI_DUTY_CYCLE_80:
+ idata->pulse = IR_SPI_PULSE_DC_80;
+ break;
+ case IR_SPI_DUTY_CYCLE_75:
+ idata->pulse = IR_SPI_PULSE_DC_75;
+ break;
+ case IR_SPI_DUTY_CYCLE_70:
+ idata->pulse = IR_SPI_PULSE_DC_70;
+ break;
+ case IR_SPI_DUTY_CYCLE_60:
+ idata->pulse = IR_SPI_PULSE_DC_60;
+ break;
+ case IR_SPI_DUTY_CYCLE_50:
+ default:
+ idata->pulse = IR_SPI_PULSE_DC_50;
+ }
+
+ if (idata->negated) {
+ idata->pulse = ~idata->pulse;
+ idata->space = 0xffff;
+ } else {
+ idata->space = 0;
+ }
+
+ return 0;
+}
+
+static int ir_spi_probe(struct spi_device *spi)
+{
+ int ret;
+ u8 dc;
+ struct ir_spi_data *idata;
+
+ idata = devm_kzalloc(&spi->dev, sizeof(*idata), GFP_KERNEL);
+ if (!idata)
+ return -ENOMEM;
+
+ idata->regulator = devm_regulator_get(&spi->dev, "irda_regulator");
+ if (IS_ERR(idata->regulator))
+ return PTR_ERR(idata->regulator);
+
+ idata->rc = rc_allocate_device(RC_DRIVER_IR_RAW_TX);
+ if (!idata->rc)
+ return -ENOMEM;
+
+ idata->rc->tx_ir = ir_spi_tx;
+ idata->rc->s_tx_carrier = ir_spi_set_tx_carrier;
+ idata->rc->s_tx_duty_cycle = ir_spi_set_duty_cycle;
+ idata->rc->driver_name = IR_SPI_DRIVER_NAME;
+ idata->rc->priv = idata;
+ idata->spi = spi;
+
+ idata->negated = of_property_read_bool(spi->dev.of_node, "negated");
+ ret = of_property_read_u8(spi->dev.of_node, "duty-cycle", &dc);
+ if (ret)
+ dc = IR_SPI_DUTY_CYCLE_50;
+
+ ret = ir_spi_set_duty_cycle(idata->rc, dc);
+ if (ret)
+ return ret;
+
+ idata->freq = IR_SPI_DEFAULT_FREQUENCY;
+
+ ret = rc_register_device(idata->rc);
+ if (ret)
+ rc_unregister_device(idata->rc);
+
+ return ret;
+}
+
+static int ir_spi_remove(struct spi_device *spi)
+{
+ struct ir_spi_data *idata = spi_get_drvdata(spi);
+
+ rc_unregister_device(idata->rc);
+
+ return 0;
+}
+
+static const struct of_device_id ir_spi_of_match[] = {
+ { .compatible = "ir-spi" },
+ {},
+};
+
+static struct spi_driver ir_spi_driver = {
+ .probe = ir_spi_probe,
+ .remove = ir_spi_remove,
+ .driver = {
+ .name = IR_SPI_DRIVER_NAME,
+ .of_match_table = ir_spi_of_match,
+ },
+};
+
+module_spi_driver(ir_spi_driver);
+
+MODULE_AUTHOR("Andi Shyti <andi.shyti@samsung.com>");
+MODULE_DESCRIPTION("SPI IR LED");
+MODULE_LICENSE("GPL v2");
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Andi Shyti <andi.shyti@samsung.com> |
|---|---|
| Date | 2016-09-01 23:40 +0200 |
| Subject | [PATCH v2 5/7] [media] ir-lirc-codec: don't wait any transmitting time for tx only devices |
| Message-ID | <scHSi-7dg-39@gated-at.bofh.it> |
| In reply to | #1474667 |
Transmitters do not need to wait until the data has been sent (and of course received). Return before waiting. Signed-off-by: Andi Shyti <andi.shyti@samsung.com> --- drivers/media/rc/ir-lirc-codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c index c327730..d8953fb 100644 --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c @@ -153,7 +153,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf, } ret = dev->tx_ir(dev, txbuf, count); - if (ret < 0) + if (ret < 0 || dev->driver_type == RC_DRIVER_IR_RAW_TX) goto out; for (duration = i = 0; i < ret; i++) -- 2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Sean Young <sean@mess.org> |
|---|---|
| Date | 2016-09-02 10:50 +0200 |
| Subject | Re: [PATCH v2 5/7] [media] ir-lirc-codec: don't wait any transmitting time for tx only devices |
| Message-ID | <scSkF-5B4-25@gated-at.bofh.it> |
| In reply to | #1474679 |
On Fri, Sep 02, 2016 at 02:16:27AM +0900, Andi Shyti wrote: > Transmitters do not need to wait until the data has been sent > (and of course received). Return before waiting. > > Signed-off-by: Andi Shyti <andi.shyti@samsung.com> > --- > drivers/media/rc/ir-lirc-codec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c > index c327730..d8953fb 100644 > --- a/drivers/media/rc/ir-lirc-codec.c > +++ b/drivers/media/rc/ir-lirc-codec.c > @@ -153,7 +153,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf, > } > > ret = dev->tx_ir(dev, txbuf, count); > - if (ret < 0) > + if (ret < 0 || dev->driver_type == RC_DRIVER_IR_RAW_TX) Just because a driver only does transmit doesn't mean its transmit ABI should change. Now this bit of code is pretty horrible. It ensures that the call to write() takes at least as long as the length of the transmit IR by sleeping. That's not much of a guarantee that the IR has been sent. Note that in the case of ir-spi, since your spi transfer is sync no sleep should be introduced here. The gap calculation in lirc checks that if the call to write() took _longer_ than expected wait before sending the next IR code (when either multiple IR codes or repeats are specified). Introducing the sleep in the kernel here does not help at all, lirc already ensures that it waits as long as the IR is long (see schedule_repeat_timer in lirc). This change was introduced in 3.10, commit f8e00d5. Sean
[toc] | [prev] | [next] | [standalone]
| From | Andi Shyti <andi.shyti@samsung.com> |
|---|---|
| Date | 2016-09-01 23:40 +0200 |
| Subject | [PATCH v2 3/7] [media] rc-core: add support for IR raw transmitters |
| Message-ID | <scHSj-7dg-47@gated-at.bofh.it> |
| In reply to | #1474667 |
IR raw transmitter driver type is specified in the enum
rc_driver_type as RC_DRIVER_IR_RAW_TX which includes all those
devices that transmit raw stream of bit to a receiver.
The data are provided by userspace applications, therefore they
don't need any input device allocation, but still they need to be
registered as raw devices.
Suggested-by: Sean Young <sean@mess.org>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
drivers/media/rc/rc-main.c | 39 +++++++++++++++++++++++----------------
include/media/rc-core.h | 9 ++++++---
2 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 7961083..c3c1f68 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1361,20 +1361,24 @@ struct rc_dev *rc_allocate_device(enum rc_driver_type type)
if (!dev)
return NULL;
- dev->input_dev = input_allocate_device();
- if (!dev->input_dev) {
- kfree(dev);
- return NULL;
- }
+ if (type != RC_DRIVER_IR_RAW_TX) {
+ dev->input_dev = input_allocate_device();
+ if (!dev->input_dev) {
+ kfree(dev);
+ return NULL;
+ }
+
+ dev->input_dev->getkeycode = ir_getkeycode;
+ dev->input_dev->setkeycode = ir_setkeycode;
+ input_set_drvdata(dev->input_dev, dev);
- dev->input_dev->getkeycode = ir_getkeycode;
- dev->input_dev->setkeycode = ir_setkeycode;
- input_set_drvdata(dev->input_dev, dev);
+ setup_timer(&dev->timer_keyup, ir_timer_keyup,
+ (unsigned long)dev);
- spin_lock_init(&dev->rc_map.lock);
- spin_lock_init(&dev->keylock);
+ spin_lock_init(&dev->rc_map.lock);
+ spin_lock_init(&dev->keylock);
+ }
mutex_init(&dev->lock);
- setup_timer(&dev->timer_keyup, ir_timer_keyup, (unsigned long)dev);
dev->dev.type = &rc_dev_type;
dev->dev.class = &rc_class;
@@ -1474,7 +1478,7 @@ out_table:
static void rc_free_rx_device(struct rc_dev *dev)
{
- if (!dev)
+ if (!dev || dev->driver_type == RC_DRIVER_IR_RAW_TX)
return;
ir_free_table(&dev->rc_map);
@@ -1522,11 +1526,14 @@ int rc_register_device(struct rc_dev *dev)
dev->input_name ?: "Unspecified device", path ?: "N/A");
kfree(path);
- rc = rc_setup_rx_device(dev);
- if (rc)
- goto out_dev;
+ if (dev->driver_type != RC_DRIVER_IR_RAW_TX) {
+ rc = rc_setup_rx_device(dev);
+ if (rc)
+ goto out_dev;
+ }
- if (dev->driver_type == RC_DRIVER_IR_RAW) {
+ if (dev->driver_type == RC_DRIVER_IR_RAW ||
+ dev->driver_type == RC_DRIVER_IR_RAW_TX) {
if (!raw_init) {
request_module_nowait("ir-lirc-codec");
raw_init = true;
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index 4fc60dd..56e33c1 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -32,13 +32,16 @@ do { \
/**
* enum rc_driver_type - type of the RC output
*
- * @RC_DRIVER_SCANCODE: Driver or hardware generates a scancode
- * @RC_DRIVER_IR_RAW: Driver or hardware generates pulse/space sequences.
- * It needs a Infra-Red pulse/space decoder
+ * @RC_DRIVER_SCANCODE: Driver or hardware generates a scancode
+ * @RC_DRIVER_IR_RAW: Driver or hardware generates pulse/space sequences.
+ * It needs a Infra-Red pulse/space decoder
+ * @RC_DRIVER_IR_RAW_TX: Device transmitter only,
+ driver requires pulce/spce data sequence.
*/
enum rc_driver_type {
RC_DRIVER_SCANCODE = 0,
RC_DRIVER_IR_RAW,
+ RC_DRIVER_IR_RAW_TX,
};
/**
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Sean Young <sean@mess.org> |
|---|---|
| Date | 2016-09-01 23:40 +0200 |
| Subject | Re: [PATCH v2 3/7] [media] rc-core: add support for IR raw transmitters |
| Message-ID | <scHSj-7dg-45@gated-at.bofh.it> |
| In reply to | #1474683 |
On Fri, Sep 02, 2016 at 02:16:25AM +0900, Andi Shyti wrote:
> IR raw transmitter driver type is specified in the enum
> rc_driver_type as RC_DRIVER_IR_RAW_TX which includes all those
> devices that transmit raw stream of bit to a receiver.
>
> The data are provided by userspace applications, therefore they
> don't need any input device allocation, but still they need to be
> registered as raw devices.
>
> Suggested-by: Sean Young <sean@mess.org>
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> ---
> drivers/media/rc/rc-main.c | 39 +++++++++++++++++++++++----------------
> include/media/rc-core.h | 9 ++++++---
> 2 files changed, 29 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
> index 7961083..c3c1f68 100644
> --- a/drivers/media/rc/rc-main.c
> +++ b/drivers/media/rc/rc-main.c
> @@ -1361,20 +1361,24 @@ struct rc_dev *rc_allocate_device(enum rc_driver_type type)
> if (!dev)
> return NULL;
>
> - dev->input_dev = input_allocate_device();
> - if (!dev->input_dev) {
> - kfree(dev);
> - return NULL;
> - }
> + if (type != RC_DRIVER_IR_RAW_TX) {
> + dev->input_dev = input_allocate_device();
> + if (!dev->input_dev) {
> + kfree(dev);
> + return NULL;
> + }
> +
> + dev->input_dev->getkeycode = ir_getkeycode;
> + dev->input_dev->setkeycode = ir_setkeycode;
> + input_set_drvdata(dev->input_dev, dev);
>
> - dev->input_dev->getkeycode = ir_getkeycode;
> - dev->input_dev->setkeycode = ir_setkeycode;
> - input_set_drvdata(dev->input_dev, dev);
> + setup_timer(&dev->timer_keyup, ir_timer_keyup,
> + (unsigned long)dev);
>
> - spin_lock_init(&dev->rc_map.lock);
> - spin_lock_init(&dev->keylock);
> + spin_lock_init(&dev->rc_map.lock);
> + spin_lock_init(&dev->keylock);
> + }
> mutex_init(&dev->lock);
> - setup_timer(&dev->timer_keyup, ir_timer_keyup, (unsigned long)dev);
>
> dev->dev.type = &rc_dev_type;
> dev->dev.class = &rc_class;
> @@ -1474,7 +1478,7 @@ out_table:
>
> static void rc_free_rx_device(struct rc_dev *dev)
> {
> - if (!dev)
> + if (!dev || dev->driver_type == RC_DRIVER_IR_RAW_TX)
> return;
>
> ir_free_table(&dev->rc_map);
> @@ -1522,11 +1526,14 @@ int rc_register_device(struct rc_dev *dev)
An tx-only device shouldn't have the sysfs attribute protocol, that
should be handled here too.
> dev->input_name ?: "Unspecified device", path ?: "N/A");
> kfree(path);
>
> - rc = rc_setup_rx_device(dev);
> - if (rc)
> - goto out_dev;
> + if (dev->driver_type != RC_DRIVER_IR_RAW_TX) {
> + rc = rc_setup_rx_device(dev);
> + if (rc)
> + goto out_dev;
> + }
>
> - if (dev->driver_type == RC_DRIVER_IR_RAW) {
> + if (dev->driver_type == RC_DRIVER_IR_RAW ||
> + dev->driver_type == RC_DRIVER_IR_RAW_TX) {
> if (!raw_init) {
> request_module_nowait("ir-lirc-codec");
> raw_init = true;
> diff --git a/include/media/rc-core.h b/include/media/rc-core.h
> index 4fc60dd..56e33c1 100644
> --- a/include/media/rc-core.h
> +++ b/include/media/rc-core.h
> @@ -32,13 +32,16 @@ do { \
> /**
> * enum rc_driver_type - type of the RC output
> *
> - * @RC_DRIVER_SCANCODE: Driver or hardware generates a scancode
> - * @RC_DRIVER_IR_RAW: Driver or hardware generates pulse/space sequences.
> - * It needs a Infra-Red pulse/space decoder
> + * @RC_DRIVER_SCANCODE: Driver or hardware generates a scancode
> + * @RC_DRIVER_IR_RAW: Driver or hardware generates pulse/space sequences.
> + * It needs a Infra-Red pulse/space decoder
> + * @RC_DRIVER_IR_RAW_TX: Device transmitter only,
> + driver requires pulce/spce data sequence.
> */
> enum rc_driver_type {
> RC_DRIVER_SCANCODE = 0,
> RC_DRIVER_IR_RAW,
> + RC_DRIVER_IR_RAW_TX,
> };
>
> /**
> --
> 2.9.3
[toc] | [prev] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2016-09-02 02:30 +0200 |
| Subject | Re: [PATCH v2 3/7] [media] rc-core: add support for IR raw transmitters |
| Message-ID | <scKwN-yx-5@gated-at.bofh.it> |
| In reply to | #1474683 |
[Multipart message — attachments visible in raw view] — view raw
Hi Andi,
[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.8-rc4 next-20160825]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]
url: https://github.com/0day-ci/linux/commits/Andi-Shyti/Add-support-for-IR-transmitters/20160902-060825
base: git://linuxtv.org/media_tree.git master
reproduce: make htmldocs
All warnings (new ones prefixed by >>):
make[3]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.
drivers/gpu/drm/i915/i915_vgpu.c:105: warning: No description found for parameter 'dev_priv'
drivers/gpu/drm/i915/i915_vgpu.c:184: warning: No description found for parameter 'dev_priv'
drivers/gpu/drm/i915/i915_vgpu.c:184: warning: Excess function parameter 'dev' description in 'intel_vgt_balloon'
drivers/gpu/drm/i915/i915_vgpu.c:106: warning: No description found for parameter 'dev_priv'
drivers/gpu/drm/i915/i915_vgpu.c:185: warning: No description found for parameter 'dev_priv'
drivers/gpu/drm/i915/i915_vgpu.c:185: warning: Excess function parameter 'dev' description in 'intel_vgt_balloon'
drivers/gpu/drm/i915/i915_gem.c:929: warning: No description found for parameter 'i915'
drivers/gpu/drm/i915/i915_gem.c:929: warning: Excess function parameter 'dev' description in 'i915_gem_gtt_pwrite_fast'
drivers/gpu/drm/i915/intel_hotplug.c:543: warning: Excess function parameter 'enabled' description in 'intel_hpd_poll_init'
drivers/gpu/drm/i915/intel_hotplug.c:544: warning: Excess function parameter 'enabled' description in 'intel_hpd_poll_init'
drivers/gpu/drm/i915/intel_fbc.c:1087: warning: No description found for parameter 'crtc_state'
drivers/gpu/drm/i915/intel_fbc.c:1087: warning: No description found for parameter 'plane_state'
drivers/gpu/drm/i915/intel_fbc.c:1088: warning: No description found for parameter 'crtc_state'
drivers/gpu/drm/i915/intel_fbc.c:1088: warning: No description found for parameter 'plane_state'
>> include/media/rc-core.h:39: warning: bad line: driver requires pulce/spce data sequence.
drivers/gpu/drm/drm_crtc.c:1272: WARNING: Inline literal start-string without end-string.
drivers/gpu/drm/drm_crtc.c:1387: WARNING: Inline literal start-string without end-string.
include/drm/drm_crtc.h:1200: WARNING: Inline literal start-string without end-string.
include/drm/drm_crtc.h:1253: WARNING: Inline literal start-string without end-string.
include/drm/drm_crtc.h:1266: WARNING: Inline literal start-string without end-string.
include/drm/drm_crtc.h:1270: WARNING: Inline literal start-string without end-string.
drivers/gpu/drm/drm_irq.c:718: WARNING: Option list ends without a blank line; unexpected unindent.
drivers/gpu/drm/drm_fb_helper.c:2196: WARNING: Inline emphasis start-string without end-string.
drivers/gpu/drm/drm_simple_kms_helper.c:156: WARNING: Inline literal start-string without end-string.
include/drm/drm_gem.h:212: WARNING: Inline emphasis start-string without end-string.
drivers/gpu/drm/i915/intel_uncore.c:1622: ERROR: Unexpected indentation.
drivers/gpu/drm/i915/intel_uncore.c:1623: WARNING: Block quote ends without a blank line; unexpected unindent.
drivers/gpu/drm/i915/intel_uncore.c:1656: ERROR: Unexpected indentation.
drivers/gpu/drm/i915/intel_uncore.c:1657: WARNING: Block quote ends without a blank line; unexpected unindent.
drivers/gpu/drm/i915/i915_vgpu.c:178: WARNING: Literal block ends without a blank line; unexpected unindent.
drivers/gpu/drm/i915/intel_audio.c:54: WARNING: Inline emphasis start-string without end-string.
drivers/gpu/drm/i915/intel_audio.c:54: WARNING: Inline emphasis start-string without end-string.
drivers/gpu/drm/i915/intel_lrc.c:1166: ERROR: Unexpected indentation.
drivers/gpu/drm/i915/intel_lrc.c:1167: WARNING: Block quote ends without a blank line; unexpected unindent.
drivers/gpu/drm/i915/intel_guc_fwif.h:159: WARNING: Block quote ends without a blank line; unexpected unindent.
drivers/gpu/drm/i915/intel_guc_fwif.h:178: WARNING: Enumerated list ends without a blank line; unexpected unindent.
WARNING: dvipng command 'dvipng' cannot be run (needed for math display), check the imgmath_dvipng setting
vim +39 include/media/rc-core.h
23 #include <media/rc-map.h>
24
25 extern int rc_core_debug;
26 #define IR_dprintk(level, fmt, ...) \
27 do { \
28 if (rc_core_debug >= level) \
29 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
30 } while (0)
31
32 /**
33 * enum rc_driver_type - type of the RC output
34 *
35 * @RC_DRIVER_SCANCODE: Driver or hardware generates a scancode
36 * @RC_DRIVER_IR_RAW: Driver or hardware generates pulse/space sequences.
37 * It needs a Infra-Red pulse/space decoder
38 * @RC_DRIVER_IR_RAW_TX: Device transmitter only,
> 39 driver requires pulce/spce data sequence.
40 */
41 enum rc_driver_type {
42 RC_DRIVER_SCANCODE = 0,
43 RC_DRIVER_IR_RAW,
44 RC_DRIVER_IR_RAW_TX,
45 };
46
47 /**
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web