linux/include/media/v4l2-mediabus.h
<<
>>
Prefs
   1/*
   2 * Media Bus API header
   3 *
   4 * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
   5 *
   6 * This program is free software; you can redistribute it and/or modify
   7 * it under the terms of the GNU General Public License version 2 as
   8 * published by the Free Software Foundation.
   9 */
  10
  11#ifndef V4L2_MEDIABUS_H
  12#define V4L2_MEDIABUS_H
  13
  14#include <linux/v4l2-mediabus.h>
  15
  16/* Parallel flags */
  17/*
  18 * Can the client run in master or in slave mode. By "Master mode" an operation
  19 * mode is meant, when the client (e.g., a camera sensor) is producing
  20 * horizontal and vertical synchronisation. In "Slave mode" the host is
  21 * providing these signals to the slave.
  22 */
  23#define V4L2_MBUS_MASTER                        (1 << 0)
  24#define V4L2_MBUS_SLAVE                         (1 << 1)
  25/*
  26 * Signal polarity flags
  27 * Note: in BT.656 mode HSYNC, FIELD, and VSYNC are unused
  28 * V4L2_MBUS_[HV]SYNC* flags should be also used for specifying
  29 * configuration of hardware that uses [HV]REF signals
  30 */
  31#define V4L2_MBUS_HSYNC_ACTIVE_HIGH             (1 << 2)
  32#define V4L2_MBUS_HSYNC_ACTIVE_LOW              (1 << 3)
  33#define V4L2_MBUS_VSYNC_ACTIVE_HIGH             (1 << 4)
  34#define V4L2_MBUS_VSYNC_ACTIVE_LOW              (1 << 5)
  35#define V4L2_MBUS_PCLK_SAMPLE_RISING            (1 << 6)
  36#define V4L2_MBUS_PCLK_SAMPLE_FALLING           (1 << 7)
  37#define V4L2_MBUS_DATA_ACTIVE_HIGH              (1 << 8)
  38#define V4L2_MBUS_DATA_ACTIVE_LOW               (1 << 9)
  39/* FIELD = 0/1 - Field1 (odd)/Field2 (even) */
  40#define V4L2_MBUS_FIELD_EVEN_HIGH               (1 << 10)
  41/* FIELD = 1/0 - Field1 (odd)/Field2 (even) */
  42#define V4L2_MBUS_FIELD_EVEN_LOW                (1 << 11)
  43
  44/* Serial flags */
  45/* How many lanes the client can use */
  46#define V4L2_MBUS_CSI2_1_LANE                   (1 << 0)
  47#define V4L2_MBUS_CSI2_2_LANE                   (1 << 1)
  48#define V4L2_MBUS_CSI2_3_LANE                   (1 << 2)
  49#define V4L2_MBUS_CSI2_4_LANE                   (1 << 3)
  50/* On which channels it can send video data */
  51#define V4L2_MBUS_CSI2_CHANNEL_0                (1 << 4)
  52#define V4L2_MBUS_CSI2_CHANNEL_1                (1 << 5)
  53#define V4L2_MBUS_CSI2_CHANNEL_2                (1 << 6)
  54#define V4L2_MBUS_CSI2_CHANNEL_3                (1 << 7)
  55/* Does it support only continuous or also non-continuous clock mode */
  56#define V4L2_MBUS_CSI2_CONTINUOUS_CLOCK         (1 << 8)
  57#define V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK      (1 << 9)
  58
  59#define V4L2_MBUS_CSI2_LANES            (V4L2_MBUS_CSI2_1_LANE | V4L2_MBUS_CSI2_2_LANE | \
  60                                         V4L2_MBUS_CSI2_3_LANE | V4L2_MBUS_CSI2_4_LANE)
  61#define V4L2_MBUS_CSI2_CHANNELS         (V4L2_MBUS_CSI2_CHANNEL_0 | V4L2_MBUS_CSI2_CHANNEL_1 | \
  62                                         V4L2_MBUS_CSI2_CHANNEL_2 | V4L2_MBUS_CSI2_CHANNEL_3)
  63
  64/**
  65 * v4l2_mbus_type - media bus type
  66 * @V4L2_MBUS_PARALLEL: parallel interface with hsync and vsync
  67 * @V4L2_MBUS_BT656:    parallel interface with embedded synchronisation, can
  68 *                      also be used for BT.1120
  69 * @V4L2_MBUS_CSI2:     MIPI CSI-2 serial interface
  70 */
  71enum v4l2_mbus_type {
  72        V4L2_MBUS_PARALLEL,
  73        V4L2_MBUS_BT656,
  74        V4L2_MBUS_CSI2,
  75};
  76
  77/**
  78 * v4l2_mbus_config - media bus configuration
  79 * @type:       in: interface type
  80 * @flags:      in / out: configuration flags, depending on @type
  81 */
  82struct v4l2_mbus_config {
  83        enum v4l2_mbus_type type;
  84        unsigned int flags;
  85};
  86
  87static inline void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt,
  88                                const struct v4l2_mbus_framefmt *mbus_fmt)
  89{
  90        pix_fmt->width = mbus_fmt->width;
  91        pix_fmt->height = mbus_fmt->height;
  92        pix_fmt->field = mbus_fmt->field;
  93        pix_fmt->colorspace = mbus_fmt->colorspace;
  94}
  95
  96static inline void v4l2_fill_mbus_format(struct v4l2_mbus_framefmt *mbus_fmt,
  97                           const struct v4l2_pix_format *pix_fmt,
  98                           enum v4l2_mbus_pixelcode code)
  99{
 100        mbus_fmt->width = pix_fmt->width;
 101        mbus_fmt->height = pix_fmt->height;
 102        mbus_fmt->field = pix_fmt->field;
 103        mbus_fmt->colorspace = pix_fmt->colorspace;
 104        mbus_fmt->code = code;
 105}
 106
 107#endif
 108
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.