* [PATCH v2 00/15] media: rc: ImgTec IR decoder driver
@ 2014-01-17 13:58 James Hogan
2014-01-17 13:58 ` [PATCH v2 06/15] dt: binding: add binding for ImgTec IR block James Hogan
[not found] ` <1389967140-20704-1-git-send-email-james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
0 siblings, 2 replies; 14+ messages in thread
From: James Hogan @ 2014-01-17 13:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab, linux-media
Cc: James Hogan, Jarod Wilson, Grant Likely, Rob Herring, devicetree,
Rob Landley, linux-doc, Tomasz Figa
A few generic changes (patches 1-5) and then add a driver for the ImgTec
Infrared decoder block (patches 6-15). Two separate rc input devices are
exposed depending on kernel configuration. One uses the hardware decoder
which is set up with timings for a specific protocol and supports
mask/value filtering and wake events. The other uses raw edge interrupts
and the generic software protocol decoders to allow multiple protocols
to be supported, including those not supported by the hardware decoder.
The hardware decoder timing values, raw data to scan code conversion
function and scan code filter to raw data filter conversion function are
provided in separate files for each protocol which the main driver can
use. The new generic scan code filter interface is made use of to reduce
interrupts and control wake events.
Changes in v2:
Patchset:
- New generic patches 1, 3-5:
- Patch 1 adds sysfs documentation which is extended by patch 4.
- Patch 3 adds a raw decoder for the Sharp protocol.
- Patch 4 adds the scancode filtering sysfs interface generically (bit
of an RFC really).
- Patch 5 changes the scancode format for 32-bit NEC (bit of an RFC
really - can we get away with this?).
DT bindings:
- Future proof compatible string from "img,ir" to "img,ir1", where the 1
corresponds to the major revision number of the hardware (Tomasz
Figa).
- Added clock-names property and three specific clock names described in
the manual, only one of which is used by the current driver (Tomasz
Figa).
Misc:
- Use spin_lock_irq() instead of spin_lock_irqsave() in various bits of
code that aren't accessible from hard interrupt context.
- Add io.h include to img-ir.h.
Raw Decoder:
- Echo the last sample after 150ms if no edges have been detected. This
allows the soft decoder state machines to recognise the final space
when no repeat code is received.
- Avoid removal race by checking for RC device in ISR.
Hardware Decoder:
- Remove the dynamic registration and unregistration of protocol decoder
timings. It didn't really get us much and it complicated locking and
load ordering.
- Simplify locking of decoders, they're now only modified when
preprocessed, and all other use is after that, so preprocessing is the
only place locking is required.
- Use the new generic filtering interface rather than creating the sysfs
files in the driver. This rearranges the code a bit, so as to use an
array of 2 filters (normal and wake) rather than separate struct
members for each, and passes the array index around between functions
rather than the pointer to the filter.
- Extend the scancode() decoder callback to handle full 32bit scancodes.
Previously negative scancodes were treated specially, and indicated
repeat codes or invalid raw data, but 32bit NEC may result in a
scancode with the top bit set. Therefore change the scancode() return
value to simply indicate success/fail/repeat, and add an extra
scancode output pointer parameter that must have been written by the
callback if it returns IMG_IR_SCANCODE.
- Separate clock rate specific data in the decoder timings structure so
that it can be more easily shared between instantiations of the
driver. A new struct img_ir_reg_timings stores the calculated clock
rate specific register values for the timings. This allows us to make
more widespread use of const on decoder timings.
- Make tolerance of hardware decoder timings configurable per protocol
rather than being fixed at 10% for all protocols. This allows the
tolerance of the Sharp protocol timings in particular to be increased.
- Fix typo in img_ir_enable_wake (s/RC_FILTER_WAKUP/RC_FILTER_WAKEUP/).
- Fix change_protocol to accept a zero protocol mask (for when "none" is
written to /sys/class/rc/rcX/protocols).
- Stop the end_timer (for keyups after repeat code timeout) safely on
removal and protocol switch.
- Fix rc_map.rc_type initialisation to use __ffs64(proto_mask).
- Fix img_ir_allowed_protos() to return a protocol mask in a u64 rather
than an unsigned long.
- Use setup_timer() macro for the end timer rather than using
init_timer() and setting function pointer and data explicitly.
- Add a debug message for when the scancode() callback rejects the data.
- Minor cosmetic changes (variable naming e.g. s/ir_dev/rdev/ in
img_ir_set_protocol).
NEC decoder:
- Update scancode and filter callbacks to handle 32-bit NEC as used by
Apple and TiVo remotes (the new 32-bit NEC scancode format is used,
with the correct bit orientation).
- Make it possible to set the filter to extended NEC even when the high
bits of the scancode value aren't set, by taking the mask into account
too. My TV remote happens to use extended NEC with address 0x7f00,
which unfortunately maps to scancodes 0x007f** which looks like normal
NEC and couldn't previously be filtered.
Sharp decoder:
- Fix typo in logic 1 pulse width comment.
- Set tolerance to 20%, which seemed to be needed for the cases I have.
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
Cc: Jarod Wilson <jarod@redhat.com>
Cc: linux-media@vger.kernel.org
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: Rob Landley <rob@landley.net>
Cc: linux-doc@vger.kernel.org
Cc: Tomasz Figa <tomasz.figa@gmail.com>
James Hogan (15):
media: rc: document rc class sysfs API
media: rc: add Sharp infrared protocol
media: rc: add raw decoder for Sharp protocol
media: rc: add sysfs scancode filtering interface
media: rc: change 32bit NEC scancode format
dt: binding: add binding for ImgTec IR block
media: rc: img-ir: add base driver
media: rc: img-ir: add raw driver
media: rc: img-ir: add hardware decoder driver
media: rc: img-ir: add to build
media: rc: img-ir: add NEC decoder module
media: rc: img-ir: add JVC decoder module
media: rc: img-ir: add Sony decoder module
media: rc: img-ir: add Sharp decoder module
media: rc: img-ir: add Sanyo decoder module
Documentation/ABI/testing/sysfs-class-rc | 92 ++
.../devicetree/bindings/media/img-ir1.txt | 30 +
drivers/media/rc/Kconfig | 11 +
drivers/media/rc/Makefile | 2 +
drivers/media/rc/img-ir/Kconfig | 61 ++
drivers/media/rc/img-ir/Makefile | 11 +
drivers/media/rc/img-ir/img-ir-core.c | 176 ++++
drivers/media/rc/img-ir/img-ir-hw.c | 1040 ++++++++++++++++++++
drivers/media/rc/img-ir/img-ir-hw.h | 269 +++++
drivers/media/rc/img-ir/img-ir-jvc.c | 92 ++
drivers/media/rc/img-ir/img-ir-nec.c | 148 +++
drivers/media/rc/img-ir/img-ir-raw.c | 151 +++
drivers/media/rc/img-ir/img-ir-raw.h | 60 ++
drivers/media/rc/img-ir/img-ir-sanyo.c | 122 +++
drivers/media/rc/img-ir/img-ir-sharp.c | 99 ++
drivers/media/rc/img-ir/img-ir-sony.c | 145 +++
drivers/media/rc/img-ir/img-ir.h | 166 ++++
drivers/media/rc/ir-nec-decoder.c | 5 +-
drivers/media/rc/ir-sharp-decoder.c | 200 ++++
drivers/media/rc/keymaps/rc-tivo.c | 86 +-
drivers/media/rc/rc-core-priv.h | 6 +
drivers/media/rc/rc-main.c | 137 +++
include/media/rc-core.h | 29 +
include/media/rc-map.h | 4 +-
24 files changed, 3097 insertions(+), 45 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-class-rc
create mode 100644 Documentation/devicetree/bindings/media/img-ir1.txt
create mode 100644 drivers/media/rc/img-ir/Kconfig
create mode 100644 drivers/media/rc/img-ir/Makefile
create mode 100644 drivers/media/rc/img-ir/img-ir-core.c
create mode 100644 drivers/media/rc/img-ir/img-ir-hw.c
create mode 100644 drivers/media/rc/img-ir/img-ir-hw.h
create mode 100644 drivers/media/rc/img-ir/img-ir-jvc.c
create mode 100644 drivers/media/rc/img-ir/img-ir-nec.c
create mode 100644 drivers/media/rc/img-ir/img-ir-raw.c
create mode 100644 drivers/media/rc/img-ir/img-ir-raw.h
create mode 100644 drivers/media/rc/img-ir/img-ir-sanyo.c
create mode 100644 drivers/media/rc/img-ir/img-ir-sharp.c
create mode 100644 drivers/media/rc/img-ir/img-ir-sony.c
create mode 100644 drivers/media/rc/img-ir/img-ir.h
create mode 100644 drivers/media/rc/ir-sharp-decoder.c
--
1.8.3.2
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 06/15] dt: binding: add binding for ImgTec IR block
2014-01-17 13:58 [PATCH v2 00/15] media: rc: ImgTec IR decoder driver James Hogan
@ 2014-01-17 13:58 ` James Hogan
2014-02-06 11:24 ` Mauro Carvalho Chehab
2014-02-06 14:33 ` Rob Herring
[not found] ` <1389967140-20704-1-git-send-email-james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
1 sibling, 2 replies; 14+ messages in thread
From: James Hogan @ 2014-01-17 13:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab, linux-media
Cc: James Hogan, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, devicetree, Rob Landley, linux-doc, Tomasz Figa
Add device tree binding for ImgTec Consumer Infrared block, specifically
major revision 1 of the hardware.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
Cc: linux-media@vger.kernel.org
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
Cc: Kumar Gala <galak@codeaurora.org>
Cc: devicetree@vger.kernel.org
Cc: Rob Landley <rob@landley.net>
Cc: linux-doc@vger.kernel.org
Cc: Tomasz Figa <tomasz.figa@gmail.com>
---
v2:
- Future proof compatible string from "img,ir" to "img,ir1", where the 1
corresponds to the major revision number of the hardware (Tomasz
Figa).
- Added clock-names property and three specific clock names described in
the manual, only one of which is used by the current driver (Tomasz
Figa).
---
.../devicetree/bindings/media/img-ir1.txt | 30 ++++++++++++++++++++++
1 file changed, 30 insertions(+)
create mode 100644 Documentation/devicetree/bindings/media/img-ir1.txt
diff --git a/Documentation/devicetree/bindings/media/img-ir1.txt b/Documentation/devicetree/bindings/media/img-ir1.txt
new file mode 100644
index 0000000..ace5fd9
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/img-ir1.txt
@@ -0,0 +1,30 @@
+* ImgTec Infrared (IR) decoder version 1
+
+This binding is for Imagination Technologies' Infrared decoder block,
+specifically major revision 1.
+
+Required properties:
+- compatible: Should be "img,ir1"
+- reg: Physical base address of the controller and length of
+ memory mapped region.
+- interrupts: The interrupt specifier to the cpu.
+
+Optional properties:
+- clocks: List of clock specifiers as described in standard
+ clock bindings.
+- clock-names: List of clock names corresponding to the clocks
+ specified in the clocks property.
+ Accepted clock names are:
+ "core": Core clock (defaults to 32.768KHz if omitted).
+ "sys": System side (fast) clock.
+ "mod": Power modulation clock.
+
+Example:
+
+ ir@02006200 {
+ compatible = "img,ir1";
+ reg = <0x02006200 0x100>;
+ interrupts = <29 4>;
+ clocks = <&clk_32khz>;
+ clock-names = "core";
+ };
--
1.8.3.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 07/15] media: rc: img-ir: add base driver
[not found] ` <1389967140-20704-1-git-send-email-james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
@ 2014-01-17 13:58 ` James Hogan
[not found] ` <1389967140-20704-8-git-send-email-james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 14+ messages in thread
From: James Hogan @ 2014-01-17 13:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab, linux-media-u79uwXL29TY76Z2rM5mHXA
Cc: James Hogan, Grant Likely, Rob Herring,
devicetree-u79uwXL29TY76Z2rM5mHXA
Add base driver for the ImgTec Infrared decoder block. The driver is
split into separate components for raw (software) decode and hardware
decoder which are in following commits.
Signed-off-by: James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
Cc: Mauro Carvalho Chehab <m.chehab-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
v2:
- Use new DT binding, with a different compatibility string and get core
clock by name.
- Remove next pointer from struct img_ir_priv. This is related to the
removal of dynamic registration/unregistration of protocol decode
timings from later patches.
- Add io.h include to img-ir.h.
---
drivers/media/rc/img-ir/img-ir-core.c | 176 ++++++++++++++++++++++++++++++++++
drivers/media/rc/img-ir/img-ir.h | 166 ++++++++++++++++++++++++++++++++
2 files changed, 342 insertions(+)
create mode 100644 drivers/media/rc/img-ir/img-ir-core.c
create mode 100644 drivers/media/rc/img-ir/img-ir.h
diff --git a/drivers/media/rc/img-ir/img-ir-core.c b/drivers/media/rc/img-ir/img-ir-core.c
new file mode 100644
index 0000000..d510213
--- /dev/null
+++ b/drivers/media/rc/img-ir/img-ir-core.c
@@ -0,0 +1,176 @@
+/*
+ * ImgTec IR Decoder found in PowerDown Controller.
+ *
+ * Copyright 2010-2014 Imagination Technologies Ltd.
+ *
+ * This contains core img-ir code for setting up the driver. The two interfaces
+ * (raw and hardware decode) are handled separately.
+ */
+
+#include <linux/clk.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include "img-ir.h"
+
+static irqreturn_t img_ir_isr(int irq, void *dev_id)
+{
+ struct img_ir_priv *priv = dev_id;
+ u32 irq_status;
+
+ spin_lock(&priv->lock);
+ /* we have to clear irqs before reading */
+ irq_status = img_ir_read(priv, IMG_IR_IRQ_STATUS);
+ img_ir_write(priv, IMG_IR_IRQ_CLEAR, irq_status);
+
+ /* don't handle valid data irqs if we're only interested in matches */
+ irq_status &= img_ir_read(priv, IMG_IR_IRQ_ENABLE);
+
+ /* hand off edge interrupts to raw decode handler */
+ if (irq_status & IMG_IR_IRQ_EDGE && img_ir_raw_enabled(&priv->raw))
+ img_ir_isr_raw(priv, irq_status);
+
+ /* hand off hardware match interrupts to hardware decode handler */
+ if (irq_status & (IMG_IR_IRQ_DATA_MATCH |
+ IMG_IR_IRQ_DATA_VALID |
+ IMG_IR_IRQ_DATA2_VALID) &&
+ img_ir_hw_enabled(&priv->hw))
+ img_ir_isr_hw(priv, irq_status);
+
+ spin_unlock(&priv->lock);
+ return IRQ_HANDLED;
+}
+
+static void img_ir_setup(struct img_ir_priv *priv)
+{
+ /* start off with interrupts disabled */
+ img_ir_write(priv, IMG_IR_IRQ_ENABLE, 0);
+
+ img_ir_setup_raw(priv);
+ img_ir_setup_hw(priv);
+
+ if (!IS_ERR(priv->clk))
+ clk_prepare_enable(priv->clk);
+}
+
+static void img_ir_ident(struct img_ir_priv *priv)
+{
+ u32 core_rev = img_ir_read(priv, IMG_IR_CORE_REV);
+
+ dev_info(priv->dev,
+ "IMG IR Decoder (%d.%d.%d.%d) probed successfully\n",
+ (core_rev & IMG_IR_DESIGNER) >> IMG_IR_DESIGNER_SHIFT,
+ (core_rev & IMG_IR_MAJOR_REV) >> IMG_IR_MAJOR_REV_SHIFT,
+ (core_rev & IMG_IR_MINOR_REV) >> IMG_IR_MINOR_REV_SHIFT,
+ (core_rev & IMG_IR_MAINT_REV) >> IMG_IR_MAINT_REV_SHIFT);
+ dev_info(priv->dev, "Modes:%s%s\n",
+ img_ir_hw_enabled(&priv->hw) ? " hardware" : "",
+ img_ir_raw_enabled(&priv->raw) ? " raw" : "");
+}
+
+static int img_ir_probe(struct platform_device *pdev)
+{
+ struct img_ir_priv *priv;
+ struct resource *res_regs;
+ int irq, error, error2;
+
+ /* Get resources from platform device */
+ irq = platform_get_irq(pdev, 0);
+ if (irq < 0) {
+ dev_err(&pdev->dev, "cannot find IRQ resource\n");
+ return irq;
+ }
+
+ /* Private driver data */
+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv) {
+ dev_err(&pdev->dev, "cannot allocate device data\n");
+ return -ENOMEM;
+ }
+ platform_set_drvdata(pdev, priv);
+ priv->dev = &pdev->dev;
+ spin_lock_init(&priv->lock);
+
+ /* Ioremap the registers */
+ res_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ priv->reg_base = devm_ioremap_resource(&pdev->dev, res_regs);
+ if (IS_ERR(priv->reg_base))
+ return PTR_ERR(priv->reg_base);
+
+ /* Get core clock */
+ priv->clk = devm_clk_get(&pdev->dev, "core");
+ if (IS_ERR(priv->clk))
+ dev_warn(&pdev->dev, "cannot get core clock resource\n");
+ /*
+ * The driver doesn't need to know about the system ("sys") or power
+ * modulation ("mod") clocks yet
+ */
+
+ /* Set up raw & hw decoder */
+ error = img_ir_probe_raw(priv);
+ error2 = img_ir_probe_hw(priv);
+ if (error && error2)
+ return (error == -ENODEV) ? error2 : error;
+
+ /* Get the IRQ */
+ priv->irq = irq;
+ error = request_irq(priv->irq, img_ir_isr, 0, "img-ir", priv);
+ if (error) {
+ dev_err(&pdev->dev, "cannot register IRQ %u\n",
+ priv->irq);
+ error = -EIO;
+ goto err_irq;
+ }
+
+ img_ir_ident(priv);
+ img_ir_setup(priv);
+
+ return 0;
+
+err_irq:
+ img_ir_remove_hw(priv);
+ img_ir_remove_raw(priv);
+ return error;
+}
+
+static int img_ir_remove(struct platform_device *pdev)
+{
+ struct img_ir_priv *priv = platform_get_drvdata(pdev);
+
+ free_irq(priv->irq, img_ir_isr);
+ img_ir_remove_hw(priv);
+ img_ir_remove_raw(priv);
+
+ if (!IS_ERR(priv->clk))
+ clk_disable_unprepare(priv->clk);
+ return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(img_ir_pmops, img_ir_suspend, img_ir_resume);
+
+static const struct of_device_id img_ir_match[] = {
+ { .compatible = "img,ir1" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, img_ir_match);
+
+static struct platform_driver img_ir_driver = {
+ .driver = {
+ .name = "img-ir",
+ .owner = THIS_MODULE,
+ .of_match_table = img_ir_match,
+ .pm = &img_ir_pmops,
+ },
+ .probe = img_ir_probe,
+ .remove = img_ir_remove,
+};
+
+module_platform_driver(img_ir_driver);
+
+MODULE_AUTHOR("Imagination Technologies Ltd.");
+MODULE_DESCRIPTION("ImgTec IR");
+MODULE_LICENSE("GPL");
diff --git a/drivers/media/rc/img-ir/img-ir.h b/drivers/media/rc/img-ir/img-ir.h
new file mode 100644
index 0000000..afb1893
--- /dev/null
+++ b/drivers/media/rc/img-ir/img-ir.h
@@ -0,0 +1,166 @@
+/*
+ * ImgTec IR Decoder found in PowerDown Controller.
+ *
+ * Copyright 2010-2014 Imagination Technologies Ltd.
+ */
+
+#ifndef _IMG_IR_H_
+#define _IMG_IR_H_
+
+#include <linux/io.h>
+#include <linux/spinlock.h>
+
+#include "img-ir-raw.h"
+#include "img-ir-hw.h"
+
+/* registers */
+
+/* relative to the start of the IR block of registers */
+#define IMG_IR_CONTROL 0x00
+#define IMG_IR_STATUS 0x04
+#define IMG_IR_DATA_LW 0x08
+#define IMG_IR_DATA_UP 0x0c
+#define IMG_IR_LEAD_SYMB_TIMING 0x10
+#define IMG_IR_S00_SYMB_TIMING 0x14
+#define IMG_IR_S01_SYMB_TIMING 0x18
+#define IMG_IR_S10_SYMB_TIMING 0x1c
+#define IMG_IR_S11_SYMB_TIMING 0x20
+#define IMG_IR_FREE_SYMB_TIMING 0x24
+#define IMG_IR_POW_MOD_PARAMS 0x28
+#define IMG_IR_POW_MOD_ENABLE 0x2c
+#define IMG_IR_IRQ_MSG_DATA_LW 0x30
+#define IMG_IR_IRQ_MSG_DATA_UP 0x34
+#define IMG_IR_IRQ_MSG_MASK_LW 0x38
+#define IMG_IR_IRQ_MSG_MASK_UP 0x3c
+#define IMG_IR_IRQ_ENABLE 0x40
+#define IMG_IR_IRQ_STATUS 0x44
+#define IMG_IR_IRQ_CLEAR 0x48
+#define IMG_IR_IRCORE_ID 0xf0
+#define IMG_IR_CORE_REV 0xf4
+#define IMG_IR_CORE_DES1 0xf8
+#define IMG_IR_CORE_DES2 0xfc
+
+
+/* field masks */
+
+/* IMG_IR_CONTROL */
+#define IMG_IR_DECODEN 0x40000000
+#define IMG_IR_CODETYPE 0x30000000
+#define IMG_IR_CODETYPE_SHIFT 28
+#define IMG_IR_HDRTOG 0x08000000
+#define IMG_IR_LDRDEC 0x04000000
+#define IMG_IR_DECODINPOL 0x02000000 /* active high */
+#define IMG_IR_BITORIEN 0x01000000 /* MSB first */
+#define IMG_IR_D1VALIDSEL 0x00008000
+#define IMG_IR_BITINV 0x00000040 /* don't invert */
+#define IMG_IR_DECODEND2 0x00000010
+#define IMG_IR_BITORIEND2 0x00000002 /* MSB first */
+#define IMG_IR_BITINVD2 0x00000001 /* don't invert */
+
+/* IMG_IR_STATUS */
+#define IMG_IR_RXDVALD2 0x00001000
+#define IMG_IR_IRRXD 0x00000400
+#define IMG_IR_TOGSTATE 0x00000200
+#define IMG_IR_RXDVAL 0x00000040
+#define IMG_IR_RXDLEN 0x0000003f
+#define IMG_IR_RXDLEN_SHIFT 0
+
+/* IMG_IR_LEAD_SYMB_TIMING, IMG_IR_Sxx_SYMB_TIMING */
+#define IMG_IR_PD_MAX 0xff000000
+#define IMG_IR_PD_MAX_SHIFT 24
+#define IMG_IR_PD_MIN 0x00ff0000
+#define IMG_IR_PD_MIN_SHIFT 16
+#define IMG_IR_W_MAX 0x0000ff00
+#define IMG_IR_W_MAX_SHIFT 8
+#define IMG_IR_W_MIN 0x000000ff
+#define IMG_IR_W_MIN_SHIFT 0
+
+/* IMG_IR_FREE_SYMB_TIMING */
+#define IMG_IR_MAXLEN 0x0007e000
+#define IMG_IR_MAXLEN_SHIFT 13
+#define IMG_IR_MINLEN 0x00001f00
+#define IMG_IR_MINLEN_SHIFT 8
+#define IMG_IR_FT_MIN 0x000000ff
+#define IMG_IR_FT_MIN_SHIFT 0
+
+/* IMG_IR_POW_MOD_PARAMS */
+#define IMG_IR_PERIOD_LEN 0x3f000000
+#define IMG_IR_PERIOD_LEN_SHIFT 24
+#define IMG_IR_PERIOD_DUTY 0x003f0000
+#define IMG_IR_PERIOD_DUTY_SHIFT 16
+#define IMG_IR_STABLE_STOP 0x00003f00
+#define IMG_IR_STABLE_STOP_SHIFT 8
+#define IMG_IR_STABLE_START 0x0000003f
+#define IMG_IR_STABLE_START_SHIFT 0
+
+/* IMG_IR_POW_MOD_ENABLE */
+#define IMG_IR_POWER_OUT_EN 0x00000002
+#define IMG_IR_POWER_MOD_EN 0x00000001
+
+/* IMG_IR_IRQ_ENABLE, IMG_IR_IRQ_STATUS, IMG_IR_IRQ_CLEAR */
+#define IMG_IR_IRQ_DEC2_ERR 0x00000080
+#define IMG_IR_IRQ_DEC_ERR 0x00000040
+#define IMG_IR_IRQ_ACT_LEVEL 0x00000020
+#define IMG_IR_IRQ_FALL_EDGE 0x00000010
+#define IMG_IR_IRQ_RISE_EDGE 0x00000008
+#define IMG_IR_IRQ_DATA_MATCH 0x00000004
+#define IMG_IR_IRQ_DATA2_VALID 0x00000002
+#define IMG_IR_IRQ_DATA_VALID 0x00000001
+#define IMG_IR_IRQ_ALL 0x000000ff
+#define IMG_IR_IRQ_EDGE (IMG_IR_IRQ_FALL_EDGE | IMG_IR_IRQ_RISE_EDGE)
+
+/* IMG_IR_CORE_ID */
+#define IMG_IR_CORE_ID 0x00ff0000
+#define IMG_IR_CORE_ID_SHIFT 16
+#define IMG_IR_CORE_CONFIG 0x0000ffff
+#define IMG_IR_CORE_CONFIG_SHIFT 0
+
+/* IMG_IR_CORE_REV */
+#define IMG_IR_DESIGNER 0xff000000
+#define IMG_IR_DESIGNER_SHIFT 24
+#define IMG_IR_MAJOR_REV 0x00ff0000
+#define IMG_IR_MAJOR_REV_SHIFT 16
+#define IMG_IR_MINOR_REV 0x0000ff00
+#define IMG_IR_MINOR_REV_SHIFT 8
+#define IMG_IR_MAINT_REV 0x000000ff
+#define IMG_IR_MAINT_REV_SHIFT 0
+
+struct device;
+struct clk;
+
+/**
+ * struct img_ir_priv - Private driver data.
+ * @dev: Platform device.
+ * @irq: IRQ number.
+ * @clk: Input clock.
+ * @reg_base: Iomem base address of IR register block.
+ * @lock: Protects IR registers and variables in this struct.
+ * @raw: Driver data for raw decoder.
+ * @hw: Driver data for hardware decoder.
+ */
+struct img_ir_priv {
+ struct device *dev;
+ int irq;
+ struct clk *clk;
+ void __iomem *reg_base;
+ spinlock_t lock;
+
+ struct img_ir_priv_raw raw;
+ struct img_ir_priv_hw hw;
+};
+
+/* Hardware access */
+
+static inline void img_ir_write(struct img_ir_priv *priv,
+ unsigned int reg_offs, unsigned int data)
+{
+ iowrite32(data, priv->reg_base + reg_offs);
+}
+
+static inline unsigned int img_ir_read(struct img_ir_priv *priv,
+ unsigned int reg_offs)
+{
+ return ioread32(priv->reg_base + reg_offs);
+}
+
+#endif /* _IMG_IR_H_ */
--
1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2 06/15] dt: binding: add binding for ImgTec IR block
2014-01-17 13:58 ` [PATCH v2 06/15] dt: binding: add binding for ImgTec IR block James Hogan
@ 2014-02-06 11:24 ` Mauro Carvalho Chehab
2014-02-06 14:33 ` Rob Herring
1 sibling, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2014-02-06 11:24 UTC (permalink / raw)
To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
devicetree, Rob Landley, Tomasz Figa
Cc: James Hogan, linux-media, linux-doc
Em Fri, 17 Jan 2014 13:58:51 +0000
James Hogan <james.hogan@imgtec.com> escreveu:
> Add device tree binding for ImgTec Consumer Infrared block, specifically
> major revision 1 of the hardware.
@DT maintainers:
ping.
>
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
> Cc: linux-media@vger.kernel.org
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Pawel Moll <pawel.moll@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
> Cc: Kumar Gala <galak@codeaurora.org>
> Cc: devicetree@vger.kernel.org
> Cc: Rob Landley <rob@landley.net>
> Cc: linux-doc@vger.kernel.org
> Cc: Tomasz Figa <tomasz.figa@gmail.com>
> ---
> v2:
> - Future proof compatible string from "img,ir" to "img,ir1", where the 1
> corresponds to the major revision number of the hardware (Tomasz
> Figa).
> - Added clock-names property and three specific clock names described in
> the manual, only one of which is used by the current driver (Tomasz
> Figa).
> ---
> .../devicetree/bindings/media/img-ir1.txt | 30 ++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/media/img-ir1.txt
>
> diff --git a/Documentation/devicetree/bindings/media/img-ir1.txt b/Documentation/devicetree/bindings/media/img-ir1.txt
> new file mode 100644
> index 0000000..ace5fd9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/img-ir1.txt
> @@ -0,0 +1,30 @@
> +* ImgTec Infrared (IR) decoder version 1
> +
> +This binding is for Imagination Technologies' Infrared decoder block,
> +specifically major revision 1.
> +
> +Required properties:
> +- compatible: Should be "img,ir1"
> +- reg: Physical base address of the controller and length of
> + memory mapped region.
> +- interrupts: The interrupt specifier to the cpu.
> +
> +Optional properties:
> +- clocks: List of clock specifiers as described in standard
> + clock bindings.
> +- clock-names: List of clock names corresponding to the clocks
> + specified in the clocks property.
> + Accepted clock names are:
> + "core": Core clock (defaults to 32.768KHz if omitted).
> + "sys": System side (fast) clock.
> + "mod": Power modulation clock.
> +
> +Example:
> +
> + ir@02006200 {
> + compatible = "img,ir1";
> + reg = <0x02006200 0x100>;
> + interrupts = <29 4>;
> + clocks = <&clk_32khz>;
> + clock-names = "core";
> + };
--
Cheers,
Mauro
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 06/15] dt: binding: add binding for ImgTec IR block
2014-01-17 13:58 ` [PATCH v2 06/15] dt: binding: add binding for ImgTec IR block James Hogan
2014-02-06 11:24 ` Mauro Carvalho Chehab
@ 2014-02-06 14:33 ` Rob Herring
2014-02-06 14:41 ` James Hogan
1 sibling, 1 reply; 14+ messages in thread
From: Rob Herring @ 2014-02-06 14:33 UTC (permalink / raw)
To: James Hogan
Cc: Mauro Carvalho Chehab, linux-media, Rob Herring, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala,
devicetree@vger.kernel.org, Rob Landley,
linux-doc@vger.kernel.org, Tomasz Figa
On Fri, Jan 17, 2014 at 7:58 AM, James Hogan <james.hogan@imgtec.com> wrote:
> Add device tree binding for ImgTec Consumer Infrared block, specifically
> major revision 1 of the hardware.
>
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
> Cc: linux-media@vger.kernel.org
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Pawel Moll <pawel.moll@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
> Cc: Kumar Gala <galak@codeaurora.org>
> Cc: devicetree@vger.kernel.org
> Cc: Rob Landley <rob@landley.net>
> Cc: linux-doc@vger.kernel.org
> Cc: Tomasz Figa <tomasz.figa@gmail.com>
> ---
> v2:
> - Future proof compatible string from "img,ir" to "img,ir1", where the 1
> corresponds to the major revision number of the hardware (Tomasz
> Figa).
> - Added clock-names property and three specific clock names described in
> the manual, only one of which is used by the current driver (Tomasz
> Figa).
> ---
> .../devicetree/bindings/media/img-ir1.txt | 30 ++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/media/img-ir1.txt
>
> diff --git a/Documentation/devicetree/bindings/media/img-ir1.txt b/Documentation/devicetree/bindings/media/img-ir1.txt
> new file mode 100644
> index 0000000..ace5fd9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/img-ir1.txt
> @@ -0,0 +1,30 @@
> +* ImgTec Infrared (IR) decoder version 1
> +
> +This binding is for Imagination Technologies' Infrared decoder block,
> +specifically major revision 1.
> +
> +Required properties:
> +- compatible: Should be "img,ir1"
Kind of short for a name. I don't have anything much better, but how
about img,ir-rev1.
> +- reg: Physical base address of the controller and length of
> + memory mapped region.
> +- interrupts: The interrupt specifier to the cpu.
> +
> +Optional properties:
> +- clocks: List of clock specifiers as described in standard
> + clock bindings.
> +- clock-names: List of clock names corresponding to the clocks
> + specified in the clocks property.
> + Accepted clock names are:
> + "core": Core clock (defaults to 32.768KHz if omitted).
> + "sys": System side (fast) clock.
> + "mod": Power modulation clock.
You need to define the order of clocks including how they are
interpreted with different number of clocks (not relying on the name).
Although, if the h/w block really has different number of clock
inputs, then it is a different h/w block and should have a different
compatible string.
Rob
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 06/15] dt: binding: add binding for ImgTec IR block
2014-02-06 14:33 ` Rob Herring
@ 2014-02-06 14:41 ` James Hogan
2014-02-07 14:33 ` Rob Herring
0 siblings, 1 reply; 14+ messages in thread
From: James Hogan @ 2014-02-06 14:41 UTC (permalink / raw)
To: Rob Herring
Cc: Mauro Carvalho Chehab, linux-media, Rob Herring, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala,
devicetree@vger.kernel.org, Rob Landley,
linux-doc@vger.kernel.org, Tomasz Figa
[-- Attachment #1: Type: text/plain, Size: 1434 bytes --]
Hi Rob,
On 06/02/14 14:33, Rob Herring wrote:
> On Fri, Jan 17, 2014 at 7:58 AM, James Hogan <james.hogan@imgtec.com> wrote:
>> +Required properties:
>> +- compatible: Should be "img,ir1"
>
> Kind of short for a name. I don't have anything much better, but how
> about img,ir-rev1.
Okay, that sounds reasonable.
>> +Optional properties:
>> +- clocks: List of clock specifiers as described in standard
>> + clock bindings.
>> +- clock-names: List of clock names corresponding to the clocks
>> + specified in the clocks property.
>> + Accepted clock names are:
>> + "core": Core clock (defaults to 32.768KHz if omitted).
>> + "sys": System side (fast) clock.
>> + "mod": Power modulation clock.
>
> You need to define the order of clocks including how they are
> interpreted with different number of clocks (not relying on the name).
Would it be sufficient to specify that "clock-names" is required if
"clocks" is provided (i.e. unnamed clocks aren't used), or is there some
other reason that clock-names shouldn't be relied upon?
Thanks for reviewing,
Cheers
James
> Although, if the h/w block really has different number of clock
> inputs, then it is a different h/w block and should have a different
> compatible string.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 06/15] dt: binding: add binding for ImgTec IR block
2014-02-06 14:41 ` James Hogan
@ 2014-02-07 14:33 ` Rob Herring
2014-02-07 14:50 ` Mark Rutland
2014-02-07 15:49 ` [PATCH v3 " James Hogan
0 siblings, 2 replies; 14+ messages in thread
From: Rob Herring @ 2014-02-07 14:33 UTC (permalink / raw)
To: James Hogan
Cc: Mauro Carvalho Chehab, linux-media, Rob Herring, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala,
devicetree@vger.kernel.org, Rob Landley,
linux-doc@vger.kernel.org, Tomasz Figa
On Thu, Feb 6, 2014 at 8:41 AM, James Hogan <james.hogan@imgtec.com> wrote:
> Hi Rob,
>
> On 06/02/14 14:33, Rob Herring wrote:
>> On Fri, Jan 17, 2014 at 7:58 AM, James Hogan <james.hogan@imgtec.com> wrote:
>>> +Required properties:
>>> +- compatible: Should be "img,ir1"
>>
>> Kind of short for a name. I don't have anything much better, but how
>> about img,ir-rev1.
>
> Okay, that sounds reasonable.
>
>>> +Optional properties:
>>> +- clocks: List of clock specifiers as described in standard
>>> + clock bindings.
>>> +- clock-names: List of clock names corresponding to the clocks
>>> + specified in the clocks property.
>>> + Accepted clock names are:
>>> + "core": Core clock (defaults to 32.768KHz if omitted).
>>> + "sys": System side (fast) clock.
>>> + "mod": Power modulation clock.
>>
>> You need to define the order of clocks including how they are
>> interpreted with different number of clocks (not relying on the name).
>
> Would it be sufficient to specify that "clock-names" is required if
> "clocks" is provided (i.e. unnamed clocks aren't used), or is there some
> other reason that clock-names shouldn't be relied upon?
irq-names, reg-names, clock-names, etc. are considered optional to
their associated property and the order is supposed to be defined.
clock-names is a bit different in that clk_get needs a name, so it
effectively is required by Linux when there is more than 1 clock.
Really, we should fix Linux.
Regardless, my other point is still valid. A given h/w block has a
fixed number of clocks. You may have them all connected to the same
source in some cases, but that does not change the number of inputs.
Defining what are the valid combinations needs to be done. Seems like
this could be:
<none> - default to 32KHz
<core> - only a "baud" clock
<core>, <sys>, <mod> - all clocks
Rob
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 06/15] dt: binding: add binding for ImgTec IR block
2014-02-07 14:33 ` Rob Herring
@ 2014-02-07 14:50 ` Mark Rutland
[not found] ` <20140207145053.GF25314-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2014-02-07 15:49 ` [PATCH v3 " James Hogan
1 sibling, 1 reply; 14+ messages in thread
From: Mark Rutland @ 2014-02-07 14:50 UTC (permalink / raw)
To: Rob Herring
Cc: James Hogan, Mauro Carvalho Chehab, linux-media@vger.kernel.org,
Rob Herring, Pawel Moll, Ian Campbell, Kumar Gala,
devicetree@vger.kernel.org, Rob Landley,
linux-doc@vger.kernel.org, Tomasz Figa
Hi Rob,
On Fri, Feb 07, 2014 at 02:33:27PM +0000, Rob Herring wrote:
> On Thu, Feb 6, 2014 at 8:41 AM, James Hogan <james.hogan@imgtec.com> wrote:
> > Hi Rob,
> >
> > On 06/02/14 14:33, Rob Herring wrote:
> >> On Fri, Jan 17, 2014 at 7:58 AM, James Hogan <james.hogan@imgtec.com> wrote:
> >>> +Required properties:
> >>> +- compatible: Should be "img,ir1"
> >>
> >> Kind of short for a name. I don't have anything much better, but how
> >> about img,ir-rev1.
> >
> > Okay, that sounds reasonable.
> >
> >>> +Optional properties:
> >>> +- clocks: List of clock specifiers as described in standard
> >>> + clock bindings.
> >>> +- clock-names: List of clock names corresponding to the clocks
> >>> + specified in the clocks property.
> >>> + Accepted clock names are:
> >>> + "core": Core clock (defaults to 32.768KHz if omitted).
> >>> + "sys": System side (fast) clock.
> >>> + "mod": Power modulation clock.
> >>
> >> You need to define the order of clocks including how they are
> >> interpreted with different number of clocks (not relying on the name).
> >
> > Would it be sufficient to specify that "clock-names" is required if
> > "clocks" is provided (i.e. unnamed clocks aren't used), or is there some
> > other reason that clock-names shouldn't be relied upon?
>
> irq-names, reg-names, clock-names, etc. are considered optional to
> their associated property and the order is supposed to be defined.
> clock-names is a bit different in that clk_get needs a name, so it
> effectively is required by Linux when there is more than 1 clock.
> Really, we should fix Linux.
If they're optional then you can't handle optional entries (i.e. when
nothing's wired to an input), and this is counter to the style I've been
recommending to people (defining clocks in terms of clock-names).
I really don't see the point in any *-names property if they don't
define the list and allow for optional / reordered lists. Why does the
order have to be fixed rather than using the -names properties? It's
already a de-facto standard.
>
> Regardless, my other point is still valid. A given h/w block has a
> fixed number of clocks. You may have them all connected to the same
> source in some cases, but that does not change the number of inputs.
> Defining what are the valid combinations needs to be done. Seems like
> this could be:
>
> <none> - default to 32KHz
> <core> - only a "baud" clock
> <core>, <sys>, <mod> - all clocks
For more complex IP blocks you might have more inputs than you actually
have clocks wired to.
How do you handle an unwired input in the middle of the list, or a new
revision of the IP block that got rid of the first clock input from the
list but is otherwise compatible?
I really don't think it makes sense to say that clock-names doesn't
define the list.
Thanks,
Mark.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 06/15] dt: binding: add binding for ImgTec IR block
2014-02-07 14:33 ` Rob Herring
2014-02-07 14:50 ` Mark Rutland
@ 2014-02-07 15:49 ` James Hogan
2014-02-27 22:52 ` James Hogan
1 sibling, 1 reply; 14+ messages in thread
From: James Hogan @ 2014-02-07 15:49 UTC (permalink / raw)
To: Mauro Carvalho Chehab, linux-media, Rob Herring
Cc: James Hogan, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
devicetree, Rob Landley, linux-doc, Tomasz Figa
Add device tree binding for ImgTec Consumer Infrared block, specifically
major revision 1 of the hardware.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
Cc: linux-media@vger.kernel.org
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
Cc: Kumar Gala <galak@codeaurora.org>
Cc: devicetree@vger.kernel.org
Cc: Rob Landley <rob@landley.net>
Cc: linux-doc@vger.kernel.org
Cc: Tomasz Figa <tomasz.figa@gmail.com>
---
v3:
- Rename compatible string to "img,ir-rev1" (Rob Herring).
- Specify ordering of clocks explicitly (Rob Herring).
v2:
- Future proof compatible string from "img,ir" to "img,ir1", where the 1
corresponds to the major revision number of the hardware (Tomasz
Figa).
- Added clock-names property and three specific clock names described in
the manual, only one of which is used by the current driver (Tomasz
Figa).
---
.../devicetree/bindings/media/img-ir-rev1.txt | 34 ++++++++++++++++++++++
1 file changed, 34 insertions(+)
create mode 100644 Documentation/devicetree/bindings/media/img-ir-rev1.txt
diff --git a/Documentation/devicetree/bindings/media/img-ir-rev1.txt b/Documentation/devicetree/bindings/media/img-ir-rev1.txt
new file mode 100644
index 000000000000..5434ce61b925
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/img-ir-rev1.txt
@@ -0,0 +1,34 @@
+* ImgTec Infrared (IR) decoder version 1
+
+This binding is for Imagination Technologies' Infrared decoder block,
+specifically major revision 1.
+
+Required properties:
+- compatible: Should be "img,ir-rev1"
+- reg: Physical base address of the controller and length of
+ memory mapped region.
+- interrupts: The interrupt specifier to the cpu.
+
+Optional properties:
+- clocks: List of clock specifiers as described in standard
+ clock bindings.
+ Up to 3 clocks may be specified in the following order:
+ 1st: Core clock (defaults to 32.768KHz if omitted).
+ 2nd: System side (fast) clock.
+ 3rd: Power modulation clock.
+- clock-names: List of clock names corresponding to the clocks
+ specified in the clocks property.
+ Accepted clock names are:
+ "core": Core clock.
+ "sys": System clock.
+ "mod": Power modulation clock.
+
+Example:
+
+ ir@02006200 {
+ compatible = "img,ir-rev1";
+ reg = <0x02006200 0x100>;
+ interrupts = <29 4>;
+ clocks = <&clk_32khz>;
+ clock-names = "core";
+ };
--
1.8.1.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 07/15] media: rc: img-ir: add base driver
[not found] ` <1389967140-20704-8-git-send-email-james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
@ 2014-02-07 16:16 ` James Hogan
0 siblings, 0 replies; 14+ messages in thread
From: James Hogan @ 2014-02-07 16:16 UTC (permalink / raw)
To: Mauro Carvalho Chehab, linux-media-u79uwXL29TY76Z2rM5mHXA
Cc: James Hogan, Grant Likely, Rob Herring,
devicetree-u79uwXL29TY76Z2rM5mHXA
Add base driver for the ImgTec Infrared decoder block. The driver is
split into separate components for raw (software) decode and hardware
decoder which are in following commits.
Signed-off-by: James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
Cc: Mauro Carvalho Chehab <m.chehab-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
v3:
- Use new compatible string "img,ir-rev1"
v2:
- Use new DT binding, with a different compatibility string and get core
clock by name.
- Remove next pointer from struct img_ir_priv. This is related to the
removal of dynamic registration/unregistration of protocol decode
timings from later patches.
- Add io.h include to img-ir.h.
---
drivers/media/rc/img-ir/img-ir-core.c | 176 ++++++++++++++++++++++++++++++++++
drivers/media/rc/img-ir/img-ir.h | 166 ++++++++++++++++++++++++++++++++
2 files changed, 342 insertions(+)
create mode 100644 drivers/media/rc/img-ir/img-ir-core.c
create mode 100644 drivers/media/rc/img-ir/img-ir.h
diff --git a/drivers/media/rc/img-ir/img-ir-core.c b/drivers/media/rc/img-ir/img-ir-core.c
new file mode 100644
index 000000000000..6b7834834fb8
--- /dev/null
+++ b/drivers/media/rc/img-ir/img-ir-core.c
@@ -0,0 +1,176 @@
+/*
+ * ImgTec IR Decoder found in PowerDown Controller.
+ *
+ * Copyright 2010-2014 Imagination Technologies Ltd.
+ *
+ * This contains core img-ir code for setting up the driver. The two interfaces
+ * (raw and hardware decode) are handled separately.
+ */
+
+#include <linux/clk.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include "img-ir.h"
+
+static irqreturn_t img_ir_isr(int irq, void *dev_id)
+{
+ struct img_ir_priv *priv = dev_id;
+ u32 irq_status;
+
+ spin_lock(&priv->lock);
+ /* we have to clear irqs before reading */
+ irq_status = img_ir_read(priv, IMG_IR_IRQ_STATUS);
+ img_ir_write(priv, IMG_IR_IRQ_CLEAR, irq_status);
+
+ /* don't handle valid data irqs if we're only interested in matches */
+ irq_status &= img_ir_read(priv, IMG_IR_IRQ_ENABLE);
+
+ /* hand off edge interrupts to raw decode handler */
+ if (irq_status & IMG_IR_IRQ_EDGE && img_ir_raw_enabled(&priv->raw))
+ img_ir_isr_raw(priv, irq_status);
+
+ /* hand off hardware match interrupts to hardware decode handler */
+ if (irq_status & (IMG_IR_IRQ_DATA_MATCH |
+ IMG_IR_IRQ_DATA_VALID |
+ IMG_IR_IRQ_DATA2_VALID) &&
+ img_ir_hw_enabled(&priv->hw))
+ img_ir_isr_hw(priv, irq_status);
+
+ spin_unlock(&priv->lock);
+ return IRQ_HANDLED;
+}
+
+static void img_ir_setup(struct img_ir_priv *priv)
+{
+ /* start off with interrupts disabled */
+ img_ir_write(priv, IMG_IR_IRQ_ENABLE, 0);
+
+ img_ir_setup_raw(priv);
+ img_ir_setup_hw(priv);
+
+ if (!IS_ERR(priv->clk))
+ clk_prepare_enable(priv->clk);
+}
+
+static void img_ir_ident(struct img_ir_priv *priv)
+{
+ u32 core_rev = img_ir_read(priv, IMG_IR_CORE_REV);
+
+ dev_info(priv->dev,
+ "IMG IR Decoder (%d.%d.%d.%d) probed successfully\n",
+ (core_rev & IMG_IR_DESIGNER) >> IMG_IR_DESIGNER_SHIFT,
+ (core_rev & IMG_IR_MAJOR_REV) >> IMG_IR_MAJOR_REV_SHIFT,
+ (core_rev & IMG_IR_MINOR_REV) >> IMG_IR_MINOR_REV_SHIFT,
+ (core_rev & IMG_IR_MAINT_REV) >> IMG_IR_MAINT_REV_SHIFT);
+ dev_info(priv->dev, "Modes:%s%s\n",
+ img_ir_hw_enabled(&priv->hw) ? " hardware" : "",
+ img_ir_raw_enabled(&priv->raw) ? " raw" : "");
+}
+
+static int img_ir_probe(struct platform_device *pdev)
+{
+ struct img_ir_priv *priv;
+ struct resource *res_regs;
+ int irq, error, error2;
+
+ /* Get resources from platform device */
+ irq = platform_get_irq(pdev, 0);
+ if (irq < 0) {
+ dev_err(&pdev->dev, "cannot find IRQ resource\n");
+ return irq;
+ }
+
+ /* Private driver data */
+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv) {
+ dev_err(&pdev->dev, "cannot allocate device data\n");
+ return -ENOMEM;
+ }
+ platform_set_drvdata(pdev, priv);
+ priv->dev = &pdev->dev;
+ spin_lock_init(&priv->lock);
+
+ /* Ioremap the registers */
+ res_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ priv->reg_base = devm_ioremap_resource(&pdev->dev, res_regs);
+ if (IS_ERR(priv->reg_base))
+ return PTR_ERR(priv->reg_base);
+
+ /* Get core clock */
+ priv->clk = devm_clk_get(&pdev->dev, "core");
+ if (IS_ERR(priv->clk))
+ dev_warn(&pdev->dev, "cannot get core clock resource\n");
+ /*
+ * The driver doesn't need to know about the system ("sys") or power
+ * modulation ("mod") clocks yet
+ */
+
+ /* Set up raw & hw decoder */
+ error = img_ir_probe_raw(priv);
+ error2 = img_ir_probe_hw(priv);
+ if (error && error2)
+ return (error == -ENODEV) ? error2 : error;
+
+ /* Get the IRQ */
+ priv->irq = irq;
+ error = request_irq(priv->irq, img_ir_isr, 0, "img-ir", priv);
+ if (error) {
+ dev_err(&pdev->dev, "cannot register IRQ %u\n",
+ priv->irq);
+ error = -EIO;
+ goto err_irq;
+ }
+
+ img_ir_ident(priv);
+ img_ir_setup(priv);
+
+ return 0;
+
+err_irq:
+ img_ir_remove_hw(priv);
+ img_ir_remove_raw(priv);
+ return error;
+}
+
+static int img_ir_remove(struct platform_device *pdev)
+{
+ struct img_ir_priv *priv = platform_get_drvdata(pdev);
+
+ free_irq(priv->irq, img_ir_isr);
+ img_ir_remove_hw(priv);
+ img_ir_remove_raw(priv);
+
+ if (!IS_ERR(priv->clk))
+ clk_disable_unprepare(priv->clk);
+ return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(img_ir_pmops, img_ir_suspend, img_ir_resume);
+
+static const struct of_device_id img_ir_match[] = {
+ { .compatible = "img,ir-rev1" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, img_ir_match);
+
+static struct platform_driver img_ir_driver = {
+ .driver = {
+ .name = "img-ir",
+ .owner = THIS_MODULE,
+ .of_match_table = img_ir_match,
+ .pm = &img_ir_pmops,
+ },
+ .probe = img_ir_probe,
+ .remove = img_ir_remove,
+};
+
+module_platform_driver(img_ir_driver);
+
+MODULE_AUTHOR("Imagination Technologies Ltd.");
+MODULE_DESCRIPTION("ImgTec IR");
+MODULE_LICENSE("GPL");
diff --git a/drivers/media/rc/img-ir/img-ir.h b/drivers/media/rc/img-ir/img-ir.h
new file mode 100644
index 000000000000..afb189394af9
--- /dev/null
+++ b/drivers/media/rc/img-ir/img-ir.h
@@ -0,0 +1,166 @@
+/*
+ * ImgTec IR Decoder found in PowerDown Controller.
+ *
+ * Copyright 2010-2014 Imagination Technologies Ltd.
+ */
+
+#ifndef _IMG_IR_H_
+#define _IMG_IR_H_
+
+#include <linux/io.h>
+#include <linux/spinlock.h>
+
+#include "img-ir-raw.h"
+#include "img-ir-hw.h"
+
+/* registers */
+
+/* relative to the start of the IR block of registers */
+#define IMG_IR_CONTROL 0x00
+#define IMG_IR_STATUS 0x04
+#define IMG_IR_DATA_LW 0x08
+#define IMG_IR_DATA_UP 0x0c
+#define IMG_IR_LEAD_SYMB_TIMING 0x10
+#define IMG_IR_S00_SYMB_TIMING 0x14
+#define IMG_IR_S01_SYMB_TIMING 0x18
+#define IMG_IR_S10_SYMB_TIMING 0x1c
+#define IMG_IR_S11_SYMB_TIMING 0x20
+#define IMG_IR_FREE_SYMB_TIMING 0x24
+#define IMG_IR_POW_MOD_PARAMS 0x28
+#define IMG_IR_POW_MOD_ENABLE 0x2c
+#define IMG_IR_IRQ_MSG_DATA_LW 0x30
+#define IMG_IR_IRQ_MSG_DATA_UP 0x34
+#define IMG_IR_IRQ_MSG_MASK_LW 0x38
+#define IMG_IR_IRQ_MSG_MASK_UP 0x3c
+#define IMG_IR_IRQ_ENABLE 0x40
+#define IMG_IR_IRQ_STATUS 0x44
+#define IMG_IR_IRQ_CLEAR 0x48
+#define IMG_IR_IRCORE_ID 0xf0
+#define IMG_IR_CORE_REV 0xf4
+#define IMG_IR_CORE_DES1 0xf8
+#define IMG_IR_CORE_DES2 0xfc
+
+
+/* field masks */
+
+/* IMG_IR_CONTROL */
+#define IMG_IR_DECODEN 0x40000000
+#define IMG_IR_CODETYPE 0x30000000
+#define IMG_IR_CODETYPE_SHIFT 28
+#define IMG_IR_HDRTOG 0x08000000
+#define IMG_IR_LDRDEC 0x04000000
+#define IMG_IR_DECODINPOL 0x02000000 /* active high */
+#define IMG_IR_BITORIEN 0x01000000 /* MSB first */
+#define IMG_IR_D1VALIDSEL 0x00008000
+#define IMG_IR_BITINV 0x00000040 /* don't invert */
+#define IMG_IR_DECODEND2 0x00000010
+#define IMG_IR_BITORIEND2 0x00000002 /* MSB first */
+#define IMG_IR_BITINVD2 0x00000001 /* don't invert */
+
+/* IMG_IR_STATUS */
+#define IMG_IR_RXDVALD2 0x00001000
+#define IMG_IR_IRRXD 0x00000400
+#define IMG_IR_TOGSTATE 0x00000200
+#define IMG_IR_RXDVAL 0x00000040
+#define IMG_IR_RXDLEN 0x0000003f
+#define IMG_IR_RXDLEN_SHIFT 0
+
+/* IMG_IR_LEAD_SYMB_TIMING, IMG_IR_Sxx_SYMB_TIMING */
+#define IMG_IR_PD_MAX 0xff000000
+#define IMG_IR_PD_MAX_SHIFT 24
+#define IMG_IR_PD_MIN 0x00ff0000
+#define IMG_IR_PD_MIN_SHIFT 16
+#define IMG_IR_W_MAX 0x0000ff00
+#define IMG_IR_W_MAX_SHIFT 8
+#define IMG_IR_W_MIN 0x000000ff
+#define IMG_IR_W_MIN_SHIFT 0
+
+/* IMG_IR_FREE_SYMB_TIMING */
+#define IMG_IR_MAXLEN 0x0007e000
+#define IMG_IR_MAXLEN_SHIFT 13
+#define IMG_IR_MINLEN 0x00001f00
+#define IMG_IR_MINLEN_SHIFT 8
+#define IMG_IR_FT_MIN 0x000000ff
+#define IMG_IR_FT_MIN_SHIFT 0
+
+/* IMG_IR_POW_MOD_PARAMS */
+#define IMG_IR_PERIOD_LEN 0x3f000000
+#define IMG_IR_PERIOD_LEN_SHIFT 24
+#define IMG_IR_PERIOD_DUTY 0x003f0000
+#define IMG_IR_PERIOD_DUTY_SHIFT 16
+#define IMG_IR_STABLE_STOP 0x00003f00
+#define IMG_IR_STABLE_STOP_SHIFT 8
+#define IMG_IR_STABLE_START 0x0000003f
+#define IMG_IR_STABLE_START_SHIFT 0
+
+/* IMG_IR_POW_MOD_ENABLE */
+#define IMG_IR_POWER_OUT_EN 0x00000002
+#define IMG_IR_POWER_MOD_EN 0x00000001
+
+/* IMG_IR_IRQ_ENABLE, IMG_IR_IRQ_STATUS, IMG_IR_IRQ_CLEAR */
+#define IMG_IR_IRQ_DEC2_ERR 0x00000080
+#define IMG_IR_IRQ_DEC_ERR 0x00000040
+#define IMG_IR_IRQ_ACT_LEVEL 0x00000020
+#define IMG_IR_IRQ_FALL_EDGE 0x00000010
+#define IMG_IR_IRQ_RISE_EDGE 0x00000008
+#define IMG_IR_IRQ_DATA_MATCH 0x00000004
+#define IMG_IR_IRQ_DATA2_VALID 0x00000002
+#define IMG_IR_IRQ_DATA_VALID 0x00000001
+#define IMG_IR_IRQ_ALL 0x000000ff
+#define IMG_IR_IRQ_EDGE (IMG_IR_IRQ_FALL_EDGE | IMG_IR_IRQ_RISE_EDGE)
+
+/* IMG_IR_CORE_ID */
+#define IMG_IR_CORE_ID 0x00ff0000
+#define IMG_IR_CORE_ID_SHIFT 16
+#define IMG_IR_CORE_CONFIG 0x0000ffff
+#define IMG_IR_CORE_CONFIG_SHIFT 0
+
+/* IMG_IR_CORE_REV */
+#define IMG_IR_DESIGNER 0xff000000
+#define IMG_IR_DESIGNER_SHIFT 24
+#define IMG_IR_MAJOR_REV 0x00ff0000
+#define IMG_IR_MAJOR_REV_SHIFT 16
+#define IMG_IR_MINOR_REV 0x0000ff00
+#define IMG_IR_MINOR_REV_SHIFT 8
+#define IMG_IR_MAINT_REV 0x000000ff
+#define IMG_IR_MAINT_REV_SHIFT 0
+
+struct device;
+struct clk;
+
+/**
+ * struct img_ir_priv - Private driver data.
+ * @dev: Platform device.
+ * @irq: IRQ number.
+ * @clk: Input clock.
+ * @reg_base: Iomem base address of IR register block.
+ * @lock: Protects IR registers and variables in this struct.
+ * @raw: Driver data for raw decoder.
+ * @hw: Driver data for hardware decoder.
+ */
+struct img_ir_priv {
+ struct device *dev;
+ int irq;
+ struct clk *clk;
+ void __iomem *reg_base;
+ spinlock_t lock;
+
+ struct img_ir_priv_raw raw;
+ struct img_ir_priv_hw hw;
+};
+
+/* Hardware access */
+
+static inline void img_ir_write(struct img_ir_priv *priv,
+ unsigned int reg_offs, unsigned int data)
+{
+ iowrite32(data, priv->reg_base + reg_offs);
+}
+
+static inline unsigned int img_ir_read(struct img_ir_priv *priv,
+ unsigned int reg_offs)
+{
+ return ioread32(priv->reg_base + reg_offs);
+}
+
+#endif /* _IMG_IR_H_ */
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2 06/15] dt: binding: add binding for ImgTec IR block
[not found] ` <20140207145053.GF25314-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
@ 2014-02-07 22:29 ` Rob Herring
0 siblings, 0 replies; 14+ messages in thread
From: Rob Herring @ 2014-02-07 22:29 UTC (permalink / raw)
To: Mark Rutland
Cc: James Hogan, Mauro Carvalho Chehab,
linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring,
Pawel Moll, Ian Campbell, Kumar Gala,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Landley,
linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Tomasz Figa
On Fri, Feb 7, 2014 at 8:50 AM, Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org> wrote:
> Hi Rob,
>
> On Fri, Feb 07, 2014 at 02:33:27PM +0000, Rob Herring wrote:
>> On Thu, Feb 6, 2014 at 8:41 AM, James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org> wrote:
>> > Hi Rob,
>> >
>> > On 06/02/14 14:33, Rob Herring wrote:
>> >> On Fri, Jan 17, 2014 at 7:58 AM, James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org> wrote:
>> >>> +Required properties:
>> >>> +- compatible: Should be "img,ir1"
>> >>
>> >> Kind of short for a name. I don't have anything much better, but how
>> >> about img,ir-rev1.
>> >
>> > Okay, that sounds reasonable.
>> >
>> >>> +Optional properties:
>> >>> +- clocks: List of clock specifiers as described in standard
>> >>> + clock bindings.
>> >>> +- clock-names: List of clock names corresponding to the clocks
>> >>> + specified in the clocks property.
>> >>> + Accepted clock names are:
>> >>> + "core": Core clock (defaults to 32.768KHz if omitted).
>> >>> + "sys": System side (fast) clock.
>> >>> + "mod": Power modulation clock.
>> >>
>> >> You need to define the order of clocks including how they are
>> >> interpreted with different number of clocks (not relying on the name).
>> >
>> > Would it be sufficient to specify that "clock-names" is required if
>> > "clocks" is provided (i.e. unnamed clocks aren't used), or is there some
>> > other reason that clock-names shouldn't be relied upon?
>>
>> irq-names, reg-names, clock-names, etc. are considered optional to
>> their associated property and the order is supposed to be defined.
>> clock-names is a bit different in that clk_get needs a name, so it
>> effectively is required by Linux when there is more than 1 clock.
>> Really, we should fix Linux.
>
> If they're optional then you can't handle optional entries (i.e. when
> nothing's wired to an input), and this is counter to the style I've been
> recommending to people (defining clocks in terms of clock-names).
>
> I really don't see the point in any *-names property if they don't
> define the list and allow for optional / reordered lists. Why does the
> order have to be fixed rather than using the -names properties? It's
> already a de-facto standard.
Maybe for clocks, but I don't think we should treat clocks differently
from other properties. We've already got enough variation in binding
styles, I'd like to be consistent across interrupts, reg, clocks, etc.
>> Regardless, my other point is still valid. A given h/w block has a
>> fixed number of clocks. You may have them all connected to the same
>> source in some cases, but that does not change the number of inputs.
>> Defining what are the valid combinations needs to be done. Seems like
>> this could be:
>>
>> <none> - default to 32KHz
>> <core> - only a "baud" clock
>> <core>, <sys>, <mod> - all clocks
>
> For more complex IP blocks you might have more inputs than you actually
> have clocks wired to.
>
> How do you handle an unwired input in the middle of the list, or a new
> revision of the IP block that got rid of the first clock input from the
> list but is otherwise compatible?
fixed-clock with freq of 0 for unwired (really wired to gnd) inputs?
With a new compatible string if it is a new block.
Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 06/15] dt: binding: add binding for ImgTec IR block
2014-02-07 15:49 ` [PATCH v3 " James Hogan
@ 2014-02-27 22:52 ` James Hogan
2014-02-28 1:28 ` Rob Herring
0 siblings, 1 reply; 14+ messages in thread
From: James Hogan @ 2014-02-27 22:52 UTC (permalink / raw)
To: Rob Herring, Mark Rutland
Cc: Mauro Carvalho Chehab, linux-media, Pawel Moll, Ian Campbell,
Kumar Gala, devicetree, Rob Landley, linux-doc, Tomasz Figa
[-- Attachment #1: Type: text/plain, Size: 2909 bytes --]
Hi Rob, Mark + DT maintainers,
On Friday 07 February 2014 15:49:15 James Hogan wrote:
> Add device tree binding for ImgTec Consumer Infrared block, specifically
> major revision 1 of the hardware.
>
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
> Cc: linux-media@vger.kernel.org
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Pawel Moll <pawel.moll@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
> Cc: Kumar Gala <galak@codeaurora.org>
> Cc: devicetree@vger.kernel.org
> Cc: Rob Landley <rob@landley.net>
> Cc: linux-doc@vger.kernel.org
> Cc: Tomasz Figa <tomasz.figa@gmail.com>
> ---
> v3:
> - Rename compatible string to "img,ir-rev1" (Rob Herring).
> - Specify ordering of clocks explicitly (Rob Herring).
I'd appreciate if somebody could give this another glance after the two
changes listed above and Ack it (I'll probably be posting a v4 patchset
tomorrow).
Thanks
James
>
> v2:
> - Future proof compatible string from "img,ir" to "img,ir1", where the 1
> corresponds to the major revision number of the hardware (Tomasz
> Figa).
> - Added clock-names property and three specific clock names described in
> the manual, only one of which is used by the current driver (Tomasz
> Figa).
> ---
> .../devicetree/bindings/media/img-ir-rev1.txt | 34
> ++++++++++++++++++++++ 1 file changed, 34 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/media/img-ir-rev1.txt
>
> diff --git a/Documentation/devicetree/bindings/media/img-ir-rev1.txt
> b/Documentation/devicetree/bindings/media/img-ir-rev1.txt new file mode
> 100644
> index 000000000000..5434ce61b925
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/img-ir-rev1.txt
> @@ -0,0 +1,34 @@
> +* ImgTec Infrared (IR) decoder version 1
> +
> +This binding is for Imagination Technologies' Infrared decoder block,
> +specifically major revision 1.
> +
> +Required properties:
> +- compatible: Should be "img,ir-rev1"
> +- reg: Physical base address of the controller and length of
> + memory mapped region.
> +- interrupts: The interrupt specifier to the cpu.
> +
> +Optional properties:
> +- clocks: List of clock specifiers as described in standard
> + clock bindings.
> + Up to 3 clocks may be specified in the following order:
> + 1st: Core clock (defaults to 32.768KHz if omitted).
> + 2nd: System side (fast) clock.
> + 3rd: Power modulation clock.
> +- clock-names: List of clock names corresponding to the clocks
> + specified in the clocks property.
> + Accepted clock names are:
> + "core": Core clock.
> + "sys": System clock.
> + "mod": Power modulation clock.
> +
> +Example:
> +
> + ir@02006200 {
> + compatible = "img,ir-rev1";
> + reg = <0x02006200 0x100>;
> + interrupts = <29 4>;
> + clocks = <&clk_32khz>;
> + clock-names = "core";
> + };
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 06/15] dt: binding: add binding for ImgTec IR block
2014-02-27 22:52 ` James Hogan
@ 2014-02-28 1:28 ` Rob Herring
2014-02-28 9:04 ` James Hogan
0 siblings, 1 reply; 14+ messages in thread
From: Rob Herring @ 2014-02-28 1:28 UTC (permalink / raw)
To: James Hogan
Cc: Rob Herring, Mark Rutland, Mauro Carvalho Chehab,
linux-media@vger.kernel.org, Pawel Moll, Ian Campbell, Kumar Gala,
devicetree@vger.kernel.org, Rob Landley,
linux-doc@vger.kernel.org, Tomasz Figa
On Thu, Feb 27, 2014 at 4:52 PM, James Hogan <james.hogan@imgtec.com> wrote:
> Hi Rob, Mark + DT maintainers,
>
> On Friday 07 February 2014 15:49:15 James Hogan wrote:
>> Add device tree binding for ImgTec Consumer Infrared block, specifically
>> major revision 1 of the hardware.
>>
>> Signed-off-by: James Hogan <james.hogan@imgtec.com>
>> Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
>> Cc: linux-media@vger.kernel.org
>> Cc: Rob Herring <robh+dt@kernel.org>
>> Cc: Pawel Moll <pawel.moll@arm.com>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
>> Cc: Kumar Gala <galak@codeaurora.org>
>> Cc: devicetree@vger.kernel.org
>> Cc: Rob Landley <rob@landley.net>
>> Cc: linux-doc@vger.kernel.org
>> Cc: Tomasz Figa <tomasz.figa@gmail.com>
>> ---
>> v3:
>> - Rename compatible string to "img,ir-rev1" (Rob Herring).
>> - Specify ordering of clocks explicitly (Rob Herring).
>
> I'd appreciate if somebody could give this another glance after the two
> changes listed above and Ack it (I'll probably be posting a v4 patchset
> tomorrow).
Looks fine.
Acked-by: Rob Herring <robh@kernel.org>
>>
>> v2:
>> - Future proof compatible string from "img,ir" to "img,ir1", where the 1
>> corresponds to the major revision number of the hardware (Tomasz
>> Figa).
>> - Added clock-names property and three specific clock names described in
>> the manual, only one of which is used by the current driver (Tomasz
>> Figa).
>> ---
>> .../devicetree/bindings/media/img-ir-rev1.txt | 34
>> ++++++++++++++++++++++ 1 file changed, 34 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/media/img-ir-rev1.txt
>>
>> diff --git a/Documentation/devicetree/bindings/media/img-ir-rev1.txt
>> b/Documentation/devicetree/bindings/media/img-ir-rev1.txt new file mode
>> 100644
>> index 000000000000..5434ce61b925
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/media/img-ir-rev1.txt
>> @@ -0,0 +1,34 @@
>> +* ImgTec Infrared (IR) decoder version 1
>> +
>> +This binding is for Imagination Technologies' Infrared decoder block,
>> +specifically major revision 1.
>> +
>> +Required properties:
>> +- compatible: Should be "img,ir-rev1"
>> +- reg: Physical base address of the controller and length of
>> + memory mapped region.
>> +- interrupts: The interrupt specifier to the cpu.
>> +
>> +Optional properties:
>> +- clocks: List of clock specifiers as described in standard
>> + clock bindings.
>> + Up to 3 clocks may be specified in the following order:
>> + 1st: Core clock (defaults to 32.768KHz if omitted).
>> + 2nd: System side (fast) clock.
>> + 3rd: Power modulation clock.
>> +- clock-names: List of clock names corresponding to the clocks
>> + specified in the clocks property.
>> + Accepted clock names are:
>> + "core": Core clock.
>> + "sys": System clock.
>> + "mod": Power modulation clock.
>> +
>> +Example:
>> +
>> + ir@02006200 {
>> + compatible = "img,ir-rev1";
>> + reg = <0x02006200 0x100>;
>> + interrupts = <29 4>;
>> + clocks = <&clk_32khz>;
>> + clock-names = "core";
>> + };
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 06/15] dt: binding: add binding for ImgTec IR block
2014-02-28 1:28 ` Rob Herring
@ 2014-02-28 9:04 ` James Hogan
0 siblings, 0 replies; 14+ messages in thread
From: James Hogan @ 2014-02-28 9:04 UTC (permalink / raw)
To: Rob Herring
Cc: Rob Herring, Mark Rutland, Mauro Carvalho Chehab,
linux-media@vger.kernel.org, Pawel Moll, Ian Campbell, Kumar Gala,
devicetree@vger.kernel.org, Rob Landley,
linux-doc@vger.kernel.org, Tomasz Figa
On 28/02/14 01:28, Rob Herring wrote:
> On Thu, Feb 27, 2014 at 4:52 PM, James Hogan <james.hogan@imgtec.com> wrote:
>>> v3:
>>> - Rename compatible string to "img,ir-rev1" (Rob Herring).
>>> - Specify ordering of clocks explicitly (Rob Herring).
>>
>> I'd appreciate if somebody could give this another glance after the two
>> changes listed above and Ack it (I'll probably be posting a v4 patchset
>> tomorrow).
>
> Looks fine.
>
> Acked-by: Rob Herring <robh@kernel.org>
Thanks Rob!
Cheers
James
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2014-02-28 9:04 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-17 13:58 [PATCH v2 00/15] media: rc: ImgTec IR decoder driver James Hogan
2014-01-17 13:58 ` [PATCH v2 06/15] dt: binding: add binding for ImgTec IR block James Hogan
2014-02-06 11:24 ` Mauro Carvalho Chehab
2014-02-06 14:33 ` Rob Herring
2014-02-06 14:41 ` James Hogan
2014-02-07 14:33 ` Rob Herring
2014-02-07 14:50 ` Mark Rutland
[not found] ` <20140207145053.GF25314-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2014-02-07 22:29 ` Rob Herring
2014-02-07 15:49 ` [PATCH v3 " James Hogan
2014-02-27 22:52 ` James Hogan
2014-02-28 1:28 ` Rob Herring
2014-02-28 9:04 ` James Hogan
[not found] ` <1389967140-20704-1-git-send-email-james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2014-01-17 13:58 ` [PATCH v2 07/15] media: rc: img-ir: add base driver James Hogan
[not found] ` <1389967140-20704-8-git-send-email-james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2014-02-07 16:16 ` [PATCH v3 " James Hogan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).