Commit 81aa8d14 authored by Ulf Hansson's avatar Ulf Hansson Committed by Mauro Carvalho Chehab

[media] exynos-gsc: Make PM callbacks available conditionally

There are no need to set up the PM callbacks (runtime and system) unless
they are being used. It also causes compiler warnings about unused
functions.

Silence the warnings by making them available for CONFIG_PM (runtime
callbacks) and CONFIG_PM_SLEEP (system sleep callbacks).

[mszyprow: squashed two patches into one to avoid potential build
break, changed patch subject and updated commit message]
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 15f90ab5
...@@ -1001,43 +1001,6 @@ static void *gsc_get_drv_data(struct platform_device *pdev) ...@@ -1001,43 +1001,6 @@ static void *gsc_get_drv_data(struct platform_device *pdev)
return driver_data; return driver_data;
} }
static int gsc_m2m_suspend(struct gsc_dev *gsc)
{
unsigned long flags;
int timeout;
spin_lock_irqsave(&gsc->slock, flags);
if (!gsc_m2m_pending(gsc)) {
spin_unlock_irqrestore(&gsc->slock, flags);
return 0;
}
clear_bit(ST_M2M_SUSPENDED, &gsc->state);
set_bit(ST_M2M_SUSPENDING, &gsc->state);
spin_unlock_irqrestore(&gsc->slock, flags);
timeout = wait_event_timeout(gsc->irq_queue,
test_bit(ST_M2M_SUSPENDED, &gsc->state),
GSC_SHUTDOWN_TIMEOUT);
clear_bit(ST_M2M_SUSPENDING, &gsc->state);
return timeout == 0 ? -EAGAIN : 0;
}
static void gsc_m2m_resume(struct gsc_dev *gsc)
{
struct gsc_ctx *ctx;
unsigned long flags;
spin_lock_irqsave(&gsc->slock, flags);
/* Clear for full H/W setup in first run after resume */
ctx = gsc->m2m.ctx;
gsc->m2m.ctx = NULL;
spin_unlock_irqrestore(&gsc->slock, flags);
if (test_and_clear_bit(ST_M2M_SUSPENDED, &gsc->state))
gsc_m2m_job_finish(ctx, VB2_BUF_STATE_ERROR);
}
static int gsc_probe(struct platform_device *pdev) static int gsc_probe(struct platform_device *pdev)
{ {
struct gsc_dev *gsc; struct gsc_dev *gsc;
...@@ -1143,6 +1106,44 @@ static int gsc_remove(struct platform_device *pdev) ...@@ -1143,6 +1106,44 @@ static int gsc_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef CONFIG_PM
static int gsc_m2m_suspend(struct gsc_dev *gsc)
{
unsigned long flags;
int timeout;
spin_lock_irqsave(&gsc->slock, flags);
if (!gsc_m2m_pending(gsc)) {
spin_unlock_irqrestore(&gsc->slock, flags);
return 0;
}
clear_bit(ST_M2M_SUSPENDED, &gsc->state);
set_bit(ST_M2M_SUSPENDING, &gsc->state);
spin_unlock_irqrestore(&gsc->slock, flags);
timeout = wait_event_timeout(gsc->irq_queue,
test_bit(ST_M2M_SUSPENDED, &gsc->state),
GSC_SHUTDOWN_TIMEOUT);
clear_bit(ST_M2M_SUSPENDING, &gsc->state);
return timeout == 0 ? -EAGAIN : 0;
}
static void gsc_m2m_resume(struct gsc_dev *gsc)
{
struct gsc_ctx *ctx;
unsigned long flags;
spin_lock_irqsave(&gsc->slock, flags);
/* Clear for full H/W setup in first run after resume */
ctx = gsc->m2m.ctx;
gsc->m2m.ctx = NULL;
spin_unlock_irqrestore(&gsc->slock, flags);
if (test_and_clear_bit(ST_M2M_SUSPENDED, &gsc->state))
gsc_m2m_job_finish(ctx, VB2_BUF_STATE_ERROR);
}
static int gsc_runtime_resume(struct device *dev) static int gsc_runtime_resume(struct device *dev)
{ {
struct gsc_dev *gsc = dev_get_drvdata(dev); struct gsc_dev *gsc = dev_get_drvdata(dev);
...@@ -1173,7 +1174,9 @@ static int gsc_runtime_suspend(struct device *dev) ...@@ -1173,7 +1174,9 @@ static int gsc_runtime_suspend(struct device *dev)
pr_debug("gsc%d: state: 0x%lx", gsc->id, gsc->state); pr_debug("gsc%d: state: 0x%lx", gsc->id, gsc->state);
return ret; return ret;
} }
#endif
#ifdef CONFIG_PM_SLEEP
static int gsc_resume(struct device *dev) static int gsc_resume(struct device *dev)
{ {
struct gsc_dev *gsc = dev_get_drvdata(dev); struct gsc_dev *gsc = dev_get_drvdata(dev);
...@@ -1210,12 +1213,11 @@ static int gsc_suspend(struct device *dev) ...@@ -1210,12 +1213,11 @@ static int gsc_suspend(struct device *dev)
return 0; return 0;
} }
#endif
static const struct dev_pm_ops gsc_pm_ops = { static const struct dev_pm_ops gsc_pm_ops = {
.suspend = gsc_suspend, SET_SYSTEM_SLEEP_PM_OPS(gsc_suspend, gsc_resume)
.resume = gsc_resume, SET_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL)
.runtime_suspend = gsc_runtime_suspend,
.runtime_resume = gsc_runtime_resume,
}; };
static struct platform_driver gsc_driver = { static struct platform_driver gsc_driver = {
......
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