summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2017-08-29 14:41:23 +0200
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2017-10-04 22:24:11 +0200
commitf689866aec08f00efc4a098d14b3a17ec8a9193b (patch)
tree787de1cea40e5311c52b96afaa637de0d7a063bb /drivers/media
parent[media] smiapp: Fix error handling in power on sequence (diff)
downloadlinux-f689866aec08f00efc4a098d14b3a17ec8a9193b.tar.xz
linux-f689866aec08f00efc4a098d14b3a17ec8a9193b.zip
[media] smiapp: Verify clock frequency after setting it, prevent changing it
The external clock frequency was set by the driver but the obtained frequency was never verified. Do that. Being able to obtain the exact frequency is important as the value is used for PLL calculations which may result in frequencies that violate the PLL tree limits. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/i2c/smiapp/smiapp-core.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index d581625d7826..55771826b446 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2870,6 +2870,7 @@ static int smiapp_probe(struct i2c_client *client,
{
struct smiapp_sensor *sensor;
struct smiapp_hwconfig *hwcfg = smiapp_get_hwconfig(&client->dev);
+ unsigned long rate;
unsigned int i;
int rval;
@@ -2908,6 +2909,14 @@ static int smiapp_probe(struct i2c_client *client,
return rval;
}
+ rate = clk_get_rate(sensor->ext_clk);
+ if (rate != sensor->hwcfg->ext_clk) {
+ dev_err(&client->dev,
+ "can't set clock freq, asked for %u but got %lu\n",
+ sensor->hwcfg->ext_clk, rate);
+ return rval;
+ }
+
sensor->xshutdown = devm_gpiod_get_optional(&client->dev, "xshutdown",
GPIOD_OUT_LOW);
if (IS_ERR(sensor->xshutdown))