提交 4ee22240 编写于 作者: A Arnd Bergmann 提交者: Mauro Carvalho Chehab

media: staging: davinci: remove vpfe driver

The davinci_vpfe driver was merged into staging back in 2012 by Manjunath
Hadli from TI, with a long TODO list.

For all I can tell, since then it has only seen fixes for compile-time
issues and global cleanups, but nobody has actually worked on the items
on the TODO list.

To make things worse, the driver in its current form is incompatible with
the platform code in arch/arm/mach-davinci, i.e. the driver expects to
get its platform_data passed to the device as a 'struct vpfe_config',
but uses a differnet definition for that structure compared to what the
platform uses.

Finally, there is another driver for the same device in
drivers/media/platform/davinci/vpfe_capture.c. From all I can tell, the
staging version was originally a copy of a more featureful driver in TI's
downstream kernels. However, that kernel no longer supports dm365 after
linux-2.6.37, and the mainline version moved in a different direction.
Signed-off-by: NArnd Bergmann <arnd@arndb.de>
Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
上级 757c2bf5
......@@ -22,8 +22,6 @@ if STAGING_MEDIA && MEDIA_SUPPORT
# Please keep them in alphabetic order
source "drivers/staging/media/allegro-dvt/Kconfig"
source "drivers/staging/media/davinci_vpfe/Kconfig"
source "drivers/staging/media/hantro/Kconfig"
source "drivers/staging/media/imx/Kconfig"
......
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_VIDEO_ALLEGRO_DVT) += allegro-dvt/
obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx/
obj-$(CONFIG_VIDEO_DM365_VPFE) += davinci_vpfe/
obj-$(CONFIG_VIDEO_MESON_VDEC) += meson/vdec/
obj-$(CONFIG_VIDEO_OMAP4) += omap4iss/
obj-$(CONFIG_VIDEO_SUNXI) += sunxi/
......
# SPDX-License-Identifier: GPL-2.0
config VIDEO_DM365_VPFE
tristate "DM365 VPFE Media Controller Capture Driver"
depends on VIDEO_V4L2
depends on (ARCH_DAVINCI_DM365 && !VIDEO_DM365_ISIF) || (COMPILE_TEST && !ARCH_OMAP1)
depends on VIDEO_V4L2_SUBDEV_API
depends on VIDEO_DAVINCI_VPBE_DISPLAY
select VIDEOBUF2_DMA_CONTIG
help
Support for DM365 VPFE based Media Controller Capture driver.
To compile this driver as a module, choose M here: the
module will be called vpfe-mc-capture.
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_VIDEO_DM365_VPFE) += davinci-vfpe.o
davinci-vfpe-objs := \
dm365_isif.o dm365_ipipe_hw.o dm365_ipipe.o \
dm365_resizer.o dm365_ipipeif.o vpfe_mc_capture.o vpfe_video.o
# Allow building it with COMPILE_TEST on other archs
ifndef CONFIG_ARCH_DAVINCI
ccflags-y += -I $(srctree)/arch/arm/mach-davinci/include/
endif
TODO (general):
==================================
- User space interface refinement
- Controls should be used when possible rather than private ioctl
- No enums should be used
- Use of MC and V4L2 subdev APIs when applicable
- Single interface header might suffice
- Current interface forces to configure everything at once
- Get rid of the dm365_ipipe_hw.[ch] layer
- Active external sub-devices defined by link configuration; no strcmp
needed
- More generic platform data (i2c adapters)
- The driver should have no knowledge of possible external subdevs; see
struct vpfe_subdev_id
- Some of the hardware control should be refactorede
- Check proper serialisation (through mutexes and spinlocks)
- Names that are visible in kernel global namespace should have a common
prefix (or a few)
- While replacing the older driver in media folder, provide a compatibility
layer and compatibility tests that warrants (using the libv4l's LD_PRELOAD
approach) there is no regression for the users using the older driver.
- make it independent of arch-specific APIs (mach/mux.h).
Building of uImage and Applications:
==================================
As of now since the interface will undergo few changes all the include
files are present in staging itself, to build for dm365 follow below steps,
- copy vpfe.h from drivers/staging/media/davinci_vpfe/ to
include/media/davinci/ folder for building the uImage.
- copy davinci_vpfe_user.h from drivers/staging/media/davinci_vpfe/ to
include/uapi/linux/davinci_vpfe.h, and add a entry in Kbuild (required
for building application).
- copy dm365_ipipeif_user.h from drivers/staging/media/davinci_vpfe/ to
include/uapi/linux/dm365_ipipeif.h and a entry in Kbuild (required
for building application).
Davinci Video processing Front End (VPFE) driver
Copyright (C) 2012 Texas Instruments Inc
Contacts: Manjunath Hadli <manjunath.hadli@ti.com>
Prabhakar Lad <prabhakar.lad@ti.com>
Introduction
============
This file documents the Texas Instruments Davinci Video processing Front End
(VPFE) driver located under drivers/media/platform/davinci. The original driver
exists for Davinci VPFE, which is now being changed to Media Controller
Framework.
Currently the driver has been successfully used on the following
version of Davinci:
DM365/DM368
The driver implements V4L2, Media controller and v4l2_subdev interfaces. Sensor,
lens and flash drivers using the v4l2_subdev interface in the kernel are
supported.
Split to subdevs
================
The Davinci VPFE is split into V4L2 subdevs, each of the blocks inside the VPFE
having one subdev to represent it. Each of the subdevs provide a V4L2 subdev
interface to userspace.
DAVINCI ISIF
DAVINCI IPIPEIF
DAVINCI IPIPE
DAVINCI CROP RESIZER
DAVINCI RESIZER A
DAVINCI RESIZER B
Each possible link in the VPFE is modelled by a link in the Media controller
interface. For an example program see [1].
ISIF, IPIPE, and RESIZER block IOCTLs
======================================
The Davinci Video processing Front End (VPFE) driver supports standard V4L2
IOCTLs and controls where possible and practical. Much of the functions provided
by the VPFE, however, does not fall under the standard IOCTL's.
In general, there is a private ioctl for configuring each of the blocks
containing hardware-dependent functions.
The following private IOCTLs are supported:
VIDIOC_VPFE_ISIF_[S/G]_RAW_PARAMS
VIDIOC_VPFE_IPIPE_[S/G]_CONFIG
VIDIOC_VPFE_RSZ_[S/G]_CONFIG
The parameter structures used by these ioctl's are described in
include/uapi/linux/davinci_vpfe.h.
The VIDIOC_VPFE_ISIF_S_RAW_PARAMS, VIDIOC_VPFE_IPIPE_S_CONFIG and
VIDIOC_VPFE_RSZ_S_CONFIG are used to configure, enable and disable functions in
the isif, ipipe and resizer blocks respectively. These IOCTL's control several
functions in the blocks they control. VIDIOC_VPFE_ISIF_S_RAW_PARAMS IOCTL
accepts a pointer to struct vpfe_isif_raw_config as its argument. Similarly
VIDIOC_VPFE_IPIPE_S_CONFIG accepts a pointer to struct vpfe_ipipe_config. And
VIDIOC_VPFE_RSZ_S_CONFIG accepts a pointer to struct vpfe_rsz_config as its
argument. Similarly VIDIOC_VPFE_ISIF_G_RAW_PARAMS, VIDIOC_VPFE_IPIPE_G_CONFIG
and VIDIOC_VPFE_RSZ_G_CONFIG are used to get the current configuration set in
the isif, ipipe and resizer blocks respectively.
The detailed functions of the VPFE itself related to a given VPFE block is
described in the Technical Reference Manuals (TRMs) --- see the end of the
document for those.
IPIPEIF block IOCTLs
======================================
The following private IOCTLs are supported:
VIDIOC_VPFE_IPIPEIF_[S/G]_CONFIG
The parameter structures used by these ioctl's are described in
include/uapi/linux/dm365_ipipeif.h
The VIDIOC_VPFE_IPIPEIF_S_CONFIG is used to configure the ipipeif
hardware block. The VIDIOC_VPFE_IPIPEIF_S_CONFIG and
VIDIOC_VPFE_IPIPEIF_G_CONFIG accepts a pointer to struct ipipeif_params
as its argument.
VPFE Operating Modes
==========================================
a: Continuous Modes
------------------------
1: tvp514x/tvp7002/mt9p031---> DAVINCI ISIF---> SDRAM
2: tvp514x/tvp7002/mt9p031---> DAVINCI ISIF---> DAVINCI IPIPEIF--->|
|
<--------------------<----------------<---------------------<---|
|
V
DAVINCI CROP RESIZER--->DAVINCI RESIZER [A/B]---> SDRAM
3: tvp514x/tvp7002/mt9p031---> DAVINCI ISIF---> DAVINCI IPIPEIF--->|
|
<--------------------<----------------<---------------------<---|
|
V
DAVINCI IPIPE---> DAVINCI CROP RESIZER--->DAVINCI RESIZER [A/B]---> SDRAM
a: Single Shot Modes
------------------------
1: SDRAM---> DAVINCI IPIPEIF---> DAVINCI IPIPE---> DAVINCI CROP RESIZER--->|
|
<----------------<----------------<------------------<---------------<--|
|
V
DAVINCI RESIZER [A/B]---> SDRAM
2: SDRAM---> DAVINCI IPIPEIF---> DAVINCI CROP RESIZER--->|
|
<----------------<----------------<---------------<---|
|
V
DAVINCI RESIZER [A/B]---> SDRAM
Technical reference manuals (TRMs) and other documentation
==========================================================
Davinci DM365 TRM:
<URL:http://www.ti.com/lit/ds/sprs457e/sprs457e.pdf>
Referenced MARCH 2009-REVISED JUNE 2011
Davinci DM368 TRM:
<URL:http://www.ti.com/lit/ds/sprs668c/sprs668c.pdf>
Referenced APRIL 2010-REVISED JUNE 2011
Davinci Video Processing Front End (VPFE) DM36x
<URL:http://www.ti.com/lit/ug/sprufg8c/sprufg8c.pdf>
References
==========
[1] http://git.ideasonboard.org/?p=media-ctl.git;a=summary
/* SPDX-License-Identifier: GPL-2.0 */
/*
* 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.
*
* Contributors:
* Manjunath Hadli <manjunath.hadli@ti.com>
* Prabhakar Lad <prabhakar.lad@ti.com>
*/
#ifndef _DAVINCI_VPFE_DM365_IPIPE_H
#define _DAVINCI_VPFE_DM365_IPIPE_H
#include <linux/platform_device.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-subdev.h>
#include "davinci_vpfe_user.h"
#include "vpfe_video.h"
enum ipipe_noise_filter {
IPIPE_D2F_1ST = 0,
IPIPE_D2F_2ND = 1,
};
/* Used for driver storage */
struct ipipe_otfdpc_2_0 {
/* 0 - disable, 1 - enable */
unsigned char en;
/* defect detection method */
enum vpfe_ipipe_otfdpc_det_meth det_method;
/* Algorithm used. Applicable only when IPIPE_DPC_OTF_MIN_MAX2 is
* used
*/
enum vpfe_ipipe_otfdpc_alg alg;
struct vpfe_ipipe_otfdpc_2_0_cfg otfdpc_2_0;
};
struct ipipe_otfdpc_3_0 {
/* 0 - disable, 1 - enable */
unsigned char en;
/* defect detection method */
enum vpfe_ipipe_otfdpc_det_meth det_method;
/* Algorithm used. Applicable only when IPIPE_DPC_OTF_MIN_MAX2 is
* used
*/
enum vpfe_ipipe_otfdpc_alg alg;
struct vpfe_ipipe_otfdpc_3_0_cfg otfdpc_3_0;
};
/* Structure for configuring Luminance Adjustment module */
struct ipipe_lum_adj {
/* Brightness adjustments */
unsigned char brightness;
/* contrast adjustments */
unsigned char contrast;
};
enum ipipe_rgb2rgb {
IPIPE_RGB2RGB_1 = 0,
IPIPE_RGB2RGB_2 = 1,
};
struct ipipe_module_params {
__u32 flag;
struct vpfe_ipipe_input_config input_config;
struct vpfe_ipipe_lutdpc lutdpc;
struct vpfe_ipipe_otfdpc otfdpc;
struct vpfe_ipipe_nf nf1;
struct vpfe_ipipe_nf nf2;
struct vpfe_ipipe_gic gic;
struct vpfe_ipipe_wb wbal;
struct vpfe_ipipe_cfa cfa;
struct vpfe_ipipe_rgb2rgb rgb2rgb1;
struct vpfe_ipipe_rgb2rgb rgb2rgb2;
struct vpfe_ipipe_gamma gamma;
struct vpfe_ipipe_3d_lut lut;
struct vpfe_ipipe_rgb2yuv rgb2yuv;
struct vpfe_ipipe_gbce gbce;
struct vpfe_ipipe_yuv422_conv yuv422_conv;
struct vpfe_ipipe_yee yee;
struct vpfe_ipipe_car car;
struct vpfe_ipipe_cgs cgs;
struct ipipe_lum_adj lum_adj;
};
#define IPIPE_PAD_SINK 0
#define IPIPE_PAD_SOURCE 1
#define IPIPE_PADS_NUM 2
#define IPIPE_OUTPUT_NONE 0
#define IPIPE_OUTPUT_RESIZER (1 << 0)
enum ipipe_input_entity {
IPIPE_INPUT_NONE = 0,
IPIPE_INPUT_MEMORY = 1,
IPIPE_INPUT_CCDC = 2,
};
struct vpfe_ipipe_device {
struct v4l2_subdev subdev;
struct media_pad pads[IPIPE_PADS_NUM];
struct v4l2_mbus_framefmt formats[IPIPE_PADS_NUM];
enum ipipe_input_entity input;
unsigned int output;
struct v4l2_ctrl_handler ctrls;
void __iomem *base_addr;
void __iomem *isp5_base_addr;
struct ipipe_module_params config;
};
struct ipipe_module_if {
unsigned int param_offset;
unsigned int param_size;
unsigned int config_offset;
int (*set)(struct vpfe_ipipe_device *ipipe, void *param);
int (*get)(struct vpfe_ipipe_device *ipipe, void *param);
};
/* data paths */
enum ipipe_data_paths {
IPIPE_RAW2YUV,
/* Bayer RAW input to YCbCr output */
IPIPE_RAW2RAW,
/* Bayer Raw to Bayer output */
IPIPE_RAW2BOX,
/* Bayer Raw to Boxcar output */
IPIPE_YUV2YUV
/* YUV Raw to YUV Raw output */
};
#define IPIPE_COLPTN_R_Ye 0x0
#define IPIPE_COLPTN_Gr_Cy 0x1
#define IPIPE_COLPTN_Gb_G 0x2
#define IPIPE_COLPTN_B_Mg 0x3
#define COLPAT_EE_SHIFT 0
#define COLPAT_EO_SHIFT 2
#define COLPAT_OE_SHIFT 4
#define COLPAT_OO_SHIFT 6
#define ipipe_sgrbg_pattern \
(IPIPE_COLPTN_Gr_Cy << COLPAT_EE_SHIFT | \
IPIPE_COLPTN_R_Ye << COLPAT_EO_SHIFT | \
IPIPE_COLPTN_B_Mg << COLPAT_OE_SHIFT | \
IPIPE_COLPTN_Gb_G << COLPAT_OO_SHIFT)
#define ipipe_srggb_pattern \
(IPIPE_COLPTN_R_Ye << COLPAT_EE_SHIFT | \
IPIPE_COLPTN_Gr_Cy << COLPAT_EO_SHIFT | \
IPIPE_COLPTN_Gb_G << COLPAT_OE_SHIFT | \
IPIPE_COLPTN_B_Mg << COLPAT_OO_SHIFT)
int vpfe_ipipe_register_entities(struct vpfe_ipipe_device *ipipe,
struct v4l2_device *v4l2_dev);
int vpfe_ipipe_init(struct vpfe_ipipe_device *ipipe,
struct platform_device *pdev);
void vpfe_ipipe_unregister_entities(struct vpfe_ipipe_device *ipipe);
void vpfe_ipipe_cleanup(struct vpfe_ipipe_device *ipipe,
struct platform_device *pdev);
void vpfe_ipipe_enable(struct vpfe_device *vpfe_dev, int en);
#endif /* _DAVINCI_VPFE_DM365_IPIPE_H */
/* SPDX-License-Identifier: GPL-2.0 */
/*
* 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.
*
* Contributors:
* Manjunath Hadli <manjunath.hadli@ti.com>
* Prabhakar Lad <prabhakar.lad@ti.com>
*/
#ifndef _DAVINCI_VPFE_DM365_IPIPEIF_H
#define _DAVINCI_VPFE_DM365_IPIPEIF_H
#include <linux/platform_device.h>
#include <media/davinci/vpss.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-subdev.h>
#include "dm365_ipipeif_user.h"
#include "vpfe_video.h"
/* IPIPE base specific types */
enum ipipeif_data_shift {
IPIPEIF_BITS15_2 = 0,
IPIPEIF_BITS14_1 = 1,
IPIPEIF_BITS13_0 = 2,
IPIPEIF_BITS12_0 = 3,
IPIPEIF_BITS11_0 = 4,
IPIPEIF_BITS10_0 = 5,
IPIPEIF_BITS9_0 = 6,
};
enum ipipeif_clkdiv {
IPIPEIF_DIVIDE_HALF = 0,
IPIPEIF_DIVIDE_THIRD = 1,
IPIPEIF_DIVIDE_FOURTH = 2,
IPIPEIF_DIVIDE_FIFTH = 3,
IPIPEIF_DIVIDE_SIXTH = 4,
IPIPEIF_DIVIDE_EIGHTH = 5,
IPIPEIF_DIVIDE_SIXTEENTH = 6,
IPIPEIF_DIVIDE_THIRTY = 7,
};
enum ipipeif_pack_mode {
IPIPEIF_PACK_16_BIT = 0,
IPIPEIF_PACK_8_BIT = 1,
};
enum ipipeif_5_1_pack_mode {
IPIPEIF_5_1_PACK_16_BIT = 0,
IPIPEIF_5_1_PACK_8_BIT = 1,
IPIPEIF_5_1_PACK_8_BIT_A_LAW = 2,
IPIPEIF_5_1_PACK_12_BIT = 3
};
enum ipipeif_input_source {
IPIPEIF_CCDC = 0,
IPIPEIF_SDRAM_RAW = 1,
IPIPEIF_CCDC_DARKFM = 2,
IPIPEIF_SDRAM_YUV = 3,
};
enum ipipeif_ialaw {
IPIPEIF_ALAW_OFF = 0,
IPIPEIF_ALAW_ON = 1,
};
enum ipipeif_input_src1 {
IPIPEIF_SRC1_PARALLEL_PORT = 0,
IPIPEIF_SRC1_SDRAM_RAW = 1,
IPIPEIF_SRC1_ISIF_DARKFM = 2,
IPIPEIF_SRC1_SDRAM_YUV = 3,
};
enum ipipeif_dfs_dir {
IPIPEIF_PORT_MINUS_SDRAM = 0,
IPIPEIF_SDRAM_MINUS_PORT = 1,
};
enum ipipeif_chroma_phase {
IPIPEIF_CBCR_Y = 0,
IPIPEIF_Y_CBCR = 1,
};
enum ipipeif_dpcm_type {
IPIPEIF_DPCM_8BIT_10BIT = 0,
IPIPEIF_DPCM_8BIT_12BIT = 1,
};
/* data shift for IPIPE 5.1 */
enum ipipeif_5_1_data_shift {
IPIPEIF_5_1_BITS11_0 = 0,
IPIPEIF_5_1_BITS10_0 = 1,
IPIPEIF_5_1_BITS9_0 = 2,
IPIPEIF_5_1_BITS8_0 = 3,
IPIPEIF_5_1_BITS7_0 = 4,
IPIPEIF_5_1_BITS15_4 = 5,
};
#define IPIPEIF_PAD_SINK 0
#define IPIPEIF_PAD_SOURCE 1
#define IPIPEIF_NUM_PADS 2
enum ipipeif_input_entity {
IPIPEIF_INPUT_NONE = 0,
IPIPEIF_INPUT_ISIF = 1,
IPIPEIF_INPUT_MEMORY = 2,
};
enum ipipeif_output_entity {
IPIPEIF_OUTPUT_NONE = 0,
IPIPEIF_OUTPUT_IPIPE = 1,
IPIPEIF_OUTPUT_RESIZER = 2,
};
struct vpfe_ipipeif_device {
struct v4l2_subdev subdev;
struct media_pad pads[IPIPEIF_NUM_PADS];
struct v4l2_mbus_framefmt formats[IPIPEIF_NUM_PADS];
enum ipipeif_input_entity input;
unsigned int output;
struct vpfe_video_device video_in;
struct v4l2_ctrl_handler ctrls;
void __iomem *ipipeif_base_addr;
struct ipipeif_params config;
int dpcm_predictor;
int gain;
};
/* IPIPEIF Register Offsets from the base address */
#define IPIPEIF_ENABLE 0x00
#define IPIPEIF_CFG1 0x04
#define IPIPEIF_PPLN 0x08
#define IPIPEIF_LPFR 0x0c
#define IPIPEIF_HNUM 0x10
#define IPIPEIF_VNUM 0x14
#define IPIPEIF_ADDRU 0x18
#define IPIPEIF_ADDRL 0x1c
#define IPIPEIF_ADOFS 0x20
#define IPIPEIF_RSZ 0x24
#define IPIPEIF_GAIN 0x28
/* Below registers are available only on IPIPE 5.1 */
#define IPIPEIF_DPCM 0x2c
#define IPIPEIF_CFG2 0x30
#define IPIPEIF_INIRSZ 0x34
#define IPIPEIF_OCLIP 0x38
#define IPIPEIF_DTUDF 0x3c
#define IPIPEIF_CLKDIV 0x40
#define IPIPEIF_DPC1 0x44
#define IPIPEIF_DPC2 0x48
#define IPIPEIF_DFSGVL 0x4c
#define IPIPEIF_DFSGTH 0x50
#define IPIPEIF_RSZ3A 0x54
#define IPIPEIF_INIRSZ3A 0x58
#define IPIPEIF_RSZ_MIN 16
#define IPIPEIF_RSZ_MAX 112
#define IPIPEIF_RSZ_CONST 16
#define IPIPEIF_ADOFS_LSB_MASK 0x1ff
#define IPIPEIF_ADOFS_LSB_SHIFT 5
#define IPIPEIF_ADOFS_MSB_MASK 0x200
#define IPIPEIF_ADDRU_MASK 0x7ff
#define IPIPEIF_ADDRL_SHIFT 5
#define IPIPEIF_ADDRL_MASK 0xffff
#define IPIPEIF_ADDRU_SHIFT 21
#define IPIPEIF_ADDRMSB_SHIFT 31
#define IPIPEIF_ADDRMSB_LEFT_SHIFT 10
/* CFG1 Masks and shifts */
#define ONESHOT_SHIFT 0
#define DECIM_SHIFT 1
#define INPSRC_SHIFT 2
#define CLKDIV_SHIFT 4
#define AVGFILT_SHIFT 7
#define PACK8IN_SHIFT 8
#define IALAW_SHIFT 9
#define CLKSEL_SHIFT 10
#define DATASFT_SHIFT 11
#define INPSRC1_SHIFT 14
/* DPC2 */
#define IPIPEIF_DPC2_EN_SHIFT 12
#define IPIPEIF_DPC2_THR_MASK 0xfff
/* Applicable for IPIPE 5.1 */
#define IPIPEIF_DF_GAIN_EN_SHIFT 10
#define IPIPEIF_DF_GAIN_MASK 0x3ff
#define IPIPEIF_DF_GAIN_THR_MASK 0xfff
/* DPCM */
#define IPIPEIF_DPCM_BITS_SHIFT 2
#define IPIPEIF_DPCM_PRED_SHIFT 1
/* CFG2 */
#define IPIPEIF_CFG2_HDPOL_SHIFT 1
#define IPIPEIF_CFG2_VDPOL_SHIFT 2
#define IPIPEIF_CFG2_YUV8_SHIFT 6
#define IPIPEIF_CFG2_YUV16_SHIFT 3
#define IPIPEIF_CFG2_YUV8P_SHIFT 7
/* INIRSZ */
#define IPIPEIF_INIRSZ_ALNSYNC_SHIFT 13
#define IPIPEIF_INIRSZ_MASK 0x1fff
/* CLKDIV */
#define IPIPEIF_CLKDIV_M_SHIFT 8
void vpfe_ipipeif_enable(struct vpfe_device *vpfe_dev);
void vpfe_ipipeif_ss_buffer_isr(struct vpfe_ipipeif_device *ipipeif);
int vpfe_ipipeif_decimation_enabled(struct vpfe_device *vpfe_dev);
int vpfe_ipipeif_get_rsz(struct vpfe_device *vpfe_dev);
void vpfe_ipipeif_cleanup(struct vpfe_ipipeif_device *ipipeif,
struct platform_device *pdev);
int vpfe_ipipeif_init(struct vpfe_ipipeif_device *ipipeif,
struct platform_device *pdev);
int vpfe_ipipeif_register_entities(struct vpfe_ipipeif_device *ipipeif,
struct v4l2_device *vdev);
void vpfe_ipipeif_unregister_entities(struct vpfe_ipipeif_device *ipipeif);
#endif /* _DAVINCI_VPFE_DM365_IPIPEIF_H */
/* SPDX-License-Identifier: GPL-2.0 */
/*
* 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.
*
* Contributors:
* Manjunath Hadli <manjunath.hadli@ti.com>
* Prabhakar Lad <prabhakar.lad@ti.com>
*/
#ifndef _DAVINCI_VPFE_DM365_IPIPEIF_USER_H
#define _DAVINCI_VPFE_DM365_IPIPEIF_USER_H
/* clockdiv for IPIPE 5.1 */
struct ipipeif_5_1_clkdiv {
unsigned char m;
unsigned char n;
};
enum ipipeif_decimation {
IPIPEIF_DECIMATION_OFF,
IPIPEIF_DECIMATION_ON
};
/* DPC at the if for IPIPE 5.1 */
struct ipipeif_dpc {
/* 0 - disable, 1 - enable */
unsigned char en;
/* threshold */
unsigned short thr;
};
enum ipipeif_clock {
IPIPEIF_PIXCEL_CLK,
IPIPEIF_SDRAM_CLK
};
enum ipipeif_avg_filter {
IPIPEIF_AVG_OFF,
IPIPEIF_AVG_ON
};
struct ipipeif_5_1 {
struct ipipeif_5_1_clkdiv clk_div;
/* Defect pixel correction */
struct ipipeif_dpc dpc;
/* clipped to this value */
unsigned short clip;
/* Align HSync and VSync to rsz_start */
unsigned char align_sync;
/* resizer start position */
unsigned int rsz_start;
/* DF gain enable */
unsigned char df_gain_en;
/* DF gain value */
unsigned short df_gain;
/* DF gain threshold value */
unsigned short df_gain_thr;
};
struct ipipeif_params {
enum ipipeif_clock clock_select;
unsigned int ppln;
unsigned int lpfr;
unsigned char rsz;
enum ipipeif_decimation decimation;
enum ipipeif_avg_filter avg_filter;
/* IPIPE 5.1 */
struct ipipeif_5_1 if_5_1;
};
/*
* Private IOCTL
* VIDIOC_VPFE_IPIPEIF_S_CONFIG: Set IPIEIF configuration
* VIDIOC_VPFE_IPIPEIF_G_CONFIG: Get IPIEIF configuration
*/
#define VIDIOC_VPFE_IPIPEIF_S_CONFIG \
_IOWR('I', BASE_VIDIOC_PRIVATE + 1, struct ipipeif_params)
#define VIDIOC_VPFE_IPIPEIF_G_CONFIG \
_IOWR('I', BASE_VIDIOC_PRIVATE + 2, struct ipipeif_params)
#endif /* _DAVINCI_VPFE_DM365_IPIPEIF_USER_H */
/* SPDX-License-Identifier: GPL-2.0 */
/*
* 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.
*
* 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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册