Re: [PATCH 2/2] dma: img-mdc: Add runtime PM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 02, 2017 at 10:44:40AM +0100, Ed Blake wrote:
> +static int img_mdc_runtime_suspend(struct device *dev);
> +static int img_mdc_runtime_resume(struct device *dev);

why fwd declaration?

> +
>  static inline u32 mdc_readl(struct mdc_dma *mdma, u32 reg)
>  {
>  	return readl(mdma->regs + reg);
> @@ -730,14 +734,23 @@ static int mdc_slave_config(struct dma_chan *chan,
>  	return 0;
>  }
>  
> +static int mdc_alloc_chan_resources(struct dma_chan *chan)
> +{
> +	struct mdc_chan *mchan = to_mdc_chan(chan);
> +	struct device *dev = mdma2dev(mchan->mdma);
> +
> +	return pm_runtime_get_sync(dev);
> +}
> +
>  static void mdc_free_chan_resources(struct dma_chan *chan)
>  {
>  	struct mdc_chan *mchan = to_mdc_chan(chan);
>  	struct mdc_dma *mdma = mchan->mdma;
> +	struct device *dev = mdma2dev(mdma);
>  
>  	mdc_terminate_all(chan);
> -
>  	mdma->soc->disable_chan(mchan);
> +	pm_runtime_put(dev);
>  }
>  
>  static irqreturn_t mdc_chan_irq(int irq, void *dev_id)
> @@ -883,10 +896,6 @@ static int mdc_dma_probe(struct platform_device *pdev)
>  	if (IS_ERR(mdma->clk))
>  		return PTR_ERR(mdma->clk);
>  
> -	ret = clk_prepare_enable(mdma->clk);
> -	if (ret)
> -		return ret;
> -

why is this removed, maybe unrelated to this change?

> +static int img_mdc_runtime_suspend(struct device *dev)
> +{
> +	struct mdc_dma *mdma = dev_get_drvdata(dev);
> +
> +	clk_disable_unprepare(mdma->clk);
> +	return 0;
> +}
> +
> +static int img_mdc_runtime_resume(struct device *dev)
> +{
> +	struct mdc_dma *mdma = dev_get_drvdata(dev);
> +
> +	return clk_prepare_enable(mdma->clk);
> +}

seems similar to the ones in prev, i guess we might be able to optimize

-- 
~Vinod
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux