Commit 91825400 authored by Manjunath Hadli's avatar Manjunath Hadli Committed by Mauro Carvalho Chehab

[media] davinci: vpfe: add v4l2 capture driver with media interface

Add the vpfe capture driver which implements media controller
interface. The driver supports the DM365 sub ip units for capture
namely - ISIF, IPIPE, IPIPEIF, Resizer. This file represents the main
driver which does isr registration, v4l2 device registration,
media registration and platform driver registrations.
It calls the appropriate subdevs from here to create subdevices
and media entities.
Signed-off-by: default avatarManjunath Hadli <manjunath.hadli@ti.com>
Signed-off-by: default avatarLad, Prabhakar <prabhakar.lad@ti.com>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: default avatarSakari Ailus <sakari.ailus@iki.fi>
Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent d31c1002
This diff is collapsed.
/*
* Copyright (C) 2012 Texas Instruments Inc
*
* 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 in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contributors:
* Manjunath Hadli <manjunath.hadli@ti.com>
* Prabhakar Lad <prabhakar.lad@ti.com>
*/
#ifndef _VPFE_H
#define _VPFE_H
#ifdef __KERNEL__
#include <linux/v4l2-subdev.h>
#include <linux/clk.h>
#include <linux/i2c.h>
#include <media/davinci/vpfe_types.h>
#define CAPTURE_DRV_NAME "vpfe-capture"
struct vpfe_route {
__u32 input;
__u32 output;
};
enum vpfe_subdev_id {
VPFE_SUBDEV_TVP5146 = 1,
VPFE_SUBDEV_MT9T031 = 2,
VPFE_SUBDEV_TVP7002 = 3,
VPFE_SUBDEV_MT9P031 = 4,
};
struct vpfe_ext_subdev_info {
/* v4l2 subdev */
struct v4l2_subdev *subdev;
/* Sub device module name */
char module_name[32];
/* Sub device group id */
int grp_id;
/* Number of inputs supported */
int num_inputs;
/* inputs available at the sub device */
struct v4l2_input *inputs;
/* Sub dev routing information for each input */
struct vpfe_route *routes;
/* ccdc bus/interface configuration */
struct vpfe_hw_if_param ccdc_if_params;
/* i2c subdevice board info */
struct i2c_board_info board_info;
/* Is this a camera sub device ? */
unsigned is_camera:1;
/* check if sub dev supports routing */
unsigned can_route:1;
/* registered ? */
unsigned registered:1;
};
struct vpfe_config {
/* Number of sub devices connected to vpfe */
int num_subdevs;
/* information about each subdev */
struct vpfe_ext_subdev_info *sub_devs;
/* evm card info */
char *card_name;
/* setup function for the input path */
int (*setup_input)(enum vpfe_subdev_id id);
/* number of clocks */
int num_clocks;
/* clocks used for vpfe capture */
char *clocks[];
};
#endif
#endif
This diff is collapsed.
/*
* Copyright (C) 2012 Texas Instruments Inc
*
* 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 in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contributors:
* Manjunath Hadli <manjunath.hadli@ti.com>
* Prabhakar Lad <prabhakar.lad@ti.com>
*/
#ifndef _DAVINCI_VPFE_MC_CAPTURE_H
#define _DAVINCI_VPFE_MC_CAPTURE_H
#include "dm365_ipipe.h"
#include "dm365_ipipeif.h"
#include "dm365_isif.h"
#include "dm365_resizer.h"
#include "vpfe_video.h"
#define VPFE_MAJOR_RELEASE 0
#define VPFE_MINOR_RELEASE 0
#define VPFE_BUILD 1
#define VPFE_CAPTURE_VERSION_CODE ((VPFE_MAJOR_RELEASE << 16) | \
(VPFE_MINOR_RELEASE << 8) | \
VPFE_BUILD)
/* IPIPE hardware limits */
#define IPIPE_MAX_OUTPUT_WIDTH_A 2176
#define IPIPE_MAX_OUTPUT_WIDTH_B 640
/* Based on max resolution supported. QXGA */
#define IPIPE_MAX_OUTPUT_HEIGHT_A 1536
/* Based on max resolution supported. VGA */
#define IPIPE_MAX_OUTPUT_HEIGHT_B 480
#define to_vpfe_device(ptr_module) \
container_of(ptr_module, struct vpfe_device, vpfe_##ptr_module)
#define to_device(ptr_module) \
(to_vpfe_device(ptr_module)->dev)
struct vpfe_device {
/* external registered sub devices */
struct v4l2_subdev **sd;
/* number of registered external subdevs */
unsigned int num_ext_subdevs;
/* vpfe cfg */
struct vpfe_config *cfg;
/* clock ptrs for vpfe capture */
struct clk **clks;
/* V4l2 device */
struct v4l2_device v4l2_dev;
/* parent device */
struct device *pdev;
/* IRQ number for DMA transfer completion at the image processor */
unsigned int imp_dma_irq;
/* CCDC IRQs used when CCDC/ISIF output to SDRAM */
unsigned int ccdc_irq0;
unsigned int ccdc_irq1;
/* maximum video memory that is available*/
unsigned int video_limit;
/* media device */
struct media_device media_dev;
/* ccdc subdevice */
struct vpfe_isif_device vpfe_isif;
/* ipipeif subdevice */
struct vpfe_ipipeif_device vpfe_ipipeif;
/* ipipe subdevice */
struct vpfe_ipipe_device vpfe_ipipe;
/* resizer subdevice */
struct vpfe_resizer_device vpfe_resizer;
};
/* File handle structure */
struct vpfe_fh {
struct v4l2_fh vfh;
struct vpfe_video_device *video;
/* Indicates whether this file handle is doing IO */
u8 io_allowed;
/* Used to keep track priority of this instance */
enum v4l2_priority prio;
};
void mbus_to_pix(const struct v4l2_mbus_framefmt *mbus,
struct v4l2_pix_format *pix);
#endif /* _DAVINCI_VPFE_MC_CAPTURE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment