atv_demod: add xtal config for tuner [1/3]
authornengwen.chen <nengwen.chen@amlogic.com>
Mon, 6 Aug 2018 11:04:10 +0000 (19:04 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Thu, 9 Aug 2018 07:26:57 +0000 (00:26 -0700)
PD#171245: add xtal config for tuner

Change-Id: Id682294ea1e0de265df56509fa5fc4480212f7a7
Signed-off-by: nengwen.chen <nengwen.chen@amlogic.com>
12 files changed:
arch/arm64/boot/dts/amlogic/txl_t950_p341.dts
arch/arm64/boot/dts/amlogic/txl_t960_p346.dts
arch/arm64/boot/dts/amlogic/txl_t962_p320.dts
arch/arm64/boot/dts/amlogic/txl_t962_p321.dts
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/atv_demod/atv_demod_driver.c
drivers/amlogic/atv_demod/atv_demod_driver.h
include/linux/amlogic/aml_atvdemod.h

index fa1a46423d5e62368c3b8594ed9005e8a420dc05..077d56f1f0754922fc8503763651a6f070b68f0f 100644 (file)
                tuner_name = "r842_tuner";
                tuner_i2c_adap = <&i2c1>;
                tuner_i2c_addr = <0xf6>;
-               tuner_xtal = <3>;
+               tuner_xtal = <1>; /* 0: 16MHz, 1: 24MHz, 3: 27MHz */
+               tuner_xtal_mode = <3>;
                                        /* NO_SHARE_XTAL(0)
                                         * MASTER_TO_SLAVE_XTAL_IN(1)
                                         * MASTER_TO_SLAVE_XTAL_OUT(2)
index e94fa04ad4d0eea74e40efff60f648456091a32f..92eecde621411983818b76bff28077292b2c3bf7 100644 (file)
                tuner_name = "r842_tuner";
                tuner_i2c_adap = <&i2c1>;
                tuner_i2c_addr = <0xf6>;
-               tuner_xtal = <3>;
+               tuner_xtal = <1>; /* 0: 16MHz, 1: 24MHz, 3: 27MHz */
+               tuner_xtal_mode = <3>;
                                        /* NO_SHARE_XTAL(0)
                                         * MASTER_TO_SLAVE_XTAL_IN(1)
                                         * MASTER_TO_SLAVE_XTAL_OUT(2)
index 3f17de1cf558a3e0b2c0c9420ee0f17787134f2a..433b8edf68739f96dc6f594545a8c138b94a8dc1 100644 (file)
                tuner_name = "si2151_tuner";
                tuner_i2c_adap = <&i2c1>;
                tuner_i2c_addr = <0x60>;
-               /* tuner_xtal = <0>; */
+               /* tuner_xtal = <0>; */ /* unuse for si2151 */
+               /* tuner_xtal_mode = <0>; */
                /* tuner_xtal_cap = <0>; */
        };
 
index 447176e5f8dfa423845c8a0957d33b9d73093288..a94d2001ceb91e7dc87e98a5f8bb5315b0e94194 100644 (file)
                tuner_name = "r842_tuner";
                tuner_i2c_adap = <&i2c1>;
                tuner_i2c_addr = <0xf6>;
-               tuner_xtal = <0>;
+               tuner_xtal = <1>; /* 0: 16MHz, 1: 24MHz, 3: 27MHz */
+               tuner_xtal_mode = <0>;
                                        /* NO_SHARE_XTAL(0)
                                         * MASTER_TO_SLAVE_XTAL_IN(1)
                                         * MASTER_TO_SLAVE_XTAL_OUT(2)
index f741fd7ca1abf0c532230db8bc0ac250e8d9180f..586ee974412a09e149efcae49ddce6808cbc6e37 100644 (file)
                tuner_name = "si2151_tuner";
                tuner_i2c_adap = <&i2c1>;
                tuner_i2c_addr = <0x60>;
-               /* tuner_xtal = <0>; */
+               /* tuner_xtal = <0>; */ /* unuse for si2151 */
+               /* tuner_xtal_mode = <0>; */
                /* tuner_xtal_cap = <0>; */
        };
 
index b414b552c673a74eca61364675ead52231e60caf..b64332b9048da2c2b51938ccb07686aa78bc4df4 100644 (file)
                tuner_name = "si2151_tuner";
                tuner_i2c_adap = <&i2c1>;
                tuner_i2c_addr = <0x60>;
-               /* tuner_xtal = <0>; */
+               /* tuner_xtal = <0>; */ /* unuse for si2151 */
+               /* tuner_xtal_mode = <0>; */
                /* tuner_xtal_cap = <0>; */
        };
 
index 374c7eeab15a852953c8b68fd14d1c6e36e187ce..ef7afc34a8240e5cd1cdba62e639ec6bf98e854c 100644 (file)
                tuner_name = "mxl661_tuner";
                tuner_i2c_adap = <&i2c1>;
                tuner_i2c_addr = <0x60>;
-               /* tuner_xtal = <0>; */
-               /* tuner_xtal_cap = <0>; */
+               tuner_xtal = <0>; /* 0: 16MHz, 1: 24MHz */
+               tuner_xtal_mode = <0>;
+                                       /* NO_SHARE_XTAL(0)
+                                        * SLAVE_XTAL_SHARE(1)
+                                        */
+               tuner_xtal_cap = <30>; /* when tuner_xtal_mode = 1, set 25 */
        };
 
        atv-demod {
index 4bdef1a4c35131fba693bda60a0da2b3607abec3..2bc6dbda3c39b523861bf6cde634a6b10e59e639 100644 (file)
                tuner_name = "mxl661_tuner";
                tuner_i2c_adap = <&i2c1>;
                tuner_i2c_addr = <0x60>;
-               /* tuner_xtal = <0>; */
-               /* tuner_xtal_cap = <0>; */
+               tuner_xtal = <0>; /* 0: 16MHz, 1: 24MHz */
+               tuner_xtal_mode = <0>;
+                                       /* NO_SHARE_XTAL(0)
+                                        * SLAVE_XTAL_SHARE(1)
+                                        */
+               tuner_xtal_cap = <30>; /* when tuner_xtal_mode = 1, set 25 */
        };
 
        atv-demod {
index 0301fbf12113919db35560c82510c4890a397b17..0da4647788298266322c9607969bf5841e8923db 100644 (file)
                tuner_name = "mxl661_tuner";
                tuner_i2c_adap = <&i2c1>;
                tuner_i2c_addr = <0x60>;
-               /* tuner_xtal = <0>; */
-               /* tuner_xtal_cap = <0>; */
+               tuner_xtal = <0>; /* 0: 16MHz, 1: 24MHz */
+               tuner_xtal_mode = <0>;
+                                       /* NO_SHARE_XTAL(0)
+                                        * SLAVE_XTAL_SHARE(1)
+                                        */
+               tuner_xtal_cap = <30>; /* when tuner_xtal_mode = 1, set 25 */
        };
 
        atv-demod {
index 0bc009f60a2ebbc607acce71eff06aca7ebe721d..c70f363fcec448da49a81a034f13a0600fec2fe4 100644 (file)
@@ -458,11 +458,17 @@ static void aml_atvdemod_dt_parse(struct aml_atvdemod_device *pdev)
                else
                        pdev->tuner_xtal = val;
 
+               ret = of_property_read_u32(node_tuner, "tuner_xtal_mode", &val);
+               if (ret)
+                       pr_err("can't find tuner_xtal_mode.\n");
+               else
+                       pdev->tuner_xtal_mode = val;
+
                ret = of_property_read_u32(node_tuner, "tuner_xtal_cap", &val);
                if (ret)
                        pr_err("can't find tuner_xtal_cap.\n");
                else
-                       pdev->tuner_xtal = val;
+                       pdev->tuner_xtal_cap = val;
 
                of_node_put(node_tuner);
        }
@@ -491,6 +497,7 @@ int aml_attach_demod_tuner(struct aml_atvdemod_device *dev)
        cfg.id = dev->tuner_id;
        cfg.i2c_addr = dev->i2c_addr;
        cfg.xtal = dev->tuner_xtal;
+       cfg.xtal_mode = dev->tuner_xtal_mode;
        cfg.xtal_cap = dev->tuner_xtal_cap;
 
        if (!dev->tuner_attached) {
index 6d2372bff9fab51c1526e173395a95aa13878a38..405ba0e4a49876f6645ad64b63d7fba3bd389fb5 100644 (file)
@@ -41,6 +41,7 @@ struct aml_atvdemod_device {
 
        unsigned int tuner_id;
        unsigned int tuner_xtal;
+       unsigned int tuner_xtal_mode;
        unsigned int tuner_xtal_cap;
        unsigned int i2c_addr;
        unsigned int i2c_adapter_id;
index 8ba76e746d939a5fb715a2dd3b0e1dae76c9ca66..29519f089d9e1c9d63fcf042bb41cb224fe40f48 100644 (file)
@@ -144,8 +144,9 @@ enum tuner_type {
 struct tuner_config {
        u8 id;
        u8 i2c_addr;
-       u8 xtal;
+       u8 xtal; /* 0: 16MHz, 1: 24MHz, 3: 27MHz */
        u8 xtal_cap;
+       u8 xtal_mode;
 };
 
 extern struct dvb_frontend *mxl661_attach(struct dvb_frontend *fe,