[media] s5p-mfc: Use clock gating only on MFC v5 hardware
Newer MFC hardware have internal clock gating feature, so additional software-triggered clock gating sometimes causes misbehavior of the MFC firmware and results in freeze or crash. This patch changes the driver to use software-triggered clock gating only when working with v5 MFC hardware, where it has been proven to work properly. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
5d1ec73184
commit
c5086f130a
@ -1442,6 +1442,7 @@ static struct s5p_mfc_variant mfc_drvdata_v5 = {
|
|||||||
.buf_size = &buf_size_v5,
|
.buf_size = &buf_size_v5,
|
||||||
.buf_align = &mfc_buf_align_v5,
|
.buf_align = &mfc_buf_align_v5,
|
||||||
.fw_name[0] = "s5p-mfc.fw",
|
.fw_name[0] = "s5p-mfc.fw",
|
||||||
|
.use_clock_gating = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct s5p_mfc_buf_size_v6 mfc_buf_size_v6 = {
|
static struct s5p_mfc_buf_size_v6 mfc_buf_size_v6 = {
|
||||||
|
@ -199,6 +199,7 @@ struct s5p_mfc_buf {
|
|||||||
struct s5p_mfc_pm {
|
struct s5p_mfc_pm {
|
||||||
struct clk *clock;
|
struct clk *clock;
|
||||||
struct clk *clock_gate;
|
struct clk *clock_gate;
|
||||||
|
bool use_clock_gating;
|
||||||
atomic_t power;
|
atomic_t power;
|
||||||
struct device *device;
|
struct device *device;
|
||||||
};
|
};
|
||||||
@ -235,6 +236,7 @@ struct s5p_mfc_variant {
|
|||||||
struct s5p_mfc_buf_size *buf_size;
|
struct s5p_mfc_buf_size *buf_size;
|
||||||
struct s5p_mfc_buf_align *buf_align;
|
struct s5p_mfc_buf_align *buf_align;
|
||||||
char *fw_name[MFC_FW_MAX_VERSIONS];
|
char *fw_name[MFC_FW_MAX_VERSIONS];
|
||||||
|
bool use_clock_gating;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,6 +37,7 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev *dev)
|
|||||||
|
|
||||||
pm = &dev->pm;
|
pm = &dev->pm;
|
||||||
p_dev = dev;
|
p_dev = dev;
|
||||||
|
pm->use_clock_gating = dev->variant->use_clock_gating;
|
||||||
pm->clock_gate = clk_get(&dev->plat_dev->dev, MFC_GATE_CLK_NAME);
|
pm->clock_gate = clk_get(&dev->plat_dev->dev, MFC_GATE_CLK_NAME);
|
||||||
if (IS_ERR(pm->clock_gate)) {
|
if (IS_ERR(pm->clock_gate)) {
|
||||||
mfc_err("Failed to get clock-gating control\n");
|
mfc_err("Failed to get clock-gating control\n");
|
||||||
@ -108,6 +109,8 @@ int s5p_mfc_clock_on(void)
|
|||||||
atomic_inc(&clk_ref);
|
atomic_inc(&clk_ref);
|
||||||
mfc_debug(3, "+ %d\n", atomic_read(&clk_ref));
|
mfc_debug(3, "+ %d\n", atomic_read(&clk_ref));
|
||||||
#endif
|
#endif
|
||||||
|
if (!pm->use_clock_gating)
|
||||||
|
return 0;
|
||||||
if (!IS_ERR_OR_NULL(pm->clock_gate))
|
if (!IS_ERR_OR_NULL(pm->clock_gate))
|
||||||
ret = clk_enable(pm->clock_gate);
|
ret = clk_enable(pm->clock_gate);
|
||||||
return ret;
|
return ret;
|
||||||
@ -119,22 +122,32 @@ void s5p_mfc_clock_off(void)
|
|||||||
atomic_dec(&clk_ref);
|
atomic_dec(&clk_ref);
|
||||||
mfc_debug(3, "- %d\n", atomic_read(&clk_ref));
|
mfc_debug(3, "- %d\n", atomic_read(&clk_ref));
|
||||||
#endif
|
#endif
|
||||||
|
if (!pm->use_clock_gating)
|
||||||
|
return;
|
||||||
if (!IS_ERR_OR_NULL(pm->clock_gate))
|
if (!IS_ERR_OR_NULL(pm->clock_gate))
|
||||||
clk_disable(pm->clock_gate);
|
clk_disable(pm->clock_gate);
|
||||||
}
|
}
|
||||||
|
|
||||||
int s5p_mfc_power_on(void)
|
int s5p_mfc_power_on(void)
|
||||||
{
|
{
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
return pm_runtime_get_sync(pm->device);
|
ret = pm_runtime_get_sync(pm->device);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
#else
|
#else
|
||||||
atomic_set(&pm->power, 1);
|
atomic_set(&pm->power, 1);
|
||||||
return 0;
|
|
||||||
#endif
|
#endif
|
||||||
|
if (!pm->use_clock_gating && !IS_ERR_OR_NULL(pm->clock_gate))
|
||||||
|
ret = clk_enable(pm->clock_gate);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int s5p_mfc_power_off(void)
|
int s5p_mfc_power_off(void)
|
||||||
{
|
{
|
||||||
|
if (!pm->use_clock_gating && !IS_ERR_OR_NULL(pm->clock_gate))
|
||||||
|
clk_disable(pm->clock_gate);
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
return pm_runtime_put_sync(pm->device);
|
return pm_runtime_put_sync(pm->device);
|
||||||
#else
|
#else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user