diff options
author | 2018-01-18 03:47:38 -0500 | |
---|---|---|
committer | 2018-03-07 04:39:42 -0500 | |
commit | 1a3ef038d09e66489f95c5cd67d815670f9cabdc (patch) | |
tree | 0320aecdfc7940e248fbfb0d2ce0380794db5a15 /drivers/media/dvb-frontends/cxd2880/cxd2880_common.c | |
parent | media: cxd2880-spi: Add support for CXD2880 SPI interface (diff) | |
download | wireguard-linux-1a3ef038d09e66489f95c5cd67d815670f9cabdc.tar.xz wireguard-linux-1a3ef038d09e66489f95c5cd67d815670f9cabdc.zip |
media: cxd2880: Add common files for the driver
These are common files for the driver for the
Sony CXD2880 DVB-T2/T tuner + demodulator.
These contains helper functions for the driver.
Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/dvb-frontends/cxd2880/cxd2880_common.c')
-rw-r--r-- | drivers/media/dvb-frontends/cxd2880/cxd2880_common.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/media/dvb-frontends/cxd2880/cxd2880_common.c b/drivers/media/dvb-frontends/cxd2880/cxd2880_common.c new file mode 100644 index 000000000000..d6f5af6609c1 --- /dev/null +++ b/drivers/media/dvb-frontends/cxd2880/cxd2880_common.c @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * cxd2880_common.c + * Sony CXD2880 DVB-T2/T tuner + demodulator driver + * common functions + * + * Copyright (C) 2016, 2017, 2018 Sony Semiconductor Solutions Corporation + */ + +#include "cxd2880_common.h" + +int cxd2880_convert2s_complement(u32 value, u32 bitlen) +{ + if (!bitlen || bitlen >= 32) + return (int)value; + + if (value & (u32)(1 << (bitlen - 1))) + return (int)(GENMASK(31, bitlen) | value); + else + return (int)(GENMASK(bitlen - 1, 0) & value); +} |