diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-05-29 05:59:39 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-06-17 07:43:46 -0400 |
commit | 80f8568f47306dc4453bb6630ac607f22ca4c7b4 (patch) | |
tree | 7ab8524d9c295c13c0031b1c309e6ba0b210ea8b | |
parent | 4bd8193674b7d3158e76eb48bdf3a787b71b8572 (diff) |
[media] cx23885: remove g_chip_ident
Replace g_chip_ident by g_chip_info. Note that the IR support is implemented
as a subdev, so this part no longer needs to be handled as a 'bridge' chip.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/pci/cx23885/cx23885-417.c | 2 | ||||
-rw-r--r-- | drivers/media/pci/cx23885/cx23885-ioctl.c | 139 | ||||
-rw-r--r-- | drivers/media/pci/cx23885/cx23885-ioctl.h | 4 | ||||
-rw-r--r-- | drivers/media/pci/cx23885/cx23885-video.c | 2 | ||||
-rw-r--r-- | drivers/media/pci/cx23885/cx23888-ir.c | 27 |
5 files changed, 29 insertions, 145 deletions
diff --git a/drivers/media/pci/cx23885/cx23885-417.c b/drivers/media/pci/cx23885/cx23885-417.c index 6dea11a7a858..68568d35a692 100644 --- a/drivers/media/pci/cx23885/cx23885-417.c +++ b/drivers/media/pci/cx23885/cx23885-417.c | |||
@@ -1690,8 +1690,8 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = { | |||
1690 | .vidioc_log_status = vidioc_log_status, | 1690 | .vidioc_log_status = vidioc_log_status, |
1691 | .vidioc_querymenu = vidioc_querymenu, | 1691 | .vidioc_querymenu = vidioc_querymenu, |
1692 | .vidioc_queryctrl = vidioc_queryctrl, | 1692 | .vidioc_queryctrl = vidioc_queryctrl, |
1693 | .vidioc_g_chip_ident = cx23885_g_chip_ident, | ||
1694 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1693 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
1694 | .vidioc_g_chip_info = cx23885_g_chip_info, | ||
1695 | .vidioc_g_register = cx23885_g_register, | 1695 | .vidioc_g_register = cx23885_g_register, |
1696 | .vidioc_s_register = cx23885_s_register, | 1696 | .vidioc_s_register = cx23885_s_register, |
1697 | #endif | 1697 | #endif |
diff --git a/drivers/media/pci/cx23885/cx23885-ioctl.c b/drivers/media/pci/cx23885/cx23885-ioctl.c index 00f51251728b..271d69d1ca8c 100644 --- a/drivers/media/pci/cx23885/cx23885-ioctl.c +++ b/drivers/media/pci/cx23885/cx23885-ioctl.c | |||
@@ -24,93 +24,21 @@ | |||
24 | #include "cx23885.h" | 24 | #include "cx23885.h" |
25 | #include "cx23885-ioctl.h" | 25 | #include "cx23885-ioctl.h" |
26 | 26 | ||
27 | #include <media/v4l2-chip-ident.h> | 27 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
28 | 28 | int cx23885_g_chip_info(struct file *file, void *fh, | |
29 | int cx23885_g_chip_ident(struct file *file, void *fh, | 29 | struct v4l2_dbg_chip_info *chip) |
30 | struct v4l2_dbg_chip_ident *chip) | ||
31 | { | 30 | { |
32 | struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; | 31 | struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; |
33 | int err = 0; | ||
34 | u8 rev; | ||
35 | |||
36 | chip->ident = V4L2_IDENT_NONE; | ||
37 | chip->revision = 0; | ||
38 | switch (chip->match.type) { | ||
39 | case V4L2_CHIP_MATCH_HOST: | ||
40 | switch (chip->match.addr) { | ||
41 | case 0: | ||
42 | rev = cx_read(RDR_CFG2) & 0xff; | ||
43 | switch (dev->pci->device) { | ||
44 | case 0x8852: | ||
45 | /* rev 0x04 could be '885 or '888. Pick '888. */ | ||
46 | if (rev == 0x04) | ||
47 | chip->ident = V4L2_IDENT_CX23888; | ||
48 | else | ||
49 | chip->ident = V4L2_IDENT_CX23885; | ||
50 | break; | ||
51 | case 0x8880: | ||
52 | if (rev == 0x0e || rev == 0x0f) | ||
53 | chip->ident = V4L2_IDENT_CX23887; | ||
54 | else | ||
55 | chip->ident = V4L2_IDENT_CX23888; | ||
56 | break; | ||
57 | default: | ||
58 | chip->ident = V4L2_IDENT_UNKNOWN; | ||
59 | break; | ||
60 | } | ||
61 | chip->revision = (dev->pci->device << 16) | (rev << 8) | | ||
62 | (dev->hwrevision & 0xff); | ||
63 | break; | ||
64 | case 1: | ||
65 | if (dev->v4l_device != NULL) { | ||
66 | chip->ident = V4L2_IDENT_CX23417; | ||
67 | chip->revision = 0; | ||
68 | } | ||
69 | break; | ||
70 | case 2: | ||
71 | /* | ||
72 | * The integrated IR controller on the CX23888 is | ||
73 | * host chip 2. It may not be used/initialized or sd_ir | ||
74 | * may be pointing at the cx25840 subdevice for the | ||
75 | * IR controller on the CX23885. Thus we find it | ||
76 | * without using the dev->sd_ir pointer. | ||
77 | */ | ||
78 | call_hw(dev, CX23885_HW_888_IR, core, g_chip_ident, | ||
79 | chip); | ||
80 | break; | ||
81 | default: | ||
82 | err = -EINVAL; /* per V4L2 spec */ | ||
83 | break; | ||
84 | } | ||
85 | break; | ||
86 | case V4L2_CHIP_MATCH_I2C_DRIVER: | ||
87 | /* If needed, returns V4L2_IDENT_AMBIGUOUS without extra work */ | ||
88 | call_all(dev, core, g_chip_ident, chip); | ||
89 | break; | ||
90 | case V4L2_CHIP_MATCH_I2C_ADDR: | ||
91 | /* | ||
92 | * We could return V4L2_IDENT_UNKNOWN, but we don't do the work | ||
93 | * to look if a chip is at the address with no driver. That's a | ||
94 | * dangerous thing to do with EEPROMs anyway. | ||
95 | */ | ||
96 | call_all(dev, core, g_chip_ident, chip); | ||
97 | break; | ||
98 | default: | ||
99 | err = -EINVAL; | ||
100 | break; | ||
101 | } | ||
102 | return err; | ||
103 | } | ||
104 | 32 | ||
105 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 33 | if (chip->match.addr > 1) |
106 | static int cx23885_g_host_register(struct cx23885_dev *dev, | ||
107 | struct v4l2_dbg_register *reg) | ||
108 | { | ||
109 | if ((reg->reg & 0x3) != 0 || reg->reg >= pci_resource_len(dev->pci, 0)) | ||
110 | return -EINVAL; | 34 | return -EINVAL; |
111 | 35 | if (chip->match.addr == 1) { | |
112 | reg->size = 4; | 36 | if (dev->v4l_device == NULL) |
113 | reg->val = cx_read(reg->reg); | 37 | return -EINVAL; |
38 | strlcpy(chip->name, "cx23417", sizeof(chip->name)); | ||
39 | } else { | ||
40 | strlcpy(chip->name, dev->v4l2_dev.name, sizeof(chip->name)); | ||
41 | } | ||
114 | return 0; | 42 | return 0; |
115 | } | 43 | } |
116 | 44 | ||
@@ -138,29 +66,16 @@ int cx23885_g_register(struct file *file, void *fh, | |||
138 | { | 66 | { |
139 | struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; | 67 | struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; |
140 | 68 | ||
141 | if (reg->match.type == V4L2_CHIP_MATCH_HOST) { | 69 | if (reg->match.addr > 1) |
142 | switch (reg->match.addr) { | 70 | return -EINVAL; |
143 | case 0: | 71 | if (reg->match.addr) |
144 | return cx23885_g_host_register(dev, reg); | 72 | return cx23417_g_register(dev, reg); |
145 | case 1: | ||
146 | return cx23417_g_register(dev, reg); | ||
147 | default: | ||
148 | break; | ||
149 | } | ||
150 | } | ||
151 | |||
152 | /* FIXME - any error returns should not be ignored */ | ||
153 | call_all(dev, core, g_register, reg); | ||
154 | return 0; | ||
155 | } | ||
156 | 73 | ||
157 | static int cx23885_s_host_register(struct cx23885_dev *dev, | ||
158 | const struct v4l2_dbg_register *reg) | ||
159 | { | ||
160 | if ((reg->reg & 0x3) != 0 || reg->reg >= pci_resource_len(dev->pci, 0)) | 74 | if ((reg->reg & 0x3) != 0 || reg->reg >= pci_resource_len(dev->pci, 0)) |
161 | return -EINVAL; | 75 | return -EINVAL; |
162 | 76 | ||
163 | cx_write(reg->reg, reg->val); | 77 | reg->size = 4; |
78 | reg->val = cx_read(reg->reg); | ||
164 | return 0; | 79 | return 0; |
165 | } | 80 | } |
166 | 81 | ||
@@ -183,19 +98,15 @@ int cx23885_s_register(struct file *file, void *fh, | |||
183 | { | 98 | { |
184 | struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; | 99 | struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; |
185 | 100 | ||
186 | if (reg->match.type == V4L2_CHIP_MATCH_HOST) { | 101 | if (reg->match.addr > 1) |
187 | switch (reg->match.addr) { | 102 | return -EINVAL; |
188 | case 0: | 103 | if (reg->match.addr) |
189 | return cx23885_s_host_register(dev, reg); | 104 | return cx23417_s_register(dev, reg); |
190 | case 1: | 105 | |
191 | return cx23417_s_register(dev, reg); | 106 | if ((reg->reg & 0x3) != 0 || reg->reg >= pci_resource_len(dev->pci, 0)) |
192 | default: | 107 | return -EINVAL; |
193 | break; | ||
194 | } | ||
195 | } | ||
196 | 108 | ||
197 | /* FIXME - any error returns should not be ignored */ | 109 | cx_write(reg->reg, reg->val); |
198 | call_all(dev, core, s_register, reg); | ||
199 | return 0; | 110 | return 0; |
200 | } | 111 | } |
201 | #endif | 112 | #endif |
diff --git a/drivers/media/pci/cx23885/cx23885-ioctl.h b/drivers/media/pci/cx23885/cx23885-ioctl.h index a6080964a9ee..92d9f0774366 100644 --- a/drivers/media/pci/cx23885/cx23885-ioctl.h +++ b/drivers/media/pci/cx23885/cx23885-ioctl.h | |||
@@ -24,8 +24,8 @@ | |||
24 | #ifndef _CX23885_IOCTL_H_ | 24 | #ifndef _CX23885_IOCTL_H_ |
25 | #define _CX23885_IOCTL_H_ | 25 | #define _CX23885_IOCTL_H_ |
26 | 26 | ||
27 | int cx23885_g_chip_ident(struct file *file, void *fh, | 27 | int cx23885_g_chip_info(struct file *file, void *fh, |
28 | struct v4l2_dbg_chip_ident *chip); | 28 | struct v4l2_dbg_chip_info *chip); |
29 | 29 | ||
30 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 30 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
31 | int cx23885_g_register(struct file *file, void *fh, | 31 | int cx23885_g_register(struct file *file, void *fh, |
diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index ed08c89adde0..ce057398c632 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c | |||
@@ -1757,8 +1757,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
1757 | .vidioc_s_tuner = vidioc_s_tuner, | 1757 | .vidioc_s_tuner = vidioc_s_tuner, |
1758 | .vidioc_g_frequency = vidioc_g_frequency, | 1758 | .vidioc_g_frequency = vidioc_g_frequency, |
1759 | .vidioc_s_frequency = vidioc_s_frequency, | 1759 | .vidioc_s_frequency = vidioc_s_frequency, |
1760 | .vidioc_g_chip_ident = cx23885_g_chip_ident, | ||
1761 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1760 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
1761 | .vidioc_g_chip_info = cx23885_g_chip_info, | ||
1762 | .vidioc_g_register = cx23885_g_register, | 1762 | .vidioc_g_register = cx23885_g_register, |
1763 | .vidioc_s_register = cx23885_s_register, | 1763 | .vidioc_s_register = cx23885_s_register, |
1764 | #endif | 1764 | #endif |
diff --git a/drivers/media/pci/cx23885/cx23888-ir.c b/drivers/media/pci/cx23885/cx23888-ir.c index cd98651f3ae6..2c951dec2d33 100644 --- a/drivers/media/pci/cx23885/cx23888-ir.c +++ b/drivers/media/pci/cx23885/cx23888-ir.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | 26 | ||
27 | #include <media/v4l2-device.h> | 27 | #include <media/v4l2-device.h> |
28 | #include <media/v4l2-chip-ident.h> | ||
29 | #include <media/rc-core.h> | 28 | #include <media/rc-core.h> |
30 | 29 | ||
31 | #include "cx23885.h" | 30 | #include "cx23885.h" |
@@ -131,8 +130,6 @@ union cx23888_ir_fifo_rec { | |||
131 | struct cx23888_ir_state { | 130 | struct cx23888_ir_state { |
132 | struct v4l2_subdev sd; | 131 | struct v4l2_subdev sd; |
133 | struct cx23885_dev *dev; | 132 | struct cx23885_dev *dev; |
134 | u32 id; | ||
135 | u32 rev; | ||
136 | 133 | ||
137 | struct v4l2_subdev_ir_parameters rx_params; | 134 | struct v4l2_subdev_ir_parameters rx_params; |
138 | struct mutex rx_params_lock; | 135 | struct mutex rx_params_lock; |
@@ -1086,23 +1083,6 @@ static int cx23888_ir_log_status(struct v4l2_subdev *sd) | |||
1086 | return 0; | 1083 | return 0; |
1087 | } | 1084 | } |
1088 | 1085 | ||
1089 | static inline int cx23888_ir_dbg_match(const struct v4l2_dbg_match *match) | ||
1090 | { | ||
1091 | return match->type == V4L2_CHIP_MATCH_HOST && match->addr == 2; | ||
1092 | } | ||
1093 | |||
1094 | static int cx23888_ir_g_chip_ident(struct v4l2_subdev *sd, | ||
1095 | struct v4l2_dbg_chip_ident *chip) | ||
1096 | { | ||
1097 | struct cx23888_ir_state *state = to_state(sd); | ||
1098 | |||
1099 | if (cx23888_ir_dbg_match(&chip->match)) { | ||
1100 | chip->ident = state->id; | ||
1101 | chip->revision = state->rev; | ||
1102 | } | ||
1103 | return 0; | ||
1104 | } | ||
1105 | |||
1106 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1086 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
1107 | static int cx23888_ir_g_register(struct v4l2_subdev *sd, | 1087 | static int cx23888_ir_g_register(struct v4l2_subdev *sd, |
1108 | struct v4l2_dbg_register *reg) | 1088 | struct v4l2_dbg_register *reg) |
@@ -1110,8 +1090,6 @@ static int cx23888_ir_g_register(struct v4l2_subdev *sd, | |||
1110 | struct cx23888_ir_state *state = to_state(sd); | 1090 | struct cx23888_ir_state *state = to_state(sd); |
1111 | u32 addr = CX23888_IR_REG_BASE + (u32) reg->reg; | 1091 | u32 addr = CX23888_IR_REG_BASE + (u32) reg->reg; |
1112 | 1092 | ||
1113 | if (!cx23888_ir_dbg_match(®->match)) | ||
1114 | return -EINVAL; | ||
1115 | if ((addr & 0x3) != 0) | 1093 | if ((addr & 0x3) != 0) |
1116 | return -EINVAL; | 1094 | return -EINVAL; |
1117 | if (addr < CX23888_IR_CNTRL_REG || addr > CX23888_IR_LEARN_REG) | 1095 | if (addr < CX23888_IR_CNTRL_REG || addr > CX23888_IR_LEARN_REG) |
@@ -1127,8 +1105,6 @@ static int cx23888_ir_s_register(struct v4l2_subdev *sd, | |||
1127 | struct cx23888_ir_state *state = to_state(sd); | 1105 | struct cx23888_ir_state *state = to_state(sd); |
1128 | u32 addr = CX23888_IR_REG_BASE + (u32) reg->reg; | 1106 | u32 addr = CX23888_IR_REG_BASE + (u32) reg->reg; |
1129 | 1107 | ||
1130 | if (!cx23888_ir_dbg_match(®->match)) | ||
1131 | return -EINVAL; | ||
1132 | if ((addr & 0x3) != 0) | 1108 | if ((addr & 0x3) != 0) |
1133 | return -EINVAL; | 1109 | return -EINVAL; |
1134 | if (addr < CX23888_IR_CNTRL_REG || addr > CX23888_IR_LEARN_REG) | 1110 | if (addr < CX23888_IR_CNTRL_REG || addr > CX23888_IR_LEARN_REG) |
@@ -1139,7 +1115,6 @@ static int cx23888_ir_s_register(struct v4l2_subdev *sd, | |||
1139 | #endif | 1115 | #endif |
1140 | 1116 | ||
1141 | static const struct v4l2_subdev_core_ops cx23888_ir_core_ops = { | 1117 | static const struct v4l2_subdev_core_ops cx23888_ir_core_ops = { |
1142 | .g_chip_ident = cx23888_ir_g_chip_ident, | ||
1143 | .log_status = cx23888_ir_log_status, | 1118 | .log_status = cx23888_ir_log_status, |
1144 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1119 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
1145 | .g_register = cx23888_ir_g_register, | 1120 | .g_register = cx23888_ir_g_register, |
@@ -1213,8 +1188,6 @@ int cx23888_ir_probe(struct cx23885_dev *dev) | |||
1213 | return -ENOMEM; | 1188 | return -ENOMEM; |
1214 | 1189 | ||
1215 | state->dev = dev; | 1190 | state->dev = dev; |
1216 | state->id = V4L2_IDENT_CX23888_IR; | ||
1217 | state->rev = 0; | ||
1218 | sd = &state->sd; | 1191 | sd = &state->sd; |
1219 | 1192 | ||
1220 | v4l2_subdev_init(sd, &cx23888_ir_controller_ops); | 1193 | v4l2_subdev_init(sd, &cx23888_ir_controller_ops); |