···320320 return x;321321}322322323323-/* Bound an image to have a width between wmin and wmax, and height between324324- * hmin and hmax, inclusive. Additionally, the width will be a multiple of325325- * 2^walign, the height will be a multiple of 2^halign, and the overall size326326- * (width*height) will be a multiple of 2^salign. The image may be shrunk327327- * or enlarged to fit the alignment constraints.328328- *329329- * The width or height maximum must not be smaller than the corresponding330330- * minimum. The alignments must not be so high there are no possible image331331- * sizes within the allowed bounds. wmin and hmin must be at least 1332332- * (don't use 0). If you don't care about a certain alignment, specify 0,333333- * as 2^0 is 1 and one byte alignment is equivalent to no alignment. If334334- * you only want to adjust downward, specify a maximum that's the same as335335- * the initial value.336336- */337323void v4l_bound_align_image(u32 *w, unsigned int wmin, unsigned int wmax,338324 unsigned int walign,339325 u32 *h, unsigned int hmin, unsigned int hmax,
+96-11
include/media/v4l2-common.h
···28282929#include <media/v4l2-dev.h>30303131-/* Common printk constucts for v4l-i2c drivers. These macros create a unique3131+/* Common printk constructs for v4l-i2c drivers. These macros create a unique3232 prefix consisting of the driver name, the adapter number and the i2c3333 address. */3434#define v4l_printk(level, name, adapter, addr, fmt, arg...) \···174174 */175175unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd);176176177177+/**178178+ * enum v4l2_i2c_tuner_type - specifies the range of tuner address that179179+ * should be used when seeking for I2C devices.180180+ *181181+ * @ADDRS_RADIO: Radio tuner addresses.182182+ * Represent the following I2C addresses:183183+ * 0x10 (if compiled with tea5761 support)184184+ * and 0x60.185185+ * @ADDRS_DEMOD: Demod tuner addresses.186186+ * Represent the following I2C addresses:187187+ * 0x42, 0x43, 0x4a and 0x4b.188188+ * @ADDRS_TV: TV tuner addresses.189189+ * Represent the following I2C addresses:190190+ * 0x42, 0x43, 0x4a, 0x4b, 0x60, 0x61, 0x62,191191+ * 0x63 and 0x64.192192+ * @ADDRS_TV_WITH_DEMOD: TV tuner addresses if demod is present, this193193+ * excludes addresses used by the demodulator194194+ * from the list of candidates.195195+ * Represent the following I2C addresses:196196+ * 0x60, 0x61, 0x62, 0x63 and 0x64.197197+ *198198+ * NOTE: All I2C addresses above use the 7-bit notation.199199+ */177200enum v4l2_i2c_tuner_type {178178- ADDRS_RADIO, /* Radio tuner addresses */179179- ADDRS_DEMOD, /* Demod tuner addresses */180180- ADDRS_TV, /* TV tuner addresses */181181- /* TV tuner addresses if demod is present, this excludes182182- addresses used by the demodulator from the list of183183- candidates. */201201+ ADDRS_RADIO,202202+ ADDRS_DEMOD,203203+ ADDRS_TV,184204 ADDRS_TV_WITH_DEMOD,185205};186186-/* Return a list of I2C tuner addresses to probe. Use only if the tuner187187- addresses are unknown. */206206+/**207207+ * v4l2_i2c_tuner_addrs - Return a list of I2C tuner addresses to probe.208208+ *209209+ * @type: type of the tuner to seek, as defined by210210+ * &enum v4l2_i2c_tuner_type.211211+ *212212+ * NOTE: Use only if the tuner addresses are unknown.213213+ */188214const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type);189215190216/* ------------------------------------------------------------------------- */···254228 * FIXME: these remaining ioctls/structs should be removed as well, but they255229 * are still used in tuner-simple.c (TUNER_SET_CONFIG) and cx18/ivtv (RESET).256230 * To remove these ioctls some more cleanup is needed in those modules.231231+ *232232+ * It doesn't make much sense on documenting them, as what we really want is233233+ * to get rid of them.257234 */258235259236/* s_config */···272243273244/* Miscellaneous helper functions */274245275275-void v4l_bound_align_image(unsigned int *w, unsigned int wmin,246246+/**247247+ * v4l_bound_align_image - adjust video dimensions according to248248+ * a given constraints.249249+ *250250+ * @width: pointer to width that will be adjusted if needed.251251+ * @wmin: minimum width.252252+ * @wmax: maximum width.253253+ * @walign: least significant bit on width.254254+ * @height: pointer to height that will be adjusted if needed.255255+ * @hmin: minimum height.256256+ * @hmax: maximum height.257257+ * @halign: least significant bit on width.258258+ * @salign: least significant bit for the image size (e. g.259259+ * :math:`width * height`).260260+ *261261+ * Clip an image to have @width between @wmin and @wmax, and @height between262262+ * @hmin and @hmax, inclusive.263263+ *264264+ * Additionally, the @width will be a multiple of :math:`2^{walign}`,265265+ * the @height will be a multiple of :math:`2^{halign}`, and the overall266266+ * size :math:`width * height` will be a multiple of :math:`2^{salign}`.267267+ *268268+ * .. note::269269+ *270270+ * #. The clipping rectangle may be shrunk or enlarged to fit the alignment271271+ * constraints.272272+ * #. @wmax must not be smaller than @wmin.273273+ * #. @hmax must not be smaller than @hmin.274274+ * #. The alignments must not be so high there are no possible image275275+ * sizes within the allowed bounds.276276+ * #. @wmin and @hmin must be at least 1 (don't use 0).277277+ * #. For @walign, @halign and @salign, if you don't care about a certain278278+ * alignment, specify ``0``, as :math:`2^0 = 1` and one byte alignment279279+ * is equivalent to no alignment.280280+ * #. If you only want to adjust downward, specify a maximum that's the281281+ * same as the initial value.282282+ */283283+void v4l_bound_align_image(unsigned int *width, unsigned int wmin,276284 unsigned int wmax, unsigned int walign,277277- unsigned int *h, unsigned int hmin,285285+ unsigned int *height, unsigned int hmin,278286 unsigned int hmax, unsigned int halign,279287 unsigned int salign);280288289289+/**290290+ * v4l2_find_nearest_format - find the nearest format size among a discrete291291+ * set of resolutions.292292+ *293293+ * @sizes: array of &struct v4l2_frmsize_discrete image sizes.294294+ * @num_sizes: length of @sizes array.295295+ * @width: desired width.296296+ * @height: desired height.297297+ *298298+ * Finds the closest resolution to minimize the width and height differences299299+ * between what requested and the supported resolutions.300300+ */281301const struct v4l2_frmsize_discrete *282302v4l2_find_nearest_format(const struct v4l2_frmsize_discrete *sizes,283303 const size_t num_sizes,284304 s32 width, s32 height);285305306306+/**307307+ * v4l2_get_timestamp - helper routine to get a timestamp to be used when308308+ * filling streaming metadata. Internally, it uses ktime_get_ts(),309309+ * which is the recommended way to get it.310310+ *311311+ * @tv: pointer to &struct timeval to be filled.312312+ */286313void v4l2_get_timestamp(struct timeval *tv);287314288315#endif /* V4L2_COMMON_H_ */