|
@@ -356,3 +356,105 @@ static int cpld_video_probe(struct i2c_client *client,
|
|
{
|
|
{
|
|
cpld_client = client;
|
|
cpld_client = client;
|
|
return 0;
|
|
return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int cpld_video_remove(struct i2c_client *client)
|
|
|
|
+{
|
|
|
|
+ cpld_client = NULL;
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static const struct i2c_device_id cpld_video_id[] = {
|
|
|
|
+ { "cpld_video", 0 },
|
|
|
|
+ { }
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct i2c_driver cpld_video_driver = {
|
|
|
|
+ .driver = {
|
|
|
|
+ .name = "cpld_video",
|
|
|
|
+ },
|
|
|
|
+ .probe = cpld_video_probe,
|
|
|
|
+ .remove = cpld_video_remove,
|
|
|
|
+ .id_table = cpld_video_id,
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static void evm_init_cpld(void)
|
|
|
|
+{
|
|
|
|
+ i2c_add_driver(&cpld_video_driver);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static struct i2c_board_info __initdata i2c_info[] = {
|
|
|
|
+ {
|
|
|
|
+ I2C_BOARD_INFO("24c256", 0x50),
|
|
|
|
+ .platform_data = &eeprom_info,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ I2C_BOARD_INFO("pcf8574a", 0x38),
|
|
|
|
+ .platform_data = &pcf_data,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ I2C_BOARD_INFO("cpld_reg0", 0x3a),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ I2C_BOARD_INFO("tlv320aic33", 0x18),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ I2C_BOARD_INFO("cpld_video", 0x3b),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ I2C_BOARD_INFO("cdce949", 0x6c),
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct davinci_i2c_platform_data i2c_pdata = {
|
|
|
|
+ .bus_freq = 100 /* kHz */,
|
|
|
|
+ .bus_delay = 0 /* usec */,
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+#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 VCH3CLK_MASK (BIT_MASK(14) | BIT_MASK(13) | BIT_MASK(12))
|
|
|
|
+#define VCH3CLK_SYSCLK8 (BIT(13))
|
|
|
|
+#define VCH3CLK_AUXCLK (BIT(14) | BIT(13))
|
|
|
|
+
|
|
|
|
+#define VIDCH2CLK (BIT(10))
|
|
|
|
+#define VIDCH3CLK (BIT(11))
|
|
|
|
+#define VIDCH1CLK (BIT(4))
|
|
|
|
+#define TVP7002_INPUT (BIT(4))
|
|
|
|
+#define TVP5147_INPUT (~BIT(4))
|
|
|
|
+#define VPIF_INPUT_ONE_CHANNEL (BIT(5))
|
|
|
|
+#define VPIF_INPUT_TWO_CHANNEL (~BIT(5))
|
|
|
|
+#define TVP5147_CH0 "tvp514x-0"
|
|
|
|
+#define TVP5147_CH1 "tvp514x-1"
|
|
|
|
+
|
|
|
|
+/* spin lock for updating above registers */
|
|
|
|
+static spinlock_t vpif_reg_lock;
|
|
|
|
+
|
|
|
|
+static int set_vpif_clock(int mux_mode, int hd)
|
|
|
|
+{
|
|
|
|
+ unsigned long flags;
|
|
|
|
+ unsigned int value;
|
|
|
|
+ int val = 0;
|
|
|
|
+ int err = 0;
|
|
|
|
+
|
|
|
|
+ if (!cpld_client)
|
|
|
|
+ return -ENXIO;
|
|
|
|
+
|
|
|
|
+ /* disable the clock */
|
|
|
|
+ spin_lock_irqsave(&vpif_reg_lock, flags);
|
|
|
|
+ value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
|
|
|
|
+ value |= (VIDCH3CLK | VIDCH2CLK);
|
|
|
|
+ __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
|
|
|
|
+ spin_unlock_irqrestore(&vpif_reg_lock, flags);
|
|
|
|
+
|
|
|
|
+ val = i2c_smbus_read_byte(cpld_client);
|
|
|
|
+ if (val < 0)
|
|
|
|
+ return val;
|
|
|
|
+
|
|
|
|
+ if (mux_mode == 1)
|
|
|
|
+ val &= ~0x40;
|
|
|
|
+ else
|
|
|
|
+ val |= 0x40;
|
|
|
|
+
|
|
|
|
+ err = i2c_smbus_write_byte(cpld_client, val);
|