devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Emilio Lopez <emilio@elopez.com.ar>,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	Mike Turquette <mturquette@linaro.org>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	devicetree <devicetree@vger.kernel.org>,
	linux-sunxi@googlegroups.com
Subject: Re: [PATCH 5/9] rc: sunxi-cir: Add support for the larger fifo found on sun5i and sun6i
Date: Thu, 20 Nov 2014 14:28:56 -0200	[thread overview]
Message-ID: <20141120142856.16b6562d@recife.lan> (raw)
In-Reply-To: <1416498928-1300-6-git-send-email-hdegoede@redhat.com>

Em Thu, 20 Nov 2014 16:55:24 +0100
Hans de Goede <hdegoede@redhat.com> escreveu:

> Add support for the larger fifo found on sun5i and sun6i, having a separate
> compatible for the ir found on sun5i & sun6i also is useful if we ever want
> to add ir transmit support, because the sun5i & sun6i version do not have
> transmit support.
> 
> Note this commits also adds checking for the end-of-packet interrupt flag
> (which was already enabled), as the fifo-data-available interrupt flag only
> gets set when the trigger-level is exceeded. So far we've been getting away
> with not doing this because of the low trigger-level, but this is something
> which we should have done since day one.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

As this is meant to be merged via some other tree:

Acked-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


> ---
>  .../devicetree/bindings/media/sunxi-ir.txt          |  2 +-
>  drivers/media/rc/sunxi-cir.c                        | 21 ++++++++++++---------
>  2 files changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/media/sunxi-ir.txt b/Documentation/devicetree/bindings/media/sunxi-ir.txt
> index 23dd5ad..5767128 100644
> --- a/Documentation/devicetree/bindings/media/sunxi-ir.txt
> +++ b/Documentation/devicetree/bindings/media/sunxi-ir.txt
> @@ -1,7 +1,7 @@
>  Device-Tree bindings for SUNXI IR controller found in sunXi SoC family
>  
>  Required properties:
> -- compatible	    : should be "allwinner,sun4i-a10-ir";
> +- compatible	    : "allwinner,sun4i-a10-ir" or "allwinner,sun5i-a13-ir"
>  - clocks	    : list of clock specifiers, corresponding to
>  		      entries in clock-names property;
>  - clock-names	    : should contain "apb" and "ir" entries;
> diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c
> index 895fb65..559b0e3 100644
> --- a/drivers/media/rc/sunxi-cir.c
> +++ b/drivers/media/rc/sunxi-cir.c
> @@ -56,12 +56,12 @@
>  #define REG_RXINT_RAI_EN		BIT(4)
>  
>  /* Rx FIFO available byte level */
> -#define REG_RXINT_RAL(val)    (((val) << 8) & (GENMASK(11, 8)))
> +#define REG_RXINT_RAL(val)    ((val) << 8)
>  
>  /* Rx Interrupt Status */
>  #define SUNXI_IR_RXSTA_REG    0x30
>  /* RX FIFO Get Available Counter */
> -#define REG_RXSTA_GET_AC(val) (((val) >> 8) & (GENMASK(5, 0)))
> +#define REG_RXSTA_GET_AC(val) (((val) >> 8) & (ir->fifo_size * 2 - 1))
>  /* Clear all interrupt status value */
>  #define REG_RXSTA_CLEARALL    0xff
>  
> @@ -72,10 +72,6 @@
>  /* CIR_REG register idle threshold */
>  #define REG_CIR_ITHR(val)    (((val) << 8) & (GENMASK(15, 8)))
>  
> -/* Hardware supported fifo size */
> -#define SUNXI_IR_FIFO_SIZE    16
> -/* How many messages in FIFO trigger IRQ */
> -#define TRIGGER_LEVEL         8
>  /* Required frequency for IR0 or IR1 clock in CIR mode */
>  #define SUNXI_IR_BASE_CLK     8000000
>  /* Frequency after IR internal divider  */
> @@ -94,6 +90,7 @@ struct sunxi_ir {
>  	struct rc_dev   *rc;
>  	void __iomem    *base;
>  	int             irq;
> +	int		fifo_size;
>  	struct clk      *clk;
>  	struct clk      *apb_clk;
>  	struct reset_control *rst;
> @@ -115,11 +112,11 @@ static irqreturn_t sunxi_ir_irq(int irqno, void *dev_id)
>  	/* clean all pending statuses */
>  	writel(status | REG_RXSTA_CLEARALL, ir->base + SUNXI_IR_RXSTA_REG);
>  
> -	if (status & REG_RXINT_RAI_EN) {
> +	if (status & (REG_RXINT_RAI_EN | REG_RXINT_RPEI_EN)) {
>  		/* How many messages in fifo */
>  		rc  = REG_RXSTA_GET_AC(status);
>  		/* Sanity check */
> -		rc = rc > SUNXI_IR_FIFO_SIZE ? SUNXI_IR_FIFO_SIZE : rc;
> +		rc = rc > ir->fifo_size ? ir->fifo_size : rc;
>  		/* If we have data */
>  		for (cnt = 0; cnt < rc; cnt++) {
>  			/* for each bit in fifo */
> @@ -156,6 +153,11 @@ static int sunxi_ir_probe(struct platform_device *pdev)
>  	if (!ir)
>  		return -ENOMEM;
>  
> +	if (of_device_is_compatible(dn, "allwinner,sun5i-a13-ir"))
> +		ir->fifo_size = 64;
> +	else
> +		ir->fifo_size = 16;
> +
>  	/* Clock */
>  	ir->apb_clk = devm_clk_get(dev, "apb");
>  	if (IS_ERR(ir->apb_clk)) {
> @@ -271,7 +273,7 @@ static int sunxi_ir_probe(struct platform_device *pdev)
>  	 * level
>  	 */
>  	writel(REG_RXINT_ROI_EN | REG_RXINT_RPEI_EN |
> -	       REG_RXINT_RAI_EN | REG_RXINT_RAL(TRIGGER_LEVEL - 1),
> +	       REG_RXINT_RAI_EN | REG_RXINT_RAL(ir->fifo_size / 2 - 1),
>  	       ir->base + SUNXI_IR_RXINT_REG);
>  
>  	/* Enable IR Module */
> @@ -319,6 +321,7 @@ static int sunxi_ir_remove(struct platform_device *pdev)
>  
>  static const struct of_device_id sunxi_ir_match[] = {
>  	{ .compatible = "allwinner,sun4i-a10-ir", },
> +	{ .compatible = "allwinner,sun5i-a13-ir", },
>  	{},
>  };
>  

  reply	other threads:[~2014-11-20 16:28 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-20 15:55 [PATCH 0/9] sun6i / A31 ir receiver support Hans de Goede
     [not found] ` <1416498928-1300-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-11-20 15:55   ` [PATCH 1/9] clk: sunxi: Give sunxi_factors_register a registers parameter Hans de Goede
2014-11-21  8:35     ` Maxime Ripard
2014-11-21  8:44       ` Hans de Goede
     [not found]         ` <546EFB83.1020806-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-11-21 11:15           ` Maxime Ripard
2014-11-20 15:55   ` [PATCH 2/9] clk: sunxi: Make sun4i_a10_mod0_data available outside of clk-mod0.c Hans de Goede
2014-11-20 15:55   ` [PATCH 3/9] clk: sunxi: Add prcm mod0 clock driver Hans de Goede
     [not found]     ` <1416498928-1300-4-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-11-20 18:24       ` Chen-Yu Tsai
     [not found]         ` <CAGb2v66zoAy93mjZn+yf8zvCmkQ8AVWH92jKL-gyu90E5HLuuw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-20 19:32           ` Hans de Goede
2014-11-21  8:49       ` Maxime Ripard
2014-11-21  9:13         ` Hans de Goede
     [not found]           ` <546F0226.2040700-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-11-24 22:03             ` Maxime Ripard
2014-11-25  8:29               ` Hans de Goede
     [not found]                 ` <54743DE1.7020704-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-11-25  8:37                   ` Hans de Goede
2014-11-26 21:13                   ` Maxime Ripard
2014-11-27  8:41                     ` Hans de Goede
     [not found]                       ` <5476E3A5.4000708-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-11-27  9:28                         ` Chen-Yu Tsai
     [not found]                           ` <CAGb2v652m0bCdPWFF4LWwjcrCJZvnLibFPw8xXJ3Q-Ge+_-p7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-27 10:10                             ` Hans de Goede
     [not found]                               ` <5476F8AB.2000601-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-11-27 19:05                                 ` Maxime Ripard
2014-11-28 13:37                                   ` Hans de Goede
     [not found]                                     ` <54787A8A.6040209-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-12-02 15:45                                       ` Maxime Ripard
2014-12-03  9:49                                         ` Hans de Goede
     [not found]                                           ` <547EDCA0.4040805-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-12-07 18:08                                             ` Maxime Ripard
2014-12-08  8:19                                               ` Hans de Goede
     [not found]                                                 ` <54855EF6.1000900-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-12-09  8:51                                                   ` Maxime Ripard
2014-11-27 18:51                         ` Maxime Ripard
2014-11-27 16:40                     ` Boris Brezillon
2014-11-27 19:15                       ` Maxime Ripard
2014-11-20 15:55   ` [PATCH 4/9] rc: sunxi-cir: Add support for an optional reset controller Hans de Goede
2014-11-20 16:28     ` Mauro Carvalho Chehab
     [not found]       ` <20141120142831.003fb63e-+RedX5hVuTR+urZeOPWqwQ@public.gmane.org>
2014-11-21  8:51         ` Maxime Ripard
     [not found]     ` <1416498928-1300-5-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-11-20 23:05       ` Julian Calaby
2014-11-20 15:55   ` [PATCH 5/9] rc: sunxi-cir: Add support for the larger fifo found on sun5i and sun6i Hans de Goede
2014-11-20 16:28     ` Mauro Carvalho Chehab [this message]
2014-11-21  8:26       ` Maxime Ripard
2014-11-21  8:42         ` Hans de Goede
     [not found]           ` <546EFAE1.9050506-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-11-21  9:59             ` Maxime Ripard
2014-11-21 10:13               ` Hans de Goede
     [not found]                 ` <546F103D.6050004-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-11-23 15:47                   ` Maxime Ripard
2014-11-20 15:55   ` [PATCH 6/9] ARM: dts: sun6i: Add ir_clk node Hans de Goede
2014-11-20 15:55   ` [PATCH 7/9] ARM: dts: sun6i: Add ir node Hans de Goede
2014-11-20 15:55   ` [PATCH 8/9] ARM: dts: sun6i: Add pinmux settings for the ir pins Hans de Goede
2014-11-20 15:55   ` [PATCH 9/9] ARM: dts: sun6i: Enable ir receiver on the Mele M9 Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141120142856.16b6562d@recife.lan \
    --to=mchehab@osg.samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=emilio@elopez.com.ar \
    --cc=hdegoede@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=mturquette@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).