aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/samsung
diff options
context:
space:
mode:
authorhuisung.kang <hs1218.kang@samsung.com>2010-09-18 20:28:59 -0400
committerArve Hjønnevåg <arve@android.com>2011-11-17 17:46:09 -0800
commit6ef0c514bbc81565c9f49d07bd8f87f06c2e5e73 (patch)
tree579270115eab6ad30640111152242f5998124bb5 /drivers/media/video/samsung
parentf5a438b4fea7658bb70cc6e507c169bc9edb2011 (diff)
downloadkernel_samsung_crespo-6ef0c514bbc81565c9f49d07bd8f87f06c2e5e73.zip
kernel_samsung_crespo-6ef0c514bbc81565c9f49d07bd8f87f06c2e5e73.tar.gz
kernel_samsung_crespo-6ef0c514bbc81565c9f49d07bd8f87f06c2e5e73.tar.bz2
S5PC11X: PD: Use regulator API for power domain control.
Change-Id: I728a17ffc9e6877cffec5926676431ec18aa910e Signed-off-by: huisung.kang <hs1218.kang@samsung.com>
Diffstat (limited to 'drivers/media/video/samsung')
-rw-r--r--drivers/media/video/samsung/fimc/csis.c12
-rw-r--r--drivers/media/video/samsung/fimc/csis.h1
-rw-r--r--drivers/media/video/samsung/fimc/fimc.h1
-rw-r--r--drivers/media/video/samsung/fimc/fimc_dev.c32
-rw-r--r--drivers/media/video/samsung/jpeg_v2/s3c-jpeg.c23
5 files changed, 61 insertions, 8 deletions
diff --git a/drivers/media/video/samsung/fimc/csis.c b/drivers/media/video/samsung/fimc/csis.c
index 372bb52..390fd68 100644
--- a/drivers/media/video/samsung/fimc/csis.c
+++ b/drivers/media/video/samsung/fimc/csis.c
@@ -18,6 +18,7 @@
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
+#include <linux/regulator/consumer.h>
#include <linux/videodev2.h>
#include <linux/slab.h>
@@ -292,6 +293,8 @@ static int s3c_csis_clk_on(struct platform_device *pdev)
clk_set_parent(mout_csis, parent);
clk_set_parent(s3c_csis->clock, mout_csis);
+ /* Turn on csis power domain regulator */
+ regulator_enable(s3c_csis->regulator);
/* clock enable for csis */
clk_enable(s3c_csis->clock);
@@ -313,6 +316,8 @@ static int s3c_csis_clk_off(struct platform_device *pdev)
/* clock disable for csis */
clk_disable(s3c_csis->clock);
+ /* Turn off csis power domain regulator */
+ regulator_disable(s3c_csis->regulator);
return 0;
}
@@ -330,6 +335,13 @@ static int s3c_csis_probe(struct platform_device *pdev)
if (pdata->cfg_gpio)
pdata->cfg_gpio();
+ /* Get csis power domain regulator */
+ s3c_csis->regulator = regulator_get(&pdev->dev, "pd");
+ if (IS_ERR(s3c_csis->regulator)) {
+ err("%s: failed to get resource %s\n",
+ __func__, "s3c-csis");
+ return PTR_ERR(s3c_csis->regulator);
+ }
/* clock & power on */
s3c_csis_clk_on(pdev);
diff --git a/drivers/media/video/samsung/fimc/csis.h b/drivers/media/video/samsung/fimc/csis.h
index e0c9af3..efd6892 100644
--- a/drivers/media/video/samsung/fimc/csis.h
+++ b/drivers/media/video/samsung/fimc/csis.h
@@ -33,6 +33,7 @@ struct s3c_csis_info {
char name[16];
struct device *dev;
struct clk *clock;
+ struct regulator *regulator;
void __iomem *regs;
int irq;
int nr_lanes;
diff --git a/drivers/media/video/samsung/fimc/fimc.h b/drivers/media/video/samsung/fimc/fimc.h
index ab641f3..5d79a15 100644
--- a/drivers/media/video/samsung/fimc/fimc.h
+++ b/drivers/media/video/samsung/fimc/fimc.h
@@ -334,6 +334,7 @@ struct fimc_control {
atomic_t in_use;
void __iomem *regs; /* register i/o */
struct clk *clk; /* interface clock */
+ struct regulator *regulator; /* pd regulator */
struct fimc_meminfo mem; /* for reserved mem */
/* kernel helpers */
diff --git a/drivers/media/video/samsung/fimc/fimc_dev.c b/drivers/media/video/samsung/fimc/fimc_dev.c
index cc7adb4..4b8d3ca 100644
--- a/drivers/media/video/samsung/fimc/fimc_dev.c
+++ b/drivers/media/video/samsung/fimc/fimc_dev.c
@@ -27,6 +27,7 @@
#include <linux/memory.h>
#include <linux/ctype.h>
#include <linux/platform_device.h>
+#include <linux/regulator/consumer.h>
#include <plat/clock.h>
#include <plat/media.h>
#include <mach/media.h>
@@ -109,17 +110,26 @@ void fimc_clk_en(struct fimc_control *ctrl, bool on)
pdata = to_fimc_plat(ctrl->dev);
lclk = clk_get(&pdev->dev, pdata->lclk_name);
- if(on){
- if(!lclk->usage){
- if(!ctrl->out)
- fimc_info1("(%d) Clock %s(%d) enabled.\n", ctrl->id, ctrl->clk->name, ctrl->clk->id);
+ if (on) {
+ if (!lclk->usage) {
+ if (!ctrl->out)
+ fimc_info1("(%d) Clock %s(%d) enabled.\n",
+ ctrl->id, ctrl->clk->name,
+ ctrl->clk->id);
+
+ /* Turn on fimc power domain regulator */
+ regulator_enable(ctrl->regulator);
clk_enable(lclk);
}
} else {
- while(lclk->usage > 0){
- if(!ctrl->out)
- fimc_info1("(%d) Clock %s(%d) disabled.\n", ctrl->id, ctrl->clk->name, ctrl->clk->id);
+ while (lclk->usage > 0) {
+ if (!ctrl->out)
+ fimc_info1("(%d) Clock %s(%d) disabled.\n",
+ ctrl->id, ctrl->clk->name,
+ ctrl->clk->id);
clk_disable(lclk);
+ /* Turn off fimc power domain regulator */
+ regulator_disable(ctrl->regulator);
}
}
@@ -1297,6 +1307,14 @@ static int __devinit fimc_probe(struct platform_device *pdev)
if (pdata->cfg_gpio)
pdata->cfg_gpio(pdev);
+ /* Get fimc power domain regulator */
+ ctrl->regulator = regulator_get(&pdev->dev, "pd");
+ if (IS_ERR(ctrl->regulator)) {
+ fimc_err("%s: failed to get resource %s\n",
+ __func__, "s3c-fimc");
+ return PTR_ERR(ctrl->regulator);
+ }
+
/* fimc source clock */
srclk = clk_get(&pdev->dev, pdata->srclk_name);
if (IS_ERR(srclk)) {
diff --git a/drivers/media/video/samsung/jpeg_v2/s3c-jpeg.c b/drivers/media/video/samsung/jpeg_v2/s3c-jpeg.c
index 789ad9b..638a2cb 100644
--- a/drivers/media/video/samsung/jpeg_v2/s3c-jpeg.c
+++ b/drivers/media/video/samsung/jpeg_v2/s3c-jpeg.c
@@ -37,6 +37,7 @@
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/platform_device.h>
+#include <linux/regulator/consumer.h>
#include <linux/version.h>
#include <plat/media.h>
@@ -52,6 +53,7 @@
#include "regs-jpeg.h"
static struct clk *s3c_jpeg_clk;
+static struct regulator *jpeg_pd_regulator;
static struct resource *s3c_jpeg_mem;
void __iomem *s3c_jpeg_base;
@@ -103,6 +105,8 @@ static int s3c_jpeg_open(struct inode *inode, struct file *file)
sspc100_jpg_ctx *jpg_reg_ctx;
DWORD ret;
+ /* Turn on jpeg power domain regulator */
+ regulator_enable(jpeg_pd_regulator);
/* clock enable */
clk_enable(s3c_jpeg_clk);
@@ -165,8 +169,10 @@ static int s3c_jpeg_release(struct inode *inode, struct file *file)
unlock_jpg_mutex();
kfree(jpg_reg_ctx);
-/* clock disable */
+ /* clock disable */
clk_disable(s3c_jpeg_clk);
+ /* Turn off jpeg power domain regulator */
+ regulator_disable(jpeg_pd_regulator);
return 0;
}
@@ -354,6 +360,15 @@ static int s3c_jpeg_probe(struct platform_device *pdev)
static int ret;
HANDLE h_mutex;
+ /* Get jpeg power domain regulator */
+ jpeg_pd_regulator = regulator_get(&pdev->dev, "pd");
+ if (IS_ERR(jpeg_pd_regulator)) {
+ jpg_err("%s: failed to get resource %s\n",
+ __func__, "s3c-jpg");
+ return PTR_ERR(jpeg_pd_regulator);
+ }
+ regulator_enable(jpeg_pd_regulator);
+
s3c_jpeg_clk = clk_get(&pdev->dev, "jpeg");
if (IS_ERR(s3c_jpeg_clk)) {
@@ -427,6 +442,8 @@ static int s3c_jpeg_probe(struct platform_device *pdev)
/* clock disable */
clk_disable(s3c_jpeg_clk);
+ /* Turn off jpeg power domain regulator */
+ regulator_disable(jpeg_pd_regulator);
return 0;
}
@@ -449,12 +466,16 @@ static int s3c_jpeg_suspend(struct platform_device *pdev, pm_message_t state)
{
/* clock disable */
clk_disable(s3c_jpeg_clk);
+ /* Turn off jpeg power domain regulator */
+ regulator_disable(jpeg_pd_regulator);
return 0;
}
static int s3c_jpeg_resume(struct platform_device *pdev)
{
+ /* Turn on jpeg power domain regulator */
+ regulator_enable(jpeg_pd_regulator);
/* clock enable */
clk_enable(s3c_jpeg_clk);