public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: mchehab@osg•samsung.com (Mauro Carvalho Chehab)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 4/9] rc: sunxi-cir: Add support for an optional reset controller
Date: Thu, 20 Nov 2014 14:28:31 -0200	[thread overview]
Message-ID: <20141120142831.003fb63e@recife.lan> (raw)
In-Reply-To: <1416498928-1300-5-git-send-email-hdegoede@redhat.com>

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

> On sun6i the cir block is attached to the reset controller, add support
> for de-asserting the reset if a reset controller is specified in dt.
> 
> 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>


> ---
>  drivers/media/rc/sunxi-cir.c | 25 +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c
> index bcee8e1..895fb65 100644
> --- a/drivers/media/rc/sunxi-cir.c
> +++ b/drivers/media/rc/sunxi-cir.c
> @@ -23,6 +23,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/module.h>
>  #include <linux/of_platform.h>
> +#include <linux/reset.h>
>  #include <media/rc-core.h>
>  
>  #define SUNXI_IR_DEV "sunxi-ir"
> @@ -95,6 +96,7 @@ struct sunxi_ir {
>  	int             irq;
>  	struct clk      *clk;
>  	struct clk      *apb_clk;
> +	struct reset_control *rst;
>  	const char      *map_name;
>  };
>  
> @@ -166,15 +168,29 @@ static int sunxi_ir_probe(struct platform_device *pdev)
>  		return PTR_ERR(ir->clk);
>  	}
>  
> +	/* Reset (optional) */
> +	ir->rst = devm_reset_control_get_optional(dev, NULL);
> +	if (IS_ERR(ir->rst)) {
> +		ret = PTR_ERR(ir->rst);
> +		if (ret == -EPROBE_DEFER)
> +			return ret;
> +		ir->rst = NULL;
> +	} else {
> +		ret = reset_control_deassert(ir->rst);
> +		if (ret)
> +			return ret;
> +	}
> +
>  	ret = clk_set_rate(ir->clk, SUNXI_IR_BASE_CLK);
>  	if (ret) {
>  		dev_err(dev, "set ir base clock failed!\n");
> -		return ret;
> +		goto exit_reset_assert;
>  	}
>  
>  	if (clk_prepare_enable(ir->apb_clk)) {
>  		dev_err(dev, "try to enable apb_ir_clk failed\n");
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		goto exit_reset_assert;
>  	}
>  
>  	if (clk_prepare_enable(ir->clk)) {
> @@ -271,6 +287,9 @@ exit_clkdisable_clk:
>  	clk_disable_unprepare(ir->clk);
>  exit_clkdisable_apb_clk:
>  	clk_disable_unprepare(ir->apb_clk);
> +exit_reset_assert:
> +	if (ir->rst)
> +		reset_control_assert(ir->rst);
>  
>  	return ret;
>  }
> @@ -282,6 +301,8 @@ static int sunxi_ir_remove(struct platform_device *pdev)
>  
>  	clk_disable_unprepare(ir->clk);
>  	clk_disable_unprepare(ir->apb_clk);
> +	if (ir->rst)
> +		reset_control_assert(ir->rst);
>  
>  	spin_lock_irqsave(&ir->ir_lock, flags);
>  	/* disable IR IRQ */

  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
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
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
2014-11-20 18:24   ` [linux-sunxi] " Chen-Yu Tsai
2014-11-20 19:32     ` Hans de Goede
2014-11-21  8:49   ` Maxime Ripard
2014-11-21  9:13     ` Hans de Goede
2014-11-24 22:03       ` Maxime Ripard
2014-11-25  8:29         ` Hans de Goede
2014-11-25  8:37           ` Hans de Goede
2014-11-26 21:13           ` Maxime Ripard
2014-11-27  8:41             ` Hans de Goede
2014-11-27  9:28               ` Chen-Yu Tsai
2014-11-27 10:10                 ` Hans de Goede
2014-11-27 19:05                   ` Maxime Ripard
2014-11-28 13:37                     ` Hans de Goede
2014-12-02 15:45                       ` Maxime Ripard
2014-12-03  9:49                         ` Hans de Goede
2014-12-07 18:08                           ` Maxime Ripard
2014-12-08  8:19                             ` Hans de Goede
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 [this message]
2014-11-21  8:51     ` Maxime Ripard
2014-11-20 23:05   ` [linux-sunxi] " 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
2014-11-21  8:26     ` Maxime Ripard
2014-11-21  8:42       ` Hans de Goede
2014-11-21  9:59         ` Maxime Ripard
2014-11-21 10:13           ` Hans de Goede
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=20141120142831.003fb63e@recife.lan \
    --to=mchehab@osg$(echo .)samsung.com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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