dib0700.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Linux driver for devices based on the DiBcom DiB0700 USB bridge
  3. *
  4. * Copyright (C) 2005-6 DiBcom, SA
  5. */
  6. #ifndef _DIB0700_H_
  7. #define _DIB0700_H_
  8. #define DVB_USB_LOG_PREFIX "dib0700"
  9. #include "dvb-usb.h"
  10. #include "dib07x0.h"
  11. extern int dvb_usb_dib0700_debug;
  12. #define deb_info(args...) dprintk(dvb_usb_dib0700_debug,0x01,args)
  13. #define deb_fw(args...) dprintk(dvb_usb_dib0700_debug,0x02,args)
  14. #define deb_fwdata(args...) dprintk(dvb_usb_dib0700_debug,0x04,args)
  15. #define deb_data(args...) dprintk(dvb_usb_dib0700_debug,0x08,args)
  16. #define REQUEST_SET_USB_XFER_LEN 0x0 /* valid only for firmware version */
  17. /* higher than 1.21 */
  18. #define REQUEST_I2C_READ 0x2
  19. #define REQUEST_I2C_WRITE 0x3
  20. #define REQUEST_POLL_RC 0x4 /* deprecated in firmware v1.20 */
  21. #define REQUEST_JUMPRAM 0x8
  22. #define REQUEST_SET_CLOCK 0xB
  23. #define REQUEST_SET_GPIO 0xC
  24. #define REQUEST_ENABLE_VIDEO 0xF
  25. // 1 Byte: 4MSB(1 = enable streaming, 0 = disable streaming) 4LSB(Video Mode: 0 = MPEG2 188Bytes, 1 = Analog)
  26. // 2 Byte: MPEG2 mode: 4MSB(1 = Master Mode, 0 = Slave Mode) 4LSB(Channel 1 = bit0, Channel 2 = bit1)
  27. // 2 Byte: Analog mode: 4MSB(0 = 625 lines, 1 = 525 lines) 4LSB( " " )
  28. #define REQUEST_SET_I2C_PARAM 0x10
  29. #define REQUEST_SET_RC 0x11
  30. #define REQUEST_NEW_I2C_READ 0x12
  31. #define REQUEST_NEW_I2C_WRITE 0x13
  32. #define REQUEST_GET_VERSION 0x15
  33. struct dib0700_state {
  34. u8 channel_state;
  35. u16 mt2060_if1[2];
  36. u8 rc_toggle;
  37. u8 rc_counter;
  38. u8 is_dib7000pc;
  39. u8 fw_use_new_i2c_api;
  40. u8 disable_streaming_master_mode;
  41. u32 fw_version;
  42. u32 nb_packet_buffer_size;
  43. int (*read_status)(struct dvb_frontend *, enum fe_status *);
  44. int (*sleep)(struct dvb_frontend* fe);
  45. u8 buf[255];
  46. struct i2c_client *i2c_client_demod;
  47. struct i2c_client *i2c_client_tuner;
  48. };
  49. int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion,
  50. u32 *romversion, u32 *ramversion, u32 *fwtype);
  51. int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio,
  52. u8 gpio_dir, u8 gpio_val);
  53. int dib0700_ctrl_clock(struct dvb_usb_device *d, u32 clk_MHz, u8 clock_out_gp3);
  54. int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx,
  55. u8 rxlen);
  56. int dib0700_download_firmware(struct usb_device *d,
  57. const struct firmware *fw);
  58. int dib0700_rc_setup(struct dvb_usb_device *d, struct usb_interface *intf);
  59. int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff);
  60. int dib0700_identify_state(struct usb_device *d,
  61. const struct dvb_usb_device_properties *props,
  62. const struct dvb_usb_device_description **desc,
  63. int *cold);
  64. int dib0700_change_protocol(struct rc_dev *dev, u64 *rc_proto);
  65. int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz);
  66. extern struct i2c_algorithm dib0700_i2c_algo;
  67. extern int dib0700_device_count;
  68. extern int dvb_usb_dib0700_ir_proto;
  69. extern struct dvb_usb_device_properties dib0700_devices[];
  70. extern struct usb_device_id dib0700_usb_id_table[];
  71. #endif