Release 4.8 drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
/*
* linux/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
*
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include "s5p_mfc_common.h"
#include "s5p_mfc_debug.h"
#include "s5p_mfc_pm.h"
#define MFC_GATE_CLK_NAME "mfc"
#define MFC_SCLK_NAME "sclk_mfc"
#define MFC_SCLK_RATE (200 * 1000000)
#define CLK_DEBUG
static struct s5p_mfc_pm *pm;
static struct s5p_mfc_dev *p_dev;
#ifdef CLK_DEBUG
static atomic_t clk_ref;
#endif
int s5p_mfc_init_pm(struct s5p_mfc_dev *dev)
{
int ret = 0;
pm = &dev->pm;
p_dev = dev;
pm->clock_gate = clk_get(&dev->plat_dev->dev, MFC_GATE_CLK_NAME);
if (IS_ERR(pm->clock_gate)) {
mfc_err("Failed to get clock-gating control\n");
ret = PTR_ERR(pm->clock_gate);
goto err_g_ip_clk;
}
ret = clk_prepare(pm->clock_gate);
if (ret) {
mfc_err("Failed to prepare clock-gating control\n");
goto err_p_ip_clk;
}
if (dev->variant->version != MFC_VERSION_V6) {
pm->clock = clk_get(&dev->plat_dev->dev, MFC_SCLK_NAME);
if (IS_ERR(pm->clock)) {
mfc_info("Failed to get MFC special clock control\n");
pm->clock = NULL;
} else {
clk_set_rate(pm->clock, MFC_SCLK_RATE);
ret = clk_prepare_enable(pm->clock);
if (ret) {
mfc_err("Failed to enable MFC special clock\n");
goto err_s_clk;
}
}
}
atomic_set(&pm->power, 0);
#ifdef CONFIG_PM
pm->device = &dev->plat_dev->dev;
pm_runtime_enable(pm->device);
#endif
#ifdef CLK_DEBUG
atomic_set(&clk_ref, 0);
#endif
return 0;
err_s_clk:
clk_put(pm->clock);
pm->clock = NULL;
err_p_ip_clk:
clk_put(pm->clock_gate);
pm->clock_gate = NULL;
err_g_ip_clk:
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kamil debski | kamil debski | 154 | 58.78% | 2 | 28.57% |
jacek anaszewski | jacek anaszewski | 88 | 33.59% | 1 | 14.29% |
shuah khan | shuah khan | 12 | 4.58% | 1 | 14.29% |
javier martinez canillas | javier martinez canillas | 6 | 2.29% | 1 | 14.29% |
rafael j. wysocki | rafael j. wysocki | 1 | 0.38% | 1 | 14.29% |
sachin kamat | sachin kamat | 1 | 0.38% | 1 | 14.29% |
| Total | 262 | 100.00% | 7 | 100.00% |
void s5p_mfc_final_pm(struct s5p_mfc_dev *dev)
{
if (dev->variant->version != MFC_VERSION_V6 &&
pm->clock) {
clk_disable_unprepare(pm->clock);
clk_put(pm->clock);
pm->clock = NULL;
}
clk_unprepare(pm->clock_gate);
clk_put(pm->clock_gate);
pm->clock_gate = NULL;
#ifdef CONFIG_PM
pm_runtime_disable(pm->device);
#endif
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kamil debski | kamil debski | 35 | 44.87% | 2 | 40.00% |
jacek anaszewski | jacek anaszewski | 30 | 38.46% | 1 | 20.00% |
shuah khan | shuah khan | 12 | 15.38% | 1 | 20.00% |
rafael j. wysocki | rafael j. wysocki | 1 | 1.28% | 1 | 20.00% |
| Total | 78 | 100.00% | 5 | 100.00% |
int s5p_mfc_clock_on(void)
{
int ret = 0;
#ifdef CLK_DEBUG
atomic_inc(&clk_ref);
mfc_debug(3, "+ %d\n", atomic_read(&clk_ref));
#endif
if (!IS_ERR_OR_NULL(pm->clock_gate))
ret = clk_enable(pm->clock_gate);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kamil debski | kamil debski | 45 | 77.59% | 1 | 33.33% |
shuah khan | shuah khan | 12 | 20.69% | 1 | 33.33% |
andrzej hajda | andrzej hajda | 1 | 1.72% | 1 | 33.33% |
| Total | 58 | 100.00% | 3 | 100.00% |
void s5p_mfc_clock_off(void)
{
#ifdef CLK_DEBUG
atomic_dec(&clk_ref);
mfc_debug(3, "- %d\n", atomic_read(&clk_ref));
#endif
if (!IS_ERR_OR_NULL(pm->clock_gate))
clk_disable(pm->clock_gate);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kamil debski | kamil debski | 37 | 77.08% | 1 | 33.33% |
shuah khan | shuah khan | 10 | 20.83% | 1 | 33.33% |
andrzej hajda | andrzej hajda | 1 | 2.08% | 1 | 33.33% |
| Total | 48 | 100.00% | 3 | 100.00% |
int s5p_mfc_power_on(void)
{
#ifdef CONFIG_PM
return pm_runtime_get_sync(pm->device);
#else
atomic_set(&pm->power, 1);
return 0;
#endif
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kamil debski | kamil debski | 34 | 97.14% | 1 | 50.00% |
rafael j. wysocki | rafael j. wysocki | 1 | 2.86% | 1 | 50.00% |
| Total | 35 | 100.00% | 2 | 100.00% |
int s5p_mfc_power_off(void)
{
#ifdef CONFIG_PM
return pm_runtime_put_sync(pm->device);
#else
atomic_set(&pm->power, 0);
return 0;
#endif
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kamil debski | kamil debski | 34 | 97.14% | 1 | 50.00% |
rafael j. wysocki | rafael j. wysocki | 1 | 2.86% | 1 | 50.00% |
| Total | 35 | 100.00% | 2 | 100.00% |
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kamil debski | kamil debski | 387 | 67.42% | 2 | 18.18% |
jacek anaszewski | jacek anaszewski | 125 | 21.78% | 1 | 9.09% |
shuah khan | shuah khan | 46 | 8.01% | 1 | 9.09% |
javier martinez canillas | javier martinez canillas | 6 | 1.05% | 1 | 9.09% |
rafael j. wysocki | rafael j. wysocki | 4 | 0.70% | 1 | 9.09% |
andrzej hajda | andrzej hajda | 2 | 0.35% | 1 | 9.09% |
sachin kamat | sachin kamat | 2 | 0.35% | 2 | 18.18% |
mauro carvalho chehab | mauro carvalho chehab | 1 | 0.17% | 1 | 9.09% |
marek szyprowski | marek szyprowski | 1 | 0.17% | 1 | 9.09% |
| Total | 574 | 100.00% | 11 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.