All of lore.kernel.org
 help / color / mirror / Atom feed
From: Moritz Fischer <mdf@kernel.org>
To: Nava kishore Manne <nava.manne@xilinx.com>
Cc: mdf@kernel.org, trix@redhat.com, robh+dt@kernel.org,
	michal.simek@xilinx.com, linux-fpga@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, git@xilinx.com
Subject: Re: [PATCH 3/3] fpga: region: Adds runtime PM support
Date: Fri, 9 Apr 2021 14:30:45 -0700	[thread overview]
Message-ID: <YHDHhf1tQo6vI49W@epycbox.lan> (raw)
In-Reply-To: <20210402092049.479-4-nava.manne@xilinx.com>

On Fri, Apr 02, 2021 at 02:50:49PM +0530, Nava kishore Manne wrote:
> Adds support to handle FPGA/PL power domain. With this patch,
> the PL power domain will be turned on before loading the bitstream
> and turned off while removing/unloading the bitstream using overlays.
> This can be achieved by adding the runtime PM support.
> 
> Signed-off-by: Nava kishore Manne <nava.manne@xilinx.com>
> ---
>  drivers/fpga/of-fpga-region.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/fpga/of-fpga-region.c b/drivers/fpga/of-fpga-region.c
> index e405309baadc..35fc2f3d4bd8 100644
> --- a/drivers/fpga/of-fpga-region.c
> +++ b/drivers/fpga/of-fpga-region.c
> @@ -15,6 +15,7 @@
>  #include <linux/of_platform.h>
>  #include <linux/slab.h>
>  #include <linux/spinlock.h>
> +#include <linux/pm_runtime.h>
>  
>  static const struct of_device_id fpga_region_of_match[] = {
>  	{ .compatible = "fpga-region", },
> @@ -302,6 +303,7 @@ static int of_fpga_region_notify_pre_apply(struct fpga_region *region,
>  	}
>  
>  	region->info = info;
> +	pm_runtime_get_sync(dev->parent);
>  	ret = fpga_region_program_fpga(region);
>  	if (ret) {
>  		/* error; reject overlay */
> @@ -324,10 +326,13 @@ static int of_fpga_region_notify_pre_apply(struct fpga_region *region,
>  static void of_fpga_region_notify_post_remove(struct fpga_region *region,
>  					      struct of_overlay_notify_data *nd)
>  {
> +	struct device *dev = &region->dev;
> +
>  	fpga_bridges_disable(&region->bridge_list);
>  	fpga_bridges_put(&region->bridge_list);
>  	fpga_image_info_free(region->info);
>  	region->info = NULL;
> +	pm_runtime_put(dev->parent);
>  }
>  
>  /**
> @@ -411,9 +416,16 @@ static int of_fpga_region_probe(struct platform_device *pdev)
>  		goto eprobe_mgr_put;
>  	}
>  
> +	pm_runtime_enable(&pdev->dev);
> +	ret = pm_runtime_get_sync(&pdev->dev);
> +	if (ret < 0)
> +		goto err_pm;
> +
> +	pm_runtime_put(&pdev->dev);
> +
>  	ret = fpga_region_register(region);
>  	if (ret)
> -		goto eprobe_mgr_put;
> +		goto err_pm;
>  
>  	of_platform_populate(np, fpga_region_of_match, NULL, &region->dev);
>  	platform_set_drvdata(pdev, region);
> @@ -422,6 +434,9 @@ static int of_fpga_region_probe(struct platform_device *pdev)
>  
>  	return 0;
>  
> +err_pm:
> +	pm_runtime_put(&pdev->dev);
> +	pm_runtime_disable(&pdev->dev);
>  eprobe_mgr_put:
>  	fpga_mgr_put(mgr);
>  	return ret;
> @@ -434,6 +449,7 @@ static int of_fpga_region_remove(struct platform_device *pdev)
>  
>  	fpga_region_unregister(region);
>  	fpga_mgr_put(mgr);
> +	pm_runtime_disable(region->dev.parent);
>  
>  	return 0;
>  }
> -- 
> 2.18.0
> 

Does this add a dependency on CONFIG_PM?

Thanks,
Moritz

WARNING: multiple messages have this Message-ID (diff)
From: Moritz Fischer <mdf@kernel.org>
To: Nava kishore Manne <nava.manne@xilinx.com>
Cc: mdf@kernel.org, trix@redhat.com, robh+dt@kernel.org,
	michal.simek@xilinx.com, linux-fpga@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, git@xilinx.com
Subject: Re: [PATCH 3/3] fpga: region: Adds runtime PM support
Date: Fri, 9 Apr 2021 14:30:45 -0700	[thread overview]
Message-ID: <YHDHhf1tQo6vI49W@epycbox.lan> (raw)
In-Reply-To: <20210402092049.479-4-nava.manne@xilinx.com>

On Fri, Apr 02, 2021 at 02:50:49PM +0530, Nava kishore Manne wrote:
> Adds support to handle FPGA/PL power domain. With this patch,
> the PL power domain will be turned on before loading the bitstream
> and turned off while removing/unloading the bitstream using overlays.
> This can be achieved by adding the runtime PM support.
> 
> Signed-off-by: Nava kishore Manne <nava.manne@xilinx.com>
> ---
>  drivers/fpga/of-fpga-region.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/fpga/of-fpga-region.c b/drivers/fpga/of-fpga-region.c
> index e405309baadc..35fc2f3d4bd8 100644
> --- a/drivers/fpga/of-fpga-region.c
> +++ b/drivers/fpga/of-fpga-region.c
> @@ -15,6 +15,7 @@
>  #include <linux/of_platform.h>
>  #include <linux/slab.h>
>  #include <linux/spinlock.h>
> +#include <linux/pm_runtime.h>
>  
>  static const struct of_device_id fpga_region_of_match[] = {
>  	{ .compatible = "fpga-region", },
> @@ -302,6 +303,7 @@ static int of_fpga_region_notify_pre_apply(struct fpga_region *region,
>  	}
>  
>  	region->info = info;
> +	pm_runtime_get_sync(dev->parent);
>  	ret = fpga_region_program_fpga(region);
>  	if (ret) {
>  		/* error; reject overlay */
> @@ -324,10 +326,13 @@ static int of_fpga_region_notify_pre_apply(struct fpga_region *region,
>  static void of_fpga_region_notify_post_remove(struct fpga_region *region,
>  					      struct of_overlay_notify_data *nd)
>  {
> +	struct device *dev = &region->dev;
> +
>  	fpga_bridges_disable(&region->bridge_list);
>  	fpga_bridges_put(&region->bridge_list);
>  	fpga_image_info_free(region->info);
>  	region->info = NULL;
> +	pm_runtime_put(dev->parent);
>  }
>  
>  /**
> @@ -411,9 +416,16 @@ static int of_fpga_region_probe(struct platform_device *pdev)
>  		goto eprobe_mgr_put;
>  	}
>  
> +	pm_runtime_enable(&pdev->dev);
> +	ret = pm_runtime_get_sync(&pdev->dev);
> +	if (ret < 0)
> +		goto err_pm;
> +
> +	pm_runtime_put(&pdev->dev);
> +
>  	ret = fpga_region_register(region);
>  	if (ret)
> -		goto eprobe_mgr_put;
> +		goto err_pm;
>  
>  	of_platform_populate(np, fpga_region_of_match, NULL, &region->dev);
>  	platform_set_drvdata(pdev, region);
> @@ -422,6 +434,9 @@ static int of_fpga_region_probe(struct platform_device *pdev)
>  
>  	return 0;
>  
> +err_pm:
> +	pm_runtime_put(&pdev->dev);
> +	pm_runtime_disable(&pdev->dev);
>  eprobe_mgr_put:
>  	fpga_mgr_put(mgr);
>  	return ret;
> @@ -434,6 +449,7 @@ static int of_fpga_region_remove(struct platform_device *pdev)
>  
>  	fpga_region_unregister(region);
>  	fpga_mgr_put(mgr);
> +	pm_runtime_disable(region->dev.parent);
>  
>  	return 0;
>  }
> -- 
> 2.18.0
> 

Does this add a dependency on CONFIG_PM?

Thanks,
Moritz

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-04-09 21:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02  9:20 [PATCH 0/3]Enable PM generic domain support Nava kishore Manne
2021-04-02  9:20 ` Nava kishore Manne
2021-04-02  9:20 ` [PATCH 1/3] dt-bindings: zynqmp: Add new PD_PL macro Nava kishore Manne
2021-04-02  9:20   ` Nava kishore Manne
2021-04-09 14:47   ` Rob Herring
2021-04-09 14:47     ` Rob Herring
2021-04-02  9:20 ` [PATCH 2/3] fpga: region: Add fpga-region property 'power-domains' Nava kishore Manne
2021-04-02  9:20   ` Nava kishore Manne
2021-04-02 17:15   ` Moritz Fischer
2021-04-02 17:15     ` Moritz Fischer
2021-04-05  8:46     ` Nava kishore Manne
2021-04-05  8:46       ` Nava kishore Manne
2021-04-09 14:50   ` Rob Herring
2021-04-09 14:50     ` Rob Herring
2021-04-02  9:20 ` [PATCH 3/3] fpga: region: Adds runtime PM support Nava kishore Manne
2021-04-02  9:20   ` Nava kishore Manne
2021-04-09 21:30   ` Moritz Fischer [this message]
2021-04-09 21:30     ` Moritz Fischer
2021-04-19  5:18     ` Nava kishore Manne
2021-04-19  5:18       ` Nava kishore Manne
2021-06-02 10:48       ` Nava kishore Manne
2021-06-02 10:48         ` Nava kishore Manne
2021-06-02 20:39         ` Tom Rix
2021-06-02 20:39           ` Tom Rix
2021-06-02 13:02   ` Johan Hovold
2021-06-02 13:02     ` Johan Hovold

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=YHDHhf1tQo6vI49W@epycbox.lan \
    --to=mdf@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=git@xilinx.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=nava.manne@xilinx.com \
    --cc=robh+dt@kernel.org \
    --cc=trix@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.