Commit f689866a authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

[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: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent d339ec6a
...@@ -2870,6 +2870,7 @@ static int smiapp_probe(struct i2c_client *client, ...@@ -2870,6 +2870,7 @@ static int smiapp_probe(struct i2c_client *client,
{ {
struct smiapp_sensor *sensor; struct smiapp_sensor *sensor;
struct smiapp_hwconfig *hwcfg = smiapp_get_hwconfig(&client->dev); struct smiapp_hwconfig *hwcfg = smiapp_get_hwconfig(&client->dev);
unsigned long rate;
unsigned int i; unsigned int i;
int rval; int rval;
...@@ -2908,6 +2909,14 @@ static int smiapp_probe(struct i2c_client *client, ...@@ -2908,6 +2909,14 @@ static int smiapp_probe(struct i2c_client *client,
return rval; 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", sensor->xshutdown = devm_gpiod_get_optional(&client->dev, "xshutdown",
GPIOD_OUT_LOW); GPIOD_OUT_LOW);
if (IS_ERR(sensor->xshutdown)) if (IS_ERR(sensor->xshutdown))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment