Re: [PATCH 3/3] V4L2: em28xx: register a V4L2 clock source

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Guennadi,

On 08/28/2013 03:28 PM, Guennadi Liakhovetski wrote:
Camera sensors usually require a master clock for data sampling. This patch
registers such a clock source for em28xx cameras. This fixes the currently
broken em28xx ov2640 camera support and can also be used by other camera
sensors.

Signed-off-by: Guennadi Liakhovetski<g.liakhovetski@xxxxxx>
---

Actually after thinking a bit more, it'd probably be better to register a
clock only for the ov2640 based camera, not for all cameras. If all agree,
I'll redo this.

Not sure, I'd assume it's better to have this clock for all the subdevs.
Currently there are only two sensors handled through regular subdev drivers
though.

  drivers/media/usb/em28xx/em28xx-camera.c |   41 ++++++++++++++++++++++-------
  drivers/media/usb/em28xx/em28xx-cards.c  |    3 ++
  drivers/media/usb/em28xx/em28xx.h        |    1 +
  3 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c
index 73cc50a..2f451e4 100644
--- a/drivers/media/usb/em28xx/em28xx-camera.c
+++ b/drivers/media/usb/em28xx/em28xx-camera.c
@@ -22,6 +22,7 @@
  #include<linux/i2c.h>
  #include<media/soc_camera.h>
  #include<media/mt9v011.h>
+#include<media/v4l2-clk.h>
  #include<media/v4l2-common.h>

  #include "em28xx.h"
@@ -325,13 +326,24 @@ int em28xx_detect_sensor(struct em28xx *dev)

  int em28xx_init_camera(struct em28xx *dev)
  {
+	char clk_name[V4L2_SUBDEV_NAME_SIZE];
+	struct i2c_client *client =&dev->i2c_client[dev->def_i2c_bus];
+	struct i2c_adapter *adap =&dev->i2c_adap[dev->def_i2c_bus];
+	int ret = 0;
+
+	v4l2_clk_name_i2c(clk_name, sizeof(clk_name),
+			  i2c_adapter_id(adap), client->addr);
+	dev->clk = v4l2_clk_register_fixed(clk_name, "mclk", -EINVAL);

Or maybe we could also create even more easy to use helper function, e.g.

v4l2_clk_register_i2c_fixed(int adap_id, unsigned int i2c_addr,
				char *clk_name);

Then clk_name (hmm, actually it's the device name ?) would be filled
inside the helper ?

--
Regards,
Sylwester
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux