linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: "Csókás, Bence" <csokas.bence@prolan.hu>,
	dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: Mesih Kilinc <mesihkilinc@gmail.com>,
	Vinod Koul <vkoul@kernel.org>,  Chen-Yu Tsai <wens@csie.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Samuel Holland <samuel@sholland.org>
Subject: Re: [PATCH 02/10] dma-engine: sun4i: Add has_reset option to quirk
Date: Thu, 24 Oct 2024 10:11:35 +0200	[thread overview]
Message-ID: <83b9d2855f9513b2431fe31c43a992eb952f9b05.camel@pengutronix.de> (raw)
In-Reply-To: <20241024064931.1144605-3-csokas.bence@prolan.hu>

On Do, 2024-10-24 at 08:49 +0200, Csókás, Bence wrote:
> From: Mesih Kilinc <mesihkilinc@gmail.com>
> 
> Allwinner suniv F1C100s has a reset bit for DMA in CCU. Sun4i do not
> has this bit but in order to support suniv we need to add it. So add
> support for reset bit.
> 
> Signed-off-by: Mesih Kilinc <mesihkilinc@gmail.com>
> ---
>  drivers/dma/sun4i-dma.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/drivers/dma/sun4i-dma.c b/drivers/dma/sun4i-dma.c
> index 5efbed7c546f..0b99b3884971 100644
> --- a/drivers/dma/sun4i-dma.c
> +++ b/drivers/dma/sun4i-dma.c
> @@ -15,6 +15,7 @@
>  #include <linux/of_dma.h>
>  #include <linux/of_device.h>
>  #include <linux/platform_device.h>
> +#include <linux/reset.h>
>  #include <linux/slab.h>
>  #include <linux/spinlock.h>
>  
> @@ -159,6 +160,7 @@ struct sun4i_dma_config {
>  	u8 ddma_drq_sdram;
>  
>  	u8 max_burst;
> +	bool has_reset;
>  };
>  
>  struct sun4i_dma_pchan {
> @@ -208,6 +210,7 @@ struct sun4i_dma_dev {
>  	int				irq;
>  	spinlock_t			lock;
>  	const struct sun4i_dma_config *cfg;
> +	struct reset_control *rst;
>  };
>  
>  static struct sun4i_dma_dev *to_sun4i_dma_dev(struct dma_device *dev)
> @@ -1215,6 +1218,15 @@ static int sun4i_dma_probe(struct platform_device *pdev)
>  		return PTR_ERR(priv->clk);
>  	}
>  
> +	if (priv->cfg->has_reset) {
> +		priv->rst = devm_reset_control_get_exclusive(&pdev->dev,
> +							       NULL);

Aligning to open parenthesis will make checkpatch --strict happy.

> +		if (IS_ERR(priv->rst)) {
> +			dev_err(&pdev->dev, "Failed to get reset control\n");

Consider using dev_err_probe() here.

> +			return PTR_ERR(priv->rst);
> +		}
> +	}
> +
>  	platform_set_drvdata(pdev, priv);
>  	spin_lock_init(&priv->lock);
>  
> @@ -1287,6 +1299,16 @@ static int sun4i_dma_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>  
> +	/* Deassert the reset control */
> +	if (priv->rst) {
> +		ret = reset_control_deassert(priv->rst);
> +		if (ret) {
> +			dev_err(&pdev->dev,
> +				"Failed to deassert the reset control\n");
> +			goto err_clk_disable;
> +		}
> +	}

You can just call reset_control_deassert() unconditionally, it accepts
a NULL parameter:

  https://docs.kernel.org/driver-api/reset.html#c.reset_control_deassert


regards
Philipp


  reply	other threads:[~2024-10-24  8:13 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-02 21:23 [RFC PATCH 00/10] Add support for DMA and audio codec of F1C100s Mesih Kilinc
2018-12-02 21:23 ` [RFC PATCH 01/10] dma-engine: sun4i: Add a quirk to support different chips Mesih Kilinc
2018-12-03 10:54   ` Maxime Ripard
2019-01-04 15:38   ` Vinod Koul
2018-12-02 21:23 ` [RFC PATCH 02/10] dma-engine: sun4i: Add has_reset option to quirk Mesih Kilinc
2018-12-02 21:23 ` [RFC PATCH 03/10] dt-bindings: dmaengine: Add Allwinner suniv F1C100s DMA Mesih Kilinc
2018-12-19 14:03   ` Rob Herring
2018-12-02 21:23 ` [RFC PATCH 04/10] dma-engine: sun4i: Add support for Allwinner suniv F1C100s Mesih Kilinc
2018-12-03 10:56   ` Maxime Ripard
2018-12-03 11:00   ` Maxime Ripard
2018-12-02 21:23 ` [RFC PATCH 05/10] ARM: dts: suniv: f1c100s: Add support for DMA Mesih Kilinc
2018-12-02 21:23 ` [RFC PATCH 06/10] ASoC: sun4i-codec: Add DMA Max Burst field Mesih Kilinc
2018-12-02 21:23 ` [RFC PATCH 07/10] dt-bindigs: sound: Add Allwinner suniv F1C100s Audio Codec Mesih Kilinc
2018-12-19 14:04   ` Rob Herring
2018-12-02 21:23 ` [RFC PATCH 08/10] ASoC: sun4i-codec: Add support for Allwinner suniv F1C100s Mesih Kilinc
2018-12-02 21:23 ` [RFC PATCH 09/10] ARM: dts: suniv: f1c100s: Add support for Audio Codec Mesih Kilinc
2018-12-02 21:23 ` [RFC PATCH 10/10] ARM: dts: suniv: f1c100s: Activate Audio Codec for Lichee Pi Nano Mesih Kilinc
2024-10-22 22:52 ` [RFC PATCH 00/10] Add support for DMA and audio codec of F1C100s Csókás Bence
2024-10-23  6:08   ` Vinod Koul
2024-10-24  6:49   ` [PATCH 01/10] dma-engine: sun4i: Add a quirk to support different chips Csókás, Bence
2024-10-24  6:49   ` [PATCH 02/10] dma-engine: sun4i: Add has_reset option to quirk Csókás, Bence
2024-10-24  8:11     ` Philipp Zabel [this message]
2024-10-24  6:49   ` [PATCH 03/10] dt-bindings: dmaengine: Add Allwinner suniv F1C100s DMA Csókás, Bence
2024-10-24 16:52     ` Conor Dooley
2024-10-24  6:49   ` [PATCH 04/10] dma-engine: sun4i: Add support for Allwinner suniv F1C100s Csókás, Bence
2024-10-24  6:49   ` [PATCH 05/10] ARM: dts: suniv: f1c100s: Add support for DMA Csókás, Bence
2024-10-24  6:49   ` [PATCH 06/10] ASoC: sun4i-codec: Add DMA Max Burst field Csókás, Bence
2024-10-24  6:49   ` [PATCH 07/10] dt-bindings: sound: Add Allwinner suniv F1C100s Audio Codec Csókás, Bence
2024-10-24  6:49   ` [PATCH 08/10] ASoC: sun4i-codec: Add support for Allwinner suniv F1C100s Csókás, Bence
2024-10-24  6:49   ` [PATCH 09/10] ARM: dts: suniv: f1c100s: Add support for Audio Codec Csókás, Bence
2024-10-24  6:49   ` [PATCH 10/10] ARM: dts: suniv: f1c100s: Activate Audio Codec for Lichee Pi Nano Csókás, Bence

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=83b9d2855f9513b2431fe31c43a992eb952f9b05.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=csokas.bence@prolan.hu \
    --cc=dmaengine@vger.kernel.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=mesihkilinc@gmail.com \
    --cc=samuel@sholland.org \
    --cc=vkoul@kernel.org \
    --cc=wens@csie.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).