cec: modify the line check for g12a
authorhongmin hua <hongmin.hua@amlogic.com>
Mon, 16 Jul 2018 06:15:50 +0000 (14:15 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Wed, 25 Jul 2018 09:10:27 +0000 (02:10 -0700)
PD#168682: cec: modify the line check for g12a

Change-Id: Id7f318caae3230df9bd6689f566524e05fd512bd
Signed-off-by: hongmin hua <hongmin.hua@amlogic.com>
27 files changed:
arch/arm64/boot/dts/amlogic/gxl_p212_1g.dts
arch/arm64/boot/dts/amlogic/gxl_p212_1g_buildroot.dts
arch/arm64/boot/dts/amlogic/gxl_p212_1g_hd.dts
arch/arm64/boot/dts/amlogic/gxl_p212_2g.dts
arch/arm64/boot/dts/amlogic/gxl_p212_2g_buildroot.dts
arch/arm64/boot/dts/amlogic/gxl_p230_2g.dts
arch/arm64/boot/dts/amlogic/gxl_p230_2g_buildroot.dts
arch/arm64/boot/dts/amlogic/gxl_p231_1g.dts
arch/arm64/boot/dts/amlogic/gxl_p231_2g.dts
arch/arm64/boot/dts/amlogic/gxl_p231_2g_buildroot.dts
arch/arm64/boot/dts/amlogic/gxl_p241_1g.dts
arch/arm64/boot/dts/amlogic/gxl_p241_1g_buildroot.dts
arch/arm64/boot/dts/amlogic/gxl_p241_v2-1g.dts
arch/arm64/boot/dts/amlogic/gxl_p241_v2_1g_buildroot.dts
arch/arm64/boot/dts/amlogic/gxm_q200_2g.dts
arch/arm64/boot/dts/amlogic/gxm_q200_2g_buildroot.dts
arch/arm64/boot/dts/amlogic/gxm_q201_2g.dts
arch/arm64/boot/dts/amlogic/gxm_skt.dts
arch/arm64/boot/dts/amlogic/mesong12a.dtsi
arch/arm64/boot/dts/amlogic/mesontxl.dtsi
arch/arm64/boot/dts/amlogic/txlx_t962e_r321.dts
arch/arm64/boot/dts/amlogic/txlx_t962e_r321_buildroot.dts
arch/arm64/boot/dts/amlogic/txlx_t962x_r311_1g.dts
arch/arm64/boot/dts/amlogic/txlx_t962x_r311_2g.dts
arch/arm64/boot/dts/amlogic/txlx_t962x_r311_720p.dts
drivers/amlogic/cec/hdmi_ao_cec.c
drivers/amlogic/cec/hdmi_ao_cec.h

index d76282a6a193985d25840bcb01251db74c161ae3..3b465044292d935a2369a7743f443b4fda66882c 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index 7b61b8d4a3a99c6059646a0145868b3012f642dd..13fb0af0c2a7f0bddb277d589951c27ad33ef146 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index 070ebe3c0aaa0fb5c64723f6a0171e4bcd163b0e..2c40f70f0fee8d827883aac5011dfb4767dc9e7f 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index 4cfe7e46b5500626195d349f21340087f399b6a1..8f130821f1ac9cc3dcd37573dbf7f54e2a3ff2c7 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index dc2989b87edfcc816a3894adc254bb185881013f..149cb478c8bba20a31602037caf689065b076523 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index 683c69c7b00fd465a9e7d5a893c7bf21af4be055..c8e8b3950f1cc98546818435600eeb44107f6850 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index b3ffda94cbcb8785e2c2e66092f65ffc3ead7173..b2e9b9a75f5b1599abbb19d56080d5555c881a64 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index a13bd14cb5220f36fd2b7a10f4c47a281199d84d..770b72c485b90dc60521b68495c71ef059c319c0 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index 749f2e0ede8a1f511c87c302691bda4591396e32..ad78b2a2fd9a58cca9af79da5710fd5a93605108 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index 510ecbd5a6d7f9512275fc98de10970a3e73c41e..b4acc1ecca4814d96db28deeb875f7ddfa072ef4 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index 7bd2baa285ba54873c52acaedb10444b297f7cb2..c5a275599fdc12c955693ca7e57bba8708f95b4e 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index b6d0bf3ca86c5e2d10597a49dd69fc8b92f633a8..aa9cce37a3183709b90718b09a7e02dda9490b17 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index 8690af2149a6fce78dd0a73f52dbf86c322903a5..b43d90129241aa3ac0b658b6e00af611493773b2 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index b3c7b69e880d962eb3f65a4b86b6f24557a5ffb3..bf77a30db46142c8fbeed26ece80a500cd724759 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index 80d5d13d074cd13a5a4627b4945b407991c258ad..d75ee5c34f0f95b60a5a662147345db088e1d290 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index 343d5966dac615012af1f6bb87f132a9cc8c25a1..03ec33124078c688e1ab038521ad6a5188dfb161 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index b98f652dced7e1f1b460d0b8eab4d8f074a87add..0b0bf702b7b95ccc655f7249e1cdb2d485f5a2d6 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        sysled {
index f561949cfb556b362fb40372ff7cdf298dc5b717..5e026ec67b8fd80e4b1255d3c5926a319e90a686 100644 (file)
                pinctrl-0=<&hdmitx_aocec>;
                reg = <0x0 0xc810023c 0x0 0x4
                       0x0 0xc8100000 0x0 0x200>;
+               reg-names = "ao_exit","ao";
        };
 
        meson-fb {
index cbd933657cffad1ba7595309e0a5c3739717c713..2da80f4b82b5a74154fac2d3dd29e960cf7fcb5b 100644 (file)
                pinctrl-1=<&eecec_b>;
                pinctrl-2=<&eecec_b>;
                reg = <0x0 0xFF80023c 0x0 0x4
-                      0x0 0xFF800000 0x0 0x400>;
+                      0x0 0xFF800000 0x0 0x400
+                      0x0 0xFF634400 0x0 0x26>;
+               reg-names = "ao_exit","ao","periphs";
        };
 
        /*if you want to use vdin just modify status to "ok"*/
index 2aeb76e8459a89c66ee3f95f6b9ce960660da94f..6de9a9d390f06d55ca0c869a8b2cca585e2e6cb1 100644 (file)
                       0x0 0xc8100000 0x0 0x200
                       0x0 0xda83e000 0x0 0x10
                       0x0 0xc883c000 0x0 0x400>;
+               reg-names = "ao_exit","ao","hdmirx","hhi";
        };
 
        canvas: canvas{
index a635ebebd0c4bcc8934fb4d863260153acfeb533..669df5dbb10ca8edd8f5d84d1fe278f53d155bf1 100644 (file)
                pinctrl-2=<&hdmitx_aocecb>;
                reg = <0x0 0xFF80023c 0x0 0x4
                       0x0 0xFF800000 0x0 0x400>;
+               reg-names = "ao_exit","ao";
        };
 
 
index 440d31cafefaa7c9a4d79cf28749bf19dc6d8ce8..4b1203e78e8fbbb71e112f3a2bcb0254cb2eca7c 100644 (file)
                pinctrl-2=<&hdmitx_aocecb>;
                reg = <0x0 0xFF80023c 0x0 0x4
                       0x0 0xFF800000 0x0 0x400>;
+               reg-names = "ao_exit","ao";
        };
 
 
index 1c5a6159b0d29839077f11d14f02a65d791df4fa..f029ec42d2b4dd2960c331cf8c28f75e85358e5b 100644 (file)
                pinctrl-2=<&hdmitx_aocecb>;
                reg = <0x0 0xFF80023c 0x0 0x4
                       0x0 0xFF800000 0x0 0x400>;
+               reg-names = "ao_exit","ao";
        };
 
 
index 62aac694e4381feff7cb47f2e507b8c957e7cf06..00378df6a9117a7c3da3dab69a711dc3b6519f37 100644 (file)
                pinctrl-2=<&hdmitx_aocecb>;
                reg = <0x0 0xFF80023c 0x0 0x4
                       0x0 0xFF800000 0x0 0x400>;
+               reg-names = "ao_exit","ao";
        };
 
 
index ee7392170ad3d700b7432c814e0110d8de9bb6dc..6ba8530ced153213fbda5c94d71d07797126499d 100644 (file)
                pinctrl-2=<&hdmitx_aocecb>;
                reg = <0x0 0xFF80023c 0x0 0x4
                       0x0 0xFF800000 0x0 0x400>;
+               reg-names = "ao_exit","ao";
        };
 
 
index 96df6d32608072dc12c01c3ad535d43d415961d7..be497086e9dc3f6fe9075d0216597bc71087480a 100644 (file)
@@ -87,6 +87,7 @@ static struct early_suspend aocec_suspend_handler;
 #define MAX_INT    0x7ffffff
 
 struct cec_platform_data_s {
+       unsigned char line_reg;/*cec gpio_i reg:0  ao;1 periph*/
        unsigned int line_bit;/*cec gpio position in reg*/
        bool ee_to_ao;/*ee cec hw module mv to ao;ao cec delete*/
 };
@@ -112,6 +113,7 @@ struct ao_cec_dev {
        void __iomem *cec_reg;
        void __iomem *hdmi_rxreg;
        void __iomem *hhi_reg;
+       void __iomem *periphs_reg;
        struct hdmitx_dev *tx_dev;
        struct workqueue_struct *cec_thread;
        struct device *dbg_dev;
@@ -946,7 +948,6 @@ static int cec_ll_trigle_tx(const unsigned char *msg, int len)
                return 0;
        }
        CEC_ERR("error msg sts:0x%x\n", reg);
-
        return -1;
 }
 
@@ -989,7 +990,10 @@ static int get_line(void)
 {
        int reg, ret = -EINVAL;
 
-       reg = readl(cec_dev->cec_reg + AO_GPIO_I);
+       if (cec_dev->plat_data->line_reg == 1)
+               reg = readl(cec_dev->periphs_reg + PREG_PAD_GPIO3_I);
+       else
+               reg = readl(cec_dev->cec_reg + AO_GPIO_I);
        ret = (reg & (1 << cec_dev->plat_data->line_bit));
 
        return ret;
@@ -1375,7 +1379,6 @@ static int cec_late_check_rx_buffer(void)
                cec_rx_buf_clear();
                return 0;
        }
-
        return 1;
 }
 
@@ -1895,7 +1898,6 @@ static ssize_t port_status_show(struct class *cla,
                tmp = tx_hpd;
                return sprintf(buf, "%x\n", tmp);
        }
-
        tmp = hdmirx_rd_top(TOP_HPD_PWR5V);
        CEC_INFO("TOP_HPD_PWR5V:%x\n", tmp);
        tmp >>= 20;
@@ -2512,21 +2514,25 @@ static void aocec_late_resume(struct early_suspend *h)
 
 #ifdef CONFIG_OF
 static const struct cec_platform_data_s cec_gxl_data = {
+       .line_reg = 0,
        .line_bit = 8,
        .ee_to_ao = 0,
 };
 
 static const struct cec_platform_data_s cec_txlx_data = {
+       .line_reg = 0,
        .line_bit = 7,
        .ee_to_ao = 1,
 };
 
 static const struct cec_platform_data_s cec_g12a_data = {
-       .line_bit = 7,
+       .line_reg = 1,
+       .line_bit = 3,
        .ee_to_ao = 1,
 };
 
 static const struct cec_platform_data_s cec_txl_data = {
+       .line_reg = 0,
        .line_bit = 7,
        .ee_to_ao = 0,
 };
@@ -2691,39 +2697,63 @@ static int aml_cec_probe(struct platform_device *pdev)
                if (ret > 0)
                        CEC_ERR("select state error:0x%x\n", ret);
        }
-
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ao_exit");
        if (res) {
-               base = ioremap(res->start, res->end - res->start);
+               base = devm_ioremap(&pdev->dev, res->start,
+                                               res->end - res->start);
+               if (!base) {
+                       CEC_ERR("Unable to map ao_exit base\n");
+                       goto tag_cec_reg_map_err;
+               }
                cec_dev->exit_reg = (void *)base;
-       } else {
-               CEC_INFO("no memory resource\n");
-               cec_dev->exit_reg = NULL;
-       }
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+       } else
+               CEC_ERR("no ao_exit regs\n")
+       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ao");
        if (res) {
-               base = ioremap(res->start, res->end - res->start);
+               base = devm_ioremap(&pdev->dev, res->start,
+                                               res->end - res->start);
+               if (!base) {
+                       CEC_ERR("Unable to map ao base\n");
+                       goto tag_cec_reg_map_err;
+               }
                cec_dev->cec_reg = (void *)base;
        } else {
-               CEC_ERR("no CEC reg resource\n");
-               cec_dev->cec_reg = NULL;
+               CEC_ERR("no ao regs\n");
+               goto tag_cec_reg_map_err;
        }
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hdmirx");
        if (res) {
-               base = ioremap(res->start, res->end - res->start);
+               base = devm_ioremap(&pdev->dev, res->start,
+                                               res->end - res->start);
+               if (!base) {
+                       CEC_ERR("Unable to map hdmirx base\n");
+                       goto tag_cec_reg_map_err;
+               }
                cec_dev->hdmi_rxreg = (void *)base;
-       } else {
-               CEC_ERR("no hdmirx reg resource\n");
-               cec_dev->hdmi_rxreg = NULL;
-       }
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
+       } else
+               CEC_ERR("no hdmirx regs\n")
+       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hhi");
        if (res) {
-               base = ioremap(res->start, res->end - res->start);
+               base = devm_ioremap(&pdev->dev, res->start,
+                                               res->end - res->start);
+               if (!base) {
+                       CEC_ERR("Unable to map hhi base\n");
+                       goto tag_cec_reg_map_err;
+               }
                cec_dev->hhi_reg = (void *)base;
-       } else {
-               CEC_ERR("no hhi reg resource\n");
-               cec_dev->hhi_reg = NULL;
-       }
+       } else
+               CEC_ERR("no hhi regs\n")
+       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "periphs");
+       if (res) {
+               base = devm_ioremap(&pdev->dev, res->start,
+                                               res->end - res->start);
+               if (!base) {
+                       CEC_ERR("Unable to map periphs base\n");
+                       goto tag_cec_reg_map_err;
+               }
+               cec_dev->periphs_reg = (void *)base;
+       } else
+               CEC_ERR("no periphs regs\n")
        r = of_property_read_u32(node, "port_num", &(cec_dev->port_num));
        if (r) {
                CEC_ERR("not find 'port_num'\n");
@@ -2822,6 +2852,8 @@ static int aml_cec_probe(struct platform_device *pdev)
        return 0;
 
 tag_cec_msg_alloc_err:
+               free_irq(cec_dev->irq_cec, (void *)cec_dev);
+tag_cec_reg_map_err:
                input_free_device(cec_dev->cec_info.remote_cec_dev);
 tag_cec_alloc_input_err:
                destroy_workqueue(cec_dev->cec_thread);
index f54c1b1131149954bc53a16e5680f9a9afd87367..4d94c84473527ce42b0a213ee6a8eb6cbb896e56 100644 (file)
@@ -39,6 +39,8 @@
 #define AO_BASE                                0xc8100000
 
 #define AO_GPIO_I                      ((0x0A << 2))
+#define PREG_PAD_GPIO3_I       (0x01b << 2)
+
 
 #define AO_CEC_GEN_CNTL                        ((0x40 << 2))
 #define AO_CEC_RW_REG                  ((0x41 << 2))