From ccb148c4d7d22792a1a65d80c85f1800f2227cfa Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 31 Aug 2009 21:53:05 +0200 Subject: compat: don't build si4713 for kernels < 2.6.26 From: Hans Verkuil si4713 requires the new i2c API, so no point trying to build it on those old kernels. Priority: normal Signed-off-by: Hans Verkuil --- v4l/versions.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/v4l/versions.txt b/v4l/versions.txt index d4c7bd380..b2c5bd8fe 100644 --- a/v4l/versions.txt +++ b/v4l/versions.txt @@ -19,6 +19,8 @@ VIDEO_TVP514X RADIO_TEA5764 VIDEO_THS7303 VIDEO_ADV7343 +RADIO_SI4713 +I2C_SI4713 [2.6.25] # Requires gpiolib -- cgit v1.2.3 From 16f4313d433426d6be10c2cb34a73cc472dc025a Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 31 Aug 2009 22:08:34 +0200 Subject: compat: don't build soc-camera modules for kernels < 2.6.28. From: Hans Verkuil Compiling this for pre-2.6.28 kernels will generate a lot of warnings due to a prototype change in dev_get_drvdata. Priority: normal Signed-off-by: Hans Verkuil CC: Guennadi Liakhovetski --- v4l/versions.txt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/v4l/versions.txt b/v4l/versions.txt index b2c5bd8fe..1995c9006 100644 --- a/v4l/versions.txt +++ b/v4l/versions.txt @@ -12,6 +12,17 @@ VIDEO_DM355_CCDC # Needs defines that are only available from 2.6.29 VIDEO_PXA27x +[2.6.28] +# dev_get_drvdata switched to const struct device * +SOC_CAMERA +SOC_CAMERA_MT9V022 +SOC_CAMERA_MT9M001 +SOC_CAMERA_MT9M111 +SOC_CAMERA_MT9T031 +SOC_CAMERA_OV772X +SOC_CAMERA_TW9910 +SOC_CAMERA_PLATFORM + [2.6.26] # Requires struct i2c_device_id VIDEO_TVP514X @@ -22,12 +33,6 @@ VIDEO_ADV7343 RADIO_SI4713 I2C_SI4713 -[2.6.25] -# Requires gpiolib -SOC_CAMERA -SOC_CAMERA_MT9V022 -SOC_CAMERA_MT9M001 - [2.6.24] # Some freezer routines USB_GSPCA_SN9C20X_EVDEV -- cgit v1.2.3 From 0d61095304d57762b4452311a5efa6b93ac9f62f Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 31 Aug 2009 22:21:04 +0200 Subject: si4713: simplify the code to remove a compiler warning. From: Hans Verkuil The compiler warned about an uninitialized stereo variable. By simplifying the code it 1) improved readability and 2) fixed the compiler warning. Priority: normal Signed-off-by: Hans Verkuil CC: Eduardo Valentin --- linux/drivers/media/radio/si4713-i2c.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/linux/drivers/media/radio/si4713-i2c.c b/linux/drivers/media/radio/si4713-i2c.c index 8cbbe48b0..6a0028eb4 100644 --- a/linux/drivers/media/radio/si4713-i2c.c +++ b/linux/drivers/media/radio/si4713-i2c.c @@ -1841,15 +1841,11 @@ static int si4713_s_modulator(struct v4l2_subdev *sd, struct v4l2_modulator *vm) u16 stereo, rds; u32 p; - if (!sdev) { - rval = -ENODEV; - goto exit; - } + if (!sdev) + return -ENODEV; - if (vm->index > 0) { - rval = -EINVAL; - goto exit; - } + if (vm->index > 0) + return -EINVAL; /* Set audio mode: mono or stereo */ if (vm->txsubchans & V4L2_TUNER_SUB_STEREO) @@ -1857,9 +1853,7 @@ static int si4713_s_modulator(struct v4l2_subdev *sd, struct v4l2_modulator *vm) else if (vm->txsubchans & V4L2_TUNER_SUB_MONO) stereo = 0; else - rval = -EINVAL; - if (rval < 0) - goto exit; + return -EINVAL; rds = !!(vm->txsubchans & V4L2_TUNER_SUB_RDS); @@ -1885,7 +1879,6 @@ static int si4713_s_modulator(struct v4l2_subdev *sd, struct v4l2_modulator *vm) unlock: mutex_unlock(&sdev->mutex); -exit: return rval; } -- cgit v1.2.3 From 158fd570dbf7a826c6578d5b5a9036dc58059371 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 31 Aug 2009 22:57:52 +0200 Subject: cx25840: fix determining the firmware name From: Hans Verkuil Depending on the model there are three different firmwares to choose from. Unfortunately if a cx23885 is loaded first, then the global firmware name is overwritten with that firmware and if ivtv is loaded next, then it tries to load the wrong firmware. In addition, the original approach would also overwrite any firmware that the user specified explicitly. Priority: normal Signed-off-by: Hans Verkuil CC: Jarod Wilson --- .../drivers/media/video/cx25840/cx25840-firmware.c | 35 ++++++++++++++-------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/linux/drivers/media/video/cx25840/cx25840-firmware.c b/linux/drivers/media/video/cx25840/cx25840-firmware.c index bdc630f0f..a19ab8644 100644 --- a/linux/drivers/media/video/cx25840/cx25840-firmware.c +++ b/linux/drivers/media/video/cx25840/cx25840-firmware.c @@ -24,10 +24,6 @@ #include "cx25840-core.h" -#define FWFILE "v4l-cx25840.fw" -#define FWFILE_CX23885 "v4l-cx23885-avcore-01.fw" -#define FWFILE_CX231XX "v4l-cx231xx-avcore-01.fw" - /* * Mike Isely - The FWSEND parameter controls the * size of the firmware chunks sent down the I2C bus to the chip. @@ -41,11 +37,11 @@ #define FWDEV(x) &((x)->dev) -static char *firmware = FWFILE; +static char *firmware = ""; module_param(firmware, charp, 0444); -MODULE_PARM_DESC(firmware, "Firmware image [default: " FWFILE "]"); +MODULE_PARM_DESC(firmware, "Firmware image to load"); static void start_fw_load(struct i2c_client *client) { @@ -66,6 +62,19 @@ static void end_fw_load(struct i2c_client *client) cx25840_write(client, 0x803, 0x03); } +static const char *get_fw_name(struct i2c_client *client) +{ + struct cx25840_state *state = to_state(i2c_get_clientdata(client)); + + if (firmware[0]) + return firmware; + if (state->is_cx23885) + return "v4l-cx23885-avcore-01.fw"; + if (state->is_cx231xx) + return "v4l-cx231xx-avcore-01.fw"; + return "v4l-cx25840.fw"; +} + static int check_fw_load(struct i2c_client *client, int size) { /* DL_ADDR_HB DL_ADDR_LB */ @@ -73,11 +82,13 @@ static int check_fw_load(struct i2c_client *client, int size) s |= cx25840_read(client, 0x800); if (size != s) { - v4l_err(client, "firmware %s load failed\n", firmware); + v4l_err(client, "firmware %s load failed\n", + get_fw_name(client)); return -EINVAL; } - v4l_info(client, "loaded %s firmware (%d bytes)\n", firmware, size); + v4l_info(client, "loaded %s firmware (%d bytes)\n", + get_fw_name(client), size); return 0; } @@ -97,26 +108,24 @@ int cx25840_loadfw(struct i2c_client *client) const struct firmware *fw = NULL; u8 buffer[FWSEND]; const u8 *ptr; + const char *fwname = get_fw_name(client); int size, retval; int MAX_BUF_SIZE = FWSEND; u32 gpio_oe = 0, gpio_da = 0; if (state->is_cx23885) { - firmware = FWFILE_CX23885; /* Preserve the GPIO OE and output bits */ gpio_oe = cx25840_read(client, 0x160); gpio_da = cx25840_read(client, 0x164); } - else if (state->is_cx231xx) - firmware = FWFILE_CX231XX; if ((state->is_cx231xx) && MAX_BUF_SIZE > 16) { v4l_err(client, " Firmware download size changed to 16 bytes max length\n"); MAX_BUF_SIZE = 16; /* cx231xx cannot accept more than 16 bytes at a time */ } - if (request_firmware(&fw, firmware, FWDEV(client)) != 0) { - v4l_err(client, "unable to open firmware %s\n", firmware); + if (request_firmware(&fw, fwname, FWDEV(client)) != 0) { + v4l_err(client, "unable to open firmware %s\n", fwname); return -EINVAL; } -- cgit v1.2.3