1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Support for the Broadcom BCM3510 ATSC demodulator (1st generation Air2PC)
5 * Copyright (C) 2001-5, B2C2 inc.
7 * GPL/Linux driver written by Patrick Boettcher <patrick.boettcher@posteo.de>
9 #ifndef __BCM3510_PRIV_H__
10 #define __BCM3510_PRIV_H__
12 #define PACKED __attribute__((packed))
15 #define err(format, arg...) printk(KERN_ERR "bcm3510: " format "\n" , ## arg)
17 #define info(format, arg...) printk(KERN_INFO "bcm3510: " format "\n" , ## arg)
19 #define warn(format, arg...) printk(KERN_WARNING "bcm3510: " format "\n" , ## arg)
22 #define PANASONIC_FIRST_IF_BASE_IN_KHz 1407500
23 #define BCM3510_SYMBOL_RATE 5381000
107 #define JDEC_WAIT_AT_RAM 0x7
108 #define JDEC_EEPROM_LOAD_WAIT 0x4
151 } bcm3510_register_value
;
156 #define CMD_GET_VERSION_INFO 0x3D
157 #define MSGID_GET_VERSION_INFO 0x15
158 struct bcm3510_hab_cmd_get_version_info
{
159 u8 microcode_version
;
165 #define BCM3510_DEF_MICROCODE_VERSION 0x0E
166 #define BCM3510_DEF_SCRIPT_VERSION 0x06
167 #define BCM3510_DEF_CONFIG_VERSION 0x01
168 #define BCM3510_DEF_DEMOD_VERSION 0xB1
171 #define CMD_ACQUIRE 0x38
173 #define MSGID_EXT_TUNER_ACQUIRE 0x0A
174 struct bcm3510_hab_cmd_ext_acquire
{
181 } PACKED ACQUIRE0
; /* control_byte */
188 } PACKED ACQUIRE1
; /* sym_if */
190 u8 IF_OFFSET0
; /* IF_Offset_10hz */
192 u8 SYM_OFFSET0
; /* SymbolRateOffset */
194 u8 NTSC_OFFSET0
; /* NTSC_Offset_10hz */
198 #define MSGID_INT_TUNER_ACQUIRE 0x0B
199 struct bcm3510_hab_cmd_int_acquire
{
206 } PACKED ACQUIRE0
; /* control_byte */
213 } PACKED ACQUIRE1
; /* sym_if */
219 u8 IF_OFFSET0
; /* IF_Offset_10hz */
221 u8 SYM_OFFSET0
; /* SymbolRateOffset */
223 u8 NTSC_OFFSET0
; /* NTSC_Offset_10hz */
228 #define BCM3510_QAM16 = 0x01
229 #define BCM3510_QAM32 = 0x02
230 #define BCM3510_QAM64 = 0x03
231 #define BCM3510_QAM128 = 0x04
232 #define BCM3510_QAM256 = 0x05
233 #define BCM3510_8VSB = 0x0B
234 #define BCM3510_16VSB = 0x0D
237 #define BCM3510_IF_TERRESTRIAL 0x0
238 #define BCM3510_IF_CABLE 0x1
239 #define BCM3510_IF_USE_CMD 0x7
242 #define BCM3510_SR_8VSB 0x0 /* 5381119 s/sec */
243 #define BCM3510_SR_256QAM 0x1 /* 5360537 s/sec */
244 #define BCM3510_SR_16QAM 0x2 /* 5056971 s/sec */
245 #define BCM3510_SR_MISC 0x3 /* 5000000 s/sec */
246 #define BCM3510_SR_USE_CMD 0x7
248 /* special symbol rate */
249 #define CMD_SET_VALUE_NOT_LISTED 0x2d
250 #define MSGID_SET_SYMBOL_RATE_NOT_LISTED 0x0c
251 struct bcm3510_hab_cmd_set_sr_not_listed
{
259 #define MSGID_SET_IF_FREQ_NOT_LISTED 0x0d
260 struct bcm3510_hab_cmd_set_if_freq_not_listed
{
268 #define CMD_AUTO_PARAM 0x2a
269 #define MSGID_AUTO_REACQUIRE 0x0e
270 struct bcm3510_hab_cmd_auto_reacquire
{
271 u8 ACQ
:1; /* on/off*/
275 #define MSGID_SET_RF_AGC_SEL 0x12
276 struct bcm3510_hab_cmd_set_agc
{
282 #define MSGID_SET_AUTO_INVERSION 0x14
283 struct bcm3510_hab_cmd_auto_inversion
{
290 #define CMD_STATE_CONTROL 0x12
291 #define MSGID_BERT_CONTROL 0x0e
292 #define MSGID_BERT_SET 0xfa
293 struct bcm3510_hab_cmd_bert_control
{
298 #define MSGID_TRI_STATE 0x2e
299 struct bcm3510_hab_cmd_tri_state
{
300 u8 RE
:1; /* a/d ram port pins */
301 u8 PE
:1; /* baud clock pin */
302 u8 AC
:1; /* a/d clock pin */
303 u8 BE
:1; /* baud clock pin */
309 #define CMD_TUNE 0x38
310 #define MSGID_TUNE 0x16
311 struct bcm3510_hab_cmd_tune_ctrl_data_pair
{
332 struct bcm3510_hab_cmd_tune
{
338 struct bcm3510_hab_cmd_tune_ctrl_data_pair ctl_dat
[16];
341 #define CMD_STATUS 0x38
342 #define MSGID_STATUS1 0x08
343 struct bcm3510_hab_cmd_status1
{
347 u8 QRE
:1; /* if QSE and the spectrum is inversed */
348 u8 QSE
:1; /* automatic spectral inversion */
361 u8 NTE
:1; /* NTSC filter sweep enabled */
362 u8 AQI
:1; /* currently acquiring */
363 u8 FA
:1; /* fast acquisition */
364 u8 ARI
:1; /* auto reacquire */
365 u8 TI
:1; /* programming the tuner */
404 #define MSGID_STATUS2 0x14
405 struct bcm3510_hab_cmd_status2
{
435 u8 MODE_TYPE
:4; /* acquire mode 0 */
443 #define CMD_SET_RF_BW_NOT_LISTED 0x3f
444 #define MSGID_SET_RF_BW_NOT_LISTED 0x11