1 // SPDX-License-Identifier: GPL-2.0
4 * Sony CXD2880 DVB-T2/T tuner + demodulator driver
5 * integration layer common functions
7 * Copyright (C) 2016, 2017, 2018 Sony Semiconductor Solutions Corporation
10 #include <linux/ktime.h>
11 #include <linux/errno.h>
13 #include "cxd2880_tnrdmd.h"
14 #include "cxd2880_tnrdmd_mon.h"
15 #include "cxd2880_integ.h"
17 int cxd2880_integ_init(struct cxd2880_tnrdmd
*tnr_dmd
)
21 u8 cpu_task_completed
= 0;
26 ret
= cxd2880_tnrdmd_init1(tnr_dmd
);
34 cxd2880_tnrdmd_check_internal_cpu_status(tnr_dmd
,
39 if (cpu_task_completed
)
42 if (ktime_to_ms(ktime_sub(ktime_get(), start
)) >
43 CXD2880_TNRDMD_WAIT_INIT_TIMEOUT
)
46 usleep_range(CXD2880_TNRDMD_WAIT_INIT_INTVL
,
47 CXD2880_TNRDMD_WAIT_INIT_INTVL
+ 1000);
50 return cxd2880_tnrdmd_init2(tnr_dmd
);
53 int cxd2880_integ_cancel(struct cxd2880_tnrdmd
*tnr_dmd
)
58 atomic_set(&tnr_dmd
->cancel
, 1);
63 int cxd2880_integ_check_cancellation(struct cxd2880_tnrdmd
*tnr_dmd
)
68 if (atomic_read(&tnr_dmd
->cancel
) != 0)