Path: blob/master/drivers/media/dvb/frontends/cxd2820r_priv.h
15112 views
/*1* Sony CXD2820R demodulator driver2*3* Copyright (C) 2010 Antti Palosaari <[email protected]>4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the License, or8* (at your option) any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License along16* with this program; if not, write to the Free Software Foundation, Inc.,17* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.18*/192021#ifndef CXD2820R_PRIV_H22#define CXD2820R_PRIV_H2324#include <linux/dvb/version.h>25#include "dvb_frontend.h"26#include "dvb_math.h"27#include "cxd2820r.h"2829#define LOG_PREFIX "cxd2820r"3031#undef dbg32#define dbg(f, arg...) \33if (cxd2820r_debug) \34printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)35#undef err36#define err(f, arg...) printk(KERN_ERR LOG_PREFIX": " f "\n" , ## arg)37#undef info38#define info(f, arg...) printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)39#undef warn40#define warn(f, arg...) printk(KERN_WARNING LOG_PREFIX": " f "\n" , ## arg)4142struct reg_val_mask {43u32 reg;44u8 val;45u8 mask;46};4748struct cxd2820r_priv {49struct i2c_adapter *i2c;50struct dvb_frontend fe[2];51struct cxd2820r_config cfg;52struct i2c_adapter tuner_i2c_adapter;5354struct mutex fe_lock; /* FE lock */55int active_fe:2; /* FE lock, -1=NONE, 0=DVB-T/T2, 1=DVB-C */5657int ber_running:1;5859u8 bank[2];60u8 gpio[3];6162fe_delivery_system_t delivery_system;63int last_tune_failed:1; /* for switch between T and T2 tune */64};6566/* cxd2820r_core.c */6768extern int cxd2820r_debug;6970int cxd2820r_gpio(struct dvb_frontend *fe);7172int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val,73u8 mask);7475int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,76int len);7778u32 cxd2820r_div_u64_round_closest(u64 dividend, u32 divisor);7980int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,81int len);8283int cxd2820r_rd_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,84int len);8586int cxd2820r_wr_reg(struct cxd2820r_priv *priv, u32 reg, u8 val);8788int cxd2820r_rd_reg(struct cxd2820r_priv *priv, u32 reg, u8 *val);8990/* cxd2820r_c.c */9192int cxd2820r_get_frontend_c(struct dvb_frontend *fe,93struct dvb_frontend_parameters *p);9495int cxd2820r_set_frontend_c(struct dvb_frontend *fe,96struct dvb_frontend_parameters *params);9798int cxd2820r_read_status_c(struct dvb_frontend *fe, fe_status_t *status);99100int cxd2820r_read_ber_c(struct dvb_frontend *fe, u32 *ber);101102int cxd2820r_read_signal_strength_c(struct dvb_frontend *fe, u16 *strength);103104int cxd2820r_read_snr_c(struct dvb_frontend *fe, u16 *snr);105106int cxd2820r_read_ucblocks_c(struct dvb_frontend *fe, u32 *ucblocks);107108int cxd2820r_init_c(struct dvb_frontend *fe);109110int cxd2820r_sleep_c(struct dvb_frontend *fe);111112int cxd2820r_get_tune_settings_c(struct dvb_frontend *fe,113struct dvb_frontend_tune_settings *s);114115/* cxd2820r_t.c */116117int cxd2820r_get_frontend_t(struct dvb_frontend *fe,118struct dvb_frontend_parameters *p);119120int cxd2820r_set_frontend_t(struct dvb_frontend *fe,121struct dvb_frontend_parameters *params);122123int cxd2820r_read_status_t(struct dvb_frontend *fe, fe_status_t *status);124125int cxd2820r_read_ber_t(struct dvb_frontend *fe, u32 *ber);126127int cxd2820r_read_signal_strength_t(struct dvb_frontend *fe, u16 *strength);128129int cxd2820r_read_snr_t(struct dvb_frontend *fe, u16 *snr);130131int cxd2820r_read_ucblocks_t(struct dvb_frontend *fe, u32 *ucblocks);132133int cxd2820r_init_t(struct dvb_frontend *fe);134135int cxd2820r_sleep_t(struct dvb_frontend *fe);136137int cxd2820r_get_tune_settings_t(struct dvb_frontend *fe,138struct dvb_frontend_tune_settings *s);139140/* cxd2820r_t2.c */141142int cxd2820r_get_frontend_t2(struct dvb_frontend *fe,143struct dvb_frontend_parameters *p);144145int cxd2820r_set_frontend_t2(struct dvb_frontend *fe,146struct dvb_frontend_parameters *params);147148int cxd2820r_read_status_t2(struct dvb_frontend *fe, fe_status_t *status);149150int cxd2820r_read_ber_t2(struct dvb_frontend *fe, u32 *ber);151152int cxd2820r_read_signal_strength_t2(struct dvb_frontend *fe, u16 *strength);153154int cxd2820r_read_snr_t2(struct dvb_frontend *fe, u16 *snr);155156int cxd2820r_read_ucblocks_t2(struct dvb_frontend *fe, u32 *ucblocks);157158int cxd2820r_init_t2(struct dvb_frontend *fe);159160int cxd2820r_sleep_t2(struct dvb_frontend *fe);161162int cxd2820r_get_tune_settings_t2(struct dvb_frontend *fe,163struct dvb_frontend_tune_settings *s);164165#endif /* CXD2820R_PRIV_H */166167168