1*ab15d248SHans Verkuil /* SPDX-License-Identifier: GPL-2.0-only */ 2b5dcee22SMauro Carvalho Chehab /* 3b5dcee22SMauro Carvalho Chehab * tc358743 - Toshiba HDMI to CSI-2 bridge 4b5dcee22SMauro Carvalho Chehab * 5*ab15d248SHans Verkuil * Copyright 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved. 6b5dcee22SMauro Carvalho Chehab */ 7b5dcee22SMauro Carvalho Chehab 8b5dcee22SMauro Carvalho Chehab /* 9b5dcee22SMauro Carvalho Chehab * References (c = chapter, p = page): 10b5dcee22SMauro Carvalho Chehab * REF_01 - Toshiba, TC358743XBG (H2C), Functional Specification, Rev 0.60 11b5dcee22SMauro Carvalho Chehab * REF_02 - Toshiba, TC358743XBG_HDMI-CSI_Tv11p_nm.xls 12b5dcee22SMauro Carvalho Chehab */ 13b5dcee22SMauro Carvalho Chehab 14b5dcee22SMauro Carvalho Chehab #ifndef _TC358743_ 15b5dcee22SMauro Carvalho Chehab #define _TC358743_ 16b5dcee22SMauro Carvalho Chehab 17b5dcee22SMauro Carvalho Chehab enum tc358743_ddc5v_delays { 18b5dcee22SMauro Carvalho Chehab DDC5V_DELAY_0_MS, 19b5dcee22SMauro Carvalho Chehab DDC5V_DELAY_50_MS, 20b5dcee22SMauro Carvalho Chehab DDC5V_DELAY_100_MS, 21b5dcee22SMauro Carvalho Chehab DDC5V_DELAY_200_MS, 22b5dcee22SMauro Carvalho Chehab }; 23b5dcee22SMauro Carvalho Chehab 24b5dcee22SMauro Carvalho Chehab enum tc358743_hdmi_detection_delay { 25b5dcee22SMauro Carvalho Chehab HDMI_MODE_DELAY_0_MS, 26b5dcee22SMauro Carvalho Chehab HDMI_MODE_DELAY_25_MS, 27b5dcee22SMauro Carvalho Chehab HDMI_MODE_DELAY_50_MS, 28b5dcee22SMauro Carvalho Chehab HDMI_MODE_DELAY_100_MS, 29b5dcee22SMauro Carvalho Chehab }; 30b5dcee22SMauro Carvalho Chehab 31b5dcee22SMauro Carvalho Chehab struct tc358743_platform_data { 32b5dcee22SMauro Carvalho Chehab /* System clock connected to REFCLK (pin H5) */ 33b5dcee22SMauro Carvalho Chehab u32 refclk_hz; /* 26 MHz, 27 MHz or 42 MHz */ 34b5dcee22SMauro Carvalho Chehab 35b5dcee22SMauro Carvalho Chehab /* DDC +5V debounce delay to avoid spurious interrupts when the cable 36b5dcee22SMauro Carvalho Chehab * is connected. 37b5dcee22SMauro Carvalho Chehab * Sets DDC5V_MODE in register DDC_CTL. 38b5dcee22SMauro Carvalho Chehab * Default: DDC5V_DELAY_0_MS 39b5dcee22SMauro Carvalho Chehab */ 40b5dcee22SMauro Carvalho Chehab enum tc358743_ddc5v_delays ddc5v_delay; 41b5dcee22SMauro Carvalho Chehab 42b5dcee22SMauro Carvalho Chehab bool enable_hdcp; 43b5dcee22SMauro Carvalho Chehab 44b5dcee22SMauro Carvalho Chehab /* 45b5dcee22SMauro Carvalho Chehab * The FIFO size is 512x32, so Toshiba recommend to set the default FIFO 46b5dcee22SMauro Carvalho Chehab * level to somewhere in the middle (e.g. 300), so it can cover speed 47b5dcee22SMauro Carvalho Chehab * mismatches in input and output ports. 48b5dcee22SMauro Carvalho Chehab */ 49b5dcee22SMauro Carvalho Chehab u16 fifo_level; 50b5dcee22SMauro Carvalho Chehab 51b5dcee22SMauro Carvalho Chehab /* Bps pr lane is (refclk_hz / pll_prd) * pll_fbd */ 52b5dcee22SMauro Carvalho Chehab u16 pll_prd; 53b5dcee22SMauro Carvalho Chehab u16 pll_fbd; 54b5dcee22SMauro Carvalho Chehab 55b5dcee22SMauro Carvalho Chehab /* CSI 56b5dcee22SMauro Carvalho Chehab * Calculate CSI parameters with REF_02 for the highest resolution your 57b5dcee22SMauro Carvalho Chehab * CSI interface can handle. The driver will adjust the number of CSI 58b5dcee22SMauro Carvalho Chehab * lanes in use according to the pixel clock. 59b5dcee22SMauro Carvalho Chehab * 60b5dcee22SMauro Carvalho Chehab * The values in brackets are calculated with REF_02 when the number of 61b5dcee22SMauro Carvalho Chehab * bps pr lane is 823.5 MHz, and can serve as a starting point. 62b5dcee22SMauro Carvalho Chehab */ 63b5dcee22SMauro Carvalho Chehab u32 lineinitcnt; /* (0x00001770) */ 64b5dcee22SMauro Carvalho Chehab u32 lptxtimecnt; /* (0x00000005) */ 65b5dcee22SMauro Carvalho Chehab u32 tclk_headercnt; /* (0x00001d04) */ 66b5dcee22SMauro Carvalho Chehab u32 tclk_trailcnt; /* (0x00000000) */ 67b5dcee22SMauro Carvalho Chehab u32 ths_headercnt; /* (0x00000505) */ 68b5dcee22SMauro Carvalho Chehab u32 twakeup; /* (0x00004650) */ 69b5dcee22SMauro Carvalho Chehab u32 tclk_postcnt; /* (0x00000000) */ 70b5dcee22SMauro Carvalho Chehab u32 ths_trailcnt; /* (0x00000004) */ 71b5dcee22SMauro Carvalho Chehab u32 hstxvregcnt; /* (0x00000005) */ 72b5dcee22SMauro Carvalho Chehab 73b5dcee22SMauro Carvalho Chehab /* DVI->HDMI detection delay to avoid unnecessary switching between DVI 74b5dcee22SMauro Carvalho Chehab * and HDMI mode. 75b5dcee22SMauro Carvalho Chehab * Sets HDMI_DET_V in register HDMI_DET. 76b5dcee22SMauro Carvalho Chehab * Default: HDMI_MODE_DELAY_0_MS 77b5dcee22SMauro Carvalho Chehab */ 78b5dcee22SMauro Carvalho Chehab enum tc358743_hdmi_detection_delay hdmi_detection_delay; 79b5dcee22SMauro Carvalho Chehab 80b5dcee22SMauro Carvalho Chehab /* Reset PHY automatically when TMDS clock goes from DC to AC. 81b5dcee22SMauro Carvalho Chehab * Sets PHY_AUTO_RST2 in register PHY_CTL2. 82b5dcee22SMauro Carvalho Chehab * Default: false 83b5dcee22SMauro Carvalho Chehab */ 84b5dcee22SMauro Carvalho Chehab bool hdmi_phy_auto_reset_tmds_detected; 85b5dcee22SMauro Carvalho Chehab 86b5dcee22SMauro Carvalho Chehab /* Reset PHY automatically when TMDS clock passes 21 MHz. 87b5dcee22SMauro Carvalho Chehab * Sets PHY_AUTO_RST3 in register PHY_CTL2. 88b5dcee22SMauro Carvalho Chehab * Default: false 89b5dcee22SMauro Carvalho Chehab */ 90b5dcee22SMauro Carvalho Chehab bool hdmi_phy_auto_reset_tmds_in_range; 91b5dcee22SMauro Carvalho Chehab 92b5dcee22SMauro Carvalho Chehab /* Reset PHY automatically when TMDS clock is detected. 93b5dcee22SMauro Carvalho Chehab * Sets PHY_AUTO_RST4 in register PHY_CTL2. 94b5dcee22SMauro Carvalho Chehab * Default: false 95b5dcee22SMauro Carvalho Chehab */ 96b5dcee22SMauro Carvalho Chehab bool hdmi_phy_auto_reset_tmds_valid; 97b5dcee22SMauro Carvalho Chehab 98b5dcee22SMauro Carvalho Chehab /* Reset HDMI PHY automatically when hsync period is out of range. 99b5dcee22SMauro Carvalho Chehab * Sets H_PI_RST in register HV_RST. 100b5dcee22SMauro Carvalho Chehab * Default: false 101b5dcee22SMauro Carvalho Chehab */ 102b5dcee22SMauro Carvalho Chehab bool hdmi_phy_auto_reset_hsync_out_of_range; 103b5dcee22SMauro Carvalho Chehab 104b5dcee22SMauro Carvalho Chehab /* Reset HDMI PHY automatically when vsync period is out of range. 105b5dcee22SMauro Carvalho Chehab * Sets V_PI_RST in register HV_RST. 106b5dcee22SMauro Carvalho Chehab * Default: false 107b5dcee22SMauro Carvalho Chehab */ 108b5dcee22SMauro Carvalho Chehab bool hdmi_phy_auto_reset_vsync_out_of_range; 109b5dcee22SMauro Carvalho Chehab }; 110b5dcee22SMauro Carvalho Chehab 111b5dcee22SMauro Carvalho Chehab /* custom controls */ 112b5dcee22SMauro Carvalho Chehab /* Audio sample rate in Hz */ 113b5dcee22SMauro Carvalho Chehab #define TC358743_CID_AUDIO_SAMPLING_RATE (V4L2_CID_USER_TC358743_BASE + 0) 114b5dcee22SMauro Carvalho Chehab /* Audio present status */ 115b5dcee22SMauro Carvalho Chehab #define TC358743_CID_AUDIO_PRESENT (V4L2_CID_USER_TC358743_BASE + 1) 116b5dcee22SMauro Carvalho Chehab 117b5dcee22SMauro Carvalho Chehab #endif 118