diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-08-06 09:53:19 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-08-08 22:43:05 -0400 |
commit | 72c851b00f6c86353c54fdd9f1ef88d82e8df6c5 (patch) | |
tree | dc6a86897e06b9ad5b576ef5d75a3c5ddab9815b /drivers | |
parent | 59b8311a9b4cdd3e11d1c7d434bb9abf1ae3bc5c (diff) |
V4L/DVB: cx25840/ivtv: replace ugly priv control with s_config
The cx25840 used a private control CX25840_CID_ENABLE_PVR150_WORKAROUND
to be told whether to enable a workaround for certain pvr150 cards.
This is really config data that it needs to get at load time.
Implemented this in cx25840 and ivtv.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/cx25840/cx25840-core.c | 23 | ||||
-rw-r--r-- | drivers/media/video/cx25840/cx25840-core.h | 8 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-driver.c | 9 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-i2c.c | 7 |
4 files changed, 23 insertions, 24 deletions
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 9fab0b17084..69763729ccc 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -1127,11 +1127,6 @@ static int cx25840_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | |||
1127 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1127 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
1128 | 1128 | ||
1129 | switch (ctrl->id) { | 1129 | switch (ctrl->id) { |
1130 | case CX25840_CID_ENABLE_PVR150_WORKAROUND: | ||
1131 | state->pvr150_workaround = ctrl->value; | ||
1132 | set_input(client, state->vid_input, state->aud_input); | ||
1133 | break; | ||
1134 | |||
1135 | case V4L2_CID_BRIGHTNESS: | 1130 | case V4L2_CID_BRIGHTNESS: |
1136 | if (ctrl->value < 0 || ctrl->value > 255) { | 1131 | if (ctrl->value < 0 || ctrl->value > 255) { |
1137 | v4l_err(client, "invalid brightness setting %d\n", | 1132 | v4l_err(client, "invalid brightness setting %d\n", |
@@ -1194,9 +1189,6 @@ static int cx25840_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | |||
1194 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1189 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
1195 | 1190 | ||
1196 | switch (ctrl->id) { | 1191 | switch (ctrl->id) { |
1197 | case CX25840_CID_ENABLE_PVR150_WORKAROUND: | ||
1198 | ctrl->value = state->pvr150_workaround; | ||
1199 | break; | ||
1200 | case V4L2_CID_BRIGHTNESS: | 1192 | case V4L2_CID_BRIGHTNESS: |
1201 | ctrl->value = (s8)cx25840_read(client, 0x414) + 128; | 1193 | ctrl->value = (s8)cx25840_read(client, 0x414) + 128; |
1202 | break; | 1194 | break; |
@@ -1792,6 +1784,20 @@ static int cx25840_log_status(struct v4l2_subdev *sd) | |||
1792 | return 0; | 1784 | return 0; |
1793 | } | 1785 | } |
1794 | 1786 | ||
1787 | static int cx25840_s_config(struct v4l2_subdev *sd, int irq, void *platform_data) | ||
1788 | { | ||
1789 | struct cx25840_state *state = to_state(sd); | ||
1790 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
1791 | |||
1792 | if (platform_data) { | ||
1793 | struct cx25840_platform_data *pdata = platform_data; | ||
1794 | |||
1795 | state->pvr150_workaround = pdata->pvr150_workaround; | ||
1796 | set_input(client, state->vid_input, state->aud_input); | ||
1797 | } | ||
1798 | return 0; | ||
1799 | } | ||
1800 | |||
1795 | static int cx23885_irq_handler(struct v4l2_subdev *sd, u32 status, | 1801 | static int cx23885_irq_handler(struct v4l2_subdev *sd, u32 status, |
1796 | bool *handled) | 1802 | bool *handled) |
1797 | { | 1803 | { |
@@ -1879,6 +1885,7 @@ static int cx25840_irq_handler(struct v4l2_subdev *sd, u32 status, | |||
1879 | 1885 | ||
1880 | static const struct v4l2_subdev_core_ops cx25840_core_ops = { | 1886 | static const struct v4l2_subdev_core_ops cx25840_core_ops = { |
1881 | .log_status = cx25840_log_status, | 1887 | .log_status = cx25840_log_status, |
1888 | .s_config = cx25840_s_config, | ||
1882 | .g_chip_ident = cx25840_g_chip_ident, | 1889 | .g_chip_ident = cx25840_g_chip_ident, |
1883 | .g_ctrl = cx25840_g_ctrl, | 1890 | .g_ctrl = cx25840_g_ctrl, |
1884 | .s_ctrl = cx25840_s_ctrl, | 1891 | .s_ctrl = cx25840_s_ctrl, |
diff --git a/drivers/media/video/cx25840/cx25840-core.h b/drivers/media/video/cx25840/cx25840-core.h index 8f47322c003..8ac57a13a45 100644 --- a/drivers/media/video/cx25840/cx25840-core.h +++ b/drivers/media/video/cx25840/cx25840-core.h | |||
@@ -26,14 +26,6 @@ | |||
26 | #include <media/v4l2-chip-ident.h> | 26 | #include <media/v4l2-chip-ident.h> |
27 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
28 | 28 | ||
29 | /* ENABLE_PVR150_WORKAROUND activates a workaround for a hardware bug that is | ||
30 | present in Hauppauge PVR-150 (and possibly PVR-500) cards that have | ||
31 | certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The | ||
32 | audio autodetect fails on some channels for these models and the workaround | ||
33 | is to select the audio standard explicitly. Many thanks to Hauppauge for | ||
34 | providing this information. */ | ||
35 | #define CX25840_CID_ENABLE_PVR150_WORKAROUND (V4L2_CID_PRIVATE_BASE+0) | ||
36 | |||
37 | struct cx25840_ir_state; | 29 | struct cx25840_ir_state; |
38 | 30 | ||
39 | struct cx25840_state { | 31 | struct cx25840_state { |
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index 07c5c18a25c..f72e9d1cee0 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
@@ -1269,15 +1269,8 @@ int ivtv_init_on_first_open(struct ivtv *itv) | |||
1269 | IVTV_DEBUG_INFO("Getting firmware version..\n"); | 1269 | IVTV_DEBUG_INFO("Getting firmware version..\n"); |
1270 | ivtv_firmware_versions(itv); | 1270 | ivtv_firmware_versions(itv); |
1271 | 1271 | ||
1272 | if (itv->card->hw_all & IVTV_HW_CX25840) { | 1272 | if (itv->card->hw_all & IVTV_HW_CX25840) |
1273 | struct v4l2_control ctrl; | ||
1274 | |||
1275 | v4l2_subdev_call(itv->sd_video, core, load_fw); | 1273 | v4l2_subdev_call(itv->sd_video, core, load_fw); |
1276 | /* CX25840_CID_ENABLE_PVR150_WORKAROUND */ | ||
1277 | ctrl.id = V4L2_CID_PRIVATE_BASE; | ||
1278 | ctrl.value = itv->pvr150_workaround; | ||
1279 | v4l2_subdev_call(itv->sd_video, core, s_ctrl, &ctrl); | ||
1280 | } | ||
1281 | 1274 | ||
1282 | vf.tuner = 0; | 1275 | vf.tuner = 0; |
1283 | vf.type = V4L2_TUNER_ANALOG_TV; | 1276 | vf.type = V4L2_TUNER_ANALOG_TV; |
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index a5b92d109c6..d391bbdb0b8 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c | |||
@@ -63,6 +63,7 @@ | |||
63 | #include "ivtv-cards.h" | 63 | #include "ivtv-cards.h" |
64 | #include "ivtv-gpio.h" | 64 | #include "ivtv-gpio.h" |
65 | #include "ivtv-i2c.h" | 65 | #include "ivtv-i2c.h" |
66 | #include <media/cx25840.h> | ||
66 | 67 | ||
67 | /* i2c implementation for cx23415/6 chip, ivtv project. | 68 | /* i2c implementation for cx23415/6 chip, ivtv project. |
68 | * Author: Kevin Thayer (nufan_wfk at yahoo.com) | 69 | * Author: Kevin Thayer (nufan_wfk at yahoo.com) |
@@ -292,6 +293,12 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx) | |||
292 | if (hw == IVTV_HW_UPD64031A || hw == IVTV_HW_UPD6408X) { | 293 | if (hw == IVTV_HW_UPD64031A || hw == IVTV_HW_UPD6408X) { |
293 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, | 294 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, |
294 | adap, mod, type, 0, I2C_ADDRS(hw_addrs[idx])); | 295 | adap, mod, type, 0, I2C_ADDRS(hw_addrs[idx])); |
296 | } else if (hw == IVTV_HW_CX25840) { | ||
297 | struct cx25840_platform_data pdata; | ||
298 | |||
299 | pdata.pvr150_workaround = itv->pvr150_workaround; | ||
300 | sd = v4l2_i2c_new_subdev_cfg(&itv->v4l2_dev, | ||
301 | adap, mod, type, 0, &pdata, hw_addrs[idx], NULL); | ||
295 | } else { | 302 | } else { |
296 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, | 303 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, |
297 | adap, mod, type, hw_addrs[idx], NULL); | 304 | adap, mod, type, hw_addrs[idx], NULL); |