Merge branch 'v3.4/features' of git://gitorious.org/linux-davinci/linux-davinci into...
authorArnd Bergmann <arnd@arndb.de>
Thu, 15 Mar 2012 20:33:47 +0000 (20:33 +0000)
committerArnd Bergmann <arnd@arndb.de>
Thu, 15 Mar 2012 20:33:47 +0000 (20:33 +0000)
* 'v3.4/features' of git://gitorious.org/linux-davinci/linux-davinci:
  ARM: davinci: dm644x evm: add support for VPBE display
  ARM: davinci: dm644x: add support for v4l2 video display

* included from the davinci/cleanup branch:
  ARM: davinci: dm644x: don't force vpfe registeration on all boards
  ARM: davinci: dm644x: fix inconsistent variable naming
  ARM: davinci: dm644x: improve readability using macro
  ARM: davinci: streamline sysmod access
  ARM: davinci: create new common platform header for davinci
  ARM: davinci: dm646x: move private definitions to C file
  ARM: davinci: dm365: move private definitions to C file
  ARM: davinci: dm644x: move private definitions to C file

Conflicts:
arch/arm/mach-davinci/board-dm644x-evm.c
arch/arm/mach-davinci/board-neuros-osd2.c
arch/arm/mach-davinci/board-sffsdr.c

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1  2 
arch/arm/mach-davinci/board-dm365-evm.c
arch/arm/mach-davinci/board-dm644x-evm.c
arch/arm/mach-davinci/board-dm646x-evm.c
arch/arm/mach-davinci/board-neuros-osd2.c
arch/arm/mach-davinci/board-sffsdr.c

@@@ -32,7 -32,6 +32,6 @@@
  #include <asm/mach/arch.h>
  
  #include <mach/mux.h>
- #include <mach/dm365.h>
  #include <mach/common.h>
  #include <mach/i2c.h>
  #include <mach/serial.h>
@@@ -42,6 -41,8 +41,8 @@@
  
  #include <media/tvp514x.h>
  
+ #include "davinci.h"
  static inline int have_imager(void)
  {
        /* REVISIT when it's supported, trigger via Kconfig */
@@@ -54,7 -55,7 +55,7 @@@ static inline int have_tvp7002(void
        return 0;
  }
  
 -#define DM365_EVM_PHY_ID              "0:01"
 +#define DM365_EVM_PHY_ID              "davinci_mdio-0:01"
  /*
   * A MAX-II CPLD is used for various board control functions.
   */
@@@ -30,7 -30,6 +30,6 @@@
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
  
- #include <mach/dm644x.h>
  #include <mach/common.h>
  #include <mach/i2c.h>
  #include <mach/serial.h>
@@@ -40,7 -39,9 +39,9 @@@
  #include <mach/usb.h>
  #include <mach/aemif.h>
  
 -#define DM644X_EVM_PHY_ID             "0:01"
+ #include "davinci.h"
 +#define DM644X_EVM_PHY_ID             "davinci_mdio-0:01"
  #define LXT971_PHY_ID (0x001378e2)
  #define LXT971_PHY_MASK       (0xfffffff0)
  
@@@ -189,7 -190,7 +190,7 @@@ static struct platform_device davinci_f
        .num_resources = 0,
  };
  
- static struct tvp514x_platform_data tvp5146_pdata = {
+ static struct tvp514x_platform_data dm644xevm_tvp5146_pdata = {
        .clk_polarity = 0,
        .hs_polarity = 1,
        .vs_polarity = 1
  
  #define TVP514X_STD_ALL       (V4L2_STD_NTSC | V4L2_STD_PAL)
  /* Inputs available at the TVP5146 */
- static struct v4l2_input tvp5146_inputs[] = {
+ static struct v4l2_input dm644xevm_tvp5146_inputs[] = {
        {
                .index = 0,
                .name = "Composite",
   * ouput that goes to vpfe. There is a one to one correspondence
   * with tvp5146_inputs
   */
- static struct vpfe_route tvp5146_routes[] = {
+ static struct vpfe_route dm644xevm_tvp5146_routes[] = {
        {
                .input = INPUT_CVBS_VI2B,
                .output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
        },
  };
  
- static struct vpfe_subdev_info vpfe_sub_devs[] = {
+ static struct vpfe_subdev_info dm644xevm_vpfe_sub_devs[] = {
        {
                .name = "tvp5146",
                .grp_id = 0,
-               .num_inputs = ARRAY_SIZE(tvp5146_inputs),
-               .inputs = tvp5146_inputs,
-               .routes = tvp5146_routes,
+               .num_inputs = ARRAY_SIZE(dm644xevm_tvp5146_inputs),
+               .inputs = dm644xevm_tvp5146_inputs,
+               .routes = dm644xevm_tvp5146_routes,
                .can_route = 1,
                .ccdc_if_params = {
                        .if_type = VPFE_BT656,
                },
                .board_info = {
                        I2C_BOARD_INFO("tvp5146", 0x5d),
-                       .platform_data = &tvp5146_pdata,
+                       .platform_data = &dm644xevm_tvp5146_pdata,
                },
        },
  };
  
- static struct vpfe_config vpfe_cfg = {
-       .num_subdevs = ARRAY_SIZE(vpfe_sub_devs),
+ static struct vpfe_config dm644xevm_capture_cfg = {
+       .num_subdevs = ARRAY_SIZE(dm644xevm_vpfe_sub_devs),
        .i2c_adapter_id = 1,
-       .sub_devs = vpfe_sub_devs,
+       .sub_devs = dm644xevm_vpfe_sub_devs,
        .card_name = "DM6446 EVM",
        .ccdc = "DM6446 CCDC",
  };
@@@ -612,6 -613,113 +613,113 @@@ static void __init evm_init_i2c(void
        i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info));
  }
  
+ #define VENC_STD_ALL  (V4L2_STD_NTSC | V4L2_STD_PAL)
+ /* venc standard timings */
+ static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] = {
+       {
+               .name           = "ntsc",
+               .timings_type   = VPBE_ENC_STD,
+               .timings        = {V4L2_STD_525_60},
+               .interlaced     = 1,
+               .xres           = 720,
+               .yres           = 480,
+               .aspect         = {11, 10},
+               .fps            = {30000, 1001},
+               .left_margin    = 0x79,
+               .upper_margin   = 0x10,
+       },
+       {
+               .name           = "pal",
+               .timings_type   = VPBE_ENC_STD,
+               .timings        = {V4L2_STD_625_50},
+               .interlaced     = 1,
+               .xres           = 720,
+               .yres           = 576,
+               .aspect         = {54, 59},
+               .fps            = {25, 1},
+               .left_margin    = 0x7e,
+               .upper_margin   = 0x16,
+       },
+ };
+ /* venc dv preset timings */
+ static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = {
+       {
+               .name           = "480p59_94",
+               .timings_type   = VPBE_ENC_DV_PRESET,
+               .timings        = {V4L2_DV_480P59_94},
+               .interlaced     = 0,
+               .xres           = 720,
+               .yres           = 480,
+               .aspect         = {1, 1},
+               .fps            = {5994, 100},
+               .left_margin    = 0x80,
+               .upper_margin   = 0x20,
+       },
+       {
+               .name           = "576p50",
+               .timings_type   = VPBE_ENC_DV_PRESET,
+               .timings        = {V4L2_DV_576P50},
+               .interlaced     = 0,
+               .xres           = 720,
+               .yres           = 576,
+               .aspect         = {1, 1},
+               .fps            = {50, 1},
+               .left_margin    = 0x7e,
+               .upper_margin   = 0x30,
+       },
+ };
+ /*
+  * The outputs available from VPBE + encoders. Keep the order same
+  * as that of encoders. First those from venc followed by that from
+  * encoders. Index in the output refers to index on a particular encoder.
+  * Driver uses this index to pass it to encoder when it supports more
+  * than one output. Userspace applications use index of the array to
+  * set an output.
+  */
+ static struct vpbe_output dm644xevm_vpbe_outputs[] = {
+       {
+               .output         = {
+                       .index          = 0,
+                       .name           = "Composite",
+                       .type           = V4L2_OUTPUT_TYPE_ANALOG,
+                       .std            = VENC_STD_ALL,
+                       .capabilities   = V4L2_OUT_CAP_STD,
+               },
+               .subdev_name    = VPBE_VENC_SUBDEV_NAME,
+               .default_mode   = "ntsc",
+               .num_modes      = ARRAY_SIZE(dm644xevm_enc_std_timing),
+               .modes          = dm644xevm_enc_std_timing,
+       },
+       {
+               .output         = {
+                       .index          = 1,
+                       .name           = "Component",
+                       .type           = V4L2_OUTPUT_TYPE_ANALOG,
+                       .capabilities   = V4L2_OUT_CAP_PRESETS,
+               },
+               .subdev_name    = VPBE_VENC_SUBDEV_NAME,
+               .default_mode   = "480p59_94",
+               .num_modes      = ARRAY_SIZE(dm644xevm_enc_preset_timing),
+               .modes          = dm644xevm_enc_preset_timing,
+       },
+ };
+ static struct vpbe_config dm644xevm_display_cfg = {
+       .module_name    = "dm644x-vpbe-display",
+       .i2c_adapter_id = 1,
+       .osd            = {
+               .module_name    = VPBE_OSD_SUBDEV_NAME,
+       },
+       .venc           = {
+               .module_name    = VPBE_VENC_SUBDEV_NAME,
+       },
+       .num_outputs    = ARRAY_SIZE(dm644xevm_vpbe_outputs),
+       .outputs        = dm644xevm_vpbe_outputs,
+ };
  static struct platform_device *davinci_evm_devices[] __initdata = {
        &davinci_fb_device,
        &rtc_dev,
@@@ -624,8 -732,6 +732,6 @@@ static struct davinci_uart_config uart_
  static void __init
  davinci_evm_map_io(void)
  {
-       /* setup input configuration for VPFE input devices */
-       dm644x_set_vpfe_config(&vpfe_cfg);
        dm644x_init();
  }
  
@@@ -697,6 -803,7 +803,7 @@@ static __init void davinci_evm_init(voi
        evm_init_i2c();
  
        davinci_setup_mmc(0, &dm6446evm_mmc_config);
+       dm644x_init_video(&dm644xevm_capture_cfg, &dm644xevm_display_cfg);
  
        davinci_serial_init(&uart_config);
        dm644x_init_asp(&dm644x_evm_snd_data);
@@@ -36,7 -36,6 +36,6 @@@
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
  
- #include <mach/dm646x.h>
  #include <mach/common.h>
  #include <mach/serial.h>
  #include <mach/i2c.h>
@@@ -45,6 -44,7 +44,7 @@@
  #include <mach/cdce949.h>
  #include <mach/aemif.h>
  
+ #include "davinci.h"
  #include "clock.h"
  
  #define NAND_BLOCK_SIZE               SZ_128K
@@@ -410,8 -410,6 +410,6 @@@ static struct davinci_i2c_platform_dat
        .bus_delay      = 0 /* usec */,
  };
  
- #define VIDCLKCTL_OFFSET      (DAVINCI_SYSTEM_MODULE_BASE + 0x38)
- #define VSCLKDIS_OFFSET               (DAVINCI_SYSTEM_MODULE_BASE + 0x6c)
  #define VCH2CLK_MASK          (BIT_MASK(10) | BIT_MASK(9) | BIT_MASK(8))
  #define VCH2CLK_SYSCLK8               (BIT(9))
  #define VCH2CLK_AUXCLK                (BIT(9) | BIT(8))
  #define TVP5147_CH0           "tvp514x-0"
  #define TVP5147_CH1           "tvp514x-1"
  
- static void __iomem *vpif_vidclkctl_reg;
- static void __iomem *vpif_vsclkdis_reg;
  /* spin lock for updating above registers */
  static spinlock_t vpif_reg_lock;
  
@@@ -441,14 -437,14 +437,14 @@@ static int set_vpif_clock(int mux_mode
        int val = 0;
        int err = 0;
  
-       if (!vpif_vidclkctl_reg || !vpif_vsclkdis_reg || !cpld_client)
+       if (!cpld_client)
                return -ENXIO;
  
        /* disable the clock */
        spin_lock_irqsave(&vpif_reg_lock, flags);
-       value = __raw_readl(vpif_vsclkdis_reg);
+       value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
        value |= (VIDCH3CLK | VIDCH2CLK);
-       __raw_writel(value, vpif_vsclkdis_reg);
+       __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
        spin_unlock_irqrestore(&vpif_reg_lock, flags);
  
        val = i2c_smbus_read_byte(cpld_client);
        if (err)
                return err;
  
-       value = __raw_readl(vpif_vidclkctl_reg);
+       value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL));
        value &= ~(VCH2CLK_MASK);
        value &= ~(VCH3CLK_MASK);
  
        else
                value |= (VCH2CLK_AUXCLK | VCH3CLK_AUXCLK);
  
-       __raw_writel(value, vpif_vidclkctl_reg);
+       __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL));
  
        spin_lock_irqsave(&vpif_reg_lock, flags);
-       value = __raw_readl(vpif_vsclkdis_reg);
+       value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
        /* enable the clock */
        value &= ~(VIDCH3CLK | VIDCH2CLK);
-       __raw_writel(value, vpif_vsclkdis_reg);
+       __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
        spin_unlock_irqrestore(&vpif_reg_lock, flags);
  
        return 0;
@@@ -564,7 -560,7 +560,7 @@@ static int setup_vpif_input_channel_mod
        int val;
        u32 value;
  
-       if (!vpif_vidclkctl_reg || !cpld_client)
+       if (!cpld_client)
                return -ENXIO;
  
        val = i2c_smbus_read_byte(cpld_client);
                return val;
  
        spin_lock_irqsave(&vpif_reg_lock, flags);
-       value = __raw_readl(vpif_vidclkctl_reg);
+       value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL));
        if (mux_mode) {
                val &= VPIF_INPUT_TWO_CHANNEL;
                value |= VIDCH1CLK;
                val |= VPIF_INPUT_ONE_CHANNEL;
                value &= ~VIDCH1CLK;
        }
-       __raw_writel(value, vpif_vidclkctl_reg);
+       __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL));
        spin_unlock_irqrestore(&vpif_reg_lock, flags);
  
        err = i2c_smbus_write_byte(cpld_client, val);
@@@ -674,12 -670,6 +670,6 @@@ static struct vpif_capture_config dm646
  
  static void __init evm_init_video(void)
  {
-       vpif_vidclkctl_reg = ioremap(VIDCLKCTL_OFFSET, 4);
-       vpif_vsclkdis_reg = ioremap(VSCLKDIS_OFFSET, 4);
-       if (!vpif_vidclkctl_reg || !vpif_vsclkdis_reg) {
-               pr_err("Can't map VPIF VIDCLKCTL or VSCLKDIS registers\n");
-               return;
-       }
        spin_lock_init(&vpif_reg_lock);
  
        dm646x_setup_vpif(&dm646x_vpif_display_config,
@@@ -736,7 -726,7 +726,7 @@@ static struct davinci_uart_config uart_
        .enabled_uarts = (1 << 0),
  };
  
 -#define DM646X_EVM_PHY_ID             "0:01"
 +#define DM646X_EVM_PHY_ID             "davinci_mdio-0:01"
  /*
   * The following EDMA channels/slots are not being used by drivers (for
   * example: Timer, GPIO, UART events etc) on dm646x, hence they are being
@@@ -30,7 -30,6 +30,6 @@@
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
  
- #include <mach/dm644x.h>
  #include <mach/common.h>
  #include <mach/i2c.h>
  #include <mach/serial.h>
@@@ -39,7 -38,9 +38,9 @@@
  #include <mach/mmc.h>
  #include <mach/usb.h>
  
 -#define NEUROS_OSD2_PHY_ID            "0:01"
+ #include "davinci.h"
 +#define NEUROS_OSD2_PHY_ID            "davinci_mdio-0:01"
  #define LXT971_PHY_ID                 0x001378e2
  #define LXT971_PHY_MASK                       0xfffffff0
  
  #include <asm/mach/arch.h>
  #include <asm/mach/flash.h>
  
- #include <mach/dm644x.h>
  #include <mach/common.h>
  #include <mach/i2c.h>
  #include <mach/serial.h>
  #include <mach/mux.h>
  #include <mach/usb.h>
  
 -#define SFFSDR_PHY_ID         "0:01"
+ #include "davinci.h"
 +#define SFFSDR_PHY_ID         "davinci_mdio-0:01"
  static struct mtd_partition davinci_sffsdr_nandflash_partition[] = {
        /* U-Boot Environment: Block 0
         * UBL:                Block 1