summaryrefslogtreecommitdiff
path: root/drivers/media/platform/qcom/camss-8x16/camss-ispif.c
diff options
context:
space:
mode:
authorTodor Tomov <todor.tomov@linaro.org>2017-08-08 16:30:17 +0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-08-26 22:31:06 +0300
commitbbde31047434678f60820c7187ca7b7ed6e1809f (patch)
tree53cde1e532dcb02c56d90e8bdc4f101779bd28f8 /drivers/media/platform/qcom/camss-8x16/camss-ispif.c
parent474a53d6454fe3bc3dadabf77dca36896608e6a0 (diff)
downloadlinux-bbde31047434678f60820c7187ca7b7ed6e1809f.tar.xz
media: camss: Use optimal clock frequency rates
Use standard V4L2 control to get pixel clock rate from a sensor linked in the media controller pipeline. Then calculate clock rates on CSIPHY, CSID and VFE to use the lowest possible. If the currnet pixel clock rate of the sensor cannot be read then use the highest possible. This case covers also the CSID test generator usage. If VFE is already powered on by another pipeline, check that the current VFE clock rate is high enough for the new pipeline. If not return busy error code as VFE clock rate cannot be changed while VFE is running. Signed-off-by: Todor Tomov <todor.tomov@linaro.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/platform/qcom/camss-8x16/camss-ispif.c')
-rw-r--r--drivers/media/platform/qcom/camss-8x16/camss-ispif.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/media/platform/qcom/camss-8x16/camss-ispif.c b/drivers/media/platform/qcom/camss-8x16/camss-ispif.c
index 31e00e534a6a..54d1946f5213 100644
--- a/drivers/media/platform/qcom/camss-8x16/camss-ispif.c
+++ b/drivers/media/platform/qcom/camss-8x16/camss-ispif.c
@@ -954,9 +954,14 @@ int msm_ispif_subdev_init(struct ispif_device *ispif,
return -ENOMEM;
for (i = 0; i < ispif->nclocks; i++) {
- ispif->clock[i] = devm_clk_get(dev, res->clock[i]);
- if (IS_ERR(ispif->clock[i]))
- return PTR_ERR(ispif->clock[i]);
+ struct camss_clock *clock = &ispif->clock[i];
+
+ clock->clk = devm_clk_get(dev, res->clock[i]);
+ if (IS_ERR(clock->clk))
+ return PTR_ERR(clock->clk);
+
+ clock->freq = NULL;
+ clock->nfreqs = 0;
}
ispif->nclocks_for_reset = 0;
@@ -969,10 +974,14 @@ int msm_ispif_subdev_init(struct ispif_device *ispif,
return -ENOMEM;
for (i = 0; i < ispif->nclocks_for_reset; i++) {
- ispif->clock_for_reset[i] = devm_clk_get(dev,
- res->clock_for_reset[i]);
- if (IS_ERR(ispif->clock_for_reset[i]))
- return PTR_ERR(ispif->clock_for_reset[i]);
+ struct camss_clock *clock = &ispif->clock_for_reset[i];
+
+ clock->clk = devm_clk_get(dev, res->clock_for_reset[i]);
+ if (IS_ERR(clock->clk))
+ return PTR_ERR(clock->clk);
+
+ clock->freq = NULL;
+ clock->nfreqs = 0;
}
for (i = 0; i < ARRAY_SIZE(ispif->line); i++)