aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc
diff options
context:
space:
mode:
authorSrinivas Kandagatla <srinivas.kandagatla@st.com>2014-01-14 06:04:21 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-01-15 08:45:22 -0500
commit1d504b649faf9f27de8ee0a5532e29b8d1fb2a02 (patch)
treeac3408ffb0a5cc73ac6e712651140a47aee1339e /drivers/media/rc
parent1045d81d301055b162a3d308e1fb81d2b62a1f2a (diff)
[media] media: st-rc: Add reset support
Some of the SOCs hold the IRB IP in softreset state by default. For this IP to work driver needs to bring it out of softreset. This patch adds support to reset the IP via reset framework. Without this patch the driver can not work with SoCs which holds the IP in softreset. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/rc')
-rw-r--r--drivers/media/rc/st_rc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c
index 65120c2d47ad..8f0cddb9e8f2 100644
--- a/drivers/media/rc/st_rc.c
+++ b/drivers/media/rc/st_rc.c
@@ -13,6 +13,7 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/of.h> 14#include <linux/of.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/reset.h>
16#include <media/rc-core.h> 17#include <media/rc-core.h>
17#include <linux/pinctrl/consumer.h> 18#include <linux/pinctrl/consumer.h>
18 19
@@ -28,6 +29,7 @@ struct st_rc_device {
28 int sample_mult; 29 int sample_mult;
29 int sample_div; 30 int sample_div;
30 bool rxuhfmode; 31 bool rxuhfmode;
32 struct reset_control *rstc;
31}; 33};
32 34
33/* Registers */ 35/* Registers */
@@ -161,6 +163,10 @@ static void st_rc_hardware_init(struct st_rc_device *dev)
161 unsigned int rx_max_symbol_per = MAX_SYMB_TIME; 163 unsigned int rx_max_symbol_per = MAX_SYMB_TIME;
162 unsigned int rx_sampling_freq_div; 164 unsigned int rx_sampling_freq_div;
163 165
166 /* Enable the IP */
167 if (dev->rstc)
168 reset_control_deassert(dev->rstc);
169
164 clk_prepare_enable(dev->sys_clock); 170 clk_prepare_enable(dev->sys_clock);
165 baseclock = clk_get_rate(dev->sys_clock); 171 baseclock = clk_get_rate(dev->sys_clock);
166 172
@@ -271,6 +277,11 @@ static int st_rc_probe(struct platform_device *pdev)
271 else 277 else
272 rc_dev->rx_base = rc_dev->base; 278 rc_dev->rx_base = rc_dev->base;
273 279
280
281 rc_dev->rstc = reset_control_get(dev, NULL);
282 if (IS_ERR(rc_dev->rstc))
283 rc_dev->rstc = NULL;
284
274 rc_dev->dev = dev; 285 rc_dev->dev = dev;
275 platform_set_drvdata(pdev, rc_dev); 286 platform_set_drvdata(pdev, rc_dev);
276 st_rc_hardware_init(rc_dev); 287 st_rc_hardware_init(rc_dev);
@@ -338,6 +349,8 @@ static int st_rc_suspend(struct device *dev)
338 writel(0x00, rc_dev->rx_base + IRB_RX_EN); 349 writel(0x00, rc_dev->rx_base + IRB_RX_EN);
339 writel(0x00, rc_dev->rx_base + IRB_RX_INT_EN); 350 writel(0x00, rc_dev->rx_base + IRB_RX_INT_EN);
340 clk_disable_unprepare(rc_dev->sys_clock); 351 clk_disable_unprepare(rc_dev->sys_clock);
352 if (rc_dev->rstc)
353 reset_control_assert(rc_dev->rstc);
341 } 354 }
342 355
343 return 0; 356 return 0;