[EMAIL PROTECTED] writes:

> As part of adding video drivers to the kernel tree, platform data has been
> defined in this patch for vpfe capture and tvp5146 drivers.
>
> Signed-off-by: Murali Karicheri <[EMAIL PROTECTED]>

Content wise, this looks OK, but there are several formatting issues
below.

> ---
>  arch/arm/mach-davinci/board-dm644x-evm.c |  173 
> +++++++++++++++++++++++++++++-
>  1 files changed, 170 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c 
> b/arch/arm/mach-davinci/board-dm644x-evm.c
> index ad38d15..50996b1 100644
> --- a/arch/arm/mach-davinci/board-dm644x-evm.c
> +++ b/arch/arm/mach-davinci/board-dm644x-evm.c
> @@ -24,8 +24,12 @@
>  #include <linux/mtd/nand.h>
>  #include <linux/mtd/partitions.h>
>  #include <linux/mtd/physmap.h>
> -#include <linux/io.h>
> -
> +#include <asm/io.h>
> +#if defined(CONFIG_VIDEO_TVP5146) || defined(CONFIG_VIDEO_TVP5146_MODULE)
> +#include <linux/videodev2.h>
> +#include <media/v4l2-int-device.h>
> +#include <media/tvp5146.h>
> +#endif

As Trilok pointed out, plese drop the #ifdefs.  It's cleaner to
always define the platform data.

I know the current code has #ifdefs, but I will be removing them
all shortly.

>  #include <asm/setup.h>
>  #include <asm/mach-types.h>
>  
> @@ -156,6 +160,22 @@ static struct platform_device davinci_fb_device = {
>  };
>  #endif
>  
> +#define V4L2_CAPTURE_MASTER "vpfe-capture"
> +#if defined(CONFIG_VIDEO_VPFE_CAPTURE) || \
> +    defined(CONFIG_VIDEO_VPFE_CAPTURE_MODULE)
> +
> +static u64 vpfe_capture_dma_mask = DMA_32BIT_MASK;
> +static struct platform_device vpfe_capture_dev = {
> +     .name           = V4L2_CAPTURE_MASTER,
> +     .id             = -1,
> +     .dev = {
> +             .dma_mask       = &vpfe_capture_dma_mask,
> +             .coherent_dma_mask      = DMA_32BIT_MASK,
> +     },
> +     .num_resources = 0,
> +};
> +#endif
> +
>  static struct platform_device rtc_dev = {
>       .name           = "rtc_davinci_evm",
>       .id             = -1,
> @@ -442,6 +462,142 @@ int dm6446evm_eeprom_write(void *buf, off_t off, size_t 
> count)
>  }
>  EXPORT_SYMBOL(dm6446evm_eeprom_write);
>  
> +#if defined(CONFIG_VIDEO_TVP5146) || \
> +    defined(CONFIG_VIDEO_TVP5146_MODULE)
> +
> +#define TVP5146_I2C_ADDR             (0x5D)
> +/* TVP5146 default register values */
> +static struct tvp5146_reg tvp5146_reg_list[] = {
> +     {TOK_WRITE, REG_INPUT_SEL, 0x05},       /* Composite selected */
> +     {TOK_WRITE, REG_AFE_GAIN_CTRL, 0x0F},
> +     {TOK_WRITE, REG_VIDEO_STD, 0x00},       /* Auto mode */
> +     {TOK_WRITE, REG_OPERATION_MODE, 0x00},
> +     {TOK_SKIP, REG_AUTOSWITCH_MASK, 0x3F},
> +     {TOK_WRITE, REG_COLOR_KILLER, 0x10},
> +     {TOK_WRITE, REG_LUMA_CONTROL1, 0x00},
> +     {TOK_WRITE, REG_LUMA_CONTROL2, 0x00},
> +     {TOK_WRITE, REG_LUMA_CONTROL3, 0x02},
> +     {TOK_WRITE, REG_BRIGHTNESS, 0x80},
> +     {TOK_WRITE, REG_CONTRAST, 0x80},
> +     {TOK_WRITE, REG_SATURATION, 0x80},
> +     {TOK_WRITE, REG_HUE, 0x00},
> +     {TOK_WRITE, REG_CHROMA_CONTROL1, 0x00},
> +     {TOK_WRITE, REG_CHROMA_CONTROL2, 0x0E},
> +     {TOK_SKIP, 0x0F, 0x00}, /* Reserved */
> +     {TOK_WRITE, REG_COMP_PR_SATURATION, 0x80},
> +     {TOK_WRITE, REG_COMP_Y_CONTRAST, 0x80},
> +     {TOK_WRITE, REG_COMP_PB_SATURATION, 0x80},
> +     {TOK_SKIP, 0x13, 0x00}, /* Reserved */
> +     {TOK_WRITE, REG_COMP_Y_BRIGHTNESS, 0x80},
> +     {TOK_SKIP, 0x15, 0x00}, /* Reserved */
> +     {TOK_SKIP, REG_AVID_START_PIXEL_LSB, 0x55},     /* NTSC timing */
> +     {TOK_SKIP, REG_AVID_START_PIXEL_MSB, 0x00},
> +     {TOK_SKIP, REG_AVID_STOP_PIXEL_LSB, 0x25},
> +     {TOK_SKIP, REG_AVID_STOP_PIXEL_MSB, 0x03},
> +     {TOK_SKIP, REG_HSYNC_START_PIXEL_LSB, 0x00},    /* NTSC timing */
> +     {TOK_SKIP, REG_HSYNC_START_PIXEL_MSB, 0x00},
> +     {TOK_SKIP, REG_HSYNC_STOP_PIXEL_LSB, 0x40},
> +     {TOK_SKIP, REG_HSYNC_STOP_PIXEL_MSB, 0x00},
> +     {TOK_SKIP, REG_VSYNC_START_LINE_LSB, 0x04},     /* NTSC timing */
> +     {TOK_SKIP, REG_VSYNC_START_LINE_MSB, 0x00},
> +     {TOK_SKIP, REG_VSYNC_STOP_LINE_LSB, 0x07},
> +     {TOK_SKIP, REG_VSYNC_STOP_LINE_MSB, 0x00},
> +     {TOK_SKIP, REG_VBLK_START_LINE_LSB, 0x01},      /* NTSC timing */
> +     {TOK_SKIP, REG_VBLK_START_LINE_MSB, 0x00},
> +     {TOK_SKIP, REG_VBLK_STOP_LINE_LSB, 0x15},
> +     {TOK_SKIP, REG_VBLK_STOP_LINE_MSB, 0x00},
> +     {TOK_SKIP, 0x26, 0x00}, /* Reserved */
> +     {TOK_SKIP, 0x27, 0x00}, /* Reserved */
> +     {TOK_SKIP, REG_FAST_SWTICH_CONTROL, 0xCC},
> +     {TOK_SKIP, 0x29, 0x00}, /* Reserved */
> +     {TOK_SKIP, REG_FAST_SWTICH_SCART_DELAY, 0x00},
> +     {TOK_SKIP, 0x2B, 0x00}, /* Reserved */
> +     {TOK_SKIP, REG_SCART_DELAY, 0x00},
> +     {TOK_SKIP, REG_CTI_DELAY, 0x00},
> +     {TOK_SKIP, REG_CTI_CONTROL, 0x00},
> +     {TOK_SKIP, 0x2F, 0x00}, /* Reserved */
> +     {TOK_SKIP, 0x30, 0x00}, /* Reserved */
> +     {TOK_SKIP, 0x31, 0x00}, /* Reserved */
> +     {TOK_WRITE, REG_SYNC_CONTROL, 0x0C},    /* HS, VS active high */
> +     {TOK_WRITE, REG_OUTPUT_FORMATTER1, 0x00},       /* 10-bit BT.656 */
> +     {TOK_WRITE, REG_OUTPUT_FORMATTER2, 0x11},       /* Enable clk & data */
> +     {TOK_WRITE, REG_OUTPUT_FORMATTER3, 0xEE},       /* Enable AVID & FLD */
> +     {TOK_WRITE, REG_OUTPUT_FORMATTER4, 0xAF},       /* Enable VS & HS */
> +     {TOK_WRITE, REG_OUTPUT_FORMATTER5, 0xFF},
> +     {TOK_WRITE, REG_OUTPUT_FORMATTER6, 0xFF},
> +     {TOK_WRITE, REG_CLEAR_LOST_LOCK, 0x01}, /* Clear status */
> +     {TOK_TERM, 0, 0}
> +};
> +
> +/* Supported inputs - Composite and S-Video */
> +static const struct tvp5146_input_info tvp5146_input_list[] = {
> +     {
> +      .input_sel = 0x05,     /* Composite input 2_B */
> +      .lock_mask = 0x0E,     /* Color subcarrier VS & HS lock */

These fields should be indented by another tab.

> +      .input = {
> +                .index = 0,
> +                .name = "COMPOSITE",
> +                .type = V4L2_INPUT_TYPE_CAMERA,
> +                .std = V4L2_STD_NTSC | V4L2_STD_PAL,}

Ditto, and many more below.  If you're an Emacs user see below[1] for
some tips on how to let Emacs handle all the formatting for you.


> +      },
> +     {
> +      .input_sel = 0x46,     /* S-Video input 2_C(Y), 1_C(C) */
> +      .lock_mask = 0x06,     /* VS & HS lock */
> +      .input = {
> +                .index = 1,
> +                .name = "SVIDEO)",
> +                .type = V4L2_INPUT_TYPE_CAMERA,
> +                .std = V4L2_STD_NTSC | V4L2_STD_PAL,}
> +      }
> +};
> +
> +static struct v4l2_ifparm tvp5146_ifparm = {
> +     .if_type = V4L2_IF_TYPE_BT656,
> +     .u = {
> +           .bt656 = {
> +                     .frame_start_on_rising_vs = 1,
> +                     .bt_sync_correct = 0,
> +                     .swap = 0,
> +                     .latch_clk_inv = 0,
> +                     .nobt_hs_inv = 0,       /* active high */
> +                     .nobt_vs_inv = 0,       /* active high */
> +                     .mode = V4L2_IF_TYPE_BT656_MODE_BT_8BIT,
> +                     .clock_min = TVP5146_XCLK_BT656,
> +                     .clock_max = TVP5146_XCLK_BT656,
> +                     },
> +           },
> +};
> +
> +/**
> + * @brief tvp5146_g_ifparm - Returns the TVP5146 decoder interface parameters
> + *
> + * @param p - pointer to v4l2_ifparm structure
> + * @return result of operation - 0 is success
> + */
> +static int tvp5146_g_ifparm(struct v4l2_ifparm *p)
> +{
> +     if (p == NULL)
> +             return -EINVAL;
> +
> +     *p = tvp5146_ifparm;
> +     return 0;
> +}
> +
> +#define TVP5146_NUM_INPUTS           ARRAY_SIZE(tvp5146_input_list)
> +
> +static struct tvp5146_platform_data tvp5146_pdata = {
> +     .master = V4L2_CAPTURE_MASTER,
> +     .ifparm = tvp5146_g_ifparm,
> +
> +     /* TVP5146 regsiter list, contains default values */
> +     .reg_list = tvp5146_reg_list,
> +
> +     /* Number of supported inputs */
> +     .num_inputs = TVP5146_NUM_INPUTS,
> +     .input_list = tvp5146_input_list,
> +};
> +
> +#endif
>  static struct i2c_board_info __initdata i2c_info[] =  {
>       {
>               I2C_BOARD_INFO("pcf8574", 0x38),
> @@ -459,10 +615,16 @@ static struct i2c_board_info __initdata i2c_info[] =  {
>               I2C_BOARD_INFO("24c256", 0x50),
>               .platform_data  = &eeprom_info,
>       },
> +#if defined(CONFIG_VIDEO_TVP5146) || \
> +    defined(CONFIG_VIDEO_TVP5146_MODULE)
> +     {
> +             I2C_BOARD_INFO(TVP5146_MODULE_NAME, TVP5146_I2C_ADDR),
> +             .platform_data = &tvp5146_pdata,
> +     },
> +#endif
>       /* ALSO:
>        * - tvl320aic33 audio codec (0x1b)
>        * - msp430 microcontroller (0x23)
> -      * - tvp5146 video decoder (0x5d)
>        */
>  };
>  
> @@ -491,6 +653,11 @@ static struct platform_device *davinci_evm_devices[] 
> __initdata = {
>  #if defined(CONFIG_FB_DAVINCI) || defined(CONFIG_FB_DAVINCI_MODULE)
>       &davinci_fb_device,
>  #endif
> +
> +#if defined(CONFIG_VIDEO_VPFE_CAPTURE) || \
> +    defined(CONFIG_VIDEO_VPFE_CAPTURE_MODULE)
> +     &vpfe_capture_dev,
> +#endif
>       &rtc_dev,
>  #if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \
>      defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)
> -- 
> 1.5.6.4
>
> _______________________________________________
> Davinci-linux-open-source mailing list
> [email protected]
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[1] If you're not an Emacs user, you should be :)   and
if you are an Emacs user, add this to your ~/.emacs and you'll never
have indentation problems again.  Simply pressing TAB in the emacs
buffer will put the line where it is supposed to be.  Also,
you cn 'M-x indent-region' and Emacs will correctly indent an entire
region of code, or a whole file.


(defun linux-c-mode ()
  "C mode with adjusted defaults for use with the Linux kernel."
  (c-set-style "K&R")
  (setq tab-width 8)
  (setq indent-tabs-mode t)
  (setq c-basic-offset 8)
  )
(add-hook 'c-mode-hook 'linux-c-mode)

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to