/*
* Copyright (C) STMicroelectronics SA 2014
* Authors: Fabien Dessenne <fabien.dessenne@st.com> for STMicroelectronics.
* License terms: GNU General Public License (GPL), version 2
*/
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h>
#include "bdisp.h"
#define BDISP_MAX_CTRL_NUM 10
#define BDISP_WORK_TIMEOUT ((100 * HZ) / 1000)
/* User configuration change */
#define BDISP_PARAMS BIT(0) /* Config updated */
#define BDISP_SRC_FMT BIT(1) /* Source set */
#define BDISP_DST_FMT BIT(2) /* Destination set */
#define BDISP_CTX_STOP_REQ BIT(3) /* Stop request */
#define BDISP_CTX_ABORT BIT(4) /* Abort while device run */
#define BDISP_MIN_W 1
#define BDISP_MAX_W 8191
#define BDISP_MIN_H 1
#define BDISP_MAX_H 8191
#define fh_to_ctx(__fh) container_of(__fh, struct bdisp_ctx, fh)
enum bdisp_dev_flags {
ST_M2M_OPEN, /* Driver opened */
ST_M2M_RUNNING, /* HW device running */
ST_M2M_SUSPENDED, /* Driver suspended */
ST_M2M_SUSPENDING, /* Driver being suspended */
};
static const struct bdisp_fmt bdisp_formats[] = {
/* ARGB888. [31:0] A:R:G:B 8:8:8:8 little endian */
{
.pixelformat = V4L2_PIX_FMT_ABGR32, /* is actually ARGB */
.nb_planes = 1,
.bpp = 32,
.bpp_plane0 = 32,
.w_align = 1,
.h_align = 1
},
/* XRGB888. [31:0] x:R:G:B 8:8:8:8 little endian */
{
.pixelformat = V4L2_PIX_FMT_XBGR32, /* is actually xRGB */
.nb_planes = 1,
.bpp = 32,
.bpp_plane0 = 32,
.w_align = 1,
.h_align = 1