diff options
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-hdw.c')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 74 |
1 files changed, 30 insertions, 44 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index add3395d3248..0c745b142fb7 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -142,6 +142,15 @@ static const unsigned char *module_i2c_addresses[] = { | |||
142 | }; | 142 | }; |
143 | 143 | ||
144 | 144 | ||
145 | static const char *ir_scheme_names[] = { | ||
146 | [PVR2_IR_SCHEME_NONE] = "none", | ||
147 | [PVR2_IR_SCHEME_29XXX] = "29xxx", | ||
148 | [PVR2_IR_SCHEME_24XXX] = "24xxx (29xxx emulation)", | ||
149 | [PVR2_IR_SCHEME_24XXX_MCE] = "24xxx (MCE device)", | ||
150 | [PVR2_IR_SCHEME_ZILOG] = "Zilog", | ||
151 | }; | ||
152 | |||
153 | |||
145 | /* Define the list of additional controls we'll dynamically construct based | 154 | /* Define the list of additional controls we'll dynamically construct based |
146 | on query of the cx2341x module. */ | 155 | on query of the cx2341x module. */ |
147 | struct pvr2_mpeg_ids { | 156 | struct pvr2_mpeg_ids { |
@@ -2170,7 +2179,7 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw) | |||
2170 | } | 2179 | } |
2171 | 2180 | ||
2172 | /* Take the IR chip out of reset, if appropriate */ | 2181 | /* Take the IR chip out of reset, if appropriate */ |
2173 | if (hdw->hdw_desc->ir_scheme == PVR2_IR_SCHEME_ZILOG) { | 2182 | if (hdw->ir_scheme_active == PVR2_IR_SCHEME_ZILOG) { |
2174 | pvr2_issue_simple_cmd(hdw, | 2183 | pvr2_issue_simple_cmd(hdw, |
2175 | FX2CMD_HCW_ZILOG_RESET | | 2184 | FX2CMD_HCW_ZILOG_RESET | |
2176 | (1 << 8) | | 2185 | (1 << 8) | |
@@ -2451,6 +2460,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, | |||
2451 | GFP_KERNEL); | 2460 | GFP_KERNEL); |
2452 | if (!hdw->controls) goto fail; | 2461 | if (!hdw->controls) goto fail; |
2453 | hdw->hdw_desc = hdw_desc; | 2462 | hdw->hdw_desc = hdw_desc; |
2463 | hdw->ir_scheme_active = hdw->hdw_desc->ir_scheme; | ||
2454 | for (idx = 0; idx < hdw->control_cnt; idx++) { | 2464 | for (idx = 0; idx < hdw->control_cnt; idx++) { |
2455 | cptr = hdw->controls + idx; | 2465 | cptr = hdw->controls + idx; |
2456 | cptr->hdw = hdw; | 2466 | cptr->hdw = hdw; |
@@ -4809,6 +4819,12 @@ static unsigned int pvr2_hdw_report_unlocked(struct pvr2_hdw *hdw,int which, | |||
4809 | stats.buffers_processed, | 4819 | stats.buffers_processed, |
4810 | stats.buffers_failed); | 4820 | stats.buffers_failed); |
4811 | } | 4821 | } |
4822 | case 6: { | ||
4823 | unsigned int id = hdw->ir_scheme_active; | ||
4824 | return scnprintf(buf, acnt, "ir scheme: id=%d %s", id, | ||
4825 | (id >= ARRAY_SIZE(ir_scheme_names) ? | ||
4826 | "?" : ir_scheme_names[id])); | ||
4827 | } | ||
4812 | default: break; | 4828 | default: break; |
4813 | } | 4829 | } |
4814 | return 0; | 4830 | return 0; |
@@ -4825,65 +4841,35 @@ static unsigned int pvr2_hdw_report_clients(struct pvr2_hdw *hdw, | |||
4825 | unsigned int tcnt = 0; | 4841 | unsigned int tcnt = 0; |
4826 | unsigned int ccnt; | 4842 | unsigned int ccnt; |
4827 | struct i2c_client *client; | 4843 | struct i2c_client *client; |
4828 | struct list_head *item; | ||
4829 | void *cd; | ||
4830 | const char *p; | 4844 | const char *p; |
4831 | unsigned int id; | 4845 | unsigned int id; |
4832 | 4846 | ||
4833 | ccnt = scnprintf(buf, acnt, "Associated v4l2-subdev drivers:"); | 4847 | ccnt = scnprintf(buf, acnt, "Associated v4l2-subdev drivers and I2C clients:\n"); |
4834 | tcnt += ccnt; | 4848 | tcnt += ccnt; |
4835 | v4l2_device_for_each_subdev(sd, &hdw->v4l2_dev) { | 4849 | v4l2_device_for_each_subdev(sd, &hdw->v4l2_dev) { |
4836 | id = sd->grp_id; | 4850 | id = sd->grp_id; |
4837 | p = NULL; | 4851 | p = NULL; |
4838 | if (id < ARRAY_SIZE(module_names)) p = module_names[id]; | 4852 | if (id < ARRAY_SIZE(module_names)) p = module_names[id]; |
4839 | if (p) { | 4853 | if (p) { |
4840 | ccnt = scnprintf(buf + tcnt, acnt - tcnt, " %s", p); | 4854 | ccnt = scnprintf(buf + tcnt, acnt - tcnt, " %s:", p); |
4841 | tcnt += ccnt; | 4855 | tcnt += ccnt; |
4842 | } else { | 4856 | } else { |
4843 | ccnt = scnprintf(buf + tcnt, acnt - tcnt, | 4857 | ccnt = scnprintf(buf + tcnt, acnt - tcnt, |
4844 | " (unknown id=%u)", id); | 4858 | " (unknown id=%u):", id); |
4845 | tcnt += ccnt; | 4859 | tcnt += ccnt; |
4846 | } | 4860 | } |
4847 | } | 4861 | client = v4l2_get_subdevdata(sd); |
4848 | ccnt = scnprintf(buf + tcnt, acnt - tcnt, "\n"); | 4862 | if (client) { |
4849 | tcnt += ccnt; | 4863 | ccnt = scnprintf(buf + tcnt, acnt - tcnt, |
4850 | 4864 | " %s @ %02x\n", client->name, | |
4851 | ccnt = scnprintf(buf + tcnt, acnt - tcnt, "I2C clients:\n"); | 4865 | client->addr); |
4852 | tcnt += ccnt; | 4866 | tcnt += ccnt; |
4853 | 4867 | } else { | |
4854 | mutex_lock(&hdw->i2c_adap.clist_lock); | 4868 | ccnt = scnprintf(buf + tcnt, acnt - tcnt, |
4855 | list_for_each(item, &hdw->i2c_adap.clients) { | 4869 | " no i2c client\n"); |
4856 | client = list_entry(item, struct i2c_client, list); | 4870 | tcnt += ccnt; |
4857 | ccnt = scnprintf(buf + tcnt, acnt - tcnt, | ||
4858 | " %s: i2c=%02x", client->name, client->addr); | ||
4859 | tcnt += ccnt; | ||
4860 | cd = i2c_get_clientdata(client); | ||
4861 | v4l2_device_for_each_subdev(sd, &hdw->v4l2_dev) { | ||
4862 | if (cd == sd) { | ||
4863 | id = sd->grp_id; | ||
4864 | p = NULL; | ||
4865 | if (id < ARRAY_SIZE(module_names)) { | ||
4866 | p = module_names[id]; | ||
4867 | } | ||
4868 | if (p) { | ||
4869 | ccnt = scnprintf(buf + tcnt, | ||
4870 | acnt - tcnt, | ||
4871 | " subdev=%s", p); | ||
4872 | tcnt += ccnt; | ||
4873 | } else { | ||
4874 | ccnt = scnprintf(buf + tcnt, | ||
4875 | acnt - tcnt, | ||
4876 | " subdev= id %u)", | ||
4877 | id); | ||
4878 | tcnt += ccnt; | ||
4879 | } | ||
4880 | break; | ||
4881 | } | ||
4882 | } | 4871 | } |
4883 | ccnt = scnprintf(buf + tcnt, acnt - tcnt, "\n"); | ||
4884 | tcnt += ccnt; | ||
4885 | } | 4872 | } |
4886 | mutex_unlock(&hdw->i2c_adap.clist_lock); | ||
4887 | return tcnt; | 4873 | return tcnt; |
4888 | } | 4874 | } |
4889 | 4875 | ||