pvrusb2-i2c-chips-v4l2.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. *
  3. *
  4. * Copyright (C) 2005 Mike Isely <isely@pobox.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. *
  19. */
  20. #include <linux/kernel.h>
  21. #include "pvrusb2-i2c-core.h"
  22. #include "pvrusb2-hdw-internal.h"
  23. #include "pvrusb2-debug.h"
  24. #include "pvrusb2-i2c-cmd-v4l2.h"
  25. #include "pvrusb2-audio.h"
  26. #include "pvrusb2-tuner.h"
  27. #include "pvrusb2-video-v4l.h"
  28. #include "pvrusb2-cx2584x-v4l.h"
  29. #include "pvrusb2-wm8775.h"
  30. #define trace_i2c(...) pvr2_trace(PVR2_TRACE_I2C,__VA_ARGS__)
  31. #define OP_STANDARD 0
  32. #define OP_AUDIOMODE 1
  33. #define OP_BCSH 2
  34. #define OP_VOLUME 3
  35. #define OP_FREQ 4
  36. #define OP_AUDIORATE 5
  37. #define OP_CROP 6
  38. #define OP_SIZE 7
  39. #define OP_LOG 8
  40. static const struct pvr2_i2c_op * const ops[] = {
  41. [OP_STANDARD] = &pvr2_i2c_op_v4l2_standard,
  42. [OP_AUDIOMODE] = &pvr2_i2c_op_v4l2_audiomode,
  43. [OP_BCSH] = &pvr2_i2c_op_v4l2_bcsh,
  44. [OP_VOLUME] = &pvr2_i2c_op_v4l2_volume,
  45. [OP_FREQ] = &pvr2_i2c_op_v4l2_frequency,
  46. [OP_CROP] = &pvr2_i2c_op_v4l2_crop,
  47. [OP_SIZE] = &pvr2_i2c_op_v4l2_size,
  48. [OP_LOG] = &pvr2_i2c_op_v4l2_log,
  49. };
  50. void pvr2_i2c_probe(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp)
  51. {
  52. int id;
  53. id = cp->client->driver->id;
  54. cp->ctl_mask = ((1 << OP_STANDARD) |
  55. (1 << OP_AUDIOMODE) |
  56. (1 << OP_BCSH) |
  57. (1 << OP_VOLUME) |
  58. (1 << OP_FREQ) |
  59. (1 << OP_CROP) |
  60. (1 << OP_SIZE) |
  61. (1 << OP_LOG));
  62. cp->status_poll = pvr2_v4l2_cmd_status_poll;
  63. if (id == I2C_DRIVERID_MSP3400) {
  64. if (pvr2_i2c_msp3400_setup(hdw,cp)) {
  65. return;
  66. }
  67. }
  68. if (id == I2C_DRIVERID_TUNER) {
  69. if (pvr2_i2c_tuner_setup(hdw,cp)) {
  70. return;
  71. }
  72. }
  73. if (id == I2C_DRIVERID_CX25840) {
  74. if (pvr2_i2c_cx2584x_v4l_setup(hdw,cp)) {
  75. return;
  76. }
  77. }
  78. if (id == I2C_DRIVERID_WM8775) {
  79. if (pvr2_i2c_wm8775_setup(hdw,cp)) {
  80. return;
  81. }
  82. }
  83. if (id == I2C_DRIVERID_SAA711X) {
  84. if (pvr2_i2c_decoder_v4l_setup(hdw,cp)) {
  85. return;
  86. }
  87. }
  88. }
  89. const struct pvr2_i2c_op *pvr2_i2c_get_op(unsigned int idx)
  90. {
  91. if (idx >= ARRAY_SIZE(ops))
  92. return NULL;
  93. return ops[idx];
  94. }
  95. /*
  96. Stuff for Emacs to see, in order to encourage consistent editing style:
  97. *** Local Variables: ***
  98. *** mode: c ***
  99. *** fill-column: 75 ***
  100. *** tab-width: 8 ***
  101. *** c-basic-offset: 8 ***
  102. *** End: ***
  103. */