diff options
Diffstat (limited to 'linux/drivers/media/video/msp3400-driver.c')
-rw-r--r-- | linux/drivers/media/video/msp3400-driver.c | 89 |
1 files changed, 22 insertions, 67 deletions
diff --git a/linux/drivers/media/video/msp3400-driver.c b/linux/drivers/media/video/msp3400-driver.c index 4ae9a5acf..cd92f1f68 100644 --- a/linux/drivers/media/video/msp3400-driver.c +++ b/linux/drivers/media/video/msp3400-driver.c @@ -57,17 +57,12 @@ #include <media/v4l2-i2c-drv-legacy.h> #include <media/tvaudio.h> #include <media/msp3400.h> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0) #include <linux/kthread.h> #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) #include <linux/suspend.h> #else #include <linux/freezer.h> #endif -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) -#include "i2c-compat.h" -#endif #include "compat.h" #include "msp3400-driver.h" @@ -90,7 +85,6 @@ int msp_dolby; int msp_stereo_thresh = 0x190; /* a2 threshold for stereo/bilingual (msp34xxg only) 0x00a0-0x03c0 */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) /* read-only */ module_param(opmode, int, 0444); @@ -101,15 +95,6 @@ module_param_named(stereo_threshold, msp_stereo_thresh, int, 0644); module_param_named(standard, msp_standard, int, 0644); module_param_named(amsound, msp_amsound, bool, 0644); module_param_named(dolby, msp_dolby, bool, 0644); -#else -MODULE_PARM(opmode, "i"); -MODULE_PARM(msp_once, "i"); -MODULE_PARM(msp_debug, "i"); -MODULE_PARM(msp_stereo_thresh, "i"); -MODULE_PARM(msp_standard, "i"); -MODULE_PARM(msp_amsound, "i"); -MODULE_PARM(msp_dolby, "i"); -#endif MODULE_PARM_DESC(opmode, "Forces a MSP3400 opmode. 0=Manual, 1=Autodetect, 2=Autodetect and autoselect"); MODULE_PARM_DESC(once, "No continuous stereo monitoring"); @@ -130,9 +115,7 @@ MODULE_PARM_DESC(dolby, "Activates Dolby processsing"); /* Addresses to scan */ static unsigned short normal_i2c[] = { 0x80 >> 1, 0x88 >> 1, I2C_CLIENT_END }; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13) -static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; -#endif + I2C_CLIENT_INSMOD; /* ----------------------------------------------------------------------- */ @@ -356,24 +339,6 @@ void msp_set_audio(struct i2c_client *client) /* ------------------------------------------------------------------------ */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) -static void msp_setup_thread(struct msp_state *state) -{ - daemonize(); - exit_files(current); - reparent_to_init(); - - spin_lock_irq(SIGMASK_LOCK(current)); - sigfillset(¤t->blocked); - spin_unlock_irq(SIGMASK_LOCK(current)); - strcpy(current->comm, "msp3400"); - - state->kthread = current; - if (state->notify != NULL) - up(state->notify); -} -#endif - static void msp_wake_thread(struct i2c_client *client) { struct msp_state *state = i2c_get_clientdata(client); @@ -390,11 +355,7 @@ int msp_sleep(struct msp_state *state, int timeout) DECLARE_WAITQUEUE(wait, current); add_wait_queue(&state->wq, &wait); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - if (!(state->rmmod || signal_pending(current))) { -#else if (!kthread_should_stop()) { -#endif if (timeout < 0) { set_current_state(TASK_INTERRUPTIBLE); schedule(); @@ -859,7 +820,12 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id) int msp_product, msp_prod_hi, msp_prod_lo; int msp_rom; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) snprintf(client->name, sizeof(client->name) - 1, "msp3400"); +#else + if (!id) + strlcpy(client->name, "msp3400", sizeof(client->name)); +#endif if (msp_reset(client) == -1) { v4l_dbg(1, msp_debug, client, "msp3400 not found\n"); @@ -912,9 +878,11 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id) msp_revision = (state->rev1 & 0x0f) + '@'; msp_hard = ((state->rev1 >> 8) & 0xff) + '@'; msp_rom = state->rev2 & 0x1f; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) snprintf(client->name, sizeof(client->name), "MSP%d4%02d%c-%c%d", msp_family, msp_product, msp_revision, msp_hard, msp_rom); +#endif /* Rev B=2, C=3, D=4, G=7 */ state->ident = msp_family * 10000 + 4000 + msp_product * 10 + msp_revision - '@'; @@ -979,7 +947,9 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id) } /* hello world :-) */ - v4l_info(client, "%s found @ 0x%x (%s)\n", client->name, + v4l_info(client, "MSP%d4%02d%c-%c%d found @ 0x%x (%s)\n", + msp_family, msp_product, + msp_revision, msp_hard, msp_rom, client->addr << 1, client->adapter->name); v4l_info(client, "%s ", client->name); if (state->has_nicam && state->has_radio) @@ -1009,20 +979,10 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id) /* startup control thread if needed */ if (thread_func) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0) state->kthread = kthread_run(thread_func, client, "msp34xx"); if (IS_ERR(state->kthread)) v4l_warn(client, "kernel_thread() failed\n"); -#else - DECLARE_MUTEX_LOCKED(sem); - - state->kthread = NULL; - state->notify = &sem; - kernel_thread(thread_func, client, 0); - down(&sem); - state->notify = NULL; -#endif msp_wake_thread(client); } return 0; @@ -1034,20 +994,8 @@ static int msp_remove(struct i2c_client *client) /* shutdown control thread */ if (state->kthread) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - DECLARE_MUTEX_LOCKED(sem); -#endif state->restart = 1; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - /* shutdown control thread */ - state->notify = &sem; - state->rmmod = 1; - wake_up_interruptible(&state->wq); - down(&sem); - state->notify = NULL; -#else kthread_stop(state->kthread); -#endif } msp_reset(client); @@ -1057,6 +1005,14 @@ static int msp_remove(struct i2c_client *client) /* ----------------------------------------------------------------------- */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static const struct i2c_device_id msp_id[] = { + { "msp3400", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, msp_id); + +#endif static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "msp3400", .driverid = I2C_DRIVERID_MSP3400, @@ -1065,11 +1021,10 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { .remove = msp_remove, .suspend = msp_suspend, .resume = msp_resume, -}; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) -EXPORT_NO_SYMBOLS; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = msp_id, #endif +}; /* * Overrides for Emacs so that we follow Linus's tabbing style. |