lcd: optimize vsync probe method, by string, not index value in dts [2/2]
authorShaochan Liu <shaochan.liu@amlogic.com>
Mon, 4 Mar 2019 07:39:02 +0000 (15:39 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Tue, 12 Mar 2019 05:30:45 +0000 (21:30 -0800)
PD#SWPL-4679

Problem:
optimize vsync probe method, by string, not index value in dts

Solution:
optimize vsync probe method, by string, not index value in dts

Verify:
verify by t962x2-x301

Change-Id: Ib87a2913b7dafb3ea3c9c5a936b29939ab7ee034
Signed-off-by: Shaochan Liu <shaochan.liu@amlogic.com>
drivers/amlogic/media/vout/lcd/lcd_tablet/lcd_tablet.c
drivers/amlogic/media/vout/lcd/lcd_vout.c

index 8a64ba6..7176e5c 100644 (file)
@@ -992,6 +992,10 @@ static int lcd_config_load_from_unifykey(struct lcd_config_s *pconf)
                ((*(p + LCD_UKEY_PCLK + 1)) << 8) |
                ((*(p + LCD_UKEY_PCLK + 2)) << 16) |
                ((*(p + LCD_UKEY_PCLK + 3)) << 24));
+       if (pconf->lcd_timing.lcd_clk == 0) { /* avoid 0 mistake */
+               pconf->lcd_timing.lcd_clk = 60;
+               LCDERR("lcd_clk is 0, default to 60Hz\n");
+       }
        pconf->lcd_basic.h_period_min = (*(p + LCD_UKEY_H_PERIOD_MIN) |
                ((*(p + LCD_UKEY_H_PERIOD_MIN + 1)) << 8));
        pconf->lcd_basic.h_period_max = (*(p + LCD_UKEY_H_PERIOD_MAX) |
index 0d69569..45c19cc 100644 (file)
@@ -1269,29 +1269,14 @@ static int lcd_config_probe(struct platform_device *pdev)
                LCDPR("detect lcd_auto_test: %d\n", lcd_driver->lcd_auto_test);
        }
 
-       ret = of_property_read_string_index(lcd_driver->dev->of_node,
-               "interrupt-names", 0, &str);
-       if (ret == 0) {
-               lcd_driver->res_vsync_irq = platform_get_resource(pdev,
-                       IORESOURCE_IRQ, 0);
-       }
-       ret = of_property_read_string_index(lcd_driver->dev->of_node,
-               "interrupt-names", 1, &str);
-       if (ret == 0) {
-               if (strcmp(str, "vbyone") == 0) {
-                       lcd_driver->res_vx1_irq =
-                               platform_get_resource(pdev, IORESOURCE_IRQ, 1);
-               } else if (strcmp(str, "vsync2") == 0) {
-                       lcd_driver->res_vsync2_irq =
-                               platform_get_resource(pdev, IORESOURCE_IRQ, 1);
-               }
-       }
-       ret = of_property_read_string_index(lcd_driver->dev->of_node,
-               "interrupt-names", 2, &str);
-       if (ret == 0) {
-               lcd_driver->res_tcon_irq = platform_get_resource(pdev,
-                       IORESOURCE_IRQ, 2);
-       }
+       lcd_driver->res_vsync_irq = platform_get_resource_byname(pdev,
+               IORESOURCE_IRQ, "vsync");
+       lcd_driver->res_vsync2_irq = platform_get_resource_byname(pdev,
+               IORESOURCE_IRQ, "vsync2");
+       lcd_driver->res_vx1_irq = platform_get_resource_byname(pdev,
+               IORESOURCE_IRQ, "vbyone");
+       lcd_driver->res_tcon_irq = platform_get_resource_byname(pdev,
+               IORESOURCE_IRQ, "tcon");
 
        lcd_driver->lcd_info = &lcd_vinfo;
        lcd_driver->lcd_config = &lcd_config_dft;