diff options
-rw-r--r-- | drivers/media/video/msp3400.c | 72 |
1 files changed, 34 insertions, 38 deletions
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index 183253e2dd91..64691d553a96 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c | |||
@@ -157,6 +157,9 @@ struct msp3400c { | |||
157 | #define HAVE_SIMPLER(msp) ((msp->rev1 & 0xff) >= 'G'-'@') | 157 | #define HAVE_SIMPLER(msp) ((msp->rev1 & 0xff) >= 'G'-'@') |
158 | #define HAVE_RADIO(msp) ((msp->rev1 & 0xff) >= 'G'-'@') | 158 | #define HAVE_RADIO(msp) ((msp->rev1 & 0xff) >= 'G'-'@') |
159 | 159 | ||
160 | /* defined at the end of the source */ | ||
161 | extern struct i2c_client client_template; | ||
162 | |||
160 | #define VIDEO_MODE_RADIO 16 /* norm magic for radio mode */ | 163 | #define VIDEO_MODE_RADIO 16 /* norm magic for radio mode */ |
161 | 164 | ||
162 | /* ---------------------------------------------------------------------- */ | 165 | /* ---------------------------------------------------------------------- */ |
@@ -1553,33 +1556,17 @@ static void msp34xxg_set_audmode(struct i2c_client *client, int audmode) | |||
1553 | 1556 | ||
1554 | /* ----------------------------------------------------------------------- */ | 1557 | /* ----------------------------------------------------------------------- */ |
1555 | 1558 | ||
1556 | static int msp_attach(struct i2c_adapter *adap, int addr, int kind); | 1559 | static void msp_wake_thread(struct i2c_client *client) |
1557 | static int msp_detach(struct i2c_client *client); | ||
1558 | static int msp_probe(struct i2c_adapter *adap); | ||
1559 | static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg); | ||
1560 | |||
1561 | static int msp_suspend(struct device * dev, pm_message_t state); | ||
1562 | static int msp_resume(struct device * dev); | ||
1563 | |||
1564 | static void msp_wake_thread(struct i2c_client *client); | ||
1565 | |||
1566 | static struct i2c_driver driver = { | ||
1567 | .id = I2C_DRIVERID_MSP3400, | ||
1568 | .attach_adapter = msp_probe, | ||
1569 | .detach_client = msp_detach, | ||
1570 | .command = msp_command, | ||
1571 | .driver = { | ||
1572 | .name = "i2c msp3400 driver", | ||
1573 | .suspend = msp_suspend, | ||
1574 | .resume = msp_resume, | ||
1575 | }, | ||
1576 | }; | ||
1577 | |||
1578 | static struct i2c_client client_template = | ||
1579 | { | 1560 | { |
1580 | .name = "(unset)", | 1561 | struct msp3400c *msp = i2c_get_clientdata(client); |
1581 | .driver = &driver, | 1562 | |
1582 | }; | 1563 | if (NULL == msp->kthread) |
1564 | return; | ||
1565 | msp3400c_setvolume(client,msp->muted,0,0); | ||
1566 | msp->watch_stereo = 0; | ||
1567 | msp->restart = 1; | ||
1568 | wake_up_interruptible(&msp->wq); | ||
1569 | } | ||
1583 | 1570 | ||
1584 | static int msp_attach(struct i2c_adapter *adap, int addr, int kind) | 1571 | static int msp_attach(struct i2c_adapter *adap, int addr, int kind) |
1585 | { | 1572 | { |
@@ -1739,18 +1726,6 @@ static int msp_probe(struct i2c_adapter *adap) | |||
1739 | return 0; | 1726 | return 0; |
1740 | } | 1727 | } |
1741 | 1728 | ||
1742 | static void msp_wake_thread(struct i2c_client *client) | ||
1743 | { | ||
1744 | struct msp3400c *msp = i2c_get_clientdata(client); | ||
1745 | |||
1746 | if (NULL == msp->kthread) | ||
1747 | return; | ||
1748 | msp3400c_setvolume(client,msp->muted,0,0); | ||
1749 | msp->watch_stereo = 0; | ||
1750 | msp->restart = 1; | ||
1751 | wake_up_interruptible(&msp->wq); | ||
1752 | } | ||
1753 | |||
1754 | /* ----------------------------------------------------------------------- */ | 1729 | /* ----------------------------------------------------------------------- */ |
1755 | 1730 | ||
1756 | static int mode_v4l2_to_v4l1(int rxsubchans) | 1731 | static int mode_v4l2_to_v4l1(int rxsubchans) |
@@ -2207,6 +2182,27 @@ static int msp_resume(struct device * dev) | |||
2207 | 2182 | ||
2208 | /* ----------------------------------------------------------------------- */ | 2183 | /* ----------------------------------------------------------------------- */ |
2209 | 2184 | ||
2185 | static struct i2c_driver driver = { | ||
2186 | .owner = THIS_MODULE, | ||
2187 | .name = "msp3400", | ||
2188 | .id = I2C_DRIVERID_MSP3400, | ||
2189 | .flags = I2C_DF_NOTIFY, | ||
2190 | .attach_adapter = msp_probe, | ||
2191 | .detach_client = msp_detach, | ||
2192 | .command = msp_command, | ||
2193 | .driver = { | ||
2194 | .suspend = msp_suspend, | ||
2195 | .resume = msp_resume, | ||
2196 | }, | ||
2197 | }; | ||
2198 | |||
2199 | static struct i2c_client client_template = | ||
2200 | { | ||
2201 | .name = "(unset)", | ||
2202 | .flags = I2C_CLIENT_ALLOW_USE, | ||
2203 | .driver = &driver, | ||
2204 | }; | ||
2205 | |||
2210 | static int __init msp3400_init_module(void) | 2206 | static int __init msp3400_init_module(void) |
2211 | { | 2207 | { |
2212 | return i2c_add_driver(&driver); | 2208 | return i2c_add_driver(&driver); |