Commit 73ff316d authored by Alex Elder's avatar Alex Elder Committed by David S. Miller

net: ipa: move IPA power operations to ipa_clock.c

Move ipa_suspend() and ipa_resume(), as well as the definition of
the ipa_pm_ops structure into "ipa_clock.c".  Make ipa_pm_ops public
and declare it as extern in "ipa_clock.h".

This is part of centralizing IPA power management functionality into
"ipa_clock.c" (the file will eventually get a name change).
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8ee7c40a
...@@ -9,9 +9,12 @@ ...@@ -9,9 +9,12 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/interconnect.h> #include <linux/interconnect.h>
#include <linux/pm.h>
#include <linux/bitops.h>
#include "ipa.h" #include "ipa.h"
#include "ipa_clock.h" #include "ipa_clock.h"
#include "ipa_endpoint.h"
#include "ipa_modem.h" #include "ipa_modem.h"
#include "ipa_data.h" #include "ipa_data.h"
...@@ -334,3 +337,62 @@ void ipa_clock_exit(struct ipa_clock *clock) ...@@ -334,3 +337,62 @@ void ipa_clock_exit(struct ipa_clock *clock)
kfree(clock); kfree(clock);
clk_put(clk); clk_put(clk);
} }
/**
* ipa_suspend() - Power management system suspend callback
* @dev: IPA device structure
*
* Return: Always returns zero
*
* Called by the PM framework when a system suspend operation is invoked.
* Suspends endpoints and releases the clock reference held to keep
* the IPA clock running until this point.
*/
static int ipa_suspend(struct device *dev)
{
struct ipa *ipa = dev_get_drvdata(dev);
/* Endpoints aren't usable until setup is complete */
if (ipa->setup_complete) {
__clear_bit(IPA_FLAG_RESUMED, ipa->flags);
ipa_endpoint_suspend(ipa);
gsi_suspend(&ipa->gsi);
}
ipa_clock_put(ipa);
return 0;
}
/**
* ipa_resume() - Power management system resume callback
* @dev: IPA device structure
*
* Return: Always returns 0
*
* Called by the PM framework when a system resume operation is invoked.
* Takes an IPA clock reference to keep the clock running until suspend,
* and resumes endpoints.
*/
static int ipa_resume(struct device *dev)
{
struct ipa *ipa = dev_get_drvdata(dev);
/* This clock reference will keep the IPA out of suspend
* until we get a power management suspend request.
*/
ipa_clock_get(ipa);
/* Endpoints aren't usable until setup is complete */
if (ipa->setup_complete) {
gsi_resume(&ipa->gsi);
ipa_endpoint_resume(ipa);
}
return 0;
}
const struct dev_pm_ops ipa_pm_ops = {
.suspend = ipa_suspend,
.resume = ipa_resume,
};
...@@ -11,6 +11,9 @@ struct device; ...@@ -11,6 +11,9 @@ struct device;
struct ipa; struct ipa;
struct ipa_clock_data; struct ipa_clock_data;
/* IPA device power management function block */
extern const struct dev_pm_ops ipa_pm_ops;
/** /**
* ipa_clock_rate() - Return the current IPA core clock rate * ipa_clock_rate() - Return the current IPA core clock rate
* @ipa: IPA structure * @ipa: IPA structure
......
...@@ -874,65 +874,6 @@ static void ipa_shutdown(struct platform_device *pdev) ...@@ -874,65 +874,6 @@ static void ipa_shutdown(struct platform_device *pdev)
dev_err(&pdev->dev, "shutdown: remove returned %d\n", ret); dev_err(&pdev->dev, "shutdown: remove returned %d\n", ret);
} }
/**
* ipa_suspend() - Power management system suspend callback
* @dev: IPA device structure
*
* Return: Always returns zero
*
* Called by the PM framework when a system suspend operation is invoked.
* Suspends endpoints and releases the clock reference held to keep
* the IPA clock running until this point.
*/
static int ipa_suspend(struct device *dev)
{
struct ipa *ipa = dev_get_drvdata(dev);
/* Endpoints aren't usable until setup is complete */
if (ipa->setup_complete) {
__clear_bit(IPA_FLAG_RESUMED, ipa->flags);
ipa_endpoint_suspend(ipa);
gsi_suspend(&ipa->gsi);
}
ipa_clock_put(ipa);
return 0;
}
/**
* ipa_resume() - Power management system resume callback
* @dev: IPA device structure
*
* Return: Always returns 0
*
* Called by the PM framework when a system resume operation is invoked.
* Takes an IPA clock reference to keep the clock running until suspend,
* and resumes endpoints.
*/
static int ipa_resume(struct device *dev)
{
struct ipa *ipa = dev_get_drvdata(dev);
/* This clock reference will keep the IPA out of suspend
* until we get a power management suspend request.
*/
ipa_clock_get(ipa);
/* Endpoints aren't usable until setup is complete */
if (ipa->setup_complete) {
gsi_resume(&ipa->gsi);
ipa_endpoint_resume(ipa);
}
return 0;
}
static const struct dev_pm_ops ipa_pm_ops = {
.suspend = ipa_suspend,
.resume = ipa_resume,
};
static const struct attribute_group *ipa_attribute_groups[] = { static const struct attribute_group *ipa_attribute_groups[] = {
&ipa_attribute_group, &ipa_attribute_group,
&ipa_feature_attribute_group, &ipa_feature_attribute_group,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment