rk31xx lvds: change defined 'BIT' to 'BITS'
authorzwl <zwl@rockchips.com>
Tue, 29 Jul 2014 06:17:19 +0000 (14:17 +0800)
committerzwl <zwl@rockchips.com>
Tue, 29 Jul 2014 06:17:19 +0000 (14:17 +0800)
drivers/video/rockchip/transmitter/rk31xx_lvds.c
drivers/video/rockchip/transmitter/rk31xx_lvds.h

index eec2de9e4c889823ba01f8c3eb54b327cecf583a..fcbc0a99e0882d8eb336f6395f076cc9a4b2b3bc 100755 (executable)
@@ -246,8 +246,7 @@ static int rk31xx_lvds_probe(struct platform_device *pdev)
 
        rk_fb_get_prmry_screen(&lvds->screen);
         if ((lvds->screen.type != SCREEN_RGB) && 
-               (lvds->screen.type != SCREEN_LVDS) &&
-               (lvds->screen.type != SCREEN_DUAL_LVDS)) {
+               (lvds->screen.type != SCREEN_LVDS)) {
                dev_err(&pdev->dev, "screen is not lvds/rgb!\n");
                ret = -EINVAL;
                 goto err_screen_type;
index 2c14fcf4ede1dc82d4f51a2807386f5fe4ae7c68..825460d899cdf87d5326da37681e508efa31b70d 100755 (executable)
@@ -3,23 +3,17 @@
 
 #include <linux/rk_screen.h>
 
-#ifdef BIT
-#undef BIT
-#endif
-#define BIT(x, bit) ((x) << (bit))
 
-#ifdef BIT_MASK
-#undef BIT_MASK
-#endif
-#define BIT_MASK(x, mask, bit) BIT((x) & (mask), bit)
-#define BIT_EN(mask, bit)  BIT(mask, bit + 16)
+#define BITS(x, bit)            ((x) << (bit))
+#define BITS_MASK(x, mask, bit)  BITS((x) & (mask), bit)
+#define BITS_EN(mask, bit)       BITS(mask, bit + 16)
 
 #define RK31XX_GRF_LVDS_CON0           0x0150
-#define v_LVDS_DATA_SEL(x)      (BIT_MASK(x, 1, 0) | BIT_EN(1, 0))
-#define v_LVDS_OUTPUT_FORMAT(x) (BIT_MASK(x, 3, 1) | BIT_EN(3, 1))
-#define v_LVDS_MSBSEL(x)        (BIT_MASK(x, 1, 3) | BIT_EN(1, 3))
-#define v_LVDSMODE_EN(x)        (BIT_MASK(x, 1, 6) | BIT_EN(1, 6))
-#define v_MIPIPHY_TTL_EN(x)     (BIT_MASK(x, 1, 7) | BIT_EN(1, 7))
+#define v_LVDS_DATA_SEL(x)      (BITS_MASK(x, 1, 0) | BITS_EN(1, 0))
+#define v_LVDS_OUTPUT_FORMAT(x) (BITS_MASK(x, 3, 1) | BITS_EN(3, 1))
+#define v_LVDS_MSBSEL(x)        (BITS_MASK(x, 1, 3) | BITS_EN(1, 3))
+#define v_LVDSMODE_EN(x)        (BITS_MASK(x, 1, 6) | BITS_EN(1, 6))
+#define v_MIPIPHY_TTL_EN(x)     (BITS_MASK(x, 1, 7) | BITS_EN(1, 7))
 
 enum {
         LVDS_DATA_FROM_LCDC = 0,
@@ -32,50 +26,50 @@ enum {
 };
 
 #define MIPIPHY_REG0           0x0000
-#define v_LANE0_EN(x)           BIT_MASK(x, 1, 2) 
-#define v_LANE1_EN(x)           BIT_MASK(x, 1, 3)
-#define v_LANE2_EN(x)           BIT_MASK(x, 1, 4)
-#define v_LANE3_EN(x)           BIT_MASK(x, 1, 5)
-#define v_LANECLK_EN(x)         BIT_MASK(x, 1, 6)
+#define v_LANE0_EN(x)           BITS_MASK(x, 1, 2)
+#define v_LANE1_EN(x)           BITS_MASK(x, 1, 3)
+#define v_LANE2_EN(x)           BITS_MASK(x, 1, 4)
+#define v_LANE3_EN(x)           BITS_MASK(x, 1, 5)
+#define v_LANECLK_EN(x)         BITS_MASK(x, 1, 6)
 
 #define MIPIPHY_REG3           0x000c
-#define m_PREDIV                BIT(0x1f, 0)
-#define m_FBDIV_MSB             BIT(1, 5)
-#define v_PREDIV(x)             BIT_MASK(x, 0x1f, 0)
-#define v_FBDIV_MSB(x)          BIT_MASK(x, 1, 5)
+#define m_PREDIV                BITS(0x1f, 0)
+#define m_FBDIV_MSB             BITS(1, 5)
+#define v_PREDIV(x)             BITS_MASK(x, 0x1f, 0)
+#define v_FBDIV_MSB(x)          BITS_MASK(x, 1, 5)
 
 #define MIPIPHY_REG4           0x0010
-#define v_FBDIV_LSB(x)          BIT_MASK(x, 0xff, 0)
+#define v_FBDIV_LSB(x)          BITS_MASK(x, 0xff, 0)
 
 #define MIPIPHY_REGE0          0x0380
-#define m_MSB_SEL               BIT(1, 0)
-#define m_DIG_INTER_RST         BIT(1, 2)
-#define m_LVDS_MODE_EN          BIT(1, 5)
-#define m_TTL_MODE_EN           BIT(1, 6)
-#define m_MIPI_MODE_EN          BIT(1, 7)
-#define v_MSB_SEL(x)            BIT_MASK(x, 1, 0)
-#define v_DIG_INTER_RST(x)      BIT_MASK(x, 1, 2)
-#define v_LVDS_MODE_EN(x)       BIT_MASK(x, 1, 5)
-#define v_TTL_MODE_EN(x)        BIT_MASK(x, 1, 6)
-#define v_MIPI_MODE_EN(x)       BIT_MASK(x, 1, 7)
+#define m_MSB_SEL               BITS(1, 0)
+#define m_DIG_INTER_RST         BITS(1, 2)
+#define m_LVDS_MODE_EN          BITS(1, 5)
+#define m_TTL_MODE_EN           BITS(1, 6)
+#define m_MIPI_MODE_EN          BITS(1, 7)
+#define v_MSB_SEL(x)            BITS_MASK(x, 1, 0)
+#define v_DIG_INTER_RST(x)      BITS_MASK(x, 1, 2)
+#define v_LVDS_MODE_EN(x)       BITS_MASK(x, 1, 5)
+#define v_TTL_MODE_EN(x)        BITS_MASK(x, 1, 6)
+#define v_MIPI_MODE_EN(x)       BITS_MASK(x, 1, 7)
 
 #define MIPIPHY_REGE1           0x0384
-#define m_DIG_INTER_EN          BIT(1, 7)
-#define v_DIG_INTER_EN(x)       BIT_MASK(x, 1, 7)
+#define m_DIG_INTER_EN          BITS(1, 7)
+#define v_DIG_INTER_EN(x)       BITS_MASK(x, 1, 7)
 
 #define MIPIPHY_REGE3           0x038c
-#define m_MIPI_EN               BIT(1, 0)
-#define m_LVDS_EN               BIT(1, 1)
-#define m_TTL_EN                BIT(1, 2)
-#define v_MIPI_EN(x)            BIT_MASK(x, 1, 0)
-#define v_LVDS_EN(x)            BIT_MASK(x, 1, 1)
-#define v_TTL_EN(x)             BIT_MASK(x, 1, 2)
+#define m_MIPI_EN               BITS(1, 0)
+#define m_LVDS_EN               BITS(1, 1)
+#define m_TTL_EN                BITS(1, 2)
+#define v_MIPI_EN(x)            BITS_MASK(x, 1, 0)
+#define v_LVDS_EN(x)            BITS_MASK(x, 1, 1)
+#define v_TTL_EN(x)             BITS_MASK(x, 1, 2)
 
 #define MIPIPHY_REGEA          0x03A8
-#define m_BG_POWER_DOWN         BIT(1, 0)
-#define m_PLL_POWER_DOWN        BIT(1, 2)
-#define v_BG_POWER_DOWN(x)      BIT_MASK(x, 1, 0)
-#define v_PLL_POWER_DOWN(x)     BIT_MASK(x, 1, 2)
+#define m_BG_POWER_DOWN         BITS(1, 0)
+#define m_PLL_POWER_DOWN        BITS(1, 2)
+#define v_BG_POWER_DOWN(x)      BITS_MASK(x, 1, 0)
+#define v_PLL_POWER_DOWN(x)     BITS_MASK(x, 1, 2)
 
 #define MIPIPHY_REGE2          0x0388
 #define MIPIPHY_REGE7          0x039C
@@ -91,7 +85,7 @@ struct rk_lvds_device {
         bool                    sys_state;
 };
 
-static int inline lvds_writel(struct rk_lvds_device *lvds, u32 offset, u32 val)
+static inline int lvds_writel(struct rk_lvds_device *lvds, u32 offset, u32 val)
 {
        writel_relaxed(val, lvds->regbase + offset);
        return 0;
@@ -107,5 +101,10 @@ static inline int lvds_msk_reg(struct rk_lvds_device *lvds, u32 offset,
        return 0;
 }
 
+static inline u32 hdmi_readl(struct rk_lvds_device *lvds, u32 offset)
+{
+       return readl_relaxed(lvds->regbase + offset);
+}
+
 #endif