3 * Sony CXD2880 DVB-T2/T tuner + demodulator driver common definitions
5 * Copyright (C) 2016, 2017 Sony Semiconductor Solutions Corporation
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; version 2 of the License.
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, see <http://www.gnu.org/licenses/>.
26 #ifndef CXD2880_COMMON_H
27 #define CXD2880_COMMON_H
29 #include <linux/types.h>
35 #define NULL ((void *)0)
39 #include <linux/delay.h>
40 #define CXD2880_SLEEP(n) msleep(n)
41 #ifndef CXD2880_SLEEP_IN_MON
42 #define CXD2880_SLEEP_IN_MON(n, obj) CXD2880_SLEEP(n)
45 #define CXD2880_ARG_UNUSED(arg) ((void)(arg))
49 CXD2880_RESULT_ERROR_ARG
,
50 CXD2880_RESULT_ERROR_IO
,
51 CXD2880_RESULT_ERROR_SW_STATE
,
52 CXD2880_RESULT_ERROR_HW_STATE
,
53 CXD2880_RESULT_ERROR_TIMEOUT
,
54 CXD2880_RESULT_ERROR_UNLOCK
,
55 CXD2880_RESULT_ERROR_RANGE
,
56 CXD2880_RESULT_ERROR_NOSUPPORT
,
57 CXD2880_RESULT_ERROR_CANCEL
,
58 CXD2880_RESULT_ERROR_OTHER
,
59 CXD2880_RESULT_ERROR_OVERFLOW
,
60 CXD2880_RESULT_OK_CONFIRM
63 int cxd2880_convert2s_complement(u32 value
, u32 bitlen
);
65 u32
cxd2880_bit_split_from_byte_array(u8
*array
, u32 start_bit
, u32 bit_num
);
67 struct cxd2880_atomic
{
71 #define cxd2880_atomic_set(a, i) ((a)->counter = i)
72 #define cxd2880_atomic_read(a) ((a)->counter)
74 struct cxd2880_stopwatch
{
78 enum cxd2880_ret
cxd2880_stopwatch_start(struct cxd2880_stopwatch
*stopwatch
);
80 enum cxd2880_ret
cxd2880_stopwatch_sleep(struct cxd2880_stopwatch
*stopwatch
,
83 enum cxd2880_ret
cxd2880_stopwatch_elapsed(struct cxd2880_stopwatch
*stopwatch
,