diff options
author | Troy Kisky <troy.kisky@boundarydevices.com> | 2013-10-24 12:26:04 -0700 |
---|---|---|
committer | Philippe Schenker <philippe.schenker@toradex.com> | 2020-08-13 16:04:32 +0200 |
commit | 8eec06da2645781ad1db69b0c08253c0786ffeb1 (patch) | |
tree | 8cc405004961c37cd78112afcbc712ed6d5fc5b8 /drivers/media | |
parent | bf2fd5f0f8f47f52848e34be3bcabbad399ff495 (diff) |
ov5640: add pwm option for mclk
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
(cherry picked from commit b4fc866e16424d9c0dcea5821dbab9780623f5ad)
(cherry picked from commit 4f704da6694f704878c9c7bb7afd2b8e013f9261)
[rebased to 4.9, get PWM period from current state]
Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
(cherry picked from commit 6a81fd7d8c8d268c0603f616a4a9496b86ec08a9)
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/platform/mxc/capture/ov5640_mipi.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/media/platform/mxc/capture/ov5640_mipi.c b/drivers/media/platform/mxc/capture/ov5640_mipi.c index 118174af2c65..a70c6c33a4fb 100644 --- a/drivers/media/platform/mxc/capture/ov5640_mipi.c +++ b/drivers/media/platform/mxc/capture/ov5640_mipi.c @@ -30,6 +30,7 @@ #include <linux/i2c.h> #include <linux/of_gpio.h> #include <linux/pinctrl/consumer.h> +#include <linux/pwm.h> #include <linux/regulator/consumer.h> #include <linux/fsl_devices.h> #include <linux/mipi_csi2.h> @@ -2001,6 +2002,7 @@ static struct v4l2_int_device ov5640_int_device = { static int ov5640_probe(struct i2c_client *client, const struct i2c_device_id *id) { + struct pwm_device *pwm; struct device *dev = &client->dev; int retval; u8 chip_id_high, chip_id_low; @@ -2071,6 +2073,13 @@ static int ov5640_probe(struct i2c_client *client, ov5640_data.streamcap.timeperframe.denominator = DEFAULT_FPS; ov5640_data.streamcap.timeperframe.numerator = 1; + pwm = pwm_get(dev, NULL); + if (!IS_ERR(pwm)) { + dev_info(dev, "found pwm%d, period=%d\n", pwm->pwm, pwm->state.period); + pwm_config(pwm, pwm->state.period >> 1, pwm->state.period); + pwm_enable(pwm); + } + ov5640_power_on(dev); ov5640_reset(); |