]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - drivers/media/dvb-frontends/cxd2880/cxd2880_io.c
3 * Sony CXD2880 DVB-T2/T tuner + demodulator driver
4 * register I/O interface functions
6 * Copyright (C) 2016, 2017 Sony Semiconductor Solutions Corporation
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; version 2 of the License.
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, see <http://www.gnu.org/licenses/>.
27 #include "cxd2880_io.h"
29 enum cxd2880_ret
cxd2880_io_common_write_one_reg(struct cxd2880_io
*io
,
30 enum cxd2880_io_tgt tgt
,
31 u8 sub_address
, u8 data
)
33 enum cxd2880_ret ret
= CXD2880_RESULT_OK
;
36 return CXD2880_RESULT_ERROR_ARG
;
38 ret
= io
->write_regs(io
, tgt
, sub_address
, &data
, 1);
43 enum cxd2880_ret
cxd2880_io_set_reg_bits(struct cxd2880_io
*io
,
44 enum cxd2880_io_tgt tgt
,
45 u8 sub_address
, u8 data
, u8 mask
)
47 enum cxd2880_ret ret
= CXD2880_RESULT_OK
;
50 return CXD2880_RESULT_ERROR_ARG
;
53 return CXD2880_RESULT_OK
;
58 ret
= io
->read_regs(io
, tgt
, sub_address
, &rdata
, 1);
59 if (ret
!= CXD2880_RESULT_OK
)
62 data
= (u8
)((data
& mask
) | (rdata
& (mask
^ 0xFF)));
65 ret
= io
->write_reg(io
, tgt
, sub_address
, data
);