/* * Driver for Zarlink ZL10039 DVB-S tuner * * Copyright 2007 Jan Daniël Louw * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.= */ #ifndef DVB_FRONTENDS_ZL10039_PRIV #define DVB_FRONTENDS_ZL10039_PRIV /* Trace function calls */ #define DEBUG_CALL_TRACE 0 /* Trace read/write function calls - information overload */ #define DEBUG_IO_TRACE 0 /* Print register values at critical points */ #define DEBUG_DUMP_REGISTERS 0 /* Print important params passed to functions */ #define DEBUG_PRINT_PARAMS 0 #if DEBUG_CALL_TRACE #define trace_printk(args...) printk(KERN_DEBUG "tuner: zl10039: " args) #else #define trace_printk(args...) #endif #if DEBUG_IO_TRACE #define io_printk(args...) printk(KERN_DEBUG "tuner: zl10039: " args) #else #define io_printk(args...) #endif #if DEBUG_PRINT_PARAMS #define params_printk(args...) printk(KERN_DEBUG "tuner: zl10039: " \ args) #else #define params_printk(args...) #endif #define eprintk(args...) printk(KERN_ERR "tuner: zl10039: " args) #define iprintk(args...) printk(KERN_INFO "tuner: zl10039: " args) enum zl10039_model_id { ID_ZL10039 = 1 }; struct zl10039_state { struct i2c_adapter *i2c; struct zl10039_config config; u8 id; }; enum zl10039_reg_addr { PLL0 = 0, PLL1, PLL2, PLL3, RFFE, BASE0, BASE1, BASE2, LO0, LO1, LO2, LO3, LO4, LO5, LO6, GENERAL }; #if DEBUG_DUMP_REGISTERS || DEBUG_IO_TRACE static const char *zl10039_reg_names[] = { "PLL_0", "PLL_1", "PLL_2", "PLL_3", "RF_FRONT_END", "BASE_BAND_0", "BASE_BAND_1", "BASE_BAND_2", "LOCAL_OSC_0", "LOCAL_OSC_1", "LOCAL_OSC_2", "LOCAL_OSC_3", "LOCAL_OSC_4", "LOCAL_OSC_5", "LOCAL_OSC_6", "GENERAL" }; #endif #if DEBUG_DUMP_REGISTERS static int zl10039_read(const struct zl10039_state *state, const enum zl10039_reg_addr reg, u8 *buf, const size_t count); static void zl10039_dump_registers(const struct zl10039_state *state) { u8 buf[16]; int ret; u8 reg; trace_printk("%s\n", __FUNCTION__); ret = zl10039_read(state, PLL0, buf, sizeof(buf)); if (ret < 0) return; for (reg = PLL0; reg <= GENERAL; reg += 4) { printk(KERN_DEBUG "%03x: [%02x %13s] [%02x %13s] [%02x %13s] " "[%02x %13s]\n", reg, buf[reg], zl10039_reg_names[reg], buf[reg+1], zl10039_reg_names[reg+1], buf[reg+2], zl10039_reg_names[reg+2], buf[reg+3], zl10039_reg_names[reg+3]); } } #else static inline void zl10039_dump_registers(const struct zl10039_state *state) {} #endif /* DEBUG_DUMP_REGISTERS */ #endif /* DVB_FRONTENDS_ZL10039_PRIV */