From 774cc4c289152bfb77806ccae722a9ae2d29dd02 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 28 Aug 2013 10:28:27 -0300 Subject: [media] V4L2: add a v4l2-clk helper macro to produce an I2C device ID To obtain a clock reference consumers supply their device object to the V4L2 clock framework. The latter then uses the consumer device name to find a matching clock. For that to work V4L2 clock providers have to provide the same device name, when registering clocks. This patch adds a helper macro to generate a suitable device name for I2C devices. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-clk.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/media') diff --git a/include/media/v4l2-clk.h b/include/media/v4l2-clk.h index a354a9d6456..0b36cc13830 100644 --- a/include/media/v4l2-clk.h +++ b/include/media/v4l2-clk.h @@ -65,4 +65,7 @@ static inline struct v4l2_clk *v4l2_clk_register_fixed(const char *dev_id, return __v4l2_clk_register_fixed(dev_id, id, rate, THIS_MODULE); } +#define v4l2_clk_name_i2c(name, size, adap, client) snprintf(name, size, \ + "%d-%04x", adap, client) + #endif -- cgit v1.2.3-70-g09d2