demux: set ciplus input source [1/1]
authorpengfei.liu <pengfei.liu@amlogic.com>
Thu, 23 Apr 2020 07:23:16 +0000 (15:23 +0800)
committerZhi Zhou <zhi.zhou@amlogic.com>
Mon, 25 May 2020 08:51:35 +0000 (01:51 -0700)
PD#SWPL-23541

Problem:
For CAS project, AES descrambler can *NOT* worked
on dmx-1 and dmx-2

Solution:
On REE side, when set descrambler source, we also
need set ciplus input source. Secure OS descrambler
is responsible for set the ciplus output

Verify:
irdeto cas verify.

Signed-off-by: pengfei.liu <pengfei.liu@amlogic.com>
Change-Id: I05a7df887f8785418708c8384f0ff13de7d7b63e

drivers/stream_input/parser/hw_demux/aml_dmx.c

index 488f052df2e2483ccd73d61284926f7b95bfc77e..28473d043190255207ab541960081da7a7b1d7cb 100644 (file)
@@ -2390,6 +2390,39 @@ void dsc_release(void)
        aml_ci_plus_disable();
 }
 /************************* AES DESC************************************/
+void set_ciplus_input_source(struct aml_dsc *dsc)
+{
+       u32 data;
+       u32 in = 0;
+
+       if (dsc->id != 0) {
+               pr_error("Ciplus set output can only work at dsc0 device\n");
+               return;
+       }
+
+       switch (dsc->source) {
+       case  AM_TS_SRC_DMX0:
+               in = 0;
+               break;
+       case  AM_TS_SRC_DMX1:
+               in = 1;
+               break;
+       case  AM_TS_SRC_DMX2:
+               in = 2;
+               break;
+       default:
+               break;
+       }
+
+       if (ciplus_out_auto_mode == 1) {
+               /* Set ciplus input source */
+               data = READ_MPEG_REG(STB_TOP_CONFIG);
+               data &= ~(3<<CIPLUS_IN_SEL);
+               data |= in << CIPLUS_IN_SEL;
+               WRITE_MPEG_REG(STB_TOP_CONFIG, data);
+               pr_inf("dsc ciplus in[%x]\n", in);
+       }
+}
 
 int dsc_enable(struct aml_dsc *dsc, int enable)
 {
@@ -5445,6 +5478,9 @@ int aml_dsc_hw_set_source(struct aml_dsc *dsc,
                if (hw_dst == -1)
                        dsc_enable(dsc, 0);
        }
+       if (src_reset && dst_reset) {
+               set_ciplus_input_source(dsc);
+       }
 
        spin_unlock_irqrestore(&dvb->slock, flags);