1 // SPDX-License-Identifier: GPL-2.0
4 * Sony CXD2880 DVB-T2/T tuner + demodulator driver
7 * Copyright (C) 2016, 2017, 2018 Sony Semiconductor Solutions Corporation
10 #include "cxd2880_common.h"
12 int cxd2880_convert2s_complement(u32 value, u32 bitlen)
14 if (!bitlen || bitlen >= 32)
17 if (value & (u32)(1 << (bitlen - 1)))
18 return (int)(GENMASK(31, bitlen) | value);
20 return (int)(GENMASK(bitlen - 1, 0) & value);