struct clk *clock;
/* vpu clock handle */
struct clk *vpu_clock;
+ /* clock status for error handling */
+ bool clocks_enabled;
/* V4l2 device */
struct v4l2_device v4l2_dev;
struct media_device mdev;
goto err_disable_unicam;
}
+ dev->clocks_enabled = true;
return 0;
err_disable_unicam:
node->streaming = false;
if (node->pad_id == IMAGE_PAD) {
- int ret;
-
/*
* Stop streaming the sensor and disable the peripheral.
* We cannot continue streaming embedded data with the
unicam_disable(dev);
- ret = clk_set_min_rate(dev->vpu_clock, 0);
- if (ret)
- unicam_err(dev, "failed to reset the min VPU clock\n");
+ if (dev->clocks_enabled) {
+ if (clk_set_min_rate(dev->vpu_clock, 0))
+ unicam_err(dev, "failed to reset the min VPU clock\n");
- clk_disable_unprepare(dev->vpu_clock);
- clk_disable_unprepare(dev->clock);
+ clk_disable_unprepare(dev->vpu_clock);
+ clk_disable_unprepare(dev->clock);
+ }
unicam_runtime_put(dev);
} else if (node->pad_id == METADATA_PAD) {