提交 786fa584 编写于 作者: L Lubomir Rintel 提交者: Mauro Carvalho Chehab

media: ov7670: make "xclk" clock optional

When the "xclk" clock was added, it was made mandatory. This broke the
driver on an OLPC plaform which doesn't know such clock. Make it
optional.

Tested on a OLPC XO-1 laptop.

Fixes: 0a024d63 ("[media] ov7670: get xclk")

Cc: stable@vger.kernel.org # 4.11+
Signed-off-by: NLubomir Rintel <lkundrak@v3.sk>
Signed-off-by: NSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
上级 146c45ef
...@@ -1808,17 +1808,24 @@ static int ov7670_probe(struct i2c_client *client, ...@@ -1808,17 +1808,24 @@ static int ov7670_probe(struct i2c_client *client,
info->pclk_hb_disable = true; info->pclk_hb_disable = true;
} }
info->clk = devm_clk_get(&client->dev, "xclk"); info->clk = devm_clk_get(&client->dev, "xclk"); /* optional */
if (IS_ERR(info->clk)) if (IS_ERR(info->clk)) {
return PTR_ERR(info->clk); ret = PTR_ERR(info->clk);
ret = clk_prepare_enable(info->clk); if (ret == -ENOENT)
if (ret) info->clk = NULL;
return ret; else
return ret;
}
if (info->clk) {
ret = clk_prepare_enable(info->clk);
if (ret)
return ret;
info->clock_speed = clk_get_rate(info->clk) / 1000000; info->clock_speed = clk_get_rate(info->clk) / 1000000;
if (info->clock_speed < 10 || info->clock_speed > 48) { if (info->clock_speed < 10 || info->clock_speed > 48) {
ret = -EINVAL; ret = -EINVAL;
goto clk_disable; goto clk_disable;
}
} }
ret = ov7670_init_gpio(client, info); ret = ov7670_init_gpio(client, info);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册