linux/drivers/media/platform/ti/davinci/vpif_display.c

/*
 * vpif-display - VPIF display driver
 * Display driver for TI DaVinci VPIF
 *
 * Copyright (C) 2009 Texas Instruments Incorporated - https://www.ti.com/
 * Copyright (C) 2014 Lad, Prabhakar <[email protected]>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation version 2.
 *
 * This program is distributed .as is. WITHOUT ANY WARRANTY of any
 * kind, whether express or implied; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>

#include <media/v4l2-ioctl.h>

#include "vpif.h"
#include "vpif_display.h"

MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_VERSION();

#define VPIF_V4L2_STD

#define vpif_err(fmt, arg...)
#define vpif_dbg(level, debug, fmt, arg...)

static int debug =;

module_param(debug, int, 0644);

MODULE_PARM_DESC();

#define VPIF_DRIVER_NAME
MODULE_ALIAS();

/* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */
static int ycmux_mode;

static u8 channel_first_int[VPIF_NUMOBJECTS][2] =;

static struct vpif_device vpif_obj =;
static struct device *vpif_dev;
static void vpif_calculate_offsets(struct channel_obj *ch);
static void vpif_config_addr(struct channel_obj *ch, int muxmode);

static inline
struct vpif_disp_buffer *to_vpif_buffer(struct vb2_v4l2_buffer *vb)
{}

/**
 * vpif_buffer_prepare :  callback function for buffer prepare
 * @vb: ptr to vb2_buffer
 *
 * This is the callback function for buffer prepare when vb2_qbuf()
 * function is called. The buffer is prepared and user space virtual address
 * or user address is converted into  physical address
 */
static int vpif_buffer_prepare(struct vb2_buffer *vb)
{}

/**
 * vpif_buffer_queue_setup : Callback function for buffer setup.
 * @vq: vb2_queue ptr
 * @nbuffers: ptr to number of buffers requested by application
 * @nplanes: contains number of distinct video planes needed to hold a frame
 * @sizes: contains the size (in bytes) of each plane.
 * @alloc_devs: ptr to allocation context
 *
 * This callback function is called when reqbuf() is called to adjust
 * the buffer count and buffer size
 */
static int vpif_buffer_queue_setup(struct vb2_queue *vq,
				unsigned int *nbuffers, unsigned int *nplanes,
				unsigned int sizes[], struct device *alloc_devs[])
{}

/**
 * vpif_buffer_queue : Callback function to add buffer to DMA queue
 * @vb: ptr to vb2_buffer
 *
 * This callback function queues the buffer to DMA engine
 */
static void vpif_buffer_queue(struct vb2_buffer *vb)
{}

/**
 * vpif_start_streaming : Starts the DMA engine for streaming
 * @vq: ptr to vb2_buffer
 * @count: number of buffers
 */
static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
{}

/**
 * vpif_stop_streaming : Stop the DMA engine
 * @vq: ptr to vb2_queue
 *
 * This callback stops the DMA engine and any remaining buffers
 * in the DMA queue are released.
 */
static void vpif_stop_streaming(struct vb2_queue *vq)
{}

static const struct vb2_ops video_qops =;

static void process_progressive_mode(struct common_obj *common)
{}

static void process_interlaced_mode(int fid, struct common_obj *common)
{}

/*
 * vpif_channel_isr: It changes status of the displayed buffer, takes next
 * buffer from the queue and sets its address in VPIF registers
 */
static irqreturn_t vpif_channel_isr(int irq, void *dev_id)
{}

static int vpif_update_std_info(struct channel_obj *ch)
{}

static int vpif_update_resolution(struct channel_obj *ch)
{}

/*
 * vpif_calculate_offsets: This function calculates buffers offset for Y and C
 * in the top and bottom field
 */
static void vpif_calculate_offsets(struct channel_obj *ch)
{}

static void vpif_config_addr(struct channel_obj *ch, int muxmode)
{}

/* functions implementing ioctls */
/**
 * vpif_querycap() - QUERYCAP handler
 * @file: file ptr
 * @priv: file handle
 * @cap: ptr to v4l2_capability structure
 */
static int vpif_querycap(struct file *file, void  *priv,
				struct v4l2_capability *cap)
{}

static int vpif_enum_fmt_vid_out(struct file *file, void  *priv,
					struct v4l2_fmtdesc *fmt)
{}

static int vpif_g_fmt_vid_out(struct file *file, void *priv,
				struct v4l2_format *fmt)
{}

static int vpif_try_fmt_vid_out(struct file *file, void *priv,
				struct v4l2_format *fmt)
{}

static int vpif_s_fmt_vid_out(struct file *file, void *priv,
				struct v4l2_format *fmt)
{}

static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
{}

static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)
{}

static int vpif_enum_output(struct file *file, void *fh,
				struct v4l2_output *output)
{}

/**
 * vpif_output_to_subdev() - Maps output to sub device
 * @vpif_cfg: global config ptr
 * @chan_cfg: channel config ptr
 * @index: Given output index from application
 *
 * lookup the sub device information for a given output index.
 * we report all the output to application. output table also
 * has sub device name for the each output
 */
static int
vpif_output_to_subdev(struct vpif_display_config *vpif_cfg,
		      struct vpif_display_chan_config *chan_cfg, int index)
{}

/**
 * vpif_set_output() - Select an output
 * @vpif_cfg: global config ptr
 * @ch: channel
 * @index: Given output index from application
 *
 * Select the given output.
 */
static int vpif_set_output(struct vpif_display_config *vpif_cfg,
		      struct channel_obj *ch, int index)
{}

static int vpif_s_output(struct file *file, void *priv, unsigned int i)
{}

static int vpif_g_output(struct file *file, void *priv, unsigned int *i)
{}

/**
 * vpif_enum_dv_timings() - ENUM_DV_TIMINGS handler
 * @file: file ptr
 * @priv: file handle
 * @timings: input timings
 */
static int
vpif_enum_dv_timings(struct file *file, void *priv,
		     struct v4l2_enum_dv_timings *timings)
{}

/**
 * vpif_s_dv_timings() - S_DV_TIMINGS handler
 * @file: file ptr
 * @priv: file handle
 * @timings: digital video timings
 */
static int vpif_s_dv_timings(struct file *file, void *priv,
		struct v4l2_dv_timings *timings)
{}

/**
 * vpif_g_dv_timings() - G_DV_TIMINGS handler
 * @file: file ptr
 * @priv: file handle
 * @timings: digital video timings
 */
static int vpif_g_dv_timings(struct file *file, void *priv,
		struct v4l2_dv_timings *timings)
{}

/*
 * vpif_log_status() - Status information
 * @file: file ptr
 * @priv: file handle
 *
 * Returns zero.
 */
static int vpif_log_status(struct file *filep, void *priv)
{}

/* vpif display ioctl operations */
static const struct v4l2_ioctl_ops vpif_ioctl_ops =;

static const struct v4l2_file_operations vpif_fops =;

/*Configure the channels, buffer sizei, request irq */
static int initialize_vpif(void)
{}

static void free_vpif_objs(void)
{}

static int vpif_probe_complete(void)
{}

/*
 * vpif_probe: This function creates device entries by register itself to the
 * V4L2 driver and initializes fields of each channel objects
 */
static __init int vpif_probe(struct platform_device *pdev)
{}

/*
 * vpif_remove: It un-register channels from V4L2 driver
 */
static void vpif_remove(struct platform_device *device)
{}

#ifdef CONFIG_PM_SLEEP
static int vpif_suspend(struct device *dev)
{}

static int vpif_resume(struct device *dev)
{}

#endif

static SIMPLE_DEV_PM_OPS(vpif_pm_ops, vpif_suspend, vpif_resume);

static __refdata struct platform_driver vpif_driver =;

module_platform_driver();