irblaster: meson: add support for tl1 [1/1]
authorBichao Zheng <bichao.zheng@amlogic.com>
Thu, 15 Nov 2018 06:01:55 +0000 (14:01 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 26 Nov 2018 11:19:50 +0000 (03:19 -0800)
PD#172587

Problem:
1.Bringup TL1.
2.Invalid frequency setting

Solution:
1.Add ir blaster device tree for tl1.
2.Add frequency setting

Verify:
verify on tl1.

Change-Id: I51759e32577172ff766fd4d50f92a00ef77c7495
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
arch/arm/boot/dts/amlogic/mesontl1.dtsi
drivers/amlogic/irblaster/meson-irblaster.c

index e7a6b4a..abd31eb 100644 (file)
                                max_frame_time = <200>;
                        };
 
+                       meson_irblaster: irblaster@14c {
+                               compatible = "amlogic, meson_irblaster";
+                               reg = <0x14c 0x10>,
+                                       <0x40 0x4>;
+                               interrupts = <0 198 1>;
+                               status = "disabled";
+                       };
+
                        i2c_AO: i2c@5000 {
                                compatible = "amlogic,meson-i2c";
                                status = "disabled";
                        function = "uart_ao_b";
                };
        };
+
+       irblaster_pins:irblaster_pin {
+               mux {
+                       groups = "remote_out_ao";
+                       function = "remote_out_ao";
+               };
+       };
+
+       irblaster_pins1:irblaster_pin1 {
+               mux {
+                       groups = "remote_out_ao9";
+                       function = "remote_out_ao";
+               };
+       };
 };
 
 &pinctrl_periphs {
index f0c7e38..2627bd1 100644 (file)
@@ -54,12 +54,25 @@ static int write_to_fifo(struct aml_irblaster_dev *dev,
                unsigned int hightime, unsigned int lowtime)
 {
        unsigned int count_delay;
+       unsigned int high_ct, low_ct;
        unsigned int cycle = 1000 / (dev->carrier_freqs / 1000);
        uint32_t val;
        int n = 0;
        int tb[3] = {
                1, 10, 100
        };
+
+       /*
+        *1. set mod_high_count = 13
+        *2. set mod_low_count = 13
+        *3. 60khz-8us, 38k-13us
+        */
+       high_ct = cycle * dev->duty_cycle / 100;
+       low_ct = cycle - high_ct;
+       writel((BLASTER_MODULATION_LOW_COUNT(low_ct - 1) |
+               BLASTER_MODULATION_HIGH_COUNT(high_ct - 1)),
+                       dev->reg_base + AO_IR_BLASTER_ADDR1);
+
        /*
        hightime: modulator signal.
        MODULATOR_TB:
@@ -208,7 +221,7 @@ static int send(struct aml_irblaster_dev *dev, const char *buf, int len)
        send_all_data(dev);
        ret = wait_for_completion_interruptible_timeout(
                &dev->blaster_completion, msecs_to_jiffies(sum_time / 1000));
-       if (ret)
+       if (!ret)
                pr_err("failed to send all data\n");
        return ret;
 }