aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-05-29 05:59:52 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-06-17 07:52:44 -0400
commit29d6a98b3381f5d94f56d4c0cd65a8cf7fb9419a (patch)
tree8e37f57e400e6d17cb83a9e145c5cdfd36233bcd
parente12771100c93e101a7a8b302b6c5d57cff7b1551 (diff)
[media] cx25840: remove the v4l2-chip-ident.h include
Replace the V4L2_IDENT_ macros from v4l2-chip-ident.h with driver specific defines. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/i2c/cx25840/cx25840-core.c50
-rw-r--r--drivers/media/i2c/cx25840/cx25840-core.h34
2 files changed, 48 insertions, 36 deletions
diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c
index 6fbdad4fe054..2e3771d57354 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.c
+++ b/drivers/media/i2c/cx25840/cx25840-core.c
@@ -497,7 +497,7 @@ static void cx23885_initialize(struct i2c_client *client)
497 497
498 /* Sys PLL */ 498 /* Sys PLL */
499 switch (state->id) { 499 switch (state->id) {
500 case V4L2_IDENT_CX23888_AV: 500 case CX23888_AV:
501 /* 501 /*
502 * 50.0 MHz * (0xb + 0xe8ba26/0x2000000)/4 = 5 * 28.636363 MHz 502 * 50.0 MHz * (0xb + 0xe8ba26/0x2000000)/4 = 5 * 28.636363 MHz
503 * 572.73 MHz before post divide 503 * 572.73 MHz before post divide
@@ -510,7 +510,7 @@ static void cx23885_initialize(struct i2c_client *client)
510 cx25840_write4(client, 0x42c, 0x42600000); 510 cx25840_write4(client, 0x42c, 0x42600000);
511 cx25840_write4(client, 0x44c, 0x161f1000); 511 cx25840_write4(client, 0x44c, 0x161f1000);
512 break; 512 break;
513 case V4L2_IDENT_CX23887_AV: 513 case CX23887_AV:
514 /* 514 /*
515 * 25.0 MHz * (0x16 + 0x1d1744c/0x2000000)/4 = 5 * 28.636363 MHz 515 * 25.0 MHz * (0x16 + 0x1d1744c/0x2000000)/4 = 5 * 28.636363 MHz
516 * 572.73 MHz before post divide 516 * 572.73 MHz before post divide
@@ -518,7 +518,7 @@ static void cx23885_initialize(struct i2c_client *client)
518 cx25840_write4(client, 0x11c, 0x01d1744c); 518 cx25840_write4(client, 0x11c, 0x01d1744c);
519 cx25840_write4(client, 0x118, 0x00000416); 519 cx25840_write4(client, 0x118, 0x00000416);
520 break; 520 break;
521 case V4L2_IDENT_CX23885_AV: 521 case CX23885_AV:
522 default: 522 default:
523 /* 523 /*
524 * 28.636363 MHz * (0x14 + 0x0/0x2000000)/4 = 5 * 28.636363 MHz 524 * 28.636363 MHz * (0x14 + 0x0/0x2000000)/4 = 5 * 28.636363 MHz
@@ -545,7 +545,7 @@ static void cx23885_initialize(struct i2c_client *client)
545 545
546 /* HVR1850 */ 546 /* HVR1850 */
547 switch (state->id) { 547 switch (state->id) {
548 case V4L2_IDENT_CX23888_AV: 548 case CX23888_AV:
549 /* 888/HVR1250 specific */ 549 /* 888/HVR1250 specific */
550 cx25840_write4(client, 0x10c, 0x13333333); 550 cx25840_write4(client, 0x10c, 0x13333333);
551 cx25840_write4(client, 0x108, 0x00000515); 551 cx25840_write4(client, 0x108, 0x00000515);
@@ -569,7 +569,7 @@ static void cx23885_initialize(struct i2c_client *client)
569 * 48 ksps, 16 bits/sample, x16 multiplier = 12.288 MHz 569 * 48 ksps, 16 bits/sample, x16 multiplier = 12.288 MHz
570 */ 570 */
571 switch (state->id) { 571 switch (state->id) {
572 case V4L2_IDENT_CX23888_AV: 572 case CX23888_AV:
573 /* 573 /*
574 * 50.0 MHz * (0x7 + 0x0bedfa4/0x2000000)/3 = 122.88 MHz 574 * 50.0 MHz * (0x7 + 0x0bedfa4/0x2000000)/3 = 122.88 MHz
575 * 368.64 MHz before post divide 575 * 368.64 MHz before post divide
@@ -579,7 +579,7 @@ static void cx23885_initialize(struct i2c_client *client)
579 cx25840_write4(client, 0x114, 0x017dbf48); 579 cx25840_write4(client, 0x114, 0x017dbf48);
580 cx25840_write4(client, 0x110, 0x000a030e); 580 cx25840_write4(client, 0x110, 0x000a030e);
581 break; 581 break;
582 case V4L2_IDENT_CX23887_AV: 582 case CX23887_AV:
583 /* 583 /*
584 * 25.0 MHz * (0xe + 0x17dbf48/0x2000000)/3 = 122.88 MHz 584 * 25.0 MHz * (0xe + 0x17dbf48/0x2000000)/3 = 122.88 MHz
585 * 368.64 MHz before post divide 585 * 368.64 MHz before post divide
@@ -588,7 +588,7 @@ static void cx23885_initialize(struct i2c_client *client)
588 cx25840_write4(client, 0x114, 0x017dbf48); 588 cx25840_write4(client, 0x114, 0x017dbf48);
589 cx25840_write4(client, 0x110, 0x000a030e); 589 cx25840_write4(client, 0x110, 0x000a030e);
590 break; 590 break;
591 case V4L2_IDENT_CX23885_AV: 591 case CX23885_AV:
592 default: 592 default:
593 /* 593 /*
594 * 28.636363 MHz * (0xc + 0x1bf0c9e/0x2000000)/3 = 122.88 MHz 594 * 28.636363 MHz * (0xc + 0x1bf0c9e/0x2000000)/3 = 122.88 MHz
@@ -5110,18 +5110,18 @@ static u32 get_cx2388x_ident(struct i2c_client *client)
5110 ret = cx25840_read4(client, 0x300); 5110 ret = cx25840_read4(client, 0x300);
5111 if (((ret & 0xffff0000) >> 16) == (ret & 0xffff)) { 5111 if (((ret & 0xffff0000) >> 16) == (ret & 0xffff)) {
5112 /* No DIF */ 5112 /* No DIF */
5113 ret = V4L2_IDENT_CX23885_AV; 5113 ret = CX23885_AV;
5114 } else { 5114 } else {
5115 /* CX23887 has a broken DIF, but the registers 5115 /* CX23887 has a broken DIF, but the registers
5116 * appear valid (but unused), good enough to detect. */ 5116 * appear valid (but unused), good enough to detect. */
5117 ret = V4L2_IDENT_CX23887_AV; 5117 ret = CX23887_AV;
5118 } 5118 }
5119 } else if (cx25840_read4(client, 0x300) & 0x0fffffff) { 5119 } else if (cx25840_read4(client, 0x300) & 0x0fffffff) {
5120 /* DIF PLL Freq Word reg exists; chip must be a CX23888 */ 5120 /* DIF PLL Freq Word reg exists; chip must be a CX23888 */
5121 ret = V4L2_IDENT_CX23888_AV; 5121 ret = CX23888_AV;
5122 } else { 5122 } else {
5123 v4l_err(client, "Unable to detect h/w, assuming cx23887\n"); 5123 v4l_err(client, "Unable to detect h/w, assuming cx23887\n");
5124 ret = V4L2_IDENT_CX23887_AV; 5124 ret = CX23887_AV;
5125 } 5125 }
5126 5126
5127 /* Back into digital power down */ 5127 /* Back into digital power down */
@@ -5135,7 +5135,7 @@ static int cx25840_probe(struct i2c_client *client,
5135 struct cx25840_state *state; 5135 struct cx25840_state *state;
5136 struct v4l2_subdev *sd; 5136 struct v4l2_subdev *sd;
5137 int default_volume; 5137 int default_volume;
5138 u32 id = V4L2_IDENT_NONE; 5138 u32 id;
5139 u16 device_id; 5139 u16 device_id;
5140 5140
5141 /* Check if the adapter supports the needed features */ 5141 /* Check if the adapter supports the needed features */
@@ -5151,14 +5151,14 @@ static int cx25840_probe(struct i2c_client *client,
5151 /* The high byte of the device ID should be 5151 /* The high byte of the device ID should be
5152 * 0x83 for the cx2583x and 0x84 for the cx2584x */ 5152 * 0x83 for the cx2583x and 0x84 for the cx2584x */
5153 if ((device_id & 0xff00) == 0x8300) { 5153 if ((device_id & 0xff00) == 0x8300) {
5154 id = V4L2_IDENT_CX25836 + ((device_id >> 4) & 0xf) - 6; 5154 id = CX25836 + ((device_id >> 4) & 0xf) - 6;
5155 } else if ((device_id & 0xff00) == 0x8400) { 5155 } else if ((device_id & 0xff00) == 0x8400) {
5156 id = V4L2_IDENT_CX25840 + ((device_id >> 4) & 0xf); 5156 id = CX25840 + ((device_id >> 4) & 0xf);
5157 } else if (device_id == 0x0000) { 5157 } else if (device_id == 0x0000) {
5158 id = get_cx2388x_ident(client); 5158 id = get_cx2388x_ident(client);
5159 } else if ((device_id & 0xfff0) == 0x5A30) { 5159 } else if ((device_id & 0xfff0) == 0x5A30) {
5160 /* The CX23100 (0x5A3C = 23100) doesn't have an A/V decoder */ 5160 /* The CX23100 (0x5A3C = 23100) doesn't have an A/V decoder */
5161 id = V4L2_IDENT_CX2310X_AV; 5161 id = CX2310X_AV;
5162 } else if ((device_id & 0xff) == (device_id >> 8)) { 5162 } else if ((device_id & 0xff) == (device_id >> 8)) {
5163 v4l_err(client, 5163 v4l_err(client,
5164 "likely a confused/unresponsive cx2388[578] A/V decoder" 5164 "likely a confused/unresponsive cx2388[578] A/V decoder"
@@ -5180,26 +5180,26 @@ static int cx25840_probe(struct i2c_client *client,
5180 v4l2_i2c_subdev_init(sd, client, &cx25840_ops); 5180 v4l2_i2c_subdev_init(sd, client, &cx25840_ops);
5181 5181
5182 switch (id) { 5182 switch (id) {
5183 case V4L2_IDENT_CX23885_AV: 5183 case CX23885_AV:
5184 v4l_info(client, "cx23885 A/V decoder found @ 0x%x (%s)\n", 5184 v4l_info(client, "cx23885 A/V decoder found @ 0x%x (%s)\n",
5185 client->addr << 1, client->adapter->name); 5185 client->addr << 1, client->adapter->name);
5186 break; 5186 break;
5187 case V4L2_IDENT_CX23887_AV: 5187 case CX23887_AV:
5188 v4l_info(client, "cx23887 A/V decoder found @ 0x%x (%s)\n", 5188 v4l_info(client, "cx23887 A/V decoder found @ 0x%x (%s)\n",
5189 client->addr << 1, client->adapter->name); 5189 client->addr << 1, client->adapter->name);
5190 break; 5190 break;
5191 case V4L2_IDENT_CX23888_AV: 5191 case CX23888_AV:
5192 v4l_info(client, "cx23888 A/V decoder found @ 0x%x (%s)\n", 5192 v4l_info(client, "cx23888 A/V decoder found @ 0x%x (%s)\n",
5193 client->addr << 1, client->adapter->name); 5193 client->addr << 1, client->adapter->name);
5194 break; 5194 break;
5195 case V4L2_IDENT_CX2310X_AV: 5195 case CX2310X_AV:
5196 v4l_info(client, "cx%d A/V decoder found @ 0x%x (%s)\n", 5196 v4l_info(client, "cx%d A/V decoder found @ 0x%x (%s)\n",
5197 device_id, client->addr << 1, client->adapter->name); 5197 device_id, client->addr << 1, client->adapter->name);
5198 break; 5198 break;
5199 case V4L2_IDENT_CX25840: 5199 case CX25840:
5200 case V4L2_IDENT_CX25841: 5200 case CX25841:
5201 case V4L2_IDENT_CX25842: 5201 case CX25842:
5202 case V4L2_IDENT_CX25843: 5202 case CX25843:
5203 /* Note: revision '(device_id & 0x0f) == 2' was never built. The 5203 /* Note: revision '(device_id & 0x0f) == 2' was never built. The
5204 marking skips from 0x1 == 22 to 0x3 == 23. */ 5204 marking skips from 0x1 == 22 to 0x3 == 23. */
5205 v4l_info(client, "cx25%3x-2%x found @ 0x%x (%s)\n", 5205 v4l_info(client, "cx25%3x-2%x found @ 0x%x (%s)\n",
@@ -5208,8 +5208,8 @@ static int cx25840_probe(struct i2c_client *client,
5208 : (device_id & 0x0f), 5208 : (device_id & 0x0f),
5209 client->addr << 1, client->adapter->name); 5209 client->addr << 1, client->adapter->name);
5210 break; 5210 break;
5211 case V4L2_IDENT_CX25836: 5211 case CX25836:
5212 case V4L2_IDENT_CX25837: 5212 case CX25837:
5213 default: 5213 default:
5214 v4l_info(client, "cx25%3x-%x found @ 0x%x (%s)\n", 5214 v4l_info(client, "cx25%3x-%x found @ 0x%x (%s)\n",
5215 (device_id & 0xfff0) >> 4, device_id & 0x0f, 5215 (device_id & 0xfff0) >> 4, device_id & 0x0f,
diff --git a/drivers/media/i2c/cx25840/cx25840-core.h b/drivers/media/i2c/cx25840/cx25840-core.h
index bd4ada28b490..37bc04217c44 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.h
+++ b/drivers/media/i2c/cx25840/cx25840-core.h
@@ -23,12 +23,24 @@
23 23
24#include <linux/videodev2.h> 24#include <linux/videodev2.h>
25#include <media/v4l2-device.h> 25#include <media/v4l2-device.h>
26#include <media/v4l2-chip-ident.h>
27#include <media/v4l2-ctrls.h> 26#include <media/v4l2-ctrls.h>
28#include <linux/i2c.h> 27#include <linux/i2c.h>
29 28
30struct cx25840_ir_state; 29struct cx25840_ir_state;
31 30
31enum cx25840_model {
32 CX23885_AV,
33 CX23887_AV,
34 CX23888_AV,
35 CX2310X_AV,
36 CX25840,
37 CX25841,
38 CX25842,
39 CX25843,
40 CX25836,
41 CX25837,
42};
43
32struct cx25840_state { 44struct cx25840_state {
33 struct i2c_client *c; 45 struct i2c_client *c;
34 struct v4l2_subdev sd; 46 struct v4l2_subdev sd;
@@ -46,7 +58,7 @@ struct cx25840_state {
46 u32 audclk_freq; 58 u32 audclk_freq;
47 int audmode; 59 int audmode;
48 int vbi_line_offset; 60 int vbi_line_offset;
49 u32 id; 61 enum cx25840_model id;
50 u32 rev; 62 u32 rev;
51 int is_initialized; 63 int is_initialized;
52 wait_queue_head_t fw_wait; /* wake up when the fw load is finished */ 64 wait_queue_head_t fw_wait; /* wake up when the fw load is finished */
@@ -66,35 +78,35 @@ static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl)
66 78
67static inline bool is_cx2583x(struct cx25840_state *state) 79static inline bool is_cx2583x(struct cx25840_state *state)
68{ 80{
69 return state->id == V4L2_IDENT_CX25836 || 81 return state->id == CX25836 ||
70 state->id == V4L2_IDENT_CX25837; 82 state->id == CX25837;
71} 83}
72 84
73static inline bool is_cx231xx(struct cx25840_state *state) 85static inline bool is_cx231xx(struct cx25840_state *state)
74{ 86{
75 return state->id == V4L2_IDENT_CX2310X_AV; 87 return state->id == CX2310X_AV;
76} 88}
77 89
78static inline bool is_cx2388x(struct cx25840_state *state) 90static inline bool is_cx2388x(struct cx25840_state *state)
79{ 91{
80 return state->id == V4L2_IDENT_CX23885_AV || 92 return state->id == CX23885_AV ||
81 state->id == V4L2_IDENT_CX23887_AV || 93 state->id == CX23887_AV ||
82 state->id == V4L2_IDENT_CX23888_AV; 94 state->id == CX23888_AV;
83} 95}
84 96
85static inline bool is_cx23885(struct cx25840_state *state) 97static inline bool is_cx23885(struct cx25840_state *state)
86{ 98{
87 return state->id == V4L2_IDENT_CX23885_AV; 99 return state->id == CX23885_AV;
88} 100}
89 101
90static inline bool is_cx23887(struct cx25840_state *state) 102static inline bool is_cx23887(struct cx25840_state *state)
91{ 103{
92 return state->id == V4L2_IDENT_CX23887_AV; 104 return state->id == CX23887_AV;
93} 105}
94 106
95static inline bool is_cx23888(struct cx25840_state *state) 107static inline bool is_cx23888(struct cx25840_state *state)
96{ 108{
97 return state->id == V4L2_IDENT_CX23888_AV; 109 return state->id == CX23888_AV;
98} 110}
99 111
100/* ----------------------------------------------------------------------- */ 112/* ----------------------------------------------------------------------- */