aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c23
-rw-r--r--drivers/media/video/cx25840/cx25840-core.h8
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c9
-rw-r--r--drivers/media/video/ivtv/ivtv-i2c.c7
-rw-r--r--include/media/cx25840.h12
5 files changed, 35 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
1787static 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
1795static int cx23885_irq_handler(struct v4l2_subdev *sd, u32 status, 1801static 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
1880static const struct v4l2_subdev_core_ops cx25840_core_ops = { 1886static 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
37struct cx25840_ir_state; 29struct cx25840_ir_state;
38 30
39struct cx25840_state { 31struct 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);
diff --git a/include/media/cx25840.h b/include/media/cx25840.h
index 1bba39e3d40..46d1a141208 100644
--- a/include/media/cx25840.h
+++ b/include/media/cx25840.h
@@ -172,4 +172,16 @@ enum cx23885_io_pad {
172 CX23885_PAD_IRQ_N, 172 CX23885_PAD_IRQ_N,
173 CX23885_PAD_GPIO16, 173 CX23885_PAD_GPIO16,
174}; 174};
175
176/* pvr150_workaround activates a workaround for a hardware bug that is
177 present in Hauppauge PVR-150 (and possibly PVR-500) cards that have
178 certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The
179 audio autodetect fails on some channels for these models and the workaround
180 is to select the audio standard explicitly. Many thanks to Hauppauge for
181 providing this information.
182 This platform data only needs to be supplied by the ivtv driver. */
183struct cx25840_platform_data {
184 int pvr150_workaround;
185};
186
175#endif 187#endif