diff options
author | Johannes Stezenbach <devnull@localhost> | 2005-03-02 21:42:00 +0000 |
---|---|---|
committer | Johannes Stezenbach <devnull@localhost> | 2005-03-02 21:42:00 +0000 |
commit | 22369c7b769f439e3b351ecc9cd396a40b452db1 (patch) | |
tree | d7c330a08914350746300715a74c8fa6dc1fcebf /linux/drivers/media/dvb | |
parent | ca7fda81614047eda9a192f937edf43dbbb11e88 (diff) | |
download | mediapointer-dvb-s2-22369c7b769f439e3b351ecc9cd396a40b452db1.tar.gz mediapointer-dvb-s2-22369c7b769f439e3b351ecc9cd396a40b452db1.tar.bz2 |
whitespace cleanup (remove ws at eol, sync with changes in mainline kernel)
Diffstat (limited to 'linux/drivers/media/dvb')
54 files changed, 754 insertions, 1070 deletions
diff --git a/linux/drivers/media/dvb/bt8xx/dst.c b/linux/drivers/media/dvb/bt8xx/dst.c index 053c1ba65..859946703 100644 --- a/linux/drivers/media/dvb/bt8xx/dst.c +++ b/linux/drivers/media/dvb/bt8xx/dst.c @@ -1,4 +1,4 @@ -/* +/* Frontend-driver for TwinHan DST Frontend Copyright (C) 2003 Jamie Honan @@ -45,7 +45,7 @@ struct dst_state { const struct dst_config* config; struct dvb_frontend frontend; - + /* private demodulator data */ u8 tx_tuna[10]; u8 rx_tuna[10]; @@ -135,13 +135,13 @@ static int dst_gpio_inb(struct dst_state *state, u8 * result) dprintk("%s: dst_gpio_inb error (err == %i)\n", __FUNCTION__, err); return -EREMOTEIO; } - + *result = (u8) rd_packet.rd.value; return 0; } #define DST_I2C_ENABLE 1 -#define DST_8820 2 +#define DST_8820 2 static int dst_reset8820(struct dst_state *state) { @@ -173,7 +173,7 @@ static int dst_i2c_enable(struct dst_state *state) if (retval < 0) return retval; // dprintk ("%s: i2c enable delay\n", __FUNCTION__); - msleep(33); + msleep(33); return 0; } @@ -690,10 +690,10 @@ static int dst_get_tuna(struct dst_state* state) state->decode_lock = 1; /* - dst->decode_n1 = (dst->rx_tuna[4] << 8) + + dst->decode_n1 = (dst->rx_tuna[4] << 8) + (dst->rx_tuna[5]); - dst->decode_n2 = (dst->rx_tuna[8] << 8) + + dst->decode_n2 = (dst->rx_tuna[8] << 8) + (dst->rx_tuna[7]); */ state->diseq_flags |= HAS_LOCK; @@ -755,9 +755,9 @@ static int dst_write_tuna(struct dvb_frontend* fe) * power_off 0x00, 0x09, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 * power_on 0x00, 0x09, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00 * Diseqc 1 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xf0, 0xec - * Diseqc 2 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xf4, 0xe8 - * Diseqc 3 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xf8, 0xe4 - * Diseqc 4 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xfc, 0xe0 + * Diseqc 2 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xf4, 0xe8 + * Diseqc 3 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xf8, 0xe4 + * Diseqc 4 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xfc, 0xe0 */ static int dst_set_diseqc(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd) @@ -1036,7 +1036,7 @@ static struct dvb_frontend_ops dst_dvbs_ops = { .frequency_tolerance = 29500, .symbol_rate_min = 1000000, .symbol_rate_max = 45000000, - /* . symbol_rate_tolerance = ???,*/ + /* . symbol_rate_tolerance = ???,*/ .caps = FE_CAN_FEC_AUTO | FE_CAN_QPSK }, @@ -1066,7 +1066,7 @@ static struct dvb_frontend_ops dst_dvbc_ops = { .frequency_max = 858000000, .symbol_rate_min = 1000000, .symbol_rate_max = 45000000, - /* . symbol_rate_tolerance = ???,*/ + /* . symbol_rate_tolerance = ???,*/ .caps = FE_CAN_FEC_AUTO | FE_CAN_QAM_AUTO }, diff --git a/linux/drivers/media/dvb/bt8xx/dst.h b/linux/drivers/media/dvb/bt8xx/dst.h index 79fbe24ad..bcb418c5c 100644 --- a/linux/drivers/media/dvb/bt8xx/dst.h +++ b/linux/drivers/media/dvb/bt8xx/dst.h @@ -1,4 +1,4 @@ -/* +/* Frontend-driver for TwinHan DST Frontend Copyright (C) 2003 Jamie Honan diff --git a/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c index ca15bdd42..73ce1f661 100644 --- a/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c @@ -167,9 +167,9 @@ static int thomson_dtt7579_pll_set(struct dvb_frontend* fe, struct dvb_frontend_ pllbuf[0] = 0xc0; // Note: non-linux standard PLL i2c address pllbuf[1] = div >> 8; - pllbuf[2] = div & 0xff; - pllbuf[3] = cp; - pllbuf[4] = bs; + pllbuf[2] = div & 0xff; + pllbuf[3] = cp; + pllbuf[4] = bs; return 0; } @@ -184,25 +184,25 @@ static struct mt352_config thomson_dtt7579_config = { static int cx24108_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) { u32 freq = params->frequency; - - int i, a, n, pump; + + int i, a, n, pump; u32 band, pll; - - + + u32 osci[]={950000,1019000,1075000,1178000,1296000,1432000, 1576000,1718000,1856000,2036000,2150000}; u32 bandsel[]={0,0x00020000,0x00040000,0x00100800,0x00101000, 0x00102000,0x00104000,0x00108000,0x00110000, 0x00120000,0x00140000}; - + #define XTAL 1011100 /* Hz, really 1.0111 MHz and a /10 prescaler */ printk("cx24108 debug: entering SetTunerFreq, freq=%d\n",freq); - + /* This is really the bit driving the tuner chip cx24108 */ - + if(freq<950000) freq=950000; /* kHz */ if(freq>2150000) freq=2150000; /* satellite IF is 950..2150MHz */ - + /* decide which VCO to use for the input frequency */ for(i=1;(i<sizeof(osci)/sizeof(osci[0]))&&(osci[i]<freq);i++); printk("cx24108 debug: select vco #%d (f=%d)\n",i,freq); @@ -210,7 +210,7 @@ static int cx24108_pll_set(struct dvb_frontend* fe, struct dvb_frontend_paramete /* the gain values must be set by SetSymbolrate */ /* compute the pll divider needed, from Conexant data sheet, resolved for (n*32+a), remember f(vco) is f(receive) *2 or *4, - depending on the divider bit. It is set to /4 on the 2 lowest + depending on the divider bit. It is set to /4 on the 2 lowest bands */ n=((i<=2?2:1)*freq*10L)/(XTAL/100); a=n%32; n/=32; if(a==0) n--; @@ -348,9 +348,9 @@ static int advbt771_samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct pllbuf[0] = 0xc2; // Note: non-linux standard PLL i2c address pllbuf[1] = div >> 8; - pllbuf[2] = div & 0xff; - pllbuf[3] = cp; - pllbuf[4] = bs; + pllbuf[2] = div & 0xff; + pllbuf[3] = cp; + pllbuf[4] = bs; return 0; } @@ -465,7 +465,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) break; } break; - + case BTTV_PINNACLESAT: card->fe = cx24110_attach(&pctvsat_config, card->i2c_adapter); if (card->fe != NULL) { @@ -609,7 +609,7 @@ static int dvb_bt8xx_probe(struct device *dev) card->op_sync_orin = 0; card->irq_err_ignore = 0; break; - + #ifdef BTTV_DVICO_DVBT_LITE case BTTV_DVICO_DVBT_LITE: #endif @@ -752,4 +752,3 @@ module_exit(dvb_bt8xx_exit); MODULE_DESCRIPTION("Bt8xx based DVB adapter driver"); MODULE_AUTHOR("Florian Schirmer <jolt@tuxbox.org>"); MODULE_LICENSE("GPL"); - diff --git a/linux/drivers/media/dvb/dibusb/Kconfig b/linux/drivers/media/dvb/dibusb/Kconfig index 725926904..6164ec52c 100644 --- a/linux/drivers/media/dvb/dibusb/Kconfig +++ b/linux/drivers/media/dvb/dibusb/Kconfig @@ -6,7 +6,7 @@ config DVB_DIBUSB select DVB_DIB3000MC select DVB_MT352 help - Support for USB 1.1 and 2.0 DVB-T devices based on reference designs made by + Support for USB 1.1 and 2.0 DVB-T devices based on reference designs made by DiBcom (<http://www.dibcom.fr>) and C&E. Devices supported by this driver: @@ -25,7 +25,7 @@ config DVB_DIBUSB Hanftek UMT-010 USB2.0 Hauppauge WinTV NOVA-T USB2 - The VP7041 seems to be identical to "CTS Portable" (Chinese + The VP7041 seems to be identical to "CTS Portable" (Chinese Television System). These devices can be understood as budget ones, they "only" deliver @@ -41,7 +41,7 @@ config DVB_DIBUSB_MISDESIGNED_DEVICES bool "Enable support for some misdesigned (see help) devices, which identify with wrong IDs" depends on DVB_DIBUSB help - Somehow Artec/Ultima Electronic forgot to program the eeprom of some of their + Somehow Artec/Ultima Electronic forgot to program the eeprom of some of their USB1.1/USB2.0 devices. So comes that they identify with the default Vendor and Product ID of the Cypress CY7C64613 (AN2235) or Cypress FX2. diff --git a/linux/drivers/media/dvb/dibusb/dvb-dibusb.h b/linux/drivers/media/dvb/dibusb/dvb-dibusb.h index 6ccdc3fe3..e42182502 100644 --- a/linux/drivers/media/dvb/dibusb/dvb-dibusb.h +++ b/linux/drivers/media/dvb/dibusb/dvb-dibusb.h @@ -1,8 +1,8 @@ /* * dvb-dibusb.h - * + * * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) - * + * * 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, version 2. @@ -105,7 +105,7 @@ extern struct dibusb_tuner dibusb_tuner[]; #define DIBUSB_POSSIBLE_I2C_ADDR_NUM 4 struct dibusb_demod { dibusb_demodulator_t id; - + int pid_filter_count; /* counter of the internal pid_filter */ u8 i2c_addrs[DIBUSB_POSSIBLE_I2C_ADDR_NUM]; /* list of possible i2c addresses of the demod */ }; @@ -113,13 +113,13 @@ struct dibusb_demod { #define DIBUSB_MAX_TUNER_NUM 2 struct dibusb_device_class { dibusb_class_t id; - + const struct dibusb_usb_controller *usb_ctrl; /* usb controller */ const char *firmware; /* valid firmware filenames */ int pipe_cmd; /* command pipe (read/write) */ int pipe_data; /* data pipe */ - + int urb_count; /* number of data URBs to be submitted */ int urb_buffer_size; /* the size of the buffer for each URB */ @@ -155,21 +155,21 @@ struct usb_dibusb { #define DIBUSB_STATE_INIT 0x000 #define DIBUSB_STATE_URB_LIST 0x001 #define DIBUSB_STATE_URB_BUF 0x002 -#define DIBUSB_STATE_URB_SUBMIT 0x004 +#define DIBUSB_STATE_URB_SUBMIT 0x004 #define DIBUSB_STATE_DVB 0x008 #define DIBUSB_STATE_I2C 0x010 #define DIBUSB_STATE_REMOTE 0x020 int init_state; - + int feedcount; struct dib_fe_xfer_ops xfer_ops; struct dibusb_tuner *tuner; - + struct urb **urb_list; u8 *buffer; dma_addr_t dma_handle; - + /* I2C */ struct i2c_adapter i2c_adap; @@ -235,11 +235,11 @@ int dibusb_urb_exit(struct usb_dibusb *); /* i2c and transfer stuff */ #define DIBUSB_I2C_TIMEOUT HZ*5 -/* +/* * protocol of all dibusb related devices */ -/* +/* * bulk msg to/from endpoint 0x01 * * general structure: @@ -249,23 +249,23 @@ int dibusb_urb_exit(struct usb_dibusb *); #define DIBUSB_REQ_START_READ 0x00 #define DIBUSB_REQ_START_DEMOD 0x01 -/* - * i2c read +/* + * i2c read * bulk write: 0x02 ((7bit i2c_addr << 1) & 0x01) register_bytes length_word * bulk read: byte_buffer (length_word bytes) */ -#define DIBUSB_REQ_I2C_READ 0x02 - +#define DIBUSB_REQ_I2C_READ 0x02 + /* * i2c write * bulk write: 0x03 (7bit i2c_addr << 1) register_bytes value_bytes */ -#define DIBUSB_REQ_I2C_WRITE 0x03 +#define DIBUSB_REQ_I2C_WRITE 0x03 -/* - * polling the value of the remote control +/* + * polling the value of the remote control * bulk write: 0x04 - * bulk read: byte_buffer (5 bytes) + * bulk read: byte_buffer (5 bytes) * * first byte of byte_buffer shows the status (0x00, 0x01, 0x02) */ @@ -280,35 +280,35 @@ int dibusb_urb_exit(struct usb_dibusb *); #define DIBUSB_RC_HAUPPAUGE_KEY_EMPTY 0x03 /* streaming mode: - * bulk write: 0x05 mode_byte + * bulk write: 0x05 mode_byte * * mode_byte is mostly 0x00 */ #define DIBUSB_REQ_SET_STREAMING_MODE 0x05 /* interrupt the internal read loop, when blocking */ -#define DIBUSB_REQ_INTR_READ 0x06 +#define DIBUSB_REQ_INTR_READ 0x06 /* io control * 0x07 cmd_byte param_bytes * * param_bytes can be up to 32 bytes * - * cmd_byte function parameter name + * cmd_byte function parameter name * 0x00 power mode * 0x00 sleep * 0x01 wakeup * - * 0x01 enable streaming + * 0x01 enable streaming * 0x02 disable streaming * * - */ + */ #define DIBUSB_REQ_SET_IOCTL 0x07 /* IOCTL commands */ -/* change the power mode in firmware */ +/* change the power mode in firmware */ #define DIBUSB_IOCTL_CMD_POWER_MODE 0x00 #define DIBUSB_IOCTL_POWER_SLEEP 0x00 #define DIBUSB_IOCTL_POWER_WAKEUP 0x01 diff --git a/linux/drivers/media/dvb/dvb-core/Kconfig b/linux/drivers/media/dvb/dvb-core/Kconfig index 7dc3511c7..a9a7b3421 100644 --- a/linux/drivers/media/dvb/dvb-core/Kconfig +++ b/linux/drivers/media/dvb/dvb-core/Kconfig @@ -8,4 +8,4 @@ config DVB_CORE to build your drivers outside the kernel, but need the DVB core. All in-kernel drivers will select this automatically if needed. If unsure say N. - + diff --git a/linux/drivers/media/dvb/dvb-core/demux.h b/linux/drivers/media/dvb/dvb-core/demux.h index 806c4e656..fb55eaa5c 100644 --- a/linux/drivers/media/dvb/dvb-core/demux.h +++ b/linux/drivers/media/dvb/dvb-core/demux.h @@ -1,8 +1,8 @@ -/* - * demux.h +/* + * demux.h * * Copyright (c) 2002 Convergence GmbH - * + * * based on code: * Copyright (c) 2000 Nokia Research Center * Tampere, FINLAND @@ -23,56 +23,56 @@ * */ -#ifndef __DEMUX_H -#define __DEMUX_H +#ifndef __DEMUX_H +#define __DEMUX_H #include <linux/types.h> #include <linux/errno.h> -#include <linux/list.h> -#include <linux/time.h> +#include <linux/list.h> +#include <linux/time.h> -/*--------------------------------------------------------------------------*/ -/* Common definitions */ -/*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ +/* Common definitions */ +/*--------------------------------------------------------------------------*/ /* * DMX_MAX_FILTER_SIZE: Maximum length (in bytes) of a section/PES filter. - */ + */ -#ifndef DMX_MAX_FILTER_SIZE +#ifndef DMX_MAX_FILTER_SIZE #define DMX_MAX_FILTER_SIZE 18 -#endif +#endif /* * DMX_MAX_SECFEED_SIZE: Maximum length (in bytes) of a private section feed filter. - */ + */ -#ifndef DMX_MAX_SECFEED_SIZE +#ifndef DMX_MAX_SECFEED_SIZE #define DMX_MAX_SECFEED_SIZE 4096 -#endif +#endif /* - * enum dmx_success: Success codes for the Demux Callback API. - */ - -enum dmx_success { - DMX_OK = 0, /* Received Ok */ - DMX_LENGTH_ERROR, /* Incorrect length */ - DMX_OVERRUN_ERROR, /* Receiver ring buffer overrun */ - DMX_CRC_ERROR, /* Incorrect CRC */ - DMX_FRAME_ERROR, /* Frame alignment error */ - DMX_FIFO_ERROR, /* Receiver FIFO overrun */ - DMX_MISSED_ERROR /* Receiver missed packet */ -} ; - -/*--------------------------------------------------------------------------*/ -/* TS packet reception */ + * enum dmx_success: Success codes for the Demux Callback API. + */ + +enum dmx_success { + DMX_OK = 0, /* Received Ok */ + DMX_LENGTH_ERROR, /* Incorrect length */ + DMX_OVERRUN_ERROR, /* Receiver ring buffer overrun */ + DMX_CRC_ERROR, /* Incorrect CRC */ + DMX_FRAME_ERROR, /* Frame alignment error */ + DMX_FIFO_ERROR, /* Receiver FIFO overrun */ + DMX_MISSED_ERROR /* Receiver missed packet */ +} ; + +/*--------------------------------------------------------------------------*/ +/* TS packet reception */ /*--------------------------------------------------------------------------*/ /* TS filter type for set() */ -#define TS_PACKET 1 /* send TS packets (188 bytes) to callback (default) */ +#define TS_PACKET 1 /* send TS packets (188 bytes) to callback (default) */ #define TS_PAYLOAD_ONLY 2 /* in case TS_PACKET is set, only send the TS payload (<=184 bytes per packet) to callback */ #define TS_DECODER 4 /* send stream to built-in decoder (if present) */ @@ -116,38 +116,38 @@ enum dmx_ts_pes #define DMX_TS_PES_PCR DMX_TS_PES_PCR0 -struct dmx_ts_feed { +struct dmx_ts_feed { int is_filtering; /* Set to non-zero when filtering in progress */ struct dmx_demux *parent; /* Back-pointer */ - void *priv; /* Pointer to private data of the API client */ - int (*set) (struct dmx_ts_feed *feed, + void *priv; /* Pointer to private data of the API client */ + int (*set) (struct dmx_ts_feed *feed, u16 pid, - int type, + int type, enum dmx_ts_pes pes_type, - size_t callback_length, - size_t circular_buffer_size, - int descramble, - struct timespec timeout); - int (*start_filtering) (struct dmx_ts_feed* feed); - int (*stop_filtering) (struct dmx_ts_feed* feed); + size_t callback_length, + size_t circular_buffer_size, + int descramble, + struct timespec timeout); + int (*start_filtering) (struct dmx_ts_feed* feed); + int (*stop_filtering) (struct dmx_ts_feed* feed); }; -/*--------------------------------------------------------------------------*/ -/* Section reception */ -/*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ +/* Section reception */ +/*--------------------------------------------------------------------------*/ -struct dmx_section_filter { - u8 filter_value [DMX_MAX_FILTER_SIZE]; - u8 filter_mask [DMX_MAX_FILTER_SIZE]; - u8 filter_mode [DMX_MAX_FILTER_SIZE]; - struct dmx_section_feed* parent; /* Back-pointer */ - void* priv; /* Pointer to private data of the API client */ +struct dmx_section_filter { + u8 filter_value [DMX_MAX_FILTER_SIZE]; + u8 filter_mask [DMX_MAX_FILTER_SIZE]; + u8 filter_mode [DMX_MAX_FILTER_SIZE]; + struct dmx_section_feed* parent; /* Back-pointer */ + void* priv; /* Pointer to private data of the API client */ }; -struct dmx_section_feed { - int is_filtering; /* Set to non-zero when filtering in progress */ +struct dmx_section_feed { + int is_filtering; /* Set to non-zero when filtering in progress */ struct dmx_demux* parent; /* Back-pointer */ - void* priv; /* Pointer to private data of the API client */ + void* priv; /* Pointer to private data of the API client */ int check_crc; u32 crc_val; @@ -156,42 +156,42 @@ struct dmx_section_feed { u8 secbuf_base[DMX_MAX_SECFEED_SIZE]; u16 secbufp, seclen, tsfeedp; - int (*set) (struct dmx_section_feed* feed, - u16 pid, - size_t circular_buffer_size, - int descramble, - int check_crc); - int (*allocate_filter) (struct dmx_section_feed* feed, - struct dmx_section_filter** filter); - int (*release_filter) (struct dmx_section_feed* feed, - struct dmx_section_filter* filter); - int (*start_filtering) (struct dmx_section_feed* feed); - int (*stop_filtering) (struct dmx_section_feed* feed); + int (*set) (struct dmx_section_feed* feed, + u16 pid, + size_t circular_buffer_size, + int descramble, + int check_crc); + int (*allocate_filter) (struct dmx_section_feed* feed, + struct dmx_section_filter** filter); + int (*release_filter) (struct dmx_section_feed* feed, + struct dmx_section_filter* filter); + int (*start_filtering) (struct dmx_section_feed* feed); + int (*stop_filtering) (struct dmx_section_feed* feed); }; -/*--------------------------------------------------------------------------*/ -/* Callback functions */ -/*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ +/* Callback functions */ +/*--------------------------------------------------------------------------*/ -typedef int (*dmx_ts_cb) ( const u8 * buffer1, +typedef int (*dmx_ts_cb) ( const u8 * buffer1, size_t buffer1_length, - const u8 * buffer2, + const u8 * buffer2, size_t buffer2_length, - struct dmx_ts_feed* source, - enum dmx_success success); + struct dmx_ts_feed* source, + enum dmx_success success); typedef int (*dmx_section_cb) ( const u8 * buffer1, size_t buffer1_len, - const u8 * buffer2, + const u8 * buffer2, size_t buffer2_len, - struct dmx_section_filter * source, - enum dmx_success success); + struct dmx_section_filter * source, + enum dmx_success success); -/*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ /* DVB Front-End */ -/*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ -enum dmx_frontend_source { +enum dmx_frontend_source { DMX_MEMORY_FE, DMX_FRONTEND_0, DMX_FRONTEND_1, @@ -201,84 +201,84 @@ enum dmx_frontend_source { DMX_STREAM_1, DMX_STREAM_2, DMX_STREAM_3 -}; +}; -struct dmx_frontend { - struct list_head connectivity_list; /* List of front-ends that can - be connected to a particular - demux */ - void* priv; /* Pointer to private data of the API client */ +struct dmx_frontend { + struct list_head connectivity_list; /* List of front-ends that can + be connected to a particular + demux */ + void* priv; /* Pointer to private data of the API client */ enum dmx_frontend_source source; }; -/*--------------------------------------------------------------------------*/ -/* MPEG-2 TS Demux */ -/*--------------------------------------------------------------------------*/ - -/* - * Flags OR'ed in the capabilites field of struct dmx_demux. - */ - -#define DMX_TS_FILTERING 1 -#define DMX_PES_FILTERING 2 -#define DMX_SECTION_FILTERING 4 -#define DMX_MEMORY_BASED_FILTERING 8 /* write() available */ -#define DMX_CRC_CHECKING 16 -#define DMX_TS_DESCRAMBLING 32 -#define DMX_SECTION_PAYLOAD_DESCRAMBLING 64 -#define DMX_MAC_ADDRESS_DESCRAMBLING 128 - -/* - * Demux resource type identifier. -*/ - -/* - * DMX_FE_ENTRY(): Casts elements in the list of registered +/*--------------------------------------------------------------------------*/ +/* MPEG-2 TS Demux */ +/*--------------------------------------------------------------------------*/ + +/* + * Flags OR'ed in the capabilites field of struct dmx_demux. + */ + +#define DMX_TS_FILTERING 1 +#define DMX_PES_FILTERING 2 +#define DMX_SECTION_FILTERING 4 +#define DMX_MEMORY_BASED_FILTERING 8 /* write() available */ +#define DMX_CRC_CHECKING 16 +#define DMX_TS_DESCRAMBLING 32 +#define DMX_SECTION_PAYLOAD_DESCRAMBLING 64 +#define DMX_MAC_ADDRESS_DESCRAMBLING 128 + +/* + * Demux resource type identifier. +*/ + +/* + * DMX_FE_ENTRY(): Casts elements in the list of registered * front-ends from the generic type struct list_head * to the type * struct dmx_frontend - *. + *. */ -#define DMX_FE_ENTRY(list) list_entry(list, struct dmx_frontend, connectivity_list) +#define DMX_FE_ENTRY(list) list_entry(list, struct dmx_frontend, connectivity_list) -struct dmx_demux { - u32 capabilities; /* Bitfield of capability flags */ - struct dmx_frontend* frontend; /* Front-end connected to the demux */ +struct dmx_demux { + u32 capabilities; /* Bitfield of capability flags */ + struct dmx_frontend* frontend; /* Front-end connected to the demux */ struct list_head reg_list; /* List of registered demuxes */ - void* priv; /* Pointer to private data of the API client */ + void* priv; /* Pointer to private data of the API client */ int users; /* Number of users */ - int (*open) (struct dmx_demux* demux); - int (*close) (struct dmx_demux* demux); - int (*write) (struct dmx_demux* demux, const char* buf, size_t count); - int (*allocate_ts_feed) (struct dmx_demux* demux, - struct dmx_ts_feed** feed, - dmx_ts_cb callback); - int (*release_ts_feed) (struct dmx_demux* demux, - struct dmx_ts_feed* feed); - int (*allocate_section_feed) (struct dmx_demux* demux, - struct dmx_section_feed** feed, - dmx_section_cb callback); + int (*open) (struct dmx_demux* demux); + int (*close) (struct dmx_demux* demux); + int (*write) (struct dmx_demux* demux, const char* buf, size_t count); + int (*allocate_ts_feed) (struct dmx_demux* demux, + struct dmx_ts_feed** feed, + dmx_ts_cb callback); + int (*release_ts_feed) (struct dmx_demux* demux, + struct dmx_ts_feed* feed); + int (*allocate_section_feed) (struct dmx_demux* demux, + struct dmx_section_feed** feed, + dmx_section_cb callback); int (*release_section_feed) (struct dmx_demux* demux, - struct dmx_section_feed* feed); - int (*descramble_mac_address) (struct dmx_demux* demux, - u8* buffer1, - size_t buffer1_length, - u8* buffer2, + struct dmx_section_feed* feed); + int (*descramble_mac_address) (struct dmx_demux* demux, + u8* buffer1, + size_t buffer1_length, + u8* buffer2, size_t buffer2_length, - u16 pid); + u16 pid); int (*descramble_section_payload) (struct dmx_demux* demux, - u8* buffer1, + u8* buffer1, size_t buffer1_length, u8* buffer2, size_t buffer2_length, - u16 pid); - int (*add_frontend) (struct dmx_demux* demux, - struct dmx_frontend* frontend); + u16 pid); + int (*add_frontend) (struct dmx_demux* demux, + struct dmx_frontend* frontend); int (*remove_frontend) (struct dmx_demux* demux, - struct dmx_frontend* frontend); - struct list_head* (*get_frontends) (struct dmx_demux* demux); - int (*connect_frontend) (struct dmx_demux* demux, - struct dmx_frontend* frontend); - int (*disconnect_frontend) (struct dmx_demux* demux); + struct dmx_frontend* frontend); + struct list_head* (*get_frontends) (struct dmx_demux* demux); + int (*connect_frontend) (struct dmx_demux* demux, + struct dmx_frontend* frontend); + int (*disconnect_frontend) (struct dmx_demux* demux); int (*get_pes_pids) (struct dmx_demux* demux, u16 *pids); @@ -286,17 +286,16 @@ struct dmx_demux { u64 *stc, unsigned int *base); }; -/*--------------------------------------------------------------------------*/ -/* Demux directory */ -/*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ +/* Demux directory */ +/*--------------------------------------------------------------------------*/ -/* - * DMX_DIR_ENTRY(): Casts elements in the list of registered +/* + * DMX_DIR_ENTRY(): Casts elements in the list of registered * demuxes from the generic type struct list_head* to the type struct dmx_demux - *. - */ + *. + */ #define DMX_DIR_ENTRY(list) list_entry(list, struct dmx_demux, reg_list) #endif /* #ifndef __DEMUX_H */ - diff --git a/linux/drivers/media/dvb/dvb-core/dmxdev.c b/linux/drivers/media/dvb/dvb-core/dmxdev.c index d3c774b3d..7d26f91e9 100644 --- a/linux/drivers/media/dvb/dvb-core/dmxdev.c +++ b/linux/drivers/media/dvb/dvb-core/dmxdev.c @@ -1,5 +1,5 @@ -/* - * dmxdev.c - DVB demultiplexer device +/* + * dmxdev.c - DVB demultiplexer device * * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de> * & Marcus Metzler <marcus@convergence.de> @@ -48,7 +48,7 @@ dvb_dmxdev_file_to_filter(struct file *file) return (struct dmxdev_filter *) file->private_data; } -static inline void dvb_dmxdev_buffer_init(struct dmxdev_buffer *buffer) +static inline void dvb_dmxdev_buffer_init(struct dmxdev_buffer *buffer) { buffer->data=NULL; buffer->size=8192; @@ -58,7 +58,7 @@ static inline void dvb_dmxdev_buffer_init(struct dmxdev_buffer *buffer) init_waitqueue_head(&buffer->queue); } -static inline int dvb_dmxdev_buffer_write(struct dmxdev_buffer *buf, const u8 *src, int len) +static inline int dvb_dmxdev_buffer_write(struct dmxdev_buffer *buf, const u8 *src, int len) { int split; int free; @@ -68,7 +68,7 @@ static inline int dvb_dmxdev_buffer_write(struct dmxdev_buffer *buf, const u8 *s return 0; if (!buf->data) return 0; - + free=buf->pread-buf->pwrite; split=0; if (free<=0) { @@ -97,14 +97,14 @@ static ssize_t dvb_dmxdev_buffer_read(struct dmxdev_buffer *src, { unsigned long todo=count; int split, avail, error; - + if (!src->data) return 0; if ((error=src->error)) { src->pwrite=src->pread; src->error=0; - return error; + return error; } if (non_blocking && (src->pwrite==src->pread)) @@ -122,9 +122,9 @@ static ssize_t dvb_dmxdev_buffer_read(struct dmxdev_buffer *src, if ((error=src->error)) { src->pwrite=src->pread; src->error=0; - return error; + return error; } - + split=src->size; avail=src->pwrite - src->pread; if (avail<0) { @@ -162,7 +162,7 @@ static struct dmx_frontend * get_fe(struct dmx_demux *demux, int type) list_for_each(pos, head) if (DMX_FE_ENTRY(pos)->source==type) return DMX_FE_ENTRY(pos); - + return NULL; } @@ -183,7 +183,7 @@ static int dvb_dvr_open(struct inode *inode, struct file *file) if (down_interruptible (&dmxdev->mutex)) return -ERESTARTSYS; - + if ((file->f_flags&O_ACCMODE)==O_RDWR) { if (!(dmxdev->capabilities&DMXDEV_CAP_DUPLEX)) { up(&dmxdev->mutex); @@ -203,20 +203,20 @@ static int dvb_dvr_open(struct inode *inode, struct file *file) if ((file->f_flags&O_ACCMODE)==O_WRONLY) { dmxdev->dvr_orig_fe=dmxdev->demux->frontend; - + if (!dmxdev->demux->write) { up(&dmxdev->mutex); return -EOPNOTSUPP; } - + front=get_fe(dmxdev->demux, DMX_MEMORY_FE); - + if (!front) { up(&dmxdev->mutex); return -EINVAL; } - dmxdev->demux->disconnect_frontend(dmxdev->demux); - dmxdev->demux->connect_frontend(dmxdev->demux, front); + dmxdev->demux->disconnect_frontend(dmxdev->demux); + dmxdev->demux->connect_frontend(dmxdev->demux, front); } up(&dmxdev->mutex); return 0; @@ -231,8 +231,8 @@ static int dvb_dvr_release(struct inode *inode, struct file *file) return -ERESTARTSYS; if ((file->f_flags&O_ACCMODE)==O_WRONLY) { - dmxdev->demux->disconnect_frontend(dmxdev->demux); - dmxdev->demux->connect_frontend(dmxdev->demux, + dmxdev->demux->disconnect_frontend(dmxdev->demux); + dmxdev->demux->connect_frontend(dmxdev->demux, dmxdev->dvr_orig_fe); } if ((file->f_flags&O_ACCMODE)==O_RDONLY) { @@ -275,8 +275,8 @@ static ssize_t dvb_dvr_read(struct file *file, char __user *buf, size_t count, int ret; //down(&dmxdev->mutex); - ret= dvb_dmxdev_buffer_read(&dmxdev->dvr_buffer, - file->f_flags&O_NONBLOCK, + ret= dvb_dmxdev_buffer_read(&dmxdev->dvr_buffer, + file->f_flags&O_NONBLOCK, buf, count, ppos); //up(&dmxdev->mutex); return ret; @@ -302,11 +302,11 @@ static int dvb_dmxdev_set_buffer_size(struct dmxdev_filter *dmxdevfilter, unsign mem=buf->data; buf->data=NULL; buf->size=size; - buf->pwrite=buf->pread=0; + buf->pwrite=buf->pread=0; spin_unlock_irq(&dmxdevfilter->dev->lock); - if (mem) + if (mem) vfree(mem); - + if (buf->size) { mem=vmalloc(dmxdevfilter->buffer.size); if (!mem) @@ -321,7 +321,7 @@ static int dvb_dmxdev_set_buffer_size(struct dmxdev_filter *dmxdevfilter, unsign static void dvb_dmxdev_filter_timeout(unsigned long data) { struct dmxdev_filter *dmxdevfilter=(struct dmxdev_filter *)data; - + dmxdevfilter->buffer.error=-ETIMEDOUT; spin_lock_irq(&dmxdevfilter->dev->lock); dmxdevfilter->state=DMXDEV_STATE_TIMEDOUT; @@ -332,7 +332,7 @@ static void dvb_dmxdev_filter_timeout(unsigned long data) static void dvb_dmxdev_filter_timer(struct dmxdev_filter *dmxdevfilter) { struct dmx_sct_filter_params *para=&dmxdevfilter->params.sec; - + del_timer(&dmxdevfilter->timer); if (para->timeout) { dmxdevfilter->timer.function=dvb_dmxdev_filter_timeout; @@ -348,7 +348,7 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len, { struct dmxdev_filter *dmxdevfilter=(struct dmxdev_filter *) filter->priv; int ret; - + if (dmxdevfilter->buffer.error) { wake_up(&dmxdevfilter->buffer.queue); return 0; @@ -359,16 +359,16 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len, return 0; } del_timer(&dmxdevfilter->timer); - dprintk("dmxdev: section callback %02x %02x %02x %02x %02x %02x\n", - buffer1[0], buffer1[1], - buffer1[2], buffer1[3], + dprintk("dmxdev: section callback %02x %02x %02x %02x %02x %02x\n", + buffer1[0], buffer1[1], + buffer1[2], buffer1[3], buffer1[4], buffer1[5]); ret=dvb_dmxdev_buffer_write(&dmxdevfilter->buffer, buffer1, buffer1_len); if (ret==buffer1_len) { ret=dvb_dmxdev_buffer_write(&dmxdevfilter->buffer, buffer2, buffer2_len); } if (ret<0) { - dmxdevfilter->buffer.pwrite=dmxdevfilter->buffer.pread; + dmxdevfilter->buffer.pwrite=dmxdevfilter->buffer.pread; dmxdevfilter->buffer.error=-EOVERFLOW; } if (dmxdevfilter->params.sec.flags&DMX_ONESHOT) @@ -385,7 +385,7 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len, struct dmxdev_filter *dmxdevfilter=(struct dmxdev_filter *) feed->priv; struct dmxdev_buffer *buffer; int ret; - + spin_lock(&dmxdevfilter->dev->lock); if (dmxdevfilter->params.pes.output==DMX_OUT_DECODER) { spin_unlock(&dmxdevfilter->dev->lock); @@ -402,10 +402,10 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len, return 0; } ret=dvb_dmxdev_buffer_write(buffer, buffer1, buffer1_len); - if (ret==buffer1_len) + if (ret==buffer1_len) ret=dvb_dmxdev_buffer_write(buffer, buffer2, buffer2_len); if (ret<0) { - buffer->pwrite=buffer->pread; + buffer->pwrite=buffer->pread; buffer->error=-EOVERFLOW; } spin_unlock(&dmxdevfilter->dev->lock); @@ -456,7 +456,7 @@ static int dvb_dmxdev_feed_start(struct dmxdev_filter *filter) } -/* restart section feed if it has filters left associated with it, +/* restart section feed if it has filters left associated with it, otherwise release the feed */ static int dvb_dmxdev_feed_restart(struct dmxdev_filter *filter) @@ -464,15 +464,15 @@ static int dvb_dmxdev_feed_restart(struct dmxdev_filter *filter) int i; struct dmxdev *dmxdev = filter->dev; u16 pid = filter->params.sec.pid; - - for (i=0; i<dmxdev->filternum; i++) + + for (i=0; i<dmxdev->filternum; i++) if (dmxdev->filter[i].state>=DMXDEV_STATE_GO && dmxdev->filter[i].type==DMXDEV_TYPE_SEC && dmxdev->filter[i].pid==pid) { dvb_dmxdev_feed_start(&dmxdev->filter[i]); return 0; } - + filter->dev->demux->release_section_feed(dmxdev->demux, filter->feed.sec); return 0; @@ -480,7 +480,7 @@ static int dvb_dmxdev_feed_restart(struct dmxdev_filter *filter) static int dvb_dmxdev_filter_stop(struct dmxdev_filter *dmxdevfilter) { - if (dmxdevfilter->state<DMXDEV_STATE_GO) + if (dmxdevfilter->state<DMXDEV_STATE_GO) return 0; switch (dmxdevfilter->type) { @@ -505,17 +505,17 @@ static int dvb_dmxdev_filter_stop(struct dmxdev_filter *dmxdevfilter) dmxdevfilter->feed.ts=NULL; break; default: - if (dmxdevfilter->state==DMXDEV_STATE_ALLOCATED) + if (dmxdevfilter->state==DMXDEV_STATE_ALLOCATED) return 0; return -EINVAL; } - dmxdevfilter->buffer.pwrite=dmxdevfilter->buffer.pread=0; + dmxdevfilter->buffer.pwrite=dmxdevfilter->buffer.pread=0; return 0; } static inline int dvb_dmxdev_filter_reset(struct dmxdev_filter *dmxdevfilter) { - if (dmxdevfilter->state<DMXDEV_STATE_SET) + if (dmxdevfilter->state<DMXDEV_STATE_SET) return 0; dmxdevfilter->type=DMXDEV_TYPE_NONE; @@ -530,11 +530,11 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) void *mem; int ret, i; - if (filter->state < DMXDEV_STATE_SET) + if (filter->state < DMXDEV_STATE_SET) return -EINVAL; if (filter->state >= DMXDEV_STATE_GO) - dvb_dmxdev_filter_stop(filter); + dvb_dmxdev_filter_stop(filter); if (!(mem = filter->buffer.data)) { mem = vmalloc(filter->buffer.size); @@ -560,27 +560,27 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) /* find active filter/feed with same PID */ for (i=0; i<dmxdev->filternum; i++) { if (dmxdev->filter[i].state >= DMXDEV_STATE_GO && - dmxdev->filter[i].pid == para->pid && + dmxdev->filter[i].pid == para->pid && dmxdev->filter[i].type == DMXDEV_TYPE_SEC) { *secfeed = dmxdev->filter[i].feed.sec; break; } } - /* if no feed found, try to allocate new one */ + /* if no feed found, try to allocate new one */ if (!*secfeed) { - ret=dmxdev->demux->allocate_section_feed(dmxdev->demux, - secfeed, + ret=dmxdev->demux->allocate_section_feed(dmxdev->demux, + secfeed, dvb_dmxdev_section_callback); if (ret<0) { printk ("DVB (%s): could not alloc feed\n", __FUNCTION__); return ret; } - - ret=(*secfeed)->set(*secfeed, para->pid, 32768, 0, + + ret=(*secfeed)->set(*secfeed, para->pid, 32768, 0, (para->flags & DMX_CHECK_CRC) ? 1 : 0); - + if (ret<0) { printk ("DVB (%s): could not set feed\n", __FUNCTION__); @@ -590,7 +590,7 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) } else { dvb_dmxdev_feed_stop(filter); } - + ret=(*secfeed)->allocate_filter(*secfeed, secfilter); if (ret < 0) { @@ -602,11 +602,11 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) (*secfilter)->priv = filter; - memcpy(&((*secfilter)->filter_value[3]), + memcpy(&((*secfilter)->filter_value[3]), &(para->filter.filter[1]), DMX_FILTER_SIZE-1); - memcpy(&(*secfilter)->filter_mask[3], + memcpy(&(*secfilter)->filter_mask[3], ¶->filter.mask[1], DMX_FILTER_SIZE-1); - memcpy(&(*secfilter)->filter_mode[3], + memcpy(&(*secfilter)->filter_mode[3], ¶->filter.mode[1], DMX_FILTER_SIZE-1); (*secfilter)->filter_value[0]=para->filter.filter[0]; @@ -614,7 +614,7 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) (*secfilter)->filter_mode[0]=para->filter.mode[0]; (*secfilter)->filter_mask[1]=0; (*secfilter)->filter_mask[2]=0; - + filter->todo = 0; ret = filter->feed.sec->start_filtering (filter->feed.sec); @@ -626,7 +626,7 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) break; } - case DMXDEV_TYPE_PES: + case DMXDEV_TYPE_PES: { struct timespec timeout = { 0 }; struct dmx_pes_filter_params *para = &filter->params.pes; @@ -635,27 +635,27 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) int ts_type; enum dmx_ts_pes ts_pes; struct dmx_ts_feed **tsfeed = &filter->feed.ts; - + filter->feed.ts = NULL; otype=para->output; - + ts_pes=(enum dmx_ts_pes) para->pes_type; - - if (ts_pes<DMX_PES_OTHER) + + if (ts_pes<DMX_PES_OTHER) ts_type=TS_DECODER; else ts_type=0; - - if (otype == DMX_OUT_TS_TAP) + + if (otype == DMX_OUT_TS_TAP) ts_type |= TS_PACKET; - - if (otype == DMX_OUT_TAP) + + if (otype == DMX_OUT_TAP) ts_type |= TS_PAYLOAD_ONLY|TS_PACKET; - - ret=dmxdev->demux->allocate_ts_feed(dmxdev->demux, - tsfeed, + + ret=dmxdev->demux->allocate_ts_feed(dmxdev->demux, + tsfeed, dvb_dmxdev_ts_callback); - if (ret<0) + if (ret<0) return ret; (*tsfeed)->priv = (void *) filter; @@ -730,13 +730,13 @@ static int dvb_dmxdev_filter_free(struct dmxdev *dmxdev, struct dmxdev_filter *d up(&dmxdev->mutex); return -ERESTARTSYS; } - + dvb_dmxdev_filter_stop(dmxdevfilter); dvb_dmxdev_filter_reset(dmxdevfilter); - + if (dmxdevfilter->buffer.data) { void *mem=dmxdevfilter->buffer.data; - + spin_lock_irq(&dmxdev->lock); dmxdevfilter->buffer.data=NULL; spin_unlock_irq(&dmxdev->lock); @@ -759,22 +759,22 @@ static inline void invert_mode(dmx_filter_t *filter) } -static int dvb_dmxdev_filter_set(struct dmxdev *dmxdev, - struct dmxdev_filter *dmxdevfilter, +static int dvb_dmxdev_filter_set(struct dmxdev *dmxdev, + struct dmxdev_filter *dmxdevfilter, struct dmx_sct_filter_params *params) { dprintk ("function : %s\n", __FUNCTION__); dvb_dmxdev_filter_stop(dmxdevfilter); - + dmxdevfilter->type=DMXDEV_TYPE_SEC; dmxdevfilter->pid=params->pid; - memcpy(&dmxdevfilter->params.sec, + memcpy(&dmxdevfilter->params.sec, params, sizeof(struct dmx_sct_filter_params)); invert_mode(&dmxdevfilter->params.sec.filter); dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_SET); - - if (params->flags&DMX_IMMEDIATE_START) + + if (params->flags&DMX_IMMEDIATE_START) return dvb_dmxdev_filter_start(dmxdevfilter); return 0; @@ -795,7 +795,7 @@ static int dvb_dmxdev_pes_filter_set(struct dmxdev *dmxdev, dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_SET); - if (params->flags&DMX_IMMEDIATE_START) + if (params->flags&DMX_IMMEDIATE_START) return dvb_dmxdev_filter_start(dmxdevfilter); return 0; @@ -806,18 +806,18 @@ static ssize_t dvb_dmxdev_read_sec(struct dmxdev_filter *dfil, { int result, hcount; int done=0; - + if (dfil->todo<=0) { hcount=3+dfil->todo; if (hcount>count) hcount=count; - result=dvb_dmxdev_buffer_read(&dfil->buffer, file->f_flags&O_NONBLOCK, + result=dvb_dmxdev_buffer_read(&dfil->buffer, file->f_flags&O_NONBLOCK, buf, hcount, ppos); if (result<0) { dfil->todo=0; return result; } - if (copy_from_user(dfil->secheader-dfil->todo, buf, result)) + if (copy_from_user(dfil->secheader-dfil->todo, buf, result)) return -EFAULT; buf+=result; done=result; @@ -831,7 +831,7 @@ static ssize_t dvb_dmxdev_read_sec(struct dmxdev_filter *dfil, } if (count>dfil->todo) count=dfil->todo; - result=dvb_dmxdev_buffer_read(&dfil->buffer, file->f_flags&O_NONBLOCK, + result=dvb_dmxdev_buffer_read(&dfil->buffer, file->f_flags&O_NONBLOCK, buf, count, ppos); if (result<0) return result; @@ -840,7 +840,7 @@ static ssize_t dvb_dmxdev_read_sec(struct dmxdev_filter *dfil, } -static ssize_t +static ssize_t dvb_demux_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct dmxdev_filter *dmxdevfilter=dvb_dmxdev_file_to_filter(file); @@ -852,8 +852,8 @@ dvb_demux_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) if (dmxdevfilter->type==DMXDEV_TYPE_SEC) ret=dvb_dmxdev_read_sec(dmxdevfilter, file, buf, count, ppos); else - ret=dvb_dmxdev_buffer_read(&dmxdevfilter->buffer, - file->f_flags&O_NONBLOCK, + ret=dvb_dmxdev_buffer_read(&dmxdevfilter->buffer, + file->f_flags&O_NONBLOCK, buf, count, ppos); up(&dmxdevfilter->mutex); @@ -868,7 +868,7 @@ static int dvb_demux_do_ioctl(struct inode *inode, struct file *file, struct dmxdev *dmxdev=dmxdevfilter->dev; unsigned long arg=(unsigned long) parg; int ret=0; - + if (down_interruptible (&dmxdev->mutex)) return -ERESTARTSYS; @@ -894,27 +894,27 @@ static int dvb_demux_do_ioctl(struct inode *inode, struct file *file, up(&dmxdevfilter->mutex); break; - case DMX_SET_FILTER: + case DMX_SET_FILTER: if (down_interruptible(&dmxdevfilter->mutex)) { up(&dmxdev->mutex); return -ERESTARTSYS; } - ret = dvb_dmxdev_filter_set(dmxdev, dmxdevfilter, + ret = dvb_dmxdev_filter_set(dmxdev, dmxdevfilter, (struct dmx_sct_filter_params *)parg); up(&dmxdevfilter->mutex); break; - case DMX_SET_PES_FILTER: + case DMX_SET_PES_FILTER: if (down_interruptible(&dmxdevfilter->mutex)) { up(&dmxdev->mutex); return -ERESTARTSYS; } - ret=dvb_dmxdev_pes_filter_set(dmxdev, dmxdevfilter, + ret=dvb_dmxdev_pes_filter_set(dmxdev, dmxdevfilter, (struct dmx_pes_filter_params *)parg); up(&dmxdevfilter->mutex); break; - case DMX_SET_BUFFER_SIZE: + case DMX_SET_BUFFER_SIZE: if (down_interruptible(&dmxdevfilter->mutex)) { up(&dmxdev->mutex); return -ERESTARTSYS; @@ -922,11 +922,11 @@ static int dvb_demux_do_ioctl(struct inode *inode, struct file *file, ret=dvb_dmxdev_set_buffer_size(dmxdevfilter, arg); up(&dmxdevfilter->mutex); break; - - case DMX_GET_EVENT: + + case DMX_GET_EVENT: break; - - case DMX_GET_PES_PIDS: + + case DMX_GET_PES_PIDS: if (!dmxdev->demux->get_pes_pids) { ret=-EINVAL; break; @@ -1023,11 +1023,11 @@ static int dvb_dvr_do_ioctl(struct inode *inode, struct file *file, return -ERESTARTSYS; switch (cmd) { - case DMX_SET_BUFFER_SIZE: + case DMX_SET_BUFFER_SIZE: // FIXME: implement ret=0; break; - + default: ret=-EINVAL; } @@ -1059,7 +1059,7 @@ static unsigned int dvb_dvr_poll (struct file *file, poll_table *wait) if (dmxdev->dvr_buffer.pread!=dmxdev->dvr_buffer.pwrite) mask |= (POLLIN | POLLRDNORM | POLLPRI); - } else + } else mask |= (POLLOUT | POLLWRNORM | POLLPRI); return mask; @@ -1083,14 +1083,14 @@ static struct dvb_device dvbdev_dvr = { .fops = &dvb_dvr_fops }; -int +int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) { int i; if (dmxdev->demux->open(dmxdev->demux) < 0) return -EUSERS; - + dmxdev->filter = vmalloc(dmxdev->filternum*sizeof(struct dmxdev_filter)); if (!dmxdev->filter) return -ENOMEM; @@ -1123,7 +1123,7 @@ dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) } EXPORT_SYMBOL(dvb_dmxdev_init); -void +void dvb_dmxdev_release(struct dmxdev *dmxdev) { dvb_unregister_device(dmxdev->dvbdev); @@ -1141,4 +1141,3 @@ dvb_dmxdev_release(struct dmxdev *dmxdev) dmxdev->demux->close(dmxdev->demux); } EXPORT_SYMBOL(dvb_dmxdev_release); - diff --git a/linux/drivers/media/dvb/dvb-core/dmxdev.h b/linux/drivers/media/dvb/dvb-core/dmxdev.h index 47d31777c..395a9cd75 100644 --- a/linux/drivers/media/dvb/dvb-core/dmxdev.h +++ b/linux/drivers/media/dvb/dvb-core/dmxdev.h @@ -1,4 +1,4 @@ -/* +/* * dmxdev.h * * Copyright (C) 2000 Ralph Metzler & Marcus Metzler diff --git a/linux/drivers/media/dvb/dvb-core/dvb_demux.c b/linux/drivers/media/dvb/dvb-core/dvb_demux.c index 19fb4d99c..ac9889d22 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_demux.c @@ -1,4 +1,4 @@ -/* +/* * dvb_demux.c - DVB kernel demux API * * Copyright (C) 2000-2001 Ralph Metzler <ralph@convergence.de> @@ -32,8 +32,8 @@ #include "dvb_demux.h" -#define NOBUFS -/* +#define NOBUFS +/* ** #define DVB_DEMUX_SECTION_LOSS_LOG to monitor payload loss in the syslog */ // #define DVB_DEMUX_SECTION_LOSS_LOG @@ -42,7 +42,7 @@ static LIST_HEAD(dmx_muxs); -static int dmx_register_demux(struct dmx_demux *demux) +static int dmx_register_demux(struct dmx_demux *demux) { demux->users = 0; list_add(&demux->reg_list, &dmx_muxs); @@ -87,14 +87,12 @@ static inline u8 payload(const u8 *tsp) { if (!(tsp[3] & 0x10)) // no payload? return 0; - if (tsp[3] & 0x20) { // adaptation field? if (tsp[4] > 183) // corrupted data? return 0; else return 184-1-tsp[4]; } - return 184; } @@ -115,7 +113,7 @@ static void dvb_dmx_memcopy (struct dvb_demux_feed *f, u8 *d, const u8 *s, size_ * Software filter functions ******************************************************************************/ -static inline int dvb_dmx_swfilter_payload (struct dvb_demux_feed *feed, const u8 *buf) +static inline int dvb_dmx_swfilter_payload (struct dvb_demux_feed *feed, const u8 *buf) { int count = payload(buf); int p; @@ -140,11 +138,11 @@ static inline int dvb_dmx_swfilter_payload (struct dvb_demux_feed *feed, const u feed->peslen += count; - return feed->cb.ts (&buf[p], count, NULL, 0, &feed->feed.ts, DMX_OK); + return feed->cb.ts (&buf[p], count, NULL, 0, &feed->feed.ts, DMX_OK); } -static int dvb_dmx_swfilter_sectionfilter (struct dvb_demux_feed *feed, +static int dvb_dmx_swfilter_sectionfilter (struct dvb_demux_feed *feed, struct dvb_demux_filter *f) { u8 neq = 0; @@ -162,8 +160,8 @@ static int dvb_dmx_swfilter_sectionfilter (struct dvb_demux_feed *feed, if (f->doneq && !neq) return 0; - return feed->cb.sec (feed->feed.sec.secbuf, feed->feed.sec.seclen, - NULL, 0, &f->filter, DMX_OK); + return feed->cb.sec (feed->feed.sec.secbuf, feed->feed.sec.seclen, + NULL, 0, &f->filter, DMX_OK); } @@ -213,7 +211,7 @@ static void dvb_dmx_swfilter_section_new(struct dvb_demux_feed *feed) */ if(sec->secbuf[0] != 0xff || sec->secbuf[n-1] != 0xff) { - printk("dvb_demux.c section ts padding loss: %d/%d\n", + printk("dvb_demux.c section ts padding loss: %d/%d\n", n, sec->tsfeedp); printk("dvb_demux.c pad data:"); for(i = 0; i < n; i++) @@ -227,13 +225,13 @@ static void dvb_dmx_swfilter_section_new(struct dvb_demux_feed *feed) sec->secbuf = sec->secbuf_base; } -/* +/* ** Losless Section Demux 1.4.1 by Emard ** Valsecchi Patrick: ** - middle of section A (no PUSI) -** - end of section A and start of section B +** - end of section A and start of section B ** (with PUSI pointing to the start of the second section) -** +** ** In this case, without feed->pusi_seen you'll receive a garbage section ** consisting of the end of section A. Basically because tsfeedp ** is incemented and the use=0 condition is not raised @@ -257,7 +255,7 @@ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed, const if(sec->tsfeedp + len > DMX_MAX_SECFEED_SIZE) { #ifdef DVB_DEMUX_SECTION_LOSS_LOG - printk("dvb_demux.c section buffer full loss: %d/%d\n", + printk("dvb_demux.c section buffer full loss: %d/%d\n", sec->tsfeedp + len - DMX_MAX_SECFEED_SIZE, DMX_MAX_SECFEED_SIZE); #endif len = DMX_MAX_SECFEED_SIZE - sec->tsfeedp; @@ -272,7 +270,7 @@ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed, const /* ----------------------------------------------------- ** Dump all the sections we can find in the data (Emard) */ - + limit = sec->tsfeedp; if(limit > DMX_MAX_SECFEED_SIZE) return -1; /* internal error should never happen */ @@ -283,7 +281,7 @@ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed, const for(n = 0; sec->secbufp + 2 < limit; n++) { seclen = section_length(sec->secbuf); - if(seclen <= 0 || seclen > DMX_MAX_SECFEED_SIZE + if(seclen <= 0 || seclen > DMX_MAX_SECFEED_SIZE || seclen + sec->secbufp > limit) return 0; sec->seclen = seclen; @@ -303,7 +301,7 @@ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed, const } -static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, const u8 *buf) +static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, const u8 *buf) { u8 p, count; int ccok, dc_i = 0; @@ -381,9 +379,9 @@ static inline void dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed, con if (feed->ts_type & TS_PAYLOAD_ONLY) dvb_dmx_swfilter_payload(feed, buf); else - feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts, DMX_OK); + feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts, DMX_OK); } - if (feed->ts_type & TS_DECODER) + if (feed->ts_type & TS_DECODER) if (feed->demux->write_to_decoder) feed->demux->write_to_decoder(feed, buf, 188); break; @@ -439,7 +437,7 @@ void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, size_t cou spin_lock(&demux->lock); while (count--) { - if(buf[0] == 0x47) { + if(buf[0] == 0x47) { dvb_dmx_swfilter_packet(demux, buf); } buf += 188; @@ -480,7 +478,7 @@ void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) demux->tsbufp=i; goto bailout; } - } else + } else p++; } @@ -524,7 +522,7 @@ void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count) demux->tsbufp=i; goto bailout; } - } else { + } else { p++; } } @@ -606,9 +604,9 @@ out: spin_unlock_irq(&feed->demux->lock); } -static int dmx_ts_feed_set (struct dmx_ts_feed* ts_feed, u16 pid, int ts_type, - enum dmx_ts_pes pes_type, size_t callback_length, - size_t circular_buffer_size, int descramble, +static int dmx_ts_feed_set (struct dmx_ts_feed* ts_feed, u16 pid, int ts_type, + enum dmx_ts_pes pes_type, size_t callback_length, + size_t circular_buffer_size, int descramble, struct timespec timeout) { struct dvb_demux_feed *feed = (struct dvb_demux_feed *) ts_feed; @@ -626,7 +624,7 @@ static int dmx_ts_feed_set (struct dmx_ts_feed* ts_feed, u16 pid, int ts_type, return -EINVAL; } - if (demux->pesfilter[pes_type] && + if (demux->pesfilter[pes_type] && demux->pesfilter[pes_type] != feed) { up(&demux->mutex); return -EINVAL; @@ -662,7 +660,7 @@ static int dmx_ts_feed_set (struct dmx_ts_feed* ts_feed, u16 pid, int ts_type, } #endif } - + feed->state = DMX_STATE_READY; up(&demux->mutex); @@ -702,7 +700,7 @@ static int dmx_ts_feed_start_filtering(struct dmx_ts_feed* ts_feed) return 0; } - + static int dmx_ts_feed_stop_filtering(struct dmx_ts_feed* ts_feed) { struct dvb_demux_feed *feed = (struct dvb_demux_feed *) ts_feed; @@ -722,7 +720,7 @@ static int dmx_ts_feed_stop_filtering(struct dmx_ts_feed* ts_feed) return -ENODEV; } - ret = demux->stop_feed(feed); + ret = demux->stop_feed(feed); spin_lock_irq(&demux->lock); ts_feed->is_filtering = 0; @@ -733,7 +731,7 @@ static int dmx_ts_feed_stop_filtering(struct dmx_ts_feed* ts_feed) return ret; } -static int dvbdmx_allocate_ts_feed (struct dmx_demux *dmx, struct dmx_ts_feed **ts_feed, +static int dvbdmx_allocate_ts_feed (struct dmx_demux *dmx, struct dmx_ts_feed **ts_feed, dmx_ts_cb callback) { struct dvb_demux *demux = (struct dvb_demux *) dmx; @@ -772,7 +770,7 @@ static int dvbdmx_allocate_ts_feed (struct dmx_demux *dmx, struct dmx_ts_feed ** feed->filter->type = DMX_TYPE_TS; feed->filter->feed = feed; feed->filter->state = DMX_STATE_READY; - + up(&demux->mutex); return 0; @@ -815,8 +813,8 @@ static int dvbdmx_release_ts_feed(struct dmx_demux *dmx, struct dmx_ts_feed *ts_ * dmx_section_feed API calls ******************************************************************************/ -static int dmx_section_feed_allocate_filter(struct dmx_section_feed* feed, - struct dmx_section_filter** filter) +static int dmx_section_feed_allocate_filter(struct dmx_section_feed* feed, + struct dmx_section_filter** filter) { struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *) feed; struct dvb_demux *dvbdemux = dvbdmxfeed->demux; @@ -847,9 +845,9 @@ static int dmx_section_feed_allocate_filter(struct dmx_section_feed* feed, } -static int dmx_section_feed_set(struct dmx_section_feed* feed, - u16 pid, size_t circular_buffer_size, - int descramble, int check_crc) +static int dmx_section_feed_set(struct dmx_section_feed* feed, + u16 pid, size_t circular_buffer_size, + int descramble, int check_crc) { struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *) feed; struct dvb_demux *dvbdmx = dvbdmxfeed->demux; @@ -859,7 +857,7 @@ static int dmx_section_feed_set(struct dmx_section_feed* feed, if (down_interruptible (&dvbdmx->mutex)) return -ERESTARTSYS; - + dvb_demux_feed_add(dvbdmxfeed); dvbdmxfeed->pid = pid; @@ -919,7 +917,7 @@ static int dmx_section_feed_start_filtering(struct dmx_section_feed *feed) if (down_interruptible (&dvbdmx->mutex)) return -ERESTARTSYS; - + if (feed->is_filtering) { up(&dvbdmx->mutex); return -EBUSY; @@ -934,7 +932,7 @@ static int dmx_section_feed_start_filtering(struct dmx_section_feed *feed) dvbdmxfeed->feed.sec.secbuf = dvbdmxfeed->feed.sec.secbuf_base; dvbdmxfeed->feed.sec.secbufp = 0; dvbdmxfeed->feed.sec.seclen = 0; - + if (!dvbdmx->start_feed) { up(&dvbdmx->mutex); return -ENODEV; @@ -971,7 +969,7 @@ static int dmx_section_feed_stop_filtering(struct dmx_section_feed* feed) return -ENODEV; } - ret = dvbdmx->stop_feed(dvbdmxfeed); + ret = dvbdmx->stop_feed(dvbdmxfeed); spin_lock_irq(&dvbdmx->lock); dvbdmxfeed->state = DMX_STATE_READY; @@ -983,7 +981,7 @@ static int dmx_section_feed_stop_filtering(struct dmx_section_feed* feed) } -static int dmx_section_feed_release_filter(struct dmx_section_feed *feed, +static int dmx_section_feed_release_filter(struct dmx_section_feed *feed, struct dmx_section_filter* filter) { struct dvb_demux_filter *dvbdmxfilter = (struct dvb_demux_filter *) filter, *f; @@ -998,9 +996,9 @@ static int dmx_section_feed_release_filter(struct dmx_section_feed *feed, return -EINVAL; } - if (feed->is_filtering) + if (feed->is_filtering) feed->stop_filtering(feed); - + spin_lock_irq(&dvbdmx->lock); f = dvbdmxfeed->filter; @@ -1018,7 +1016,7 @@ static int dmx_section_feed_release_filter(struct dmx_section_feed *feed, return 0; } -static int dvbdmx_allocate_section_feed(struct dmx_demux *demux, +static int dvbdmx_allocate_section_feed(struct dmx_demux *demux, struct dmx_section_feed **feed, dmx_section_cb callback) { @@ -1058,7 +1056,7 @@ static int dvbdmx_allocate_section_feed(struct dmx_demux *demux, return 0; } -static int dvbdmx_release_section_feed(struct dmx_demux *demux, +static int dvbdmx_release_section_feed(struct dmx_demux *demux, struct dmx_section_feed *feed) { struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *) feed; @@ -1137,7 +1135,7 @@ static int dvbdmx_add_frontend(struct dmx_demux *demux, struct dmx_frontend *fro { struct dvb_demux *dvbdemux = (struct dvb_demux *) demux; struct list_head *head = &dvbdemux->frontend_list; - + list_add(&(frontend->connectivity_list), head); return 0; @@ -1166,7 +1164,6 @@ static struct list_head * dvbdmx_get_frontends(struct dmx_demux *demux) if (list_empty(&dvbdemux->frontend_list)) return NULL; - return &dvbdemux->frontend_list; } @@ -1177,7 +1174,7 @@ static int dvbdmx_connect_frontend(struct dmx_demux *demux, struct dmx_frontend if (demux->frontend) return -EINVAL; - + if (down_interruptible (&dvbdemux->mutex)) return -ERESTARTSYS; @@ -1195,7 +1192,6 @@ static int dvbdmx_disconnect_frontend(struct dmx_demux *demux) return -ERESTARTSYS; demux->frontend = NULL; - up(&dvbdemux->mutex); return 0; } @@ -1226,21 +1222,17 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux) vfree(dvbdemux->filter); return -ENOMEM; } - for (i=0; i<dvbdemux->filternum; i++) { dvbdemux->filter[i].state = DMX_STATE_FREE; dvbdemux->filter[i].index = i; } - for (i=0; i<dvbdemux->feednum; i++) { dvbdemux->feed[i].state = DMX_STATE_FREE; dvbdemux->feed[i].index = i; } - dvbdemux->frontend_list.next= dvbdemux->frontend_list.prev= &dvbdemux->frontend_list; - for (i=0; i<DMX_TS_PES_OTHER; i++) { dvbdemux->pesfilter[i] = NULL; dvbdemux->pids[i] = 0xffff; @@ -1271,7 +1263,7 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux) dmx->descramble_mac_address = NULL; dmx->descramble_section_payload = NULL; - + dmx->add_frontend = dvbdmx_add_frontend; dmx->remove_frontend = dvbdmx_remove_frontend; dmx->get_frontends = dvbdmx_get_frontends; @@ -1282,7 +1274,7 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux) sema_init(&dvbdemux->mutex, 1); spin_lock_init(&dvbdemux->lock); - if ((err = dmx_register_demux(dmx)) < 0) + if ((err = dmx_register_demux(dmx)) < 0) return err; return 0; @@ -1300,4 +1292,3 @@ int dvb_dmx_release(struct dvb_demux *dvbdemux) return 0; } EXPORT_SYMBOL(dvb_dmx_release); - diff --git a/linux/drivers/media/dvb/dvb-core/dvb_demux.h b/linux/drivers/media/dvb/dvb-core/dvb_demux.h index 326cce056..c09beb391 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_demux.h +++ b/linux/drivers/media/dvb/dvb-core/dvb_demux.h @@ -1,4 +1,4 @@ -/* +/* * dvb_demux.h: DVB kernel demux API * * Copyright (C) 2000-2001 Marcus Metzler & Ralph Metzler @@ -45,10 +45,10 @@ struct dvb_demux_filter { struct dmx_section_filter filter; - u8 maskandmode [DMX_MAX_FILTER_SIZE]; - u8 maskandnotmode [DMX_MAX_FILTER_SIZE]; + u8 maskandmode [DMX_MAX_FILTER_SIZE]; + u8 maskandnotmode [DMX_MAX_FILTER_SIZE]; int doneq; - + struct dvb_demux_filter *next; struct dvb_demux_feed *feed; int index; @@ -85,16 +85,16 @@ struct dvb_demux_feed { int buffer_size; int descramble; - struct timespec timeout; + struct timespec timeout; struct dvb_demux_filter *filter; int cb_length; - + int ts_type; enum dmx_ts_pes pes_type; int cc; int pusi_seen; /* prevents feeding of garbage from previous section */ - + u16 peslen; struct list_head list_head; @@ -114,7 +114,7 @@ struct dvb_demux { const u8 *buf, size_t len); void (*memcopy) (struct dvb_demux_feed *feed, u8 *dst, const u8 *src, size_t len); - + int users; #define MAX_DVB_DEMUX_USERS 10 struct dvb_demux_filter *filter; @@ -124,8 +124,8 @@ struct dvb_demux { struct dvb_demux_feed *pesfilter[DMX_TS_PES_OTHER]; u16 pids[DMX_TS_PES_OTHER]; - int playing; - int recording; + int playing; + int recording; #define DMX_MAX_PID 0x2000 struct list_head feed_list; @@ -144,4 +144,3 @@ void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count); void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count); #endif /* _DVB_DEMUX_H_ */ - diff --git a/linux/drivers/media/dvb/dvb-core/dvb_filter.c b/linux/drivers/media/dvb/dvb-core/dvb_filter.c index 5e541bfb6..bd5143906 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_filter.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_filter.c @@ -22,12 +22,12 @@ static u32 ac3_frames[3][32] = {69,87,104,121,139,174,208,243,278,348,417,487,557,696,835,975,1114, 1253,1393,0,0,0,0,0,0,0,0,0,0,0,0,0}, {96,120,144,168,192,240,288,336,384,480,576,672,768,960,1152,1344, - 1536,1728,1920,0,0,0,0,0,0,0,0,0,0,0,0,0}}; + 1536,1728,1920,0,0,0,0,0,0,0,0,0,0,0,0,0}}; #if 0 -static void setup_ts2pes(ipack *pa, ipack *pv, u16 *pida, u16 *pidv, +static void setup_ts2pes(ipack *pa, ipack *pv, u16 *pida, u16 *pidv, void (*pes_write)(u8 *buf, int count, void *data), void *priv) { @@ -72,7 +72,7 @@ static int read_picture_header(u8 *headr, struct mpg_picture *pic, int field, in u8 pct; if (pr) printk( "Pic header: "); - pic->temporal_reference[field] = (( headr[0] << 2 ) | + pic->temporal_reference[field] = (( headr[0] << 2 ) | (headr[1] & 0x03) )& 0x03ff; if (pr) printk( " temp ref: 0x%04x", pic->temporal_reference[field]); @@ -93,31 +93,31 @@ static int read_picture_header(u8 *headr, struct mpg_picture *pic, int field, in } - pic->vinfo.vbv_delay = (( headr[1] >> 5 ) | ( headr[2] << 3) | + pic->vinfo.vbv_delay = (( headr[1] >> 5 ) | ( headr[2] << 3) | ( (headr[3] & 0x1F) << 11) ) & 0xffff; if (pr) printk( " vbv delay: 0x%04x", pic->vinfo.vbv_delay); - pic->picture_header_parameter = ( headr[3] & 0xe0 ) | + pic->picture_header_parameter = ( headr[3] & 0xe0 ) | ((headr[4] & 0x80) >> 3); if ( pct == B_FRAME ){ pic->picture_header_parameter |= ( headr[4] >> 3 ) & 0x0f; } - if (pr) printk( " pic head param: 0x%x", + if (pr) printk( " pic head param: 0x%x", pic->picture_header_parameter); return pct; -} +} #endif #if 0 /* needs 4 byte input */ static int read_gop_header(u8 *headr, struct mpg_picture *pic, int pr) { - if (pr) printk("GOP header: "); + if (pr) printk("GOP header: "); - pic->time_code = (( headr[0] << 17 ) | ( headr[1] << 9) | + pic->time_code = (( headr[0] << 17 ) | ( headr[1] << 9) | ( headr[2] << 1 ) | (headr[3] &0x01)) & 0x1ffffff; if (pr) printk(" time: %d:%d.%d ", (headr[0]>>2)& 0x1F, @@ -129,14 +129,14 @@ static int read_gop_header(u8 *headr, struct mpg_picture *pic, int pr) } else { pic->closed_gop = 0; } - if (pr) printk("closed: %d", pic->closed_gop); + if (pr) printk("closed: %d", pic->closed_gop); if ( ( headr[3] & 0x20 ) != 0 ){ pic->broken_link = 1; } else { pic->broken_link = 0; } - if (pr) printk(" broken: %d\n", pic->broken_link); + if (pr) printk(" broken: %d\n", pic->broken_link); return 0; } @@ -153,39 +153,39 @@ static int read_sequence_header(u8 *headr, struct dvb_video_info *vi, int pr) vi->horizontal_size = ((headr[1] &0xF0) >> 4) | (headr[0] << 4); vi->vertical_size = ((headr[1] &0x0F) << 8) | (headr[2]); - + sw = (int)((headr[3]&0xF0) >> 4) ; switch( sw ){ case 1: if (pr) printk("Videostream: ASPECT: 1:1"); - vi->aspect_ratio = 100; + vi->aspect_ratio = 100; break; case 2: if (pr) printk("Videostream: ASPECT: 4:3"); - vi->aspect_ratio = 133; + vi->aspect_ratio = 133; break; case 3: if (pr) printk("Videostream: ASPECT: 16:9"); - vi->aspect_ratio = 177; + vi->aspect_ratio = 177; break; case 4: if (pr) printk("Videostream: ASPECT: 2.21:1"); - vi->aspect_ratio = 221; + vi->aspect_ratio = 221; break; case 5 ... 15: if (pr) printk("Videostream: ASPECT: reserved"); - vi->aspect_ratio = 0; + vi->aspect_ratio = 0; break; default: - vi->aspect_ratio = 0; + vi->aspect_ratio = 0; return -1; } @@ -240,7 +240,7 @@ static int read_sequence_header(u8 *headr, struct dvb_video_info *vi, int pr) } vi->bit_rate = (headr[4] << 10) | (headr[5] << 2) | (headr[6] & 0x03); - + vi->vbv_buffer_size = (( headr[6] & 0xF8) >> 3 ) | (( headr[7] & 0x1F )<< 5); @@ -303,7 +303,7 @@ static int get_ainfo(u8 *mbuf, int count, struct dvb_audio_info *ai, int pr) else { c++; } - } + } if (!found) return -1; @@ -333,8 +333,8 @@ static int get_ainfo(u8 *mbuf, int count, struct dvb_audio_info *ai, int pr) if (ai->frequency == 3) printk(" Freq: reserved\n"); else - printk(" Freq: %d kHz\n",ai->frequency); - + printk(" Freq: %d kHz\n",ai->frequency); + } ai->off = c; return 0; @@ -349,7 +349,7 @@ int dvb_filter_get_ac3info(u8 *mbuf, int count, struct dvb_audio_info *ai, int p int c = 0; u8 frame = 0; int fr = 0; - + while ( !found && c < count){ u8 *b = mbuf+c; @@ -358,7 +358,7 @@ int dvb_filter_get_ac3info(u8 *mbuf, int count, struct dvb_audio_info *ai, int p else { c++; } - } + } if (!found) return -1; if (pr) @@ -402,7 +402,7 @@ static u8 *skip_pes_header(u8 **bufp) int skip = 0; static const int mpeg1_skip_table[16] = { - 1, 0xffff, 5, 10, 0xffff, 0xffff, 0xffff, 0xffff, + 1, 0xffff, 5, 10, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff }; @@ -479,9 +479,9 @@ static void initialize_mpg_picture(struct mpg_picture *pic) pic->picture_display_extension_flag[0] = 0; pic->picture_display_extension_flag[1] = 0; - pic->sequence_header_flag = 0; - pic->gop_flag = 0; - pic->sequence_end_flag = 0; + pic->sequence_header_flag = 0; + pic->gop_flag = 0; + pic->sequence_end_flag = 0; } #endif @@ -553,7 +553,7 @@ static void init_mpg_picture( struct mpg_picture *pic, int chan, int32_t field_t } #endif -void dvb_filter_pes2ts_init(struct dvb_filter_pes2ts *p2ts, unsigned short pid, +void dvb_filter_pes2ts_init(struct dvb_filter_pes2ts *p2ts, unsigned short pid, dvb_filter_pes2ts_cb_t *cb, void *priv) { unsigned char *buf=p2ts->buf; @@ -601,4 +601,3 @@ int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts, unsigned char *pes, return p2ts->cb(p2ts->priv, buf); } EXPORT_SYMBOL(dvb_filter_pes2ts); - diff --git a/linux/drivers/media/dvb/dvb-core/dvb_filter.h b/linux/drivers/media/dvb/dvb-core/dvb_filter.h index bd328dc25..b0848f783 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_filter.h +++ b/linux/drivers/media/dvb/dvb-core/dvb_filter.h @@ -34,8 +34,8 @@ struct dvb_filter_pes2ts { void *priv; }; -void dvb_filter_pes2ts_init(struct dvb_filter_pes2ts *p2ts, unsigned short pid, - dvb_filter_pes2ts_cb_t *cb, void *priv); +void dvb_filter_pes2ts_init(struct dvb_filter_pes2ts *p2ts, unsigned short pid, + dvb_filter_pes2ts_cb_t *cb, void *priv); int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts, unsigned char *pes, int len, int payload_start); @@ -70,8 +70,8 @@ int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts, unsigned char *pes, #define QUANT_MATRIX_EXTENSION 0x03 #define PICTURE_DISPLAY_EXTENSION 0x07 -#define I_FRAME 0x01 -#define B_FRAME 0x02 +#define I_FRAME 0x01 +#define B_FRAME 0x02 #define P_FRAME 0x03 /* Initialize sequence_data */ @@ -92,7 +92,7 @@ int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts, unsigned char *pes, #define PES_CRC_FLAG 0x02 #define PES_EXT_FLAG 0x01 -//pts_dts flags +//pts_dts flags #define PTS_ONLY 0x80 #define PTS_DTS 0xC0 @@ -165,7 +165,7 @@ struct dvb_video_info { s16 vbv_delay; u32 CSPF; u32 off; -}; +}; #define OFF_SIZE 4 #define FIRST_FIELD 0 @@ -181,10 +181,10 @@ struct mpg_picture { int low_delay; int closed_gop; int broken_link; - int sequence_header_flag; - int gop_flag; + int sequence_header_flag; + int gop_flag; int sequence_end_flag; - + u8 profile_and_level; s32 picture_coding_parameter; u32 matrix[32]; @@ -211,11 +211,11 @@ struct mpg_picture { int forward_bank; int backward_bank; int compress; - s16 frame_centre_horizontal_offset[OFF_SIZE]; + s16 frame_centre_horizontal_offset[OFF_SIZE]; /* [0-2] 1st field, [3] 2nd field */ s16 frame_centre_vertical_offset[OFF_SIZE]; /* [0-2] 1st field, [3] 2nd field */ - s16 temporal_reference[2]; + s16 temporal_reference[2]; /* [0] 1st field, [1] 2nd field */ s8 picture_coding_type[2]; diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.h b/linux/drivers/media/dvb/dvb-core/dvb_net.h index 5b701efe8..f14e4ca38 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_net.h +++ b/linux/drivers/media/dvb/dvb-core/dvb_net.h @@ -1,4 +1,4 @@ -/* +/* * dvb_net.h * * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH @@ -44,4 +44,3 @@ void dvb_net_release(struct dvb_net *); int dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *); #endif - diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.c b/linux/drivers/media/dvb/dvb-core/dvbdev.c index d949ad77d..fa857dd48 100644 --- a/linux/drivers/media/dvb/dvb-core/dvbdev.c +++ b/linux/drivers/media/dvb/dvb-core/dvbdev.c @@ -1,4 +1,4 @@ -/* +/* * dvbdev.c * * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de> @@ -80,7 +80,7 @@ static struct dvb_device* dvbdev_find_device (int minor) static int dvb_device_open(struct inode *inode, struct file *file) { struct dvb_device *dvbdev; - + dvbdev = dvbdev_find_device (iminor(inode)); if (dvbdev && dvbdev->fops) { @@ -152,7 +152,7 @@ int dvb_generic_release(struct inode *inode, struct file *file) } else { dvbdev->writers++; } - + dvbdev->users++; return 0; } @@ -163,7 +163,7 @@ int dvb_generic_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { struct dvb_device *dvbdev = file->private_data; - + if (!dvbdev) return -ENODEV; @@ -195,7 +195,7 @@ skip: } -int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, +int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, const struct dvb_device *template, void *priv, int type) { struct dvb_device *dvbdev; @@ -219,7 +219,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, } up (&dvbdev_register_lock); - + memcpy(dvbdev, template, sizeof(struct dvb_device)); dvbdev->type = type; dvbdev->id = id; @@ -231,7 +231,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, list_add_tail (&dvbdev->list_head, &adap->device_list); devfs_mk_cdev(MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), - S_IFCHR | S_IRUSR | S_IWUSR, + S_IFCHR | S_IRUSR | S_IWUSR, "dvb/adapter%d/%s%d", adap->num, dnames[type], id); class_simple_device_add(dvb_class, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), @@ -239,7 +239,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n", adap->num, dnames[type], id, nums2minor(adap->num, type, id), - nums2minor(adap->num, type, id)); + nums2minor(adap->num, type, id)); return 0; } @@ -306,7 +306,7 @@ int dvb_register_adapter(struct dvb_adapter **padap, const char *name, struct mo INIT_LIST_HEAD (&adap->device_list); printk ("DVB: registering new adapter (%s).\n", name); - + devfs_mk_dir("dvb/adapter%d", num); adap->num = num; adap->name = name; @@ -447,4 +447,3 @@ module_exit(exit_dvbdev); MODULE_DESCRIPTION("DVB Core Driver"); MODULE_AUTHOR("Marcus Metzler, Ralph Metzler, Holger Waechtler"); MODULE_LICENSE("GPL"); - diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.h b/linux/drivers/media/dvb/dvb-core/dvbdev.h index ef1f5f9d9..184edba3c 100644 --- a/linux/drivers/media/dvb/dvb-core/dvbdev.h +++ b/linux/drivers/media/dvb/dvb-core/dvbdev.h @@ -1,4 +1,4 @@ -/* +/* * dvbdev.h * * Copyright (C) 2000 Ralph Metzler & Marcus Metzler @@ -80,7 +80,7 @@ extern int dvb_register_adapter (struct dvb_adapter **padap, const char *name, s extern int dvb_unregister_adapter (struct dvb_adapter *adap); extern int dvb_register_device (struct dvb_adapter *adap, - struct dvb_device **pdvbdev, + struct dvb_device **pdvbdev, const struct dvb_device *template, void *priv, int type); @@ -100,6 +100,5 @@ extern int dvb_usercopy(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg, int (*func)(struct inode *inode, struct file *file, unsigned int cmd, void *arg)); - -#endif /* #ifndef _DVBDEV_H_ */ +#endif /* #ifndef _DVBDEV_H_ */ diff --git a/linux/drivers/media/dvb/frontends/at76c651.c b/linux/drivers/media/dvb/frontends/at76c651.c index 812d814dc..861876791 100644 --- a/linux/drivers/media/dvb/frontends/at76c651.c +++ b/linux/drivers/media/dvb/frontends/at76c651.c @@ -255,14 +255,6 @@ static int at76c651_set_inversion(struct at76c651_state* state, fe_spectral_inve return at76c651_writereg(state, 0x60, feciqinv); } - - - - - - - - static int at76c651_set_parameters(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) { @@ -355,7 +347,6 @@ static int at76c651_read_snr(struct dvb_frontend* fe, u16* snr) ((at76c651_readreg(state, 0x8F) << 8) | at76c651_readreg(state, 0x90)); - return 0; } diff --git a/linux/drivers/media/dvb/frontends/at76c651.h b/linux/drivers/media/dvb/frontends/at76c651.h index 47fd9af48..34054df93 100644 --- a/linux/drivers/media/dvb/frontends/at76c651.h +++ b/linux/drivers/media/dvb/frontends/at76c651.h @@ -1,6 +1,6 @@ /* * at76c651.c - * + * * Atmel DVB-C Frontend Driver (at76c651) * * Copyright (C) 2001 fnbrd <fnbrd@gmx.de> @@ -41,7 +41,7 @@ struct at76c651_config int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); }; -extern struct dvb_frontend* at76c651_attach(const struct at76c651_config* config, +extern struct dvb_frontend* at76c651_attach(const struct at76c651_config* config, struct i2c_adapter* i2c); #endif // AT76C651_H diff --git a/linux/drivers/media/dvb/frontends/cx22700.c b/linux/drivers/media/dvb/frontends/cx22700.c index cddfe05a8..663002da3 100644 --- a/linux/drivers/media/dvb/frontends/cx22700.c +++ b/linux/drivers/media/dvb/frontends/cx22700.c @@ -230,16 +230,6 @@ static int cx22700_get_tps (struct cx22700_state* state, struct dvb_ofdm_paramet return 0; } - - - - - - - - - - static int cx22700_init (struct dvb_frontend* fe) { struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv; @@ -409,11 +399,11 @@ error: static struct dvb_frontend_ops cx22700_ops = { .info = { - .name = "Conexant CX22700 DVB-T", - .type = FE_OFDM, - .frequency_min = 470000000, - .frequency_max = 860000000, - .frequency_stepsize = 166667, + .name = "Conexant CX22700 DVB-T", + .type = FE_OFDM, + .frequency_min = 470000000, + .frequency_max = 860000000, + .frequency_stepsize = 166667, .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | diff --git a/linux/drivers/media/dvb/frontends/cx22702.c b/linux/drivers/media/dvb/frontends/cx22702.c index 845a5a4cd..7bcff1c62 100644 --- a/linux/drivers/media/dvb/frontends/cx22702.c +++ b/linux/drivers/media/dvb/frontends/cx22702.c @@ -195,18 +195,6 @@ static int cx22702_get_tps (struct cx22702_state *state, struct dvb_ofdm_paramet return 0; } - - - - - - - - - - - - /* Talk to the demod, set the FEC, GUARD, QAM settings etc */ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) { @@ -259,7 +247,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet return 0; } - /* manually programmed values */ + /* manually programmed values */ val=0; switch(p->u.ofdm.constellation) { case QPSK: val = (val&0xe7); break; @@ -332,7 +320,6 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet return 0; } - /* Reset the demod hardware and reset all of the configuration registers to a default state. */ static int cx22702_init (struct dvb_frontend* fe) diff --git a/linux/drivers/media/dvb/frontends/cx24110.c b/linux/drivers/media/dvb/frontends/cx24110.c index 5121a8939..4bbffaae2 100644 --- a/linux/drivers/media/dvb/frontends/cx24110.c +++ b/linux/drivers/media/dvb/frontends/cx24110.c @@ -131,7 +131,6 @@ static int cx24110_writereg (struct cx24110_state* state, int reg, int data) return 0; } - static int cx24110_readreg (struct cx24110_state* state, u8 reg) { int ret; @@ -181,7 +180,6 @@ static int cx24110_set_inversion (struct cx24110_state* state, fe_spectral_inver return 0; } - static int cx24110_set_fec (struct cx24110_state* state, fe_code_rate_t fec) { /* fixme (low): error handling */ @@ -227,7 +225,6 @@ static int cx24110_set_fec (struct cx24110_state* state, fe_code_rate_t fec) return 0; } - static fe_code_rate_t cx24110_get_fec (struct cx24110_state* state) { int i; @@ -244,7 +241,6 @@ static fe_code_rate_t cx24110_get_fec (struct cx24110_state* state) } } - static int cx24110_set_symbolrate (struct cx24110_state* state, u32 srate) { /* fixme (low): add error handling */ @@ -317,17 +313,6 @@ dprintk("cx24110 debug: entering %s(%d)\n",__FUNCTION__,srate); } - - - - - - - - - - - int cx24110_pll_write (struct dvb_frontend* fe, u32 data) { struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; @@ -369,8 +354,6 @@ int cx24110_pll_write (struct dvb_frontend* fe, u32 data) return 0; } - - static int cx24110_initfe(struct dvb_frontend* fe) { struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; @@ -388,7 +371,6 @@ static int cx24110_initfe(struct dvb_frontend* fe) return 0; } - static int cx24110_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage) { struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; @@ -531,7 +513,7 @@ static int cx24110_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par static int cx24110_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) { - struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; + struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; s32 afc; unsigned sclk; /* cannot read back tuner settings (freq). Need to have some private storage */ @@ -558,7 +540,7 @@ static int cx24110_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par static int cx24110_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) { - struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; + struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv; return cx24110_writereg(state,0x76,(cx24110_readreg(state,0x76)&~0x10)|(((tone==SEC_TONE_ON))?0x10:0)); } @@ -587,7 +569,7 @@ struct dvb_frontend* cx24110_attach(const struct cx24110_config* config, memcpy(&state->ops, &cx24110_ops, sizeof(struct dvb_frontend_ops)); state->lastber = 0; state->lastbler = 0; - state->lastesn0 = 0; + state->lastesn0 = 0; /* check if the demod is there */ ret = cx24110_readreg(state, 0x00); diff --git a/linux/drivers/media/dvb/frontends/dib3000-common.c b/linux/drivers/media/dvb/frontends/dib3000-common.c index 13ba61d53..1a4f1f7c2 100644 --- a/linux/drivers/media/dvb/frontends/dib3000-common.c +++ b/linux/drivers/media/dvb/frontends/dib3000-common.c @@ -9,6 +9,7 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,2=i2c,4=srch (|-able))."); #define deb_i2c(args...) dprintk(0x02,args) #define deb_srch(args...) dprintk(0x04,args) + int dib3000_read_reg(struct dib3000_state *state, u16 reg) { u8 wb[] = { ((reg >> 8) | 0x80) & 0xff, reg & 0xff }; @@ -17,10 +18,10 @@ int dib3000_read_reg(struct dib3000_state *state, u16 reg) { .addr = state->config.demod_address, .flags = 0, .buf = wb, .len = 2 }, { .addr = state->config.demod_address, .flags = I2C_M_RD, .buf = rb, .len = 2 }, }; - + if (i2c_transfer(state->i2c, msg, 2) != 2) deb_i2c("i2c read error\n"); - + deb_i2c("reading i2c bus (reg: %5d 0x%04x, val: %5d 0x%04x)\n",reg,reg, (rb[0] << 8) | rb[1],(rb[0] << 8) | rb[1]); @@ -33,8 +34,8 @@ int dib3000_write_reg(struct dib3000_state *state, u16 reg, u16 val) (reg >> 8) & 0xff, reg & 0xff, (val >> 8) & 0xff, val & 0xff, }; - struct i2c_msg msg[] = { - { .addr = state->config.demod_address, .flags = 0, .buf = b, .len = 4 } + struct i2c_msg msg[] = { + { .addr = state->config.demod_address, .flags = 0, .buf = b, .len = 4 } }; deb_i2c("writing i2c bus (reg: %5d 0x%04x, val: %5d 0x%04x)\n",reg,reg,val,val); @@ -55,7 +56,7 @@ int dib3000_search_status(u16 irq,u16 lock) deb_srch("auto search failed\n"); return 0; // auto search failed } - return -1; // try again + return -1; // try again } /* for auto search */ @@ -72,7 +73,7 @@ u16 dib3000_seq[2][2][2] = /* fft,gua, inv */ }; MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de"); -MODULE_DESCRIPTION("Common functions for the dib3000mb/dib3000mc dvb-frontend drivers"); +MODULE_DESCRIPTION("Common functions for the dib3000mb/dib3000mc dvb frontend drivers"); MODULE_LICENSE("GPL"); EXPORT_SYMBOL(dib3000_seq); diff --git a/linux/drivers/media/dvb/frontends/dib3000.h b/linux/drivers/media/dvb/frontends/dib3000.h index a5e21f6bb..80687c130 100644 --- a/linux/drivers/media/dvb/frontends/dib3000.h +++ b/linux/drivers/media/dvb/frontends/dib3000.h @@ -1,5 +1,5 @@ /* - * public header file of the frontend drivers for mobile DVB-T demodulators + * public header file of the frontend drivers for mobile DVB-T demodulators * DiBcom 3000M-B and DiBcom 3000P/M-C (http://www.dibcom.fr/) * * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) diff --git a/linux/drivers/media/dvb/frontends/dib3000mb.c b/linux/drivers/media/dvb/frontends/dib3000mb.c index 71bd57705..3beb4483a 100644 --- a/linux/drivers/media/dvb/frontends/dib3000mb.c +++ b/linux/drivers/media/dvb/frontends/dib3000mb.c @@ -20,6 +20,7 @@ * see Documentation/dvb/README.dibusb for more information * */ + #include <linux/config.h> #include <linux/kernel.h> #include <linux/version.h> @@ -41,7 +42,7 @@ static int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe (|-able))."); -#endif +#endif #define deb_info(args...) dprintk(0x01,args) #define deb_xfer(args...) dprintk(0x02,args) #define deb_setf(args...) dprintk(0x04,args) @@ -290,12 +291,12 @@ static int dib3000mb_set_frontend(struct dvb_frontend* fe, wr(DIB3000MB_REG_RESTART, DIB3000MB_RESTART_AUTO_SEARCH); wr(DIB3000MB_REG_RESTART, DIB3000MB_RESTART_OFF); - while ((search_state = + while ((search_state = dib3000_search_status( rd(DIB3000MB_REG_AS_IRQ_PENDING), - rd(DIB3000MB_REG_LOCK2_VALUE))) < 0 && as_count++ < 100) + rd(DIB3000MB_REG_LOCK2_VALUE))) < 0 && as_count++ < 100) msleep(1); - + deb_setf("search_state after autosearch %d after %d checks\n",search_state,as_count); if (search_state == 1) { @@ -430,7 +431,7 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe, fep->inversion = ((inv_test2 == 2) && (inv_test1==1 || inv_test1==0)) || - ((inv_test2 == 0) && (inv_test1==1 || inv_test1==2)) ? + ((inv_test2 == 0) && (inv_test1==1 || inv_test1==2)) ? INVERSION_ON : INVERSION_OFF; deb_getf("inversion %d %d, %d\n", inv_test2, inv_test1, fep->inversion); @@ -451,7 +452,7 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe, default: err("Unexpected constellation returned by TPS (%d)", tps_val); break; - } + } deb_getf("TPS: %d\n", tps_val); if (rd(DIB3000MB_REG_TPS_HRCH)) { @@ -480,7 +481,7 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe, break; } deb_getf("TPS: %d\n", tps_val); - + tps_val = rd(DIB3000MB_REG_TPS_CODE_RATE_LP); } else { deb_getf("HRCH OFF\n"); @@ -668,7 +669,7 @@ static int dib3000mb_pid_control(struct dvb_frontend *fe,int index, int pid,int return 0; } -static int dib3000mb_fifo_control(struct dvb_frontend *fe, int onoff) +static int dib3000mb_fifo_control(struct dvb_frontend *fe, int onoff) { struct dib3000_state *state = (struct dib3000_state*) fe->demodulator_priv; @@ -681,7 +682,7 @@ static int dib3000mb_fifo_control(struct dvb_frontend *fe, int onoff) return 0; } -static int dib3000mb_pid_parse(struct dvb_frontend *fe, int onoff) +static int dib3000mb_pid_parse(struct dvb_frontend *fe, int onoff) { struct dib3000_state *state = fe->demodulator_priv; deb_xfer("%s pid parsing\n",onoff ? "enabling" : "disabling"); @@ -718,12 +719,12 @@ struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, memcpy(&state->ops, &dib3000mb_ops, sizeof(struct dvb_frontend_ops)); /* check for the correct demod */ - if (rd(DIB3000_REG_MANUFACTOR_ID) != DIB3000_I2C_ID_DIBCOM) + if (rd(DIB3000_REG_MANUFACTOR_ID) != DIB3000_I2C_ID_DIBCOM) goto error; if (rd(DIB3000_REG_DEVICE_ID) != DIB3000MB_DEVICE_ID) goto error; - + /* create dvb_frontend */ state->frontend.ops = &state->ops; state->frontend.demodulator_priv = state; @@ -733,7 +734,7 @@ struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, xfer_ops->fifo_ctrl = dib3000mb_fifo_control; xfer_ops->pid_ctrl = dib3000mb_pid_control; xfer_ops->tuner_pass_ctrl = dib3000mb_tuner_pass_ctrl; - + return &state->frontend; error: @@ -741,14 +742,14 @@ error: kfree(state); return NULL; } - + static struct dvb_frontend_ops dib3000mb_ops = { .info = { .name = "DiBcom 3000M-B DVB-T", - .type = FE_OFDM, - .frequency_min = 44250000, - .frequency_max = 867250000, + .type = FE_OFDM, + .frequency_min = 44250000, + .frequency_max = 867250000, .frequency_stepsize = 62500, .caps = FE_CAN_INVERSION_AUTO | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | diff --git a/linux/drivers/media/dvb/frontends/dib3000mc.c b/linux/drivers/media/dvb/frontends/dib3000mc.c index 9bed3dd05..76707bfca 100644 --- a/linux/drivers/media/dvb/frontends/dib3000mc.c +++ b/linux/drivers/media/dvb/frontends/dib3000mc.c @@ -51,7 +51,7 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe,16=s static int dib3000mc_tuner_pass_ctrl(struct dvb_frontend *fe, int onoff, u8 pll_addr); static int dib3000mc_set_impulse_noise(struct dib3000_state * state, int mode, - fe_transmit_mode_t transmission_mode, fe_bandwidth_t bandwidth) + fe_transmit_mode_t transmission_mode, fe_bandwidth_t bandwidth) { switch (transmission_mode) { case TRANSMISSION_MODE_2K: @@ -60,13 +60,13 @@ static int dib3000mc_set_impulse_noise(struct dib3000_state * state, int mode, case TRANSMISSION_MODE_8K: wr_foreach(dib3000mc_reg_fft,dib3000mc_fft_modes[1]); break; - default: + default: break; } switch (bandwidth) { /* case BANDWIDTH_5_MHZ: - wr_foreach(dib3000mc_reg_impulse_noise,dib3000mc_impluse_noise[0]); + wr_foreach(dib3000mc_reg_impulse_noise,dib3000mc_impluse_noise[0]); break; */ case BANDWIDTH_6_MHZ: wr_foreach(dib3000mc_reg_impulse_noise,dib3000mc_impluse_noise[1]); @@ -77,12 +77,12 @@ static int dib3000mc_set_impulse_noise(struct dib3000_state * state, int mode, case BANDWIDTH_8_MHZ: wr_foreach(dib3000mc_reg_impulse_noise,dib3000mc_impluse_noise[3]); break; - default: + default: break; } switch (mode) { - case 0: /* no impulse */ /* fall through */ + case 0: /* no impulse */ /* fall through */ wr_foreach(dib3000mc_reg_imp_noise_ctl,dib3000mc_imp_noise_ctl[0]); break; case 1: /* new algo */ @@ -107,14 +107,14 @@ static int dib3000mc_set_timing(struct dib3000_state *state, int upd_offset, case BANDWIDTH_8_MHZ: comp = DIB3000MC_CLOCK_REF*8; break; case BANDWIDTH_7_MHZ: comp = DIB3000MC_CLOCK_REF*7; break; case BANDWIDTH_6_MHZ: comp = DIB3000MC_CLOCK_REF*6; break; - default: err("unknown bandwidth (%d)",bw); break; + default: err("unknown bandwidth (%d)",bw); break; } timf_msb = (comp >> 16) & 0xff; timf_lsb = (comp & 0xffff); // Update the timing offset ; if (upd_offset > 0) { - if (!state->timing_offset_comp_done) { + if (!state->timing_offset_comp_done) { msleep(200); state->timing_offset_comp_done = 1; } @@ -128,11 +128,11 @@ static int dib3000mc_set_timing(struct dib3000_state *state, int upd_offset, tim_offset = state->timing_offset; if (tim_offset < 0) { - tim_sgn = 1; + tim_sgn = 1; tim_offset = -tim_offset; - } else + } else tim_sgn = 0; - + comp1 = (u32)tim_offset * (u32)timf_lsb ; comp2 = (u32)tim_offset * (u32)timf_msb ; comp = ((comp1 >> 16) + comp2) >> 7; @@ -141,7 +141,7 @@ static int dib3000mc_set_timing(struct dib3000_state *state, int upd_offset, comp = (u32)(timf_msb << 16) + (u32) timf_lsb + comp; else comp = (u32)(timf_msb << 16) + (u32) timf_lsb - comp ; - + timf_msb = (comp >> 16) & 0xff; timf_lsb = comp & 0xffff; @@ -177,7 +177,7 @@ static int dib3000mc_init_auto_scan(struct dib3000_state *state, fe_bandwidth_t return -EINVAL; } if (boost) { - u32 timeout = (rd(DIB3000MC_REG_BW_TIMOUT_MSB) << 16) + + u32 timeout = (rd(DIB3000MC_REG_BW_TIMOUT_MSB) << 16) + rd(DIB3000MC_REG_BW_TIMOUT_LSB); timeout *= 85; timeout >>= 7; wr(DIB3000MC_REG_BW_TIMOUT_MSB,(timeout >> 16) & 0xffff); @@ -189,13 +189,13 @@ static int dib3000mc_init_auto_scan(struct dib3000_state *state, fe_bandwidth_t static int dib3000mc_set_adp_cfg(struct dib3000_state *state, fe_modulation_t con) { switch (con) { - case QAM_64: + case QAM_64: wr_foreach(dib3000mc_reg_adp_cfg,dib3000mc_adp_cfg[2]); break; - case QAM_16: + case QAM_16: wr_foreach(dib3000mc_reg_adp_cfg,dib3000mc_adp_cfg[1]); break; - case QPSK: + case QPSK: wr_foreach(dib3000mc_reg_adp_cfg,dib3000mc_adp_cfg[0]); break; case QAM_AUTO: @@ -237,7 +237,7 @@ static int dib3000mc_set_general_cfg(struct dib3000_state *state, struct dvb_fro } switch (ofdm->hierarchy_information) { case HIERARCHY_NONE: /* fall through */ - case HIERARCHY_1: alpha = DIB3000_ALPHA_1; break; + case HIERARCHY_1: alpha = DIB3000_ALPHA_1; break; case HIERARCHY_2: alpha = DIB3000_ALPHA_2; break; case HIERARCHY_4: alpha = DIB3000_ALPHA_4; break; case HIERARCHY_AUTO: break; @@ -262,7 +262,7 @@ static int dib3000mc_set_general_cfg(struct dib3000_state *state, struct dvb_fro case FEC_AUTO: break; default: return -EINVAL; } - + wr(DIB3000MC_REG_DEMOD_PARM,DIB3000MC_DEMOD_PARM(alpha,qam,guard,fft)); wr(DIB3000MC_REG_HRCH_PARM,DIB3000MC_HRCH_PARM(sel_hp,cr,hrch)); @@ -327,14 +327,14 @@ static int dib3000mc_get_frontend(struct dvb_frontend* fe, fep->inversion = ((inv_test2 == 2) && (inv_test1==1 || inv_test1==0)) || - ((inv_test2 == 0) && (inv_test1==1 || inv_test1==2)) ? + ((inv_test2 == 0) && (inv_test1==1 || inv_test1==2)) ? INVERSION_ON : INVERSION_OFF; deb_getf("inversion %d %d, %d\n", inv_test2, inv_test1, fep->inversion); fep->frequency = state->last_tuned_freq; fep->u.ofdm.bandwidth= state->last_tuned_bw; - + tps_val = rd(DIB3000MC_REG_TUNING_PARM); switch (DIB3000MC_TP_QAM(tps_val)) { @@ -353,7 +353,7 @@ static int dib3000mc_get_frontend(struct dvb_frontend* fe, default: err("Unexpected constellation returned by TPS (%d)", tps_val); break; - } + } if (DIB3000MC_TP_HRCH(tps_val)) { deb_getf("HRCH ON "); @@ -462,12 +462,12 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe, struct dvb_ofdm_parameters *ofdm = &fep->u.ofdm; int search_state,auto_val; u16 val; - + if (tuner) { /* initial call from dvb */ dib3000mc_tuner_pass_ctrl(fe,1,state->config.pll_addr(fe)); state->config.pll_set(fe,fep,NULL); dib3000mc_tuner_pass_ctrl(fe,0,state->config.pll_addr(fe)); - + state->last_tuned_freq = fep->frequency; // if (!scanboost) { dib3000mc_set_timing(state,0,ofdm->transmission_mode,ofdm->bandwidth); @@ -477,7 +477,7 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe, wr_foreach(dib3000mc_reg_agc_bandwidth,dib3000mc_agc_bandwidth); wr(DIB3000MC_REG_RESTART,DIB3000MC_RESTART_AGC); wr(DIB3000MC_REG_RESTART,DIB3000MC_RESTART_OFF); - + /* Default cfg isi offset adp */ wr_foreach(dib3000mc_reg_offset,dib3000mc_offset[0]); @@ -495,7 +495,7 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe, auto_val = 0; dib3000mc_set_general_cfg(state,fep,&auto_val); dib3000mc_set_impulse_noise(state,0,ofdm->constellation,ofdm->bandwidth); - + val = rd(DIB3000MC_REG_DEMOD_PARM); wr(DIB3000MC_REG_DEMOD_PARM,val|DIB3000MC_DEMOD_RST_DEMOD_ON); wr(DIB3000MC_REG_DEMOD_PARM,val); @@ -507,17 +507,17 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe, int as_count=0; deb_setf("autosearch enabled.\n"); - + val = rd(DIB3000MC_REG_DEMOD_PARM); wr(DIB3000MC_REG_DEMOD_PARM,val | DIB3000MC_DEMOD_RST_AUTO_SRCH_ON); wr(DIB3000MC_REG_DEMOD_PARM,val); while ((search_state = dib3000_search_status( - rd(DIB3000MC_REG_AS_IRQ),1)) < 0 && as_count++ < 100) + rd(DIB3000MC_REG_AS_IRQ),1)) < 0 && as_count++ < 100) msleep(10); - + deb_info("search_state after autosearch %d after %d checks\n",search_state,as_count); - + if (search_state == 1) { struct dvb_frontend_parameters feps; if (dib3000mc_get_frontend(fe, &feps) == 0) { @@ -529,33 +529,31 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe, dib3000mc_set_impulse_noise(state,0,ofdm->transmission_mode,ofdm->bandwidth); wr(DIB3000MC_REG_ISI,DIB3000MC_ISI_DEFAULT|DIB3000MC_ISI_ACTIVATE); dib3000mc_set_adp_cfg(state,ofdm->constellation); - + /* set_offset_cfg */ wr_foreach(dib3000mc_reg_offset, dib3000mc_offset[(ofdm->transmission_mode == TRANSMISSION_MODE_8K)+1]); } } else { /* second call, after autosearch (fka: set_WithKnownParams) */ // dib3000mc_set_timing(state,1,ofdm->transmission_mode,ofdm->bandwidth); - + auto_val = 0; dib3000mc_set_general_cfg(state,fep,&auto_val); if (auto_val) deb_info("auto_val is true, even though an auto search was already performed.\n"); dib3000mc_set_impulse_noise(state,0,ofdm->constellation,ofdm->bandwidth); - + val = rd(DIB3000MC_REG_DEMOD_PARM); wr(DIB3000MC_REG_DEMOD_PARM,val | DIB3000MC_DEMOD_RST_AUTO_SRCH_ON); wr(DIB3000MC_REG_DEMOD_PARM,val); - + msleep(30); - + wr(DIB3000MC_REG_ISI,DIB3000MC_ISI_DEFAULT|DIB3000MC_ISI_ACTIVATE); dib3000mc_set_adp_cfg(state,ofdm->constellation); wr_foreach(dib3000mc_reg_offset, dib3000mc_offset[(ofdm->transmission_mode == TRANSMISSION_MODE_8K)+1]); - - } return 0; } @@ -567,26 +565,26 @@ static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) state->timing_offset = 0; state->timing_offset_comp_done = 0; - + wr(DIB3000MC_REG_RESTART,DIB3000MC_RESTART_CONFIG); wr(DIB3000MC_REG_RESTART,DIB3000MC_RESTART_OFF); wr(DIB3000MC_REG_CLK_CFG_1,DIB3000MC_CLK_CFG_1_POWER_UP); wr(DIB3000MC_REG_CLK_CFG_2,DIB3000MC_CLK_CFG_2_PUP_MOBILE); wr(DIB3000MC_REG_CLK_CFG_3,DIB3000MC_CLK_CFG_3_POWER_UP); wr(DIB3000MC_REG_CLK_CFG_7,DIB3000MC_CLK_CFG_7_INIT); - + wr(DIB3000MC_REG_RST_UNC,DIB3000MC_RST_UNC_OFF); wr(DIB3000MC_REG_UNK_19,DIB3000MC_UNK_19); wr(33,5); wr(36,81); - wr(DIB3000MC_REG_UNK_88,DIB3000MC_UNK_88); - + wr(DIB3000MC_REG_UNK_88,DIB3000MC_UNK_88); + wr(DIB3000MC_REG_UNK_99,DIB3000MC_UNK_99); wr(DIB3000MC_REG_UNK_111,DIB3000MC_UNK_111_PH_N_MODE_0); /* phase noise algo off */ /* mobile mode - portable reception */ - wr_foreach(dib3000mc_reg_mobile_mode,dib3000mc_mobile_mode[1]); + wr_foreach(dib3000mc_reg_mobile_mode,dib3000mc_mobile_mode[1]); /* TUNER_PANASONIC_ENV57H12D5: */ wr_foreach(dib3000mc_reg_agc_bandwidth,dib3000mc_agc_bandwidth); @@ -599,24 +597,24 @@ static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) wr(DIB3000MC_REG_UNK_2,DIB3000MC_UNK_2); wr(DIB3000MC_REG_UNK_3,DIB3000MC_UNK_3); wr(DIB3000MC_REG_SEQ_TPS,DIB3000MC_SEQ_TPS_DEFAULT); - + wr_foreach(dib3000mc_reg_bandwidth,dib3000mc_bandwidth_8mhz); wr_foreach(dib3000mc_reg_bandwidth_general,dib3000mc_bandwidth_general); - + wr(DIB3000MC_REG_UNK_4,DIB3000MC_UNK_4); wr(DIB3000MC_REG_SET_DDS_FREQ_MSB,DIB3000MC_DDS_FREQ_MSB_INV_OFF); wr(DIB3000MC_REG_SET_DDS_FREQ_LSB,DIB3000MC_DDS_FREQ_LSB); - dib3000mc_set_timing(state,0,TRANSMISSION_MODE_8K,BANDWIDTH_8_MHZ); + dib3000mc_set_timing(state,0,TRANSMISSION_MODE_8K,BANDWIDTH_8_MHZ); // wr_foreach(dib3000mc_reg_timing_freq,dib3000mc_timing_freq[3]); - + wr(DIB3000MC_REG_UNK_120,DIB3000MC_UNK_120); wr(DIB3000MC_REG_UNK_134,DIB3000MC_UNK_134); wr(DIB3000MC_REG_FEC_CFG,DIB3000MC_FEC_CFG); - + wr(DIB3000MC_REG_DIVERSITY3,DIB3000MC_DIVERSITY3_IN_OFF); - + dib3000mc_set_impulse_noise(state,0,TRANSMISSION_MODE_8K,BANDWIDTH_8_MHZ); /* output mode control, just the MPEG2_SLAVE */ @@ -632,13 +630,13 @@ static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) rd(DIB3000MC_REG_OUTMODE))); wr(DIB3000MC_REG_SMO_MODE, - DIB3000MC_SMO_MODE_DEFAULT | + DIB3000MC_SMO_MODE_DEFAULT | DIB3000MC_SMO_MODE_188); wr(DIB3000MC_REG_FIFO_THRESHOLD,DIB3000MC_FIFO_THRESHOLD_DEFAULT); wr(DIB3000MC_REG_ELEC_OUT,DIB3000MC_ELEC_OUT_DIV_OUT_ON); */ - + /* diversity */ wr(DIB3000MC_REG_DIVERSITY1,DIB3000MC_DIVERSITY1_DEFAULT); wr(DIB3000MC_REG_DIVERSITY2,DIB3000MC_DIVERSITY2_DEFAULT); @@ -708,14 +706,14 @@ static int dib3000mc_read_snr(struct dvb_frontend* fe, u16 *snr) u16 val = rd(DIB3000MC_REG_SIGNAL_NOISE_LSB), val2 = rd(DIB3000MC_REG_SIGNAL_NOISE_MSB); u16 sig,noise; - + sig = (((val >> 6) & 0xff) << 8) + (val & 0x3f); noise = (((val >> 4) & 0xff) << 8) + ((val & 0xf) << 2) + ((val2 >> 14) & 0x3); if (noise == 0) *snr = 0xffff; else *snr = (u16) sig/noise; - + deb_stat("signal: mantisse = %d, exponent = %d\n",(sig >> 8) & 0xff, sig & 0xff); deb_stat("noise: mantisse = %d, exponent = %d\n",(noise >> 8) & 0xff, noise & 0xff); deb_stat("snr: %d\n",*snr); @@ -753,7 +751,7 @@ static int dib3000mc_set_frontend_and_tuner(struct dvb_frontend* fe, struct dvb_ } static void dib3000mc_release(struct dvb_frontend* fe) -{ +{ struct dib3000_state *state = (struct dib3000_state *) fe->demodulator_priv; kfree(state); } @@ -771,9 +769,9 @@ static int dib3000mc_fifo_control(struct dvb_frontend *fe, int onoff) { struct dib3000_state *state = (struct dib3000_state*) fe->demodulator_priv; u16 tmp = rd(DIB3000MC_REG_SMO_MODE); - + deb_xfer("%s fifo\n",onoff ? "enabling" : "disabling"); - + if (onoff) { deb_xfer("%d %x\n",tmp & DIB3000MC_SMO_MODE_FIFO_UNFLUSH,tmp & DIB3000MC_SMO_MODE_FIFO_UNFLUSH); wr(DIB3000MC_REG_SMO_MODE,tmp & DIB3000MC_SMO_MODE_FIFO_UNFLUSH); @@ -784,13 +782,13 @@ static int dib3000mc_fifo_control(struct dvb_frontend *fe, int onoff) return 0; } -static int dib3000mc_pid_parse(struct dvb_frontend *fe, int onoff) +static int dib3000mc_pid_parse(struct dvb_frontend *fe, int onoff) { struct dib3000_state *state = fe->demodulator_priv; u16 tmp = rd(DIB3000MC_REG_SMO_MODE); - + deb_xfer("%s pid parsing\n",onoff ? "enabling" : "disabling"); - + if (onoff) { wr(DIB3000MC_REG_SMO_MODE,tmp | DIB3000MC_SMO_MODE_PID_PARSE); } else { @@ -810,7 +808,7 @@ static int dib3000mc_tuner_pass_ctrl(struct dvb_frontend *fe, int onoff, u8 pll_ return 0; } -static int dib3000mc_demod_init(struct dib3000_state *state) +static int dib3000mc_demod_init(struct dib3000_state *state) { u16 default_addr = 0x0a; /* first init */ @@ -818,13 +816,13 @@ static int dib3000mc_demod_init(struct dib3000_state *state) deb_info("initializing the demod the first time. Setting demod addr to 0x%x\n",default_addr); wr(DIB3000MC_REG_ELEC_OUT,DIB3000MC_ELEC_OUT_DIV_OUT_ON); wr(DIB3000MC_REG_OUTMODE,DIB3000MC_OM_PAR_CONT_CLK); - + wr(DIB3000MC_REG_RST_I2C_ADDR, DIB3000MC_DEMOD_ADDR(default_addr) | DIB3000MC_DEMOD_ADDR_ON); - + state->config.demod_address = default_addr; - + wr(DIB3000MC_REG_RST_I2C_ADDR, DIB3000MC_DEMOD_ADDR(default_addr)); } else @@ -852,13 +850,13 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, memcpy(&state->ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops)); /* check for the correct demod */ - if (rd(DIB3000_REG_MANUFACTOR_ID) != DIB3000_I2C_ID_DIBCOM) + if (rd(DIB3000_REG_MANUFACTOR_ID) != DIB3000_I2C_ID_DIBCOM) goto error; devid = rd(DIB3000_REG_DEVICE_ID); if (devid != DIB3000MC_DEVICE_ID && devid != DIB3000P_DEVICE_ID) goto error; - + switch (devid) { case DIB3000MC_DEVICE_ID: info("Found a DiBcom 3000M-C, interesting..."); @@ -879,7 +877,7 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, xfer_ops->tuner_pass_ctrl = dib3000mc_tuner_pass_ctrl; dib3000mc_demod_init(state); - + return &state->frontend; error: @@ -887,20 +885,20 @@ error: kfree(state); return NULL; } - + static struct dvb_frontend_ops dib3000mc_ops = { .info = { .name = "DiBcom 3000P/M-C DVB-T", - .type = FE_OFDM, - .frequency_min = 44250000, - .frequency_max = 867250000, + .type = FE_OFDM, + .frequency_min = 44250000, + .frequency_max = 867250000, .frequency_stepsize = 62500, .caps = FE_CAN_INVERSION_AUTO | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO | - FE_CAN_TRANSMISSION_MODE_AUTO | + FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_RECOVER | FE_CAN_HIERARCHY_AUTO, diff --git a/linux/drivers/media/dvb/frontends/dib3000mc_priv.h b/linux/drivers/media/dvb/frontends/dib3000mc_priv.h index 178403da1..2930aac75 100644 --- a/linux/drivers/media/dvb/frontends/dib3000mc_priv.h +++ b/linux/drivers/media/dvb/frontends/dib3000mc_priv.h @@ -1,12 +1,12 @@ /* * dib3000mc_priv.h - * + * * Copyright (C) 2004 Patrick Boettcher (patrick.boettcher@desy.de) - * + * * 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, version 2. - * + * * for more information see dib3000mc.c . */ @@ -15,10 +15,10 @@ /* * Demodulator parameters - * reg: 0 1 1 1 11 11 111 + * reg: 0 1 1 1 11 11 111 * | | | | | | * | | | | | +-- alpha (000=0, 001=1, 010=2, 100=4) - * | | | | +----- constellation (00=QPSK, 01=16QAM, 10=64QAM) + * | | | | +----- constellation (00=QPSK, 01=16QAM, 10=64QAM) * | | | +-------- guard (00=1/32, 01=1/16, 10=1/8, 11=1/4) * | | +----------- transmission mode (0=2k, 1=8k) * | | @@ -49,7 +49,7 @@ (0x1 & s) | \ ((0x7 & f) << 1) | \ ((0x1 & h) << 4) ) - + /* timeout ??? */ #define DIB3000MC_REG_UNK_1 ( 1) #define DIB3000MC_UNK_1 ( 0x04) @@ -74,16 +74,16 @@ #define DIB3000MC_IS_TPS(v) ((v << 8) & 0x1) #define DIB3000MC_IS_AS(v) ((v >> 4) & 0xf) -/* parameters for the bandwidth */ +/* parameters for the bandwidth */ #define DIB3000MC_REG_BW_TIMOUT_MSB ( 6) #define DIB3000MC_REG_BW_TIMOUT_LSB ( 7) static u16 dib3000mc_reg_bandwidth[] = { 6,7,8,9,10,11,16,17 }; -/*static u16 dib3000mc_bandwidth_5mhz[] = +/*static u16 dib3000mc_bandwidth_5mhz[] = { 0x28, 0x9380, 0x87, 0x4100, 0x2a4, 0x4500, 0x1, 0xb0d0 };*/ -static u16 dib3000mc_bandwidth_6mhz[] = +static u16 dib3000mc_bandwidth_6mhz[] = { 0x21, 0xd040, 0x70, 0xb62b, 0x233, 0x8ed5, 0x1, 0xb0d0 }; static u16 dib3000mc_bandwidth_7mhz[] = @@ -107,7 +107,7 @@ static u16 dib3000mc_bandwidth_general[] = { 0x0000, 0x03e8, 0x0000, 0x03f2 }; #define DIB3000MC_REG_UNK_19 ( 19) #define DIB3000MC_UNK_19 ( 0) -/* DDS frequency value (IF position) and inversion bit */ +/* DDS frequency value (IF position) and inversion bit */ #define DIB3000MC_REG_INVERSION ( 21) #define DIB3000MC_REG_SET_DDS_FREQ_MSB ( 21) #define DIB3000MC_DDS_FREQ_MSB_INV_OFF (0x0164) @@ -125,7 +125,7 @@ static u16 dib3000mc_bandwidth_general[] = { 0x0000, 0x03e8, 0x0000, 0x03f2 }; //static u16 dib3000mc_timing_freq[][2] = { // { 0x69, 0x9f18 }, /* 5 MHz */ -// { 0x7e ,0xbee9 }, /* 6 MHz */ +// { 0x7e ,0xbee9 }, /* 6 MHz */ // { 0x93 ,0xdebb }, /* 7 MHz */ // { 0xa8 ,0xfe8c }, /* 8 MHz */ //}; @@ -155,7 +155,7 @@ static u16 dib3000mc_imp_noise_ctl[][2] = { { 0x1294, 0x1ff8 }, /* mode 4 */ }; -/* AGC registers */ +/* AGC registers */ static u16 dib3000mc_reg_agc[] = { 36,37,38,39,42,43,44,45,46,47,48,49 }; @@ -164,8 +164,8 @@ static u16 dib3000mc_agc_tuner[][12] = { { 0x0051, 0x301d, 0x0000, 0x1cc7, 0xcf5c, 0x6666, 0xbae1, 0xa148, 0x3b5e, 0x3c1c, 0x001a, 0x2019 }, /* TUNER_PANASONIC_ENV77H04D5, */ - - { 0x0051, 0x301d, 0x0000, 0x1cc7, 0xdc29, 0x570a, + + { 0x0051, 0x301d, 0x0000, 0x1cc7, 0xdc29, 0x570a, 0xbae1, 0x8ccd, 0x3b6d, 0x551d, 0x000a, 0x951e }, /* TUNER_PANASONIC_ENV57H13D5, TUNER_PANASONIC_ENV57H12D5 */ @@ -184,10 +184,10 @@ static u16 dib3000mc_reg_agc_bandwidth[] = { 40,41 }; static u16 dib3000mc_agc_bandwidth[] = { 0x119,0x330 }; static u16 dib3000mc_reg_agc_bandwidth_general[] = { 50,51,52,53,54 }; -static u16 dib3000mc_agc_bandwidth_general[] = +static u16 dib3000mc_agc_bandwidth_general[] = { 0x8000, 0x91ca, 0x01ba, 0x0087, 0x0087 }; -#define DIB3000MC_REG_IMP_NOISE_55 ( 55) +#define DIB3000MC_REG_IMP_NOISE_55 ( 55) #define DIB3000MC_IMP_NEW_ALGO(w) (w | (1<<10)) /* Impulse noise params */ @@ -202,26 +202,26 @@ static u16 dib3000mc_impluse_noise[][3] = { static u16 dib3000mc_reg_fft[] = { 58,59,60,61,62,63,64,65,66,67,68,69, 70,71,72,73,74,75,76,77,78,79,80,81, - 82,83,84,85,86 + 82,83,84,85,86 }; static u16 dib3000mc_fft_modes[][29] = { - { 0x38, 0x6d9, 0x3f28, 0x7a7, 0x3a74, 0x196, 0x32a, 0x48c, - 0x3ffe, 0x7f3, 0x2d94, 0x76, 0x53d, - 0x3ff8, 0x7e3, 0x3320, 0x76, 0x5b3, - 0x3feb, 0x7d2, 0x365e, 0x76, 0x48c, - 0x3ffe, 0x5b3, 0x3feb, 0x76, 0x0, 0xd + { 0x38, 0x6d9, 0x3f28, 0x7a7, 0x3a74, 0x196, 0x32a, 0x48c, + 0x3ffe, 0x7f3, 0x2d94, 0x76, 0x53d, + 0x3ff8, 0x7e3, 0x3320, 0x76, 0x5b3, + 0x3feb, 0x7d2, 0x365e, 0x76, 0x48c, + 0x3ffe, 0x5b3, 0x3feb, 0x76, 0x0, 0xd }, /* fft mode 0 */ { 0x3b, 0x6d9, 0x3f28, 0x7a7, 0x3a74, 0x196, 0x32a, 0x48c, - 0x3ffe, 0x7f3, 0x2d94, 0x76, 0x53d, - 0x3ff8, 0x7e3, 0x3320, 0x76, 0x5b3, - 0x3feb, 0x7d2, 0x365e, 0x76, 0x48c, - 0x3ffe, 0x5b3, 0x3feb, 0x0, 0x8200, 0xd + 0x3ffe, 0x7f3, 0x2d94, 0x76, 0x53d, + 0x3ff8, 0x7e3, 0x3320, 0x76, 0x5b3, + 0x3feb, 0x7d2, 0x365e, 0x76, 0x48c, + 0x3ffe, 0x5b3, 0x3feb, 0x0, 0x8200, 0xd }, /* fft mode 1 */ }; #define DIB3000MC_REG_UNK_88 ( 88) -#define DIB3000MC_UNK_88 (0x0410) +#define DIB3000MC_UNK_88 (0x0410) static u16 dib3000mc_reg_bw[] = { 93,94,95,96,97,98 }; static u16 dib3000mc_bw[][6] = { @@ -261,7 +261,7 @@ static u16 dib3000mc_bw[][6] = { /* adapter config for constellation */ static u16 dib3000mc_reg_adp_cfg[] = { 129, 130, 131, 132 }; -static u16 dib3000mc_adp_cfg[][4] = { +static u16 dib3000mc_adp_cfg[][4] = { { 0x99a, 0x7fae, 0x333, 0x7ff0 }, /* QPSK */ { 0x23d, 0x7fdf, 0x0a4, 0x7ff0 }, /* 16-QAM */ { 0x148, 0x7ff0, 0x0a4, 0x7ff8 }, /* 64-QAM */ @@ -299,7 +299,7 @@ static u16 dib3000mc_mobile_mode[][5] = { * |||| +---- fifo_ctrl (1 = inhibit (flushed), 0 = active (unflushed)) * |||+------ pid_parse (1 = enabled, 0 = disabled) * ||+------- outp_188 (1 = TS packet size 188, 0 = packet size 204) - * |+-------- unk + * |+-------- unk * +--------- unk */ diff --git a/linux/drivers/media/dvb/frontends/dvb_dummy_fe.c b/linux/drivers/media/dvb/frontends/dvb_dummy_fe.c index 8e94d99f3..375d6f3b4 100644 --- a/linux/drivers/media/dvb/frontends/dvb_dummy_fe.c +++ b/linux/drivers/media/dvb/frontends/dvb_dummy_fe.c @@ -27,14 +27,12 @@ #include "dvb_dummy_fe.h" - struct dvb_dummy_fe_state { - struct dvb_frontend_ops ops; - struct dvb_frontend frontend; }; + static int dvb_dummy_fe_read_status(struct dvb_frontend* fe, fe_status_t* status) { *status = FE_HAS_SIGNAL @@ -179,9 +177,9 @@ static struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops = { .info = { .name = "Dummy DVB-T", - .type = FE_OFDM, - .frequency_min = 0, - .frequency_max = 863250000, + .type = FE_OFDM, + .frequency_min = 0, + .frequency_max = 863250000, .frequency_stepsize = 62500, .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 | @@ -211,12 +209,12 @@ static struct dvb_frontend_ops dvb_dummy_fe_qam_ops = { .info = { .name = "Dummy DVB-C", - .type = FE_QAM, + .type = FE_QAM, .frequency_stepsize = 62500, - .frequency_min = 51000000, - .frequency_max = 858000000, - .symbol_rate_min = (57840000/2)/64, /* SACLK/64 == (XIN/2)/64 */ - .symbol_rate_max = (57840000/2)/4, /* SACLK/4 */ + .frequency_min = 51000000, + .frequency_max = 858000000, + .symbol_rate_min = (57840000/2)/64, /* SACLK/64 == (XIN/2)/64 */ + .symbol_rate_max = (57840000/2)/4, /* SACLK/4 */ .caps = FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 | FE_CAN_QAM_128 | FE_CAN_QAM_256 | FE_CAN_FEC_AUTO | FE_CAN_INVERSION_AUTO @@ -240,14 +238,14 @@ static struct dvb_frontend_ops dvb_dummy_fe_qam_ops = { static struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops = { .info = { - .name = "Dummy DVB-S", - .type = FE_QPSK, - .frequency_min = 950000, - .frequency_max = 2150000, - .frequency_stepsize = 250, /* kHz for QPSK frontends */ - .frequency_tolerance = 29500, - .symbol_rate_min = 1000000, - .symbol_rate_max = 45000000, + .name = "Dummy DVB-S", + .type = FE_QPSK, + .frequency_min = 950000, + .frequency_max = 2150000, + .frequency_stepsize = 250, /* kHz for QPSK frontends */ + .frequency_tolerance = 29500, + .symbol_rate_min = 1000000, + .symbol_rate_max = 45000000, .caps = FE_CAN_INVERSION_AUTO | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | @@ -269,7 +267,7 @@ static struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops = { .read_ucblocks = dvb_dummy_fe_read_ucblocks, .set_voltage = dvb_dummy_fe_set_voltage, - .set_tone = dvb_dummy_fe_set_tone, + .set_tone = dvb_dummy_fe_set_tone, }; MODULE_DESCRIPTION("DVB DUMMY Frontend"); diff --git a/linux/drivers/media/dvb/frontends/l64781.c b/linux/drivers/media/dvb/frontends/l64781.c index 9d2a98194..66e7426d0 100644 --- a/linux/drivers/media/dvb/frontends/l64781.c +++ b/linux/drivers/media/dvb/frontends/l64781.c @@ -31,17 +31,13 @@ struct l64781_state { - struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - const struct l64781_config* config; - struct dvb_frontend frontend; /* private demodulator data */ - int first:1; + int first:1; }; #define dprintk(args...) \ @@ -543,7 +539,7 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config, /* Responds to all reads with 0 */ if (l64781_readreg(state, 0x1a) != 0) { - dprintk("Read 1 returned unexpcted value\n"); + dprintk("Read 1 returned unexpcted value\n"); goto error; } @@ -552,7 +548,7 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config, /* Responds with register default value */ if (l64781_readreg(state, 0x1a) != 0xa1) { - dprintk("Read 2 returned unexpcted value\n"); + dprintk("Read 2 returned unexpcted value\n"); goto error; } @@ -580,10 +576,10 @@ static struct dvb_frontend_ops l64781_ops = { .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | - FE_CAN_MUTE_TS + FE_CAN_MUTE_TS }, - .release = l64781_release, + .release = l64781_release, .init = l64781_init, .sleep = l64781_sleep, diff --git a/linux/drivers/media/dvb/frontends/mt312.c b/linux/drivers/media/dvb/frontends/mt312.c index 4f4fef72a..9880b3742 100644 --- a/linux/drivers/media/dvb/frontends/mt312.c +++ b/linux/drivers/media/dvb/frontends/mt312.c @@ -36,14 +36,10 @@ struct mt312_state { - struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - /* configuration settings */ const struct mt312_config* config; - struct dvb_frontend frontend; u8 id; @@ -228,20 +224,6 @@ static int mt312_get_code_rate(struct mt312_state* state, fe_code_rate_t *cr) return 0; } - - - - - - - - - - - - - - static int mt312_initfe(struct dvb_frontend* fe) { struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv; @@ -716,7 +698,7 @@ static struct dvb_frontend_ops vp310_mt312_ops = { FE_CAN_RECOVER }, - .release = mt312_release, + .release = mt312_release, .init = mt312_initfe, .sleep = mt312_sleep, diff --git a/linux/drivers/media/dvb/frontends/mt312_priv.h b/linux/drivers/media/dvb/frontends/mt312_priv.h index 1ddff687e..5e0b95b53 100644 --- a/linux/drivers/media/dvb/frontends/mt312_priv.h +++ b/linux/drivers/media/dvb/frontends/mt312_priv.h @@ -1,4 +1,4 @@ -/* +/* Driver for Zarlink MT312 QPSK Frontend Copyright (C) 2003 Andreas Oberritter <obi@linuxtv.org> diff --git a/linux/drivers/media/dvb/frontends/mt352.c b/linux/drivers/media/dvb/frontends/mt352.c index 3c82909ea..7e29a25c1 100644 --- a/linux/drivers/media/dvb/frontends/mt352.c +++ b/linux/drivers/media/dvb/frontends/mt352.c @@ -68,16 +68,16 @@ static int mt352_single_write(struct dvb_frontend *fe, u8 reg, u8 val) printk("mt352_write() to reg %x failed (err = %d)!\n", reg, err); return err; } - return 0; + return 0; } int mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen) { int err,i; for (i=0; i < ilen-1; i++) - if ((err = mt352_single_write(fe,ibuf[0]+i,ibuf[i+1]))) + if ((err = mt352_single_write(fe,ibuf[0]+i,ibuf[i+1]))) return err; - + return 0; } @@ -108,7 +108,7 @@ int mt352_read(struct dvb_frontend *fe, u8 reg) { return mt352_read_register(fe->demodulator_priv,reg); } - + static int mt352_sleep(struct dvb_frontend* fe) { static u8 mt352_softdown[] = { CLOCK_CTL, 0x20, 0x08 }; diff --git a/linux/drivers/media/dvb/frontends/nxt2002.c b/linux/drivers/media/dvb/frontends/nxt2002.c index 55a4a5961..ff3b261fd 100644 --- a/linux/drivers/media/dvb/frontends/nxt2002.c +++ b/linux/drivers/media/dvb/frontends/nxt2002.c @@ -1,5 +1,5 @@ /* - Support for B2C2/BBTI Technisat Air2PC - ATSC + Support for B2C2/BBTI Technisat Air2PC - ATSC Copyright (C) 2004 Taylor Jacob <rtjacob@earthlink.net> @@ -59,7 +59,7 @@ static int i2c_writebytes (struct nxt2002_state* state, u8 reg, u8 *buf, u8 len) u8 buf2 [256],x; int err; struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf2, .len = len + 1 }; - + buf2[0] = reg; for (x = 0 ; x < len ; x++) buf2[x+1] = buf[x]; @@ -91,12 +91,12 @@ static u8 i2c_readbytes (struct nxt2002_state* state, u8 reg, u8* buf, u8 len) return 0; } -static u16 nxt2002_crc(u16 crc, u8 c) +static u16 nxt2002_crc(u16 crc, u8 c) { u8 i; u16 input = (u16) c & 0xFF; - + input<<=8; for(i=0 ;i<8 ;i++) { if((crc ^ input) & 0x8000) @@ -130,7 +130,7 @@ static int nxt2002_writereg_multibyte (struct nxt2002_state* state, u8 reg, u8* if ((buf & 0x02) == 0) return 0; - + dprintk("Error writing multireg register %02X\n",reg); return 0; @@ -162,16 +162,16 @@ static void nxt2002_microcontroller_stop (struct nxt2002_state* state) buf[0] = 0x80; i2c_writebytes(state,0x22,buf,1); - while (counter < 20) { + while (counter < 20) { i2c_readbytes(state,0x31,buf,1); - if (buf[0] & 0x40) + if (buf[0] & 0x40) return; msleep(10); counter++; } dprintk("Timeout waiting for micro to stop.. This is ok after firmware upload\n"); - return; + return; } static void nxt2002_microcontroller_start (struct nxt2002_state* state) @@ -211,7 +211,7 @@ static int nxt2002_writetuner (struct nxt2002_state* state, u8* data) /* write UC Opmode to begin transfer */ buf = 0x80; i2c_writebytes(state,0x21,&buf,1); - + while (count < 20) { i2c_readbytes(state,0x21,&buf,1); if ((buf & 0x80)== 0x00) @@ -243,7 +243,7 @@ static int nxt2002_load_firmware (struct dvb_frontend* fe, const struct firmware struct nxt2002_state* state = (struct nxt2002_state*) fe->demodulator_priv; u8 buf[256],written = 0,chunkpos = 0; - u16 rambase,position,crc = 0; + u16 rambase,position,crc = 0; dprintk("%s\n", __FUNCTION__); dprintk("Firmware is %d bytes\n",fw->size); @@ -251,7 +251,6 @@ static int nxt2002_load_firmware (struct dvb_frontend* fe, const struct firmware /* Get the RAM base for this nxt2002 */ i2c_readbytes(state,0x10,buf,1); - if (buf[0] & 0x10) rambase = 0x1000; else @@ -263,7 +262,6 @@ static int nxt2002_load_firmware (struct dvb_frontend* fe, const struct firmware buf[0] = 0x80; i2c_writebytes(state,0x2B,buf,1); - for (position = 0; position < fw->size ; position++) { if (written == 0) { crc = 0; @@ -274,7 +272,7 @@ static int nxt2002_load_firmware (struct dvb_frontend* fe, const struct firmware /* write starting address */ i2c_writebytes(state,0x29,buf,3); } - written++; + written++; chunkpos++; if ((written % 4) == 0) @@ -282,7 +280,6 @@ static int nxt2002_load_firmware (struct dvb_frontend* fe, const struct firmware crc = nxt2002_crc(crc,fw->data[position]); - if ((written == 255) || (position+1 == fw->size)) { /* write remaining bytes of firmware */ i2c_writebytes(state, chunkpos+4-(written %4), @@ -290,7 +287,7 @@ static int nxt2002_load_firmware (struct dvb_frontend* fe, const struct firmware written %4); buf[0] = crc << 8; buf[1] = crc & 0xFF; - + /* write crc */ i2c_writebytes(state,0x2C,buf,2); @@ -309,24 +306,23 @@ static int nxt2002_load_firmware (struct dvb_frontend* fe, const struct firmware return 0; }; - static int nxt2002_setup_frontend_parameters (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) { struct nxt2002_state* state = (struct nxt2002_state*) fe->demodulator_priv; u32 freq = 0; - u16 tunerfreq = 0; + u16 tunerfreq = 0; u8 buf[4]; - freq = 44000 + ( p->frequency / 1000 ); + freq = 44000 + ( p->frequency / 1000 ); dprintk("freq = %d p->frequency = %d\n",freq,p->frequency); tunerfreq = freq * 24/4000; - + buf[0] = (tunerfreq >> 8) & 0x7F; buf[1] = (tunerfreq & 0xFF); - + if (p->frequency <= 214000000) { buf[2] = 0x84 + (0x06 << 3); buf[3] = (p->frequency <= 172000000) ? 0x01 : 0x02; @@ -337,7 +333,7 @@ static int nxt2002_setup_frontend_parameters (struct dvb_frontend* fe, buf[2] = 0x84 + (0x0E << 3); buf[3] = 0x08; } else { - buf[2] = 0x84 + (0x0F << 3); + buf[2] = 0x84 + (0x0F << 3); buf[3] = 0x02; } @@ -347,8 +343,6 @@ static int nxt2002_setup_frontend_parameters (struct dvb_frontend* fe, /* reset the agc now that tuning has been completed */ nxt2002_agc_reset(state); - - /* set target power level */ switch (p->u.vsb.modulation) { case QAM_64: @@ -449,7 +443,7 @@ static int nxt2002_setup_frontend_parameters (struct dvb_frontend* fe, nxt2002_microcontroller_start(state); - /* adjacent channel detection should be done here, but I don't + /* adjacent channel detection should be done here, but I don't have any stations with this need so I cannot test it */ return 0; @@ -466,7 +460,7 @@ static int nxt2002_read_status(struct dvb_frontend* fe, fe_status_t* status) *status |= FE_HAS_SIGNAL; *status |= FE_HAS_CARRIER; *status |= FE_HAS_VITERBI; - *status |= FE_HAS_SYNC; + *status |= FE_HAS_SYNC; *status |= FE_HAS_LOCK; } return 0; @@ -477,10 +471,10 @@ static int nxt2002_read_ber(struct dvb_frontend* fe, u32* ber) struct nxt2002_state* state = (struct nxt2002_state*) fe->demodulator_priv; u8 b[3]; - nxt2002_readreg_multibyte(state,0xE6,b,3); + nxt2002_readreg_multibyte(state,0xE6,b,3); *ber = ((b[0] << 8) + b[1]) * 8; - + return 0; } @@ -495,7 +489,7 @@ static int nxt2002_read_signal_strength(struct dvb_frontend* fe, u16* strength) i2c_writebytes(state,0xA1,b,1); /* get multreg val */ - nxt2002_readreg_multibyte(state,0xA6,b,2); + nxt2002_readreg_multibyte(state,0xA6,b,2); temp = (b[0] << 8) | b[1]; *strength = ((0x7FFF - temp) & 0x0FFF) * 16; @@ -516,7 +510,7 @@ static int nxt2002_read_snr(struct dvb_frontend* fe, u16* snr) i2c_writebytes(state,0xA1,b,1); /* get multreg val from 0xA6 */ - nxt2002_readreg_multibyte(state,0xA6,b,2); + nxt2002_readreg_multibyte(state,0xA6,b,2); temp = (b[0] << 8) | b[1]; temp2 = 0x7FFF - temp; @@ -542,9 +536,8 @@ static int nxt2002_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) { struct nxt2002_state* state = (struct nxt2002_state*) fe->demodulator_priv; u8 b[3]; - - nxt2002_readreg_multibyte(state,0xE6,b,3); + nxt2002_readreg_multibyte(state,0xE6,b,3); *ucblocks = b[2]; return 0; @@ -582,7 +575,7 @@ static int nxt2002_init(struct dvb_frontend* fe) /* Put the micro into reset */ nxt2002_microcontroller_stop(state); - + /* ensure transfer is complete */ buf[0]=0; i2c_writebytes(state,0x2B,buf,1); @@ -597,7 +590,7 @@ static int nxt2002_init(struct dvb_frontend* fe) i2c_writebytes(state,0x08,buf,1); /* write agc sdm configure */ - buf[0] = 0xF1; + buf[0] = 0xF1; i2c_writebytes(state,0x57,buf,1); /* write mod output format */ @@ -654,11 +647,11 @@ struct dvb_frontend* nxt2002_attach(const struct nxt2002_config* config, /* Check the first 5 registers to ensure this a revision we can handle */ i2c_readbytes(state, 0x00, buf, 5); - if (buf[0] != 0x04) goto error; /* device id */ - if (buf[1] != 0x02) goto error; /* fab id */ - if (buf[2] != 0x11) goto error; /* month */ - if (buf[3] != 0x20) goto error; /* year msb */ - if (buf[4] != 0x00) goto error; /* year lsb */ + if (buf[0] != 0x04) goto error; /* device id */ + if (buf[1] != 0x02) goto error; /* fab id */ + if (buf[2] != 0x11) goto error; /* month */ + if (buf[3] != 0x20) goto error; /* year msb */ + if (buf[4] != 0x00) goto error; /* year lsb */ /* create dvb_frontend */ state->frontend.ops = &state->ops; @@ -678,7 +671,7 @@ static struct dvb_frontend_ops nxt2002_ops = { .frequency_min = 54000000, .frequency_max = 860000000, /* stepsize is just a guess */ - .frequency_stepsize = 166666, + .frequency_stepsize = 166666, .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | FE_CAN_8VSB | FE_CAN_QAM_64 | FE_CAN_QAM_256 diff --git a/linux/drivers/media/dvb/frontends/nxt2002.h b/linux/drivers/media/dvb/frontends/nxt2002.h index a177d5e6b..462301f57 100644 --- a/linux/drivers/media/dvb/frontends/nxt2002.h +++ b/linux/drivers/media/dvb/frontends/nxt2002.h @@ -18,6 +18,6 @@ struct nxt2002_config }; extern struct dvb_frontend* nxt2002_attach(const struct nxt2002_config* config, - struct i2c_adapter* i2c); + struct i2c_adapter* i2c); #endif // NXT2002_H diff --git a/linux/drivers/media/dvb/frontends/nxt6000.c b/linux/drivers/media/dvb/frontends/nxt6000.c index c0fa123e9..9708d4732 100644 --- a/linux/drivers/media/dvb/frontends/nxt6000.c +++ b/linux/drivers/media/dvb/frontends/nxt6000.c @@ -32,16 +32,11 @@ struct nxt6000_state { - struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - /* configuration settings */ const struct nxt6000_config* config; - struct dvb_frontend frontend; - }; static int debug = 0; @@ -424,16 +419,6 @@ static void nxt6000_dump_status(struct nxt6000_state *state) printk("\n"); } - - - - - - - - - - static int nxt6000_read_status(struct dvb_frontend* fe, fe_status_t* status) { u8 core_status; @@ -474,7 +459,6 @@ static int nxt6000_init(struct dvb_frontend* fe) return 0; } - static int nxt6000_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *param) { struct nxt6000_state* state = (struct nxt6000_state*) fe->demodulator_priv; @@ -496,7 +480,6 @@ static int nxt6000_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par return 0; } - static void nxt6000_release(struct dvb_frontend* fe) { struct nxt6000_state* state = (struct nxt6000_state*) fe->demodulator_priv; diff --git a/linux/drivers/media/dvb/frontends/sp8870.c b/linux/drivers/media/dvb/frontends/sp8870.c index 72338d461..538cb03ee 100644 --- a/linux/drivers/media/dvb/frontends/sp8870.c +++ b/linux/drivers/media/dvb/frontends/sp8870.c @@ -130,7 +130,7 @@ static int sp8870_firmware_upload (struct sp8870_state* state, const struct firm msg.flags = 0; msg.buf = tx_buf; msg.len = tx_len + 2; - if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { + if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { printk("%s: firmware upload failed!\n", __FUNCTION__); printk ("%s: i2c error (err == %i)\n", __FUNCTION__, err); return err; diff --git a/linux/drivers/media/dvb/frontends/sp887x.c b/linux/drivers/media/dvb/frontends/sp887x.c index 5f7aee97a..f34c010d0 100644 --- a/linux/drivers/media/dvb/frontends/sp887x.c +++ b/linux/drivers/media/dvb/frontends/sp887x.c @@ -20,13 +20,9 @@ struct sp887x_state { - struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - const struct sp887x_config* config; - struct dvb_frontend frontend; /* demodulator private data */ @@ -345,19 +341,6 @@ static void sp887x_correct_offsets (struct sp887x_state* state, sp887x_writereg(state, 0x30a, frequency_shift & 0xfff); } - - - - - - - - - - - - - static int sp887x_setup_frontend_parameters (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) { diff --git a/linux/drivers/media/dvb/frontends/stv0297.c b/linux/drivers/media/dvb/frontends/stv0297.c index e1e0b5e19..65255113f 100644 --- a/linux/drivers/media/dvb/frontends/stv0297.c +++ b/linux/drivers/media/dvb/frontends/stv0297.c @@ -29,13 +29,9 @@ #include "stv0297.h" struct stv0297_state { - struct i2c_adapter *i2c; - struct dvb_frontend_ops ops; - const struct stv0297_config *config; - struct dvb_frontend frontend; unsigned long base_freq; @@ -367,18 +363,6 @@ static int stv0297_set_inversion(struct stv0297_state *state, fe_spectral_invers return 0; } - - - - - - - - - - - - int stv0297_enable_plli2c(struct dvb_frontend *fe) { struct stv0297_state *state = (struct stv0297_state *) fe->demodulator_priv; diff --git a/linux/drivers/media/dvb/frontends/stv0299.c b/linux/drivers/media/dvb/frontends/stv0299.c index bbe24fc47..a468f8804 100644 --- a/linux/drivers/media/dvb/frontends/stv0299.c +++ b/linux/drivers/media/dvb/frontends/stv0299.c @@ -54,13 +54,9 @@ #include "stv0299.h" struct stv0299_state { - struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - const struct stv0299_config* config; - struct dvb_frontend frontend; u8 initialised:1; @@ -102,7 +98,6 @@ int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data) return stv0299_writeregI(state, reg, data); } - static u8 stv0299_readreg (struct stv0299_state* state, u8 reg) { int ret; @@ -120,7 +115,6 @@ static u8 stv0299_readreg (struct stv0299_state* state, u8 reg) return b1[0]; } - static int stv0299_readregs (struct stv0299_state* state, u8 reg1, u8 *b, u8 len) { int ret; @@ -135,7 +129,6 @@ static int stv0299_readregs (struct stv0299_state* state, u8 reg1, u8 *b, u8 len return ret == 2 ? 0 : ret; } - static int stv0299_set_FEC (struct stv0299_state* state, fe_code_rate_t fec) { dprintk ("%s\n", __FUNCTION__); @@ -172,7 +165,6 @@ static int stv0299_set_FEC (struct stv0299_state* state, fe_code_rate_t fec) } } - static fe_code_rate_t stv0299_get_fec (struct stv0299_state* state) { static fe_code_rate_t fec_tab [] = { FEC_2_3, FEC_3_4, FEC_5_6, @@ -190,7 +182,6 @@ static fe_code_rate_t stv0299_get_fec (struct stv0299_state* state) return fec_tab [index]; } - static int stv0299_wait_diseqc_fifo (struct stv0299_state* state, int timeout) { unsigned long start = jiffies; @@ -208,7 +199,6 @@ static int stv0299_wait_diseqc_fifo (struct stv0299_state* state, int timeout) return 0; } - static int stv0299_wait_diseqc_idle (struct stv0299_state* state, int timeout) { unsigned long start = jiffies; @@ -244,7 +234,6 @@ static int stv0299_set_symbolrate (struct dvb_frontend* fe, u32 srate) return state->config->set_symbol_rate(fe, srate, ratio); } - static int stv0299_get_symbolrate (struct stv0299_state* state) { u32 Mclk = state->config->mclk / 4096L; @@ -277,19 +266,6 @@ static int stv0299_get_symbolrate (struct stv0299_state* state) return srate; } - - - - - - - - - - - - - static int stv0299_send_diseqc_msg (struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *m) { @@ -321,7 +297,6 @@ static int stv0299_send_diseqc_msg (struct dvb_frontend* fe, return 0; } - static int stv0299_send_diseqc_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) { struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; @@ -349,7 +324,6 @@ static int stv0299_send_diseqc_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t return 0; } - static int stv0299_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone) { struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; @@ -372,7 +346,6 @@ static int stv0299_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone) } } - static int stv0299_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage) { struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; @@ -412,7 +385,6 @@ static int stv0299_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag }; } - static int stv0299_send_legacy_dish_cmd(struct dvb_frontend* fe, u32 cmd) { u8 last = 1; @@ -433,9 +405,7 @@ static int stv0299_send_legacy_dish_cmd(struct dvb_frontend* fe, u32 cmd) for (i=0; i<9; i++) { if((cmd & 0x01) != last) { - stv0299_set_voltage(fe, - last ? SEC_VOLTAGE_13 : - SEC_VOLTAGE_18); + stv0299_set_voltage(fe, last ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18); last = (last) ? 0 : 1; } @@ -448,7 +418,6 @@ static int stv0299_send_legacy_dish_cmd(struct dvb_frontend* fe, u32 cmd) return 0; } - static int stv0299_init (struct dvb_frontend* fe) { struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; @@ -468,7 +437,6 @@ static int stv0299_init (struct dvb_frontend* fe) return 0; } - static int stv0299_read_status(struct dvb_frontend* fe, fe_status_t* status) { struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv; diff --git a/linux/drivers/media/dvb/frontends/tda10021.c b/linux/drivers/media/dvb/frontends/tda10021.c index 72da8b69e..8bbcec71d 100644 --- a/linux/drivers/media/dvb/frontends/tda10021.c +++ b/linux/drivers/media/dvb/frontends/tda10021.c @@ -1,4 +1,4 @@ -/* +/* TDA10021 - Single Chip Cable Channel Receiver driver module used on the the Siemens DVB-C cards @@ -19,7 +19,7 @@ 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. -*/ +*/ #include <linux/config.h> #include <linux/delay.h> @@ -35,20 +35,16 @@ struct tda10021_state { - struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - /* configuration settings */ const struct tda10021_config* config; - struct dvb_frontend frontend; u8 pwm; u8 reg0; }; - + #if 0 #define dprintk(x...) printk(x) @@ -70,9 +66,9 @@ static u8 tda10021_inittab[0x40]= { 0x73, 0x6a, 0x23, 0x0a, 0x02, 0x37, 0x77, 0x1a, 0x37, 0x6a, 0x17, 0x8a, 0x1e, 0x86, 0x43, 0x40, - 0xb8, 0x3f, 0xa1, 0x00, 0xcd, 0x01, 0x00, 0xff, + 0xb8, 0x3f, 0xa1, 0x00, 0xcd, 0x01, 0x00, 0xff, 0x11, 0x00, 0x7c, 0x31, 0x30, 0x20, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x33, 0x11, 0x0d, 0x95, 0x08, 0x58, 0x00, 0x00, 0x80, 0x00, 0x80, 0xff, 0x00, 0x00, 0x04, 0x2d, 0x2f, 0xff, 0x00, 0x00, 0x00, 0x00, @@ -94,7 +90,6 @@ static int tda10021_writereg (struct tda10021_state* state, u8 reg, u8 data) return (ret != 1) ? -EREMOTEIO : 0; } - static u8 tda10021_readreg (struct tda10021_state* state, u8 reg) { u8 b0 [] = { reg }; @@ -115,7 +110,7 @@ static int lock_tuner(struct tda10021_state* state) { u8 buf[2] = { 0x0f, tda10021_inittab[0x0f] | 0x80 }; struct i2c_msg msg = {.addr=state->config->demod_address, .flags=0, .buf=buf, .len=2}; - + if(i2c_transfer(state->i2c, &msg, 1) != 1) { printk("tda10021: lock tuner fails\n"); @@ -129,7 +124,7 @@ static int unlock_tuner(struct tda10021_state* state) { u8 buf[2] = { 0x0f, tda10021_inittab[0x0f] & 0x7f }; struct i2c_msg msg_post={.addr=state->config->demod_address, .flags=0, .buf=buf, .len=2}; - + if(i2c_transfer(state->i2c, &msg_post, 1) != 1) { printk("tda10021: unlock tuner fails\n"); @@ -142,12 +137,12 @@ static int tda10021_setup_reg0 (struct tda10021_state* state, u8 reg0, fe_spectral_inversion_t inversion) { reg0 |= state->reg0 & 0x63; - + if (INVERSION_ON == inversion) ENABLE_INVERSION(reg0); else if (INVERSION_OFF == inversion) DISABLE_INVERSION(reg0); - + tda10021_writereg (state, 0x00, reg0 & 0xfe); tda10021_writereg (state, 0x00, reg0 | 0x01); @@ -157,13 +152,13 @@ static int tda10021_setup_reg0 (struct tda10021_state* state, u8 reg0, static int tda10021_set_symbolrate (struct tda10021_state* state, u32 symbolrate) { - s32 BDR; + s32 BDR; s32 BDRI; s16 SFIL=0; u16 NDEC = 0; u32 tmp, ratio; - if (symbolrate > XIN/2) + if (symbolrate > XIN/2) symbolrate = XIN/2; if (symbolrate < 500000) symbolrate = 500000; @@ -171,7 +166,7 @@ static int tda10021_set_symbolrate (struct tda10021_state* state, u32 symbolrate if (symbolrate < XIN/16) NDEC = 1; if (symbolrate < XIN/32) NDEC = 2; if (symbolrate < XIN/64) NDEC = 3; - + if (symbolrate < (u32)(XIN/12.3)) SFIL = 1; if (symbolrate < (u32)(XIN/16)) SFIL = 0; if (symbolrate < (u32)(XIN/24.6)) SFIL = 1; @@ -179,22 +174,22 @@ static int tda10021_set_symbolrate (struct tda10021_state* state, u32 symbolrate if (symbolrate < (u32)(XIN/49.2)) SFIL = 1; if (symbolrate < (u32)(XIN/64)) SFIL = 0; if (symbolrate < (u32)(XIN/98.4)) SFIL = 1; - + symbolrate <<= NDEC; ratio = (symbolrate << 4) / FIN; tmp = ((symbolrate << 4) % FIN) << 8; ratio = (ratio << 8) + tmp / FIN; tmp = (tmp % FIN) << 8; ratio = (ratio << 8) + (tmp + FIN/2) / FIN; - + BDR = ratio; BDRI = (((XIN << 5) / symbolrate) + 1) / 2; - - if (BDRI > 0xFF) + + if (BDRI > 0xFF) BDRI = 0xFF; - + SFIL = (SFIL << 4) | tda10021_inittab[0x0E]; - + NDEC = (NDEC << 6) | tda10021_inittab[0x03]; tda10021_writereg (state, 0x03, NDEC); @@ -208,20 +203,11 @@ static int tda10021_set_symbolrate (struct tda10021_state* state, u32 symbolrate return 0; } - - - - - - - - - static int tda10021_init (struct dvb_frontend *fe) { struct tda10021_state* state = (struct tda10021_state*) fe->demodulator_priv; int i; - + dprintk("DVB: TDA10021(%d): init chip\n", fe->adapter->num); //tda10021_writereg (fe, 0, 0); @@ -230,13 +216,13 @@ static int tda10021_init (struct dvb_frontend *fe) tda10021_writereg (state, i, tda10021_inittab[i]); tda10021_writereg (state, 0x34, state->pwm); - + //Comment by markus //0x2A[3-0] == PDIV -> P multiplaying factor (P=PDIV+1)(default 0) //0x2A[4] == BYPPLL -> Power down mode (default 1) //0x2A[5] == LCK -> PLL Lock Flag //0x2A[6] == POLAXIN -> Polarity of the input reference clock (default 0) - + //Activate PLL tda10021_writereg(state, 0x2a, tda10021_inittab[0x2a] & 0xef); @@ -255,7 +241,7 @@ static int tda10021_set_parameters (struct dvb_frontend *fe, struct tda10021_state* state = (struct tda10021_state*) fe->demodulator_priv; //table for QAM4-QAM256 ready QAM4 QAM16 QAM32 QAM64 QAM128 QAM256 - //CONF + //CONF static const u8 reg0x00 [] = { 0x14, 0x00, 0x04, 0x08, 0x0c, 0x10 }; //AGCREF value static const u8 reg0x01 [] = { 0x78, 0x8c, 0x8c, 0x6a, 0x78, 0x5c }; @@ -265,7 +251,7 @@ static int tda10021_set_parameters (struct dvb_frontend *fe, static const u8 reg0x08 [] = { 0x8c, 0xa2, 0x74, 0x43, 0x34, 0x23 }; //AREF static const u8 reg0x09 [] = { 0x96, 0x91, 0x96, 0x6a, 0x7e, 0x6b }; - + int qam = p->u.qam.modulation; if (qam < 0 || qam > 5) @@ -320,8 +306,8 @@ static int tda10021_read_ber(struct dvb_frontend* fe, u32* ber) struct tda10021_state* state = (struct tda10021_state*) fe->demodulator_priv; u32 _ber = tda10021_readreg(state, 0x14) | - (tda10021_readreg(state, 0x15) << 8) | - ((tda10021_readreg(state, 0x16) & 0x0f) << 16); + (tda10021_readreg(state, 0x15) << 8) | + ((tda10021_readreg(state, 0x16) & 0x0f) << 16); *ber = 10 * _ber; return 0; @@ -367,7 +353,7 @@ static int tda10021_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_pa struct tda10021_state* state = (struct tda10021_state*) fe->demodulator_priv; int sync; s8 afc = 0; - + sync = tda10021_readreg(state, 0x11); afc = tda10021_readreg(state, 0x19); if (verbose) { @@ -454,7 +440,7 @@ static struct dvb_frontend_ops tda10021_ops = { #endif .caps = 0x400 | //FE_CAN_QAM_4 FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 | - FE_CAN_QAM_128 | FE_CAN_QAM_256 | + FE_CAN_QAM_128 | FE_CAN_QAM_256 | FE_CAN_FEC_AUTO }, diff --git a/linux/drivers/media/dvb/frontends/tda10021.h b/linux/drivers/media/dvb/frontends/tda10021.h index fd9a5b9f8..7d6a51ce2 100644 --- a/linux/drivers/media/dvb/frontends/tda10021.h +++ b/linux/drivers/media/dvb/frontends/tda10021.h @@ -1,4 +1,4 @@ -/* +/* TDA10021 - Single Chip Cable Channel Receiver driver module used on the the Siemens DVB-C cards @@ -37,7 +37,6 @@ struct tda10021_config }; extern struct dvb_frontend* tda10021_attach(const struct tda10021_config* config, - struct i2c_adapter* i2c, - u8 pwm); + struct i2c_adapter* i2c, u8 pwm); #endif // TDA10021_H diff --git a/linux/drivers/media/dvb/frontends/tda1004x.c b/linux/drivers/media/dvb/frontends/tda1004x.c index 47c90d6e0..0860e895a 100644 --- a/linux/drivers/media/dvb/frontends/tda1004x.c +++ b/linux/drivers/media/dvb/frontends/tda1004x.c @@ -39,19 +39,14 @@ #define TDA1004X_DEMOD_TDA10046 1 -struct tda1004x_state -{ +struct tda1004x_state { struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - const struct tda1004x_config* config; - struct dvb_frontend frontend; /* private demod data */ u8 initialised:1; - u8 demod_type; }; @@ -347,7 +342,6 @@ static int tda1004x_check_upload_ok(struct tda1004x_state *state, u8 dspVersion) return 0; } - static int tda10045_fwupload(struct dvb_frontend* fe) { struct tda1004x_state* state = fe->demodulator_priv; @@ -363,7 +357,7 @@ static int tda10045_fwupload(struct dvb_frontend* fe) ret = state->config->request_firmware(fe, &fw, TDA10045_DEFAULT_FIRMWARE); if (ret) { printk("tda1004x: no firmware upload (timeout or file not found?)\n"); - return ret; + return ret; } /* reset chip */ @@ -407,7 +401,7 @@ static int tda10046_fwupload(struct dvb_frontend* fe) ret = state->config->request_firmware(fe, &fw, TDA10046_DEFAULT_FIRMWARE); if (ret) { printk("tda1004x: no firmware upload (timeout or file not found?)\n"); - return ret; + return ret; } /* set parameters */ @@ -476,23 +470,6 @@ static int tda1004x_decode_fec(int tdafec) return -1; } - - - - - - - - - - - - - - - - - int tda1004x_write_byte(struct dvb_frontend* fe, int reg, int data) { struct tda1004x_state* state = fe->demodulator_priv; diff --git a/linux/drivers/media/dvb/frontends/tda8083.c b/linux/drivers/media/dvb/frontends/tda8083.c index 03c4366e1..db6624b9f 100644 --- a/linux/drivers/media/dvb/frontends/tda8083.c +++ b/linux/drivers/media/dvb/frontends/tda8083.c @@ -35,14 +35,10 @@ struct tda8083_state { - struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - /* configuration settings */ const struct tda8083_config* config; - struct dvb_frontend frontend; }; @@ -78,7 +74,6 @@ static int tda8083_writereg (struct tda8083_state* state, u8 reg, u8 data) return (ret != 1) ? -1 : 0; } - static int tda8083_readregs (struct tda8083_state* state, u8 reg1, u8 *b, u8 len) { int ret; @@ -94,7 +89,6 @@ static int tda8083_readregs (struct tda8083_state* state, u8 reg1, u8 *b, u8 len return ret == 2 ? 0 : -1; } - static inline u8 tda8083_readreg (struct tda8083_state* state, u8 reg) { u8 val; @@ -104,8 +98,6 @@ static inline u8 tda8083_readreg (struct tda8083_state* state, u8 reg) return val; } - - static int tda8083_set_inversion (struct tda8083_state* state, fe_spectral_inversion_t inversion) { /* XXX FIXME: implement other modes than FEC_AUTO */ @@ -115,7 +107,6 @@ static int tda8083_set_inversion (struct tda8083_state* state, fe_spectral_inver return -EINVAL; } - static int tda8083_set_fec (struct tda8083_state* state, fe_code_rate_t fec) { if (fec == FEC_AUTO) @@ -127,7 +118,6 @@ static int tda8083_set_fec (struct tda8083_state* state, fe_code_rate_t fec) return -EINVAL; } - static fe_code_rate_t tda8083_get_fec (struct tda8083_state* state) { u8 index; @@ -139,7 +129,6 @@ static fe_code_rate_t tda8083_get_fec (struct tda8083_state* state) return fec_tab [index]; } - static int tda8083_set_symbolrate (struct tda8083_state* state, u32 srate) { u32 ratio; @@ -179,7 +168,6 @@ static int tda8083_set_symbolrate (struct tda8083_state* state, u32 srate) return 1; } - static void tda8083_wait_diseqc_fifo (struct tda8083_state* state, int timeout) { unsigned long start = jiffies; @@ -205,7 +193,6 @@ static int tda8083_set_tone (struct tda8083_state* state, fe_sec_tone_mode_t ton }; } - static int tda8083_set_voltage (struct tda8083_state* state, fe_sec_voltage_t voltage) { switch (voltage) { @@ -236,27 +223,6 @@ static int tda8083_send_diseqc_burst (struct tda8083_state* state, fe_sec_mini_c return 0; } - - - - - - - - - - - - - - - - - - - - - static int tda8083_send_diseqc_msg (struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *m) { @@ -475,9 +441,9 @@ static struct dvb_frontend_ops tda8083_ops = { .read_snr = tda8083_read_snr, .diseqc_send_master_cmd = tda8083_send_diseqc_msg, - .diseqc_send_burst = tda8083_diseqc_send_burst, - .set_tone = tda8083_diseqc_set_tone, - .set_voltage = tda8083_diseqc_set_voltage, + .diseqc_send_burst = tda8083_diseqc_send_burst, + .set_tone = tda8083_diseqc_set_tone, + .set_voltage = tda8083_diseqc_set_voltage, }; module_param(debug, int, 0644); diff --git a/linux/drivers/media/dvb/frontends/tda80xx.c b/linux/drivers/media/dvb/frontends/tda80xx.c index 5b8828b27..3d552c34f 100644 --- a/linux/drivers/media/dvb/frontends/tda80xx.c +++ b/linux/drivers/media/dvb/frontends/tda80xx.c @@ -204,8 +204,8 @@ static int tda80xx_set_parameters(struct tda80xx_state* state, * r = k * clk / symbol_rate * * k: 2^21 for caa 0..3, - * 2^20 for caa 4..5, - * 2^19 for caa 6..7 + * 2^20 for caa 4..5, + * 2^19 for caa 6..7 */ if (symbol_rate <= (clk * 3) / 32) k = (1 << 19); @@ -422,7 +422,7 @@ static int tda8044_init(struct dvb_frontend* fe) tda80xx_write(state, 0x00, tda8044_inittab_post, sizeof(tda8044_inittab_post)); if (state->config->pll_init) { - tda80xx_writereg(state, 0x1c, 0x80); + tda80xx_writereg(state, 0x1c, 0x80); state->config->pll_init(fe); tda80xx_writereg(state, 0x1c, 0x00); } @@ -437,7 +437,7 @@ static int tda8083_init(struct dvb_frontend* fe) tda80xx_write(state, 0x00, tda8083_inittab, sizeof(tda8083_inittab)); if (state->config->pll_init) { - tda80xx_writereg(state, 0x1c, 0x80); + tda80xx_writereg(state, 0x1c, 0x80); state->config->pll_init(fe); tda80xx_writereg(state, 0x1c, 0x00); } @@ -445,21 +445,6 @@ static int tda8083_init(struct dvb_frontend* fe) return 0; } - - - - - - - - - - - - - - - static int tda80xx_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) { struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; @@ -492,7 +477,7 @@ static int tda80xx_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) static int tda80xx_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *cmd) { - struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; + struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; if (cmd->msg_len > 6) return -EINVAL; @@ -536,7 +521,7 @@ static int tda80xx_sleep(struct dvb_frontend* fe) static int tda80xx_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) { - struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; + struct tda80xx_state* state = (struct tda80xx_state*) fe->demodulator_priv; tda80xx_writereg(state, 0x1c, 0x80); state->config->pll_set(fe, p); @@ -735,9 +720,9 @@ static struct dvb_frontend_ops tda80xx_ops = { .read_ucblocks = tda80xx_read_ucblocks, .diseqc_send_master_cmd = tda80xx_send_diseqc_msg, - .diseqc_send_burst = tda80xx_send_diseqc_burst, - .set_tone = tda80xx_set_tone, - .set_voltage = tda80xx_set_voltage, + .diseqc_send_burst = tda80xx_send_diseqc_burst, + .set_tone = tda80xx_set_tone, + .set_voltage = tda80xx_set_voltage, }; module_param(debug, int, 0644); diff --git a/linux/drivers/media/dvb/frontends/ves1820.c b/linux/drivers/media/dvb/frontends/ves1820.c index acd340ad8..62945ef1f 100644 --- a/linux/drivers/media/dvb/frontends/ves1820.c +++ b/linux/drivers/media/dvb/frontends/ves1820.c @@ -34,14 +34,10 @@ struct ves1820_state { - struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - /* configuration settings */ const struct ves1820_config* config; - struct dvb_frontend frontend; /* private demodulator data */ @@ -97,7 +93,6 @@ static u8 ves1820_readreg(struct ves1820_state *state, u8 reg) return b1[0]; } - static int ves1820_setup_reg0(struct ves1820_state *state, u8 reg0, fe_spectral_inversion_t inversion) { reg0 |= state->reg0 & 0x62; @@ -105,10 +100,8 @@ static int ves1820_setup_reg0(struct ves1820_state *state, u8 reg0, fe_spectral_ if (INVERSION_ON == inversion) { if (!state->config->invert) reg0 |= 0x20; else reg0 &= ~0x20; - } else if (INVERSION_OFF == inversion) { - - if (!state->config->invert) reg0 &= ~0x20; + if (!state->config->invert) reg0 &= ~0x20; else reg0 |= 0x20; } @@ -198,18 +191,6 @@ static int ves1820_set_symbolrate(struct ves1820_state *state, u32 symbolrate) return 0; } - - - - - - - - - - - - static int ves1820_init(struct dvb_frontend* fe) { struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; diff --git a/linux/drivers/media/dvb/frontends/ves1820.h b/linux/drivers/media/dvb/frontends/ves1820.h index 8739fec48..355f130b1 100644 --- a/linux/drivers/media/dvb/frontends/ves1820.h +++ b/linux/drivers/media/dvb/frontends/ves1820.h @@ -46,7 +46,6 @@ struct ves1820_config }; extern struct dvb_frontend* ves1820_attach(const struct ves1820_config* config, - struct i2c_adapter* i2c, - u8 pwm); + struct i2c_adapter* i2c, u8 pwm); #endif // VES1820_H diff --git a/linux/drivers/media/dvb/frontends/ves1x93.c b/linux/drivers/media/dvb/frontends/ves1x93.c index 1c511ef6b..b97861c5a 100644 --- a/linux/drivers/media/dvb/frontends/ves1x93.c +++ b/linux/drivers/media/dvb/frontends/ves1x93.c @@ -35,14 +35,10 @@ struct ves1x93_state { - struct i2c_adapter* i2c; - struct dvb_frontend_ops ops; - /* configuration settings */ const struct ves1x93_config* config; - struct dvb_frontend frontend; /* previous uncorrected block counter */ @@ -69,7 +65,6 @@ static u8 init_1893_tab [] = { 0x00, 0x55, 0x00, 0x00, 0x7f, 0x00 }; - static u8 init_1993_tab [] = { 0x00, 0x9c, 0x35, 0x80, 0x6a, 0x09, 0x72, 0x8c, 0x09, 0x6b, 0x00, 0x00, 0x4c, 0x08, 0x00, 0x00, @@ -89,7 +84,6 @@ static u8 init_1893_wtab[] = 1,1,1,0,1,1 }; - static u8 init_1993_wtab[] = { 1,1,1,1,1,1,1,1, 1,1,0,0,1,1,0,0, @@ -112,7 +106,6 @@ static int ves1x93_writereg (struct ves1x93_state* state, u8 reg, u8 data) return 0; } - static u8 ves1x93_readreg (struct ves1x93_state* state, u8 reg) { int ret; @@ -163,7 +156,6 @@ static int ves1x93_set_inversion (struct ves1x93_state* state, fe_spectral_inver return ves1x93_writereg (state, 0x0c, (state->init_1x93_tab[0x0c] & 0x3f) | val); } - static int ves1x93_set_fec (struct ves1x93_state* state, fe_code_rate_t fec) { if (fec == FEC_AUTO) @@ -174,13 +166,11 @@ static int ves1x93_set_fec (struct ves1x93_state* state, fe_code_rate_t fec) return ves1x93_writereg (state, 0x0d, fec - FEC_1_2); } - static fe_code_rate_t ves1x93_get_fec (struct ves1x93_state* state) { return FEC_1_2 + ((ves1x93_readreg (state, 0x0d) >> 4) & 0x7); } - static int ves1x93_set_symbolrate (struct ves1x93_state* state, u32 srate) { u32 BDR; @@ -256,7 +246,7 @@ static int ves1x93_set_symbolrate (struct ves1x93_state* state, u32 srate) AGCR = state->init_1x93_tab[0x05]; if (state->config->invert_pwm) AGCR |= 0x20; - + if (srate < 6000000) AGCR |= 0x80; else @@ -271,20 +261,6 @@ static int ves1x93_set_symbolrate (struct ves1x93_state* state, u32 srate) return 0; } - - - - - - - - - - - - - - static int ves1x93_init (struct dvb_frontend* fe) { struct ves1x93_state* state = (struct ves1x93_state*) fe->demodulator_priv; @@ -349,6 +325,7 @@ static int ves1x93_read_status(struct dvb_frontend* fe, fe_status_t* status) } *status = 0; + if (sync & 1) *status |= FE_HAS_SIGNAL; @@ -367,7 +344,6 @@ static int ves1x93_read_status(struct dvb_frontend* fe, fe_status_t* status) return 0; } - static int ves1x93_read_ber(struct dvb_frontend* fe, u32* ber) { struct ves1x93_state* state = (struct ves1x93_state*) fe->demodulator_priv; diff --git a/linux/drivers/media/dvb/ttpci/av7110.h b/linux/drivers/media/dvb/ttpci/av7110.h index 46aab89eb..09bc74ce2 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.h +++ b/linux/drivers/media/dvb/ttpci/av7110.h @@ -281,4 +281,3 @@ extern int av7110_init_v4l(struct av7110 *av7110); extern int av7110_exit_v4l(struct av7110 *av7110); #endif /* _AV7110_H_ */ - diff --git a/linux/drivers/media/dvb/ttpci/av7110_hw.c b/linux/drivers/media/dvb/ttpci/av7110_hw.c index 8c0a1611f..b90a61248 100644 --- a/linux/drivers/media/dvb/ttpci/av7110_hw.c +++ b/linux/drivers/media/dvb/ttpci/av7110_hw.c @@ -95,7 +95,7 @@ u32 av7110_debiread(struct av7110 *av7110, u32 config, int addr, int count) printk("%s: wait_for_debi_done #2 failed\n", __FUNCTION__); return 0; } - + result = saa7146_read(dev, DEBI_AD); result &= (0xffffffffUL >> ((4 - count) * 8)); return result; @@ -314,7 +314,7 @@ int av7110_wait_msgstate(struct av7110 *av7110, u16 flags) msleep(50); return 0; } - + /* new firmware */ start = jiffies; for (;;) { diff --git a/linux/drivers/media/dvb/ttpci/budget-patch.c b/linux/drivers/media/dvb/ttpci/budget-patch.c index 866f149cc..dc45a3ded 100644 --- a/linux/drivers/media/dvb/ttpci/budget-patch.c +++ b/linux/drivers/media/dvb/ttpci/budget-patch.c @@ -13,19 +13,19 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Or, point your browser to http://www.gnu.org/copyleft/gpl.html - * + * * * the project's page is at http://www.linuxtv.org/dvb/ */ @@ -55,7 +55,7 @@ static struct pci_device_id pci_tbl[] = { /* those lines are for budget-patch to be tried ** on a true budget card and observe the ** behaviour of VSYNC generated by rps1. -** this code was shamelessly copy/pasted from budget.c +** this code was shamelessly copy/pasted from budget.c */ static void gpio_Set22K (struct budget *budget, int state) { @@ -123,7 +123,7 @@ static int SendDiSEqCMsg (struct budget *budget, int len, u8 *msg, unsigned long return 0; } -/* shamelessly copy/pasted from budget.c +/* shamelessly copy/pasted from budget.c */ static int budget_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) { @@ -173,12 +173,12 @@ static int budget_av7110_send_fw_cmd(struct budget_patch *budget, u16* buf, int { ttpci_budget_debiwrite(budget, DEBINOSWAP, COMMAND + 2*i, 2, (u32) buf[i], 0,0); msleep(5); - } + } if (length) ttpci_budget_debiwrite(budget, DEBINOSWAP, COMMAND + 2, 2, (u32) buf[1], 0,0); else ttpci_budget_debiwrite(budget, DEBINOSWAP, COMMAND + 2, 2, 0, 0,0); - msleep(5); + msleep(5); ttpci_budget_debiwrite(budget, DEBINOSWAP, COMMAND, 2, (u32) buf[0], 0,0); msleep(5); return 0; @@ -187,7 +187,7 @@ static int budget_av7110_send_fw_cmd(struct budget_patch *budget, u16* buf, int static void av7110_set22k(struct budget_patch *budget, int state) { u16 buf[2] = {( COMTYPE_AUDIODAC << 8) | (state ? ON22K : OFF22K), 0}; - + dprintk(2, "budget: %p\n", budget); budget_av7110_send_fw_cmd(budget, buf, 2); } @@ -210,7 +210,7 @@ static int av7110_send_diseqc_msg(struct budget_patch *budget, int len, u8 *msg, buf[3]=burst ? 0x01 : 0x00; else buf[3]=0xffff; - + for (i=0; i<len; i++) buf[i+4]=msg[i]; @@ -412,11 +412,11 @@ static struct tda8083_config grundig_29504_451_config = { }; static void frontend_init(struct budget_patch* budget) -{ +{ switch(budget->dev->pci->subsystem_device) { case 0x0000: // Hauppauge/TT WinTV DVB-S rev1.X case 0x1013: // SATELCO Multimedia PCI - + // try the ALPS BSRV2 first of all budget->dvb_frontend = ves1x93_attach(&alps_bsrv2_config, &budget->i2c_adap); if (budget->dvb_frontend) { @@ -498,7 +498,7 @@ static int budget_patch_attach (struct saa7146_dev* dev, struct saa7146_pci_exte saa7146_write(dev, CLIP_FORMAT_CTRL, 0); // r78 // Set HPS prescaler for port B input saa7146_write(dev, HPS_CTRL, (1<<30) | (0<<29) | (1<<28) | (0<<12) ); - saa7146_write(dev, MC2, + saa7146_write(dev, MC2, 0 * (MASK_08 | MASK_24) | // BRS control 0 * (MASK_09 | MASK_25) | // a 0 * (MASK_10 | MASK_26) | // b @@ -512,15 +512,15 @@ static int budget_patch_attach (struct saa7146_dev* dev, struct saa7146_pci_exte // RPS1 timeout disable saa7146_write(dev, RPS_TOV1, 0); - // code for autodetection + // code for autodetection // will wait for VBI_B event (vertical blank at port B) // and will reset GPIO3 after VBI_B is detected. // (GPIO3 should be raised high by CPU to - // test if GPIO3 will generate vertical blank signal + // test if GPIO3 will generate vertical blank signal // in budget patch GPIO3 is connected to VSYNC_B count = 0; #if 0 - WRITE_RPS1(cpu_to_le32(CMD_UPLOAD | + WRITE_RPS1(cpu_to_le32(CMD_UPLOAD | MASK_10 | MASK_09 | MASK_08 | MASK_06 | MASK_05 | MASK_04 | MASK_03 | MASK_02 )); #endif WRITE_RPS1(cpu_to_le32(CMD_PAUSE | EVT_VBI_B)); @@ -557,7 +557,7 @@ static int budget_patch_attach (struct saa7146_dev* dev, struct saa7146_pci_exte saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); mdelay(150); - + if( (saa7146_read(dev, GPIO_CTRL) & 0x10000000) == 0) detected = 1; @@ -570,51 +570,51 @@ static int budget_patch_attach (struct saa7146_dev* dev, struct saa7146_pci_exte if(detected == 0) printk("budget-patch not detected or saa7146 in non-default state.\n" "try enabling ressetting of 7146 with MASK_31 in MC1 register\n"); - + else printk("BUDGET-PATCH DETECTED.\n"); /* OLD (Original design by Roberto Deza): -** This code will setup the SAA7146_RPS1 to generate a square -** wave on GPIO3, changing when a field (TS_HEIGHT/2 "lines" of -** TS_WIDTH packets) has been acquired on SAA7146_D1B video port; -** then, this GPIO3 output which is connected to the D1B_VSYNC -** input, will trigger the acquisition of the alternate field +** This code will setup the SAA7146_RPS1 to generate a square +** wave on GPIO3, changing when a field (TS_HEIGHT/2 "lines" of +** TS_WIDTH packets) has been acquired on SAA7146_D1B video port; +** then, this GPIO3 output which is connected to the D1B_VSYNC +** input, will trigger the acquisition of the alternate field ** and so on. -** Currently, the TT_budget / WinTV_Nova cards have two ICs -** (74HCT4040, LVC74) for the generation of this VSYNC signal, +** Currently, the TT_budget / WinTV_Nova cards have two ICs +** (74HCT4040, LVC74) for the generation of this VSYNC signal, ** which seems that can be done perfectly without this :-)). -*/ +*/ /* New design (By Emard) ** this rps1 code will copy internal HS event to GPIO3 pin. ** GPIO3 is in budget-patch hardware connectd to port B VSYNC ** HS is an internal event of 7146, accessible with RPS -** and temporarily raised high every n lines +** and temporarily raised high every n lines ** (n in defined in the RPS_THRESH1 counter threshold) ** I think HS is raised high on the beginning of the n-th line ** and remains high until this n-th line that triggered ** it is completely received. When the receiption of n-th line ** ends, HS is lowered. -** To transmit data over DMA, 7146 needs changing state at -** port B VSYNC pin. Any changing of port B VSYNC will +** To transmit data over DMA, 7146 needs changing state at +** port B VSYNC pin. Any changing of port B VSYNC will ** cause some DMA data transfer, with more or less packets loss. -** It depends on the phase and frequency of VSYNC and +** It depends on the phase and frequency of VSYNC and ** the way of 7146 is instructed to trigger on port B (defined ** in DD1_INIT register, 3rd nibble from the right valid ** numbers are 0-7, see datasheet) ** -** The correct triggering can minimize packet loss, +** The correct triggering can minimize packet loss, ** dvbtraffic should give this stable bandwidths: ** 22k transponder = 33814 kbit/s ** 27.5k transponder = 38045 kbit/s -** by experiment it is found that the best results -** (stable bandwidths and almost no packet loss) -** are obtained using DD1_INIT triggering number 2 -** (Va at rising edge of VS Fa = HS x VS-failing forced toggle) +** by experiment it is found that the best results +** (stable bandwidths and almost no packet loss) +** are obtained using DD1_INIT triggering number 2 +** (Va at rising edge of VS Fa = HS x VS-failing forced toggle) ** and a VSYNC phase that occurs in the middle of DMA transfer ** (about byte 188*512=96256 in the DMA window). ** @@ -625,20 +625,20 @@ static int budget_patch_attach (struct saa7146_dev* dev, struct saa7146_pci_exte ** increment. That's how the 7146 is programmed to do event ** counting in this budget-patch.c ** I *think* HPS setting has something to do with the phase -** of HS but I cant be 100% sure in that. +** of HS but I cant be 100% sure in that. ** hardware debug note: a working budget card (including budget patch) ** with vpeirq() interrupt setup in mode "0x90" (every 64K) will ** generate 3 interrupts per 25-Hz DMA frame of 2*188*512 bytes ** and that means 3*25=75 Hz of interrupt freqency, as seen by -** watch cat /proc/interrupts +** watch cat /proc/interrupts ** ** If this frequency is 3x lower (and data received in the DMA ** buffer don't start with 0x47, but in the middle of packets, ** whose lengths appear to be like 188 292 188 104 etc. -** this means VSYNC line is not connected in the hardware. +** this means VSYNC line is not connected in the hardware. ** (check soldering pcb and pins) -** The same behaviour of missing VSYNC can be duplicated on budget +** The same behaviour of missing VSYNC can be duplicated on budget ** cards, by seting DD1_INIT trigger mode 7 in 3rd nibble. */ @@ -681,14 +681,14 @@ static int budget_patch_attach (struct saa7146_dev* dev, struct saa7146_pci_exte // low 16 bits are set to TS_WIDTH bytes (TS_WIDTH=2*188 //,then RPS_THRESH1 // should be set to trigger every TS_HEIGHT (512) lines. - // + // saa7146_write(dev, RPS_THRESH1, (TS_HEIGHT*1) | MASK_12 ); - + // saa7146_write(dev, RPS_THRESH0, ((TS_HEIGHT/2)<<16) |MASK_28| (TS_HEIGHT/2) |MASK_12 ); // Enable RPS1 (rFC p33) saa7146_write(dev, MC1, (MASK_13 | MASK_29)); - + if (!(budget = kmalloc (sizeof(struct budget_patch), GFP_KERNEL))) return -ENOMEM; @@ -722,20 +722,20 @@ static int budget_patch_detach (struct saa7146_dev* dev) return err; } -static int __init budget_patch_init(void) +static int __init budget_patch_init(void) { return saa7146_register_extension(&budget_extension); } static void __exit budget_patch_exit(void) { - saa7146_unregister_extension(&budget_extension); + saa7146_unregister_extension(&budget_extension); } static struct saa7146_extension budget_extension = { .name = "budget_patch dvb\0", .flags = 0, - + .module = THIS_MODULE, .pci_tbl = pci_tbl, .attach = budget_patch_attach, @@ -752,4 +752,3 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Emard, Roberto Deza, Holger Waechtler, Michael Hunold, others"); MODULE_DESCRIPTION("Driver for full TS modified DVB-S SAA7146+AV7110 " "based so-called Budget Patch cards"); - diff --git a/linux/drivers/media/dvb/ttpci/budget.c b/linux/drivers/media/dvb/ttpci/budget.c index c2a8b8cb9..5e6a10f4a 100644 --- a/linux/drivers/media/dvb/ttpci/budget.c +++ b/linux/drivers/media/dvb/ttpci/budget.c @@ -1,35 +1,35 @@ /* - * budget.c: driver for the SAA7146 based Budget DVB cards + * budget.c: driver for the SAA7146 based Budget DVB cards * - * Compiled from various sources by Michael Hunold <michael@mihu.de> + * Compiled from various sources by Michael Hunold <michael@mihu.de> * * Copyright (C) 2002 Ralph Metzler <rjkm@metzlerbros.de> * - * Copyright (C) 1999-2002 Ralph Metzler + * Copyright (C) 1999-2002 Ralph Metzler * & Marcus Metzler for convergence integrated media GmbH * * 26feb2004 Support for FS Activy Card (Grundig tuner) by * Michael Dreher <michael@5dot1.de>, * Oliver Endriss <o.endriss@gmx.de> and * Andreas 'randy' Weinberger - * + * * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Or, point your browser to http://www.gnu.org/copyleft/gpl.html - * + * * * the project's page is at http://www.linuxtv.org/dvb/ */ @@ -204,7 +204,7 @@ static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param return 0; } -static struct ves1x93_config alps_bsrv2_config = +static struct ves1x93_config alps_bsrv2_config = { .demod_address = 0x08, .xin = 90100000UL, @@ -358,7 +358,7 @@ static int grundig_29504_401_pll_set(struct dvb_frontend* fe, struct dvb_fronten if (params->frequency < 175000000) band_select = 0x0e; else if (params->frequency < 470000000) band_select = 0x05; else band_select = 0x03; - + data[0] = (div >> 8) & 0x7f; data[1] = div & 0xff; data[2] = ((div >> 10) & 0x60) | cfg; @@ -409,7 +409,7 @@ static u8 read_pwm(struct budget* budget) } static void frontend_init(struct budget *budget) -{ +{ switch(budget->dev->pci->subsystem_device) { case 0x1003: // Hauppauge/TT Nova budget (stv0299/ALPS BSRU6(tsa5059) OR ves1893/ALPS BSRV2(sp5659)) case 0x1013: @@ -432,24 +432,24 @@ static void frontend_init(struct budget *budget) } break; - case 0x1004: // Hauppauge/TT DVB-C budget (ves1820/ALPS TDBE2(sp5659)) + case 0x1004: // Hauppauge/TT DVB-C budget (ves1820/ALPS TDBE2(sp5659)) budget->dvb_frontend = ves1820_attach(&alps_tdbe2_config, &budget->i2c_adap, read_pwm(budget)); if (budget->dvb_frontend) break; break; - case 0x1005: // Hauppauge/TT Nova-T budget (L64781/Grundig 29504-401(tsa5060)) + case 0x1005: // Hauppauge/TT Nova-T budget (L64781/Grundig 29504-401(tsa5060)) budget->dvb_frontend = l64781_attach(&grundig_29504_401_config, &budget->i2c_adap); if (budget->dvb_frontend) break; break; case 0x4f60: // Fujitsu Siemens Activy Budget-S PCI rev AL (stv0299/ALPS BSRU6(tsa5059)) - budget->dvb_frontend = stv0299_attach(&alps_bsru6_config, &budget->i2c_adap); + budget->dvb_frontend = stv0299_attach(&alps_bsru6_config, &budget->i2c_adap); if (budget->dvb_frontend) { budget->dvb_frontend->ops->set_voltage = siemens_budget_set_voltage; break; - } + } break; case 0x4f61: // Fujitsu Siemens Activy Budget-S PCI rev GR (tda8083/Grundig 29504-451(tsa5522)) @@ -514,7 +514,7 @@ static int budget_detach (struct saa7146_dev* dev) kfree (budget); dev->ext_priv = NULL; - + return err; } @@ -543,8 +543,8 @@ MODULE_DEVICE_TABLE(pci, pci_tbl); static struct saa7146_extension budget_extension = { .name = "budget dvb\0", - .flags = 0, - + .flags = 0, + .module = THIS_MODULE, .pci_tbl = pci_tbl, .attach = budget_attach, @@ -552,16 +552,16 @@ static struct saa7146_extension budget_extension = { .irq_mask = MASK_10, .irq_func = ttpci_budget_irq10_handler, -}; +}; -static int __init budget_init(void) +static int __init budget_init(void) { return saa7146_register_extension(&budget_extension); } static void __exit budget_exit(void) { - saa7146_unregister_extension(&budget_extension); + saa7146_unregister_extension(&budget_extension); } module_init(budget_init); @@ -571,4 +571,3 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Ralph Metzler, Marcus Metzler, Michael Hunold, others"); MODULE_DESCRIPTION("driver for the SAA7146 based so-called " "budget PCI DVB cards by Siemens, Technotrend, Hauppauge"); - diff --git a/linux/drivers/media/dvb/ttpci/ttpci-eeprom.c b/linux/drivers/media/dvb/ttpci/ttpci-eeprom.c index 602071868..e9a8457b0 100644 --- a/linux/drivers/media/dvb/ttpci/ttpci-eeprom.c +++ b/linux/drivers/media/dvb/ttpci/ttpci-eeprom.c @@ -144,4 +144,3 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Ralph Metzler, Marcus Metzler, others"); MODULE_DESCRIPTION("Decode dvb_net MAC address from EEPROM of PCI DVB cards " "made by Siemens, Technotrend, Hauppauge"); - diff --git a/linux/drivers/media/dvb/ttusb-dec/Kconfig b/linux/drivers/media/dvb/ttusb-dec/Kconfig index 00e07707e..c334526af 100644 --- a/linux/drivers/media/dvb/ttusb-dec/Kconfig +++ b/linux/drivers/media/dvb/ttusb-dec/Kconfig @@ -10,11 +10,11 @@ config DVB_TTUSB_DEC Even if these devices have a MPEG decoder built in, they transmit only compressed MPEG data over the USB bus, so you need - an external software decoder to watch TV on your computer. + an external software decoder to watch TV on your computer. This driver needs external firmware. Please use the commands "<kerneldir>/Documentation/dvb/get_dvb_firmware dec2000t", - "<kerneldir>/Documentation/dvb/get_dvb_firmware dec2540t", + "<kerneldir>/Documentation/dvb/get_dvb_firmware dec2540t", "<kerneldir>/Documentation/dvb/get_dvb_firmware dec3000s", download/extract them, and then copy them to /usr/lib/hotplug/firmware. diff --git a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c index b3286691b..8d7d7c30b 100644 --- a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c @@ -152,7 +152,7 @@ struct ttusb_dec { struct dvb_demux_filter *video_filter; struct list_head filter_info_list; spinlock_t filter_info_list_lock; - + struct input_dev rc_input_dev; int active; /* Loaded successfully */ @@ -171,9 +171,9 @@ struct filter_info { }; const uint16_t rc_keys[] = { - KEY_POWER, - KEY_MUTE, - KEY_1, + KEY_POWER, + KEY_MUTE, + KEY_1, KEY_2, KEY_3, KEY_4, @@ -207,7 +207,7 @@ static void ttusb_dec_handle_irq( struct urb *urb, struct pt_regs *regs) struct ttusb_dec * dec = urb->context; char *buffer = dec->irq_buffer; int retval; - + switch(urb->status) { case 0: /*success*/ break; @@ -221,17 +221,17 @@ static void ttusb_dec_handle_irq( struct urb *urb, struct pt_regs *regs) return; default: dprintk("%s:nonzero status received: %d\n", - __FUNCTION__,urb->status); + __FUNCTION__,urb->status); goto exit; } - if( (buffer[0] == 0x1) && (buffer[2] == 0x15) ) { + if( (buffer[0] == 0x1) && (buffer[2] == 0x15) ) { /* IR - Event */ /* this is an fact a bit too simple implementation; * the box also reports a keyrepeat signal - * (with buffer[3] == 0x40) in an intervall of ~100ms. + * (with buffer[3] == 0x40) in an intervall of ~100ms. * But to handle this correctly we had to imlemenent some - * kind of timer which signals a 'key up' event if no + * kind of timer which signals a 'key up' event if no * keyrepeat signal is recieved for lets say 200ms. * this should/could be added later ... * for now lets report each signal as a key down and up*/ @@ -1186,19 +1186,19 @@ static void ttusb_init_rc( struct ttusb_dec *dec) { u8 b[] = { 0x00, 0x01 }; int i; - + init_input_dev(&dec->rc_input_dev); - - dec->rc_input_dev.name = "ttusb_dec remote control"; + + dec->rc_input_dev.name = "ttusb_dec remote control"; dec->rc_input_dev.evbit[0] = BIT(EV_KEY); dec->rc_input_dev.keycodesize = sizeof(unsigned char); dec->rc_input_dev.keycodemax = KEY_MAX; - + for (i = 0; i < sizeof(rc_keys)/sizeof(rc_keys[0]); i++) set_bit(rc_keys[i], dec->rc_input_dev.keybit); - + input_register_device(&dec->rc_input_dev); - + if(usb_submit_urb(dec->irq_urb,GFP_KERNEL)) { printk("%s: usb_submit_urb failed\n",__FUNCTION__); } @@ -1233,14 +1233,14 @@ static int ttusb_dec_init_usb(struct ttusb_dec *dec) dec->irq_urb = usb_alloc_urb(0, GFP_KERNEL); if(!dec->irq_urb) { return -ENOMEM; - } - dec->irq_buffer = usb_buffer_alloc(dec->udev,IRQ_PACKET_SIZE, + } + dec->irq_buffer = usb_buffer_alloc(dec->udev,IRQ_PACKET_SIZE, SLAB_ATOMIC, &dec->irq_dma_handle); if(!dec->irq_buffer) { return -ENOMEM; } usb_fill_int_urb(dec->irq_urb, dec->udev,dec->irq_pipe, - dec->irq_buffer, IRQ_PACKET_SIZE, + dec->irq_buffer, IRQ_PACKET_SIZE, ttusb_dec_handle_irq, dec, 1); dec->irq_urb->transfer_dma = dec->irq_dma_handle; dec->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; @@ -1516,11 +1516,11 @@ static void ttusb_dec_exit_usb(struct ttusb_dec *dec) * As the irq is submitted after the interface is changed, * this is the best method i figured out. * Any other possibilities?*/ - if(dec->interface == TTUSB_DEC_INTERFACE_IN) + if(dec->interface == TTUSB_DEC_INTERFACE_IN) usb_kill_urb(dec->irq_urb); - + usb_free_urb(dec->irq_urb); - + usb_buffer_free(dec->udev,IRQ_PACKET_SIZE, dec->irq_buffer, dec->irq_dma_handle); } @@ -1605,7 +1605,7 @@ static int ttusb_dec_probe(struct usb_interface *intf, dec->udev = udev; - if (ttusb_dec_init_usb(dec)) + if (ttusb_dec_init_usb(dec)) return 0; if (ttusb_dec_init_stb(dec)) { ttusb_dec_exit_usb(dec); @@ -1733,4 +1733,3 @@ MODULE_AUTHOR("Alex Woods <linux-dvb@giblets.org>"); MODULE_DESCRIPTION(DRIVER_NAME); MODULE_LICENSE("GPL"); MODULE_DEVICE_TABLE(usb, ttusb_dec_table); - diff --git a/linux/drivers/media/dvb/ttusb-dec/ttusbdecfe.c b/linux/drivers/media/dvb/ttusb-dec/ttusbdecfe.c index fbadb67db..ff0e5212a 100644 --- a/linux/drivers/media/dvb/ttusb-dec/ttusbdecfe.c +++ b/linux/drivers/media/dvb/ttusb-dec/ttusbdecfe.c @@ -47,7 +47,7 @@ static int ttusbdecfe_read_status(struct dvb_frontend* fe, fe_status_t* status) return 0; } - + static int ttusbdecfe_dvbt_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) { struct ttusbdecfe_state* state = (struct ttusbdecfe_state*) fe->demodulator_priv; @@ -104,7 +104,7 @@ static int ttusbdecfe_dvbs_diseqc_send_master_cmd(struct dvb_frontend* fe, struc u8 b[] = { 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - + memcpy(&b[4], cmd->msg, cmd->msg_len); state->config->send_command(fe, 0x72, |