dibusb.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Header file for all dibusb-based-receivers.
  3. *
  4. * Copyright (C) 2004-5 Patrick Boettcher ([email protected])
  5. *
  6. * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information
  7. */
  8. #ifndef _DVB_USB_DIBUSB_H_
  9. #define _DVB_USB_DIBUSB_H_
  10. #ifndef DVB_USB_LOG_PREFIX
  11. #define DVB_USB_LOG_PREFIX "dibusb"
  12. #endif
  13. #include "dvb-usb.h"
  14. #include "dib3000.h"
  15. #include "dib3000mc.h"
  16. #include "mt2060.h"
  17. /*
  18. * protocol of all dibusb related devices
  19. */
  20. /*
  21. * bulk msg to/from endpoint 0x01
  22. *
  23. * general structure:
  24. * request_byte parameter_bytes
  25. */
  26. #define DIBUSB_REQ_START_READ 0x00
  27. #define DIBUSB_REQ_START_DEMOD 0x01
  28. /*
  29. * i2c read
  30. * bulk write: 0x02 ((7bit i2c_addr << 1) | 0x01) register_bytes length_word
  31. * bulk read: byte_buffer (length_word bytes)
  32. */
  33. #define DIBUSB_REQ_I2C_READ 0x02
  34. /*
  35. * i2c write
  36. * bulk write: 0x03 (7bit i2c_addr << 1) register_bytes value_bytes
  37. */
  38. #define DIBUSB_REQ_I2C_WRITE 0x03
  39. /*
  40. * polling the value of the remote control
  41. * bulk write: 0x04
  42. * bulk read: byte_buffer (5 bytes)
  43. */
  44. #define DIBUSB_REQ_POLL_REMOTE 0x04
  45. /* additional status values for Hauppauge Remote Control Protocol */
  46. #define DIBUSB_RC_HAUPPAUGE_KEY_PRESSED 0x01
  47. #define DIBUSB_RC_HAUPPAUGE_KEY_EMPTY 0x03
  48. /* streaming mode:
  49. * bulk write: 0x05 mode_byte
  50. *
  51. * mode_byte is mostly 0x00
  52. */
  53. #define DIBUSB_REQ_SET_STREAMING_MODE 0x05
  54. /* interrupt the internal read loop, when blocking */
  55. #define DIBUSB_REQ_INTR_READ 0x06
  56. /* io control
  57. * 0x07 cmd_byte param_bytes
  58. *
  59. * param_bytes can be up to 32 bytes
  60. *
  61. * cmd_byte function parameter name
  62. * 0x00 power mode
  63. * 0x00 sleep
  64. * 0x01 wakeup
  65. *
  66. * 0x01 enable streaming
  67. * 0x02 disable streaming
  68. *
  69. *
  70. */
  71. #define DIBUSB_REQ_SET_IOCTL 0x07
  72. /* IOCTL commands */
  73. /* change the power mode in firmware */
  74. #define DIBUSB_IOCTL_CMD_POWER_MODE 0x00
  75. #define DIBUSB_IOCTL_POWER_SLEEP 0x00
  76. #define DIBUSB_IOCTL_POWER_WAKEUP 0x01
  77. /* modify streaming of the FX2 */
  78. #define DIBUSB_IOCTL_CMD_ENABLE_STREAM 0x01
  79. #define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02
  80. /* Max transfer size done by I2C transfer functions */
  81. #define MAX_XFER_SIZE 64
  82. struct dibusb_state {
  83. struct dib_fe_xfer_ops ops;
  84. int mt2060_present;
  85. u8 tuner_addr;
  86. };
  87. struct dibusb_device_state {
  88. /* for RC5 remote control */
  89. int old_toggle;
  90. int last_repeat_count;
  91. };
  92. extern struct i2c_algorithm dibusb_i2c_algo;
  93. extern int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *);
  94. extern int dibusb_dib3000mc_tuner_attach (struct dvb_usb_adapter *);
  95. extern int dibusb_streaming_ctrl(struct dvb_usb_adapter *, int);
  96. extern int dibusb_pid_filter(struct dvb_usb_adapter *, int, u16, int);
  97. extern int dibusb_pid_filter_ctrl(struct dvb_usb_adapter *, int);
  98. extern int dibusb2_0_streaming_ctrl(struct dvb_usb_adapter *, int);
  99. extern int dibusb_power_ctrl(struct dvb_usb_device *, int);
  100. extern int dibusb2_0_power_ctrl(struct dvb_usb_device *, int);
  101. #define DEFAULT_RC_INTERVAL 150
  102. //#define DEFAULT_RC_INTERVAL 100000
  103. extern struct rc_map_table rc_map_dibusb_table[];
  104. extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *);
  105. extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *);
  106. #endif