aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/msp3400.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/msp3400.c')
-rw-r--r--drivers/media/video/msp3400.c95
1 files changed, 95 insertions, 0 deletions
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c
index e75e7948fd9d..6e2b0775a74e 100644
--- a/drivers/media/video/msp3400.c
+++ b/drivers/media/video/msp3400.c
@@ -382,6 +382,7 @@ static void msp3400c_setvolume(struct i2c_client *client,
382{ 382{
383 int val = 0, bal = 0; 383 int val = 0, bal = 0;
384 384
385muted=0;
385 if (!muted) { 386 if (!muted) {
386 /* 0x7f instead if 0x73 here has sound quality issues, 387 /* 0x7f instead if 0x73 here has sound quality issues,
387 * probably due to overmodulation + clipping ... */ 388 * probably due to overmodulation + clipping ... */
@@ -989,6 +990,8 @@ static int msp34xx_modus(int norm)
989{ 990{
990 switch (norm) { 991 switch (norm) {
991 case VIDEO_MODE_PAL: 992 case VIDEO_MODE_PAL:
993 dprintk(KERN_DEBUG "msp34xx: video mode selected to PAL\n");
994
992#if 1 995#if 1
993 /* experimental: not sure this works with all chip versions */ 996 /* experimental: not sure this works with all chip versions */
994 return 0x7003; 997 return 0x7003;
@@ -997,12 +1000,16 @@ static int msp34xx_modus(int norm)
997 return 0x1003; 1000 return 0x1003;
998#endif 1001#endif
999 case VIDEO_MODE_NTSC: /* BTSC */ 1002 case VIDEO_MODE_NTSC: /* BTSC */
1003 dprintk(KERN_DEBUG "msp34xx: video mode selected to NTSC\n");
1000 return 0x2003; 1004 return 0x2003;
1001 case VIDEO_MODE_SECAM: 1005 case VIDEO_MODE_SECAM:
1006 dprintk(KERN_DEBUG "msp34xx: video mode selected to SECAM\n");
1002 return 0x0003; 1007 return 0x0003;
1003 case VIDEO_MODE_RADIO: 1008 case VIDEO_MODE_RADIO:
1009 dprintk(KERN_DEBUG "msp34xx: video mode selected to Radio\n");
1004 return 0x0003; 1010 return 0x0003;
1005 case VIDEO_MODE_AUTO: 1011 case VIDEO_MODE_AUTO:
1012 dprintk(KERN_DEBUG "msp34xx: video mode selected to Auto\n");
1006 return 0x2003; 1013 return 0x2003;
1007 default: 1014 default:
1008 return 0x0003; 1015 return 0x0003;
@@ -1495,6 +1502,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind)
1495 dprintk("msp34xx: error while reading chip version\n"); 1502 dprintk("msp34xx: error while reading chip version\n");
1496 return -1; 1503 return -1;
1497 } 1504 }
1505 printk(KERN_INFO "msp34xx: rev1=0x%04x, rev2=0x%04x\n", msp->rev1, msp->rev2);
1498 1506
1499 msp3400c_setvolume(c, msp->muted, msp->volume, msp->balance); 1507 msp3400c_setvolume(c, msp->muted, msp->volume, msp->balance);
1500 1508
@@ -1762,6 +1770,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
1762 msp_any_set_audmode(client,mode_v4l1_to_v4l2(va->mode)); 1770 msp_any_set_audmode(client,mode_v4l1_to_v4l2(va->mode));
1763 break; 1771 break;
1764 } 1772 }
1773
1765 case VIDIOCSCHAN: 1774 case VIDIOCSCHAN:
1766 { 1775 {
1767 struct video_channel *vc = arg; 1776 struct video_channel *vc = arg;
@@ -1782,6 +1791,92 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
1782 } 1791 }
1783 1792
1784 /* --- v4l2 ioctls --- */ 1793 /* --- v4l2 ioctls --- */
1794 case VIDIOC_S_STD:
1795 {
1796 v4l2_std_id *id = arg;
1797
1798 /*FIXME: use V4L2 mode flags on msp3400 instead of V4L1*/
1799 if (*id & V4L2_STD_PAL) {
1800 msp->norm=VIDEO_MODE_PAL;
1801 } else if (*id & V4L2_STD_SECAM) {
1802 msp->norm=VIDEO_MODE_SECAM;
1803 } else {
1804 msp->norm=VIDEO_MODE_NTSC;
1805 }
1806
1807 msp_wake_thread(client);
1808 return 0;
1809 }
1810
1811 case VIDIOC_G_AUDIO:
1812 {
1813 struct v4l2_audio *a = arg;
1814
1815 memset(a,0,sizeof(*a));
1816
1817 switch (a->index) {
1818 case AUDIO_RADIO:
1819 strcpy(a->name,"Radio");
1820 break;
1821 case AUDIO_EXTERN_1:
1822 strcpy(a->name,"Extern 1");
1823 break;
1824 case AUDIO_EXTERN_2:
1825 strcpy(a->name,"Extern 2");
1826 break;
1827 case AUDIO_TUNER:
1828 strcpy(a->name,"Television");
1829 break;
1830 default:
1831 return -EINVAL;
1832 }
1833
1834 msp_any_detect_stereo(client);
1835 if (msp->audmode == V4L2_TUNER_MODE_STEREO) {
1836 a->capability=V4L2_AUDCAP_STEREO;
1837 }
1838
1839 break;
1840 }
1841 case VIDIOC_S_AUDIO:
1842 {
1843 struct v4l2_audio *sarg = arg;
1844
1845 switch (sarg->index) {
1846 case AUDIO_RADIO:
1847 /* Hauppauge uses IN2 for the radio */
1848 msp->mode = MSP_MODE_FM_RADIO;
1849 scart = SCART_IN2;
1850 break;
1851 case AUDIO_EXTERN_1:
1852 /* IN1 is often used for external input ... */
1853 msp->mode = MSP_MODE_EXTERN;
1854 scart = SCART_IN1;
1855 break;
1856 case AUDIO_EXTERN_2:
1857 /* ... sometimes it is IN2 through ;) */
1858 msp->mode = MSP_MODE_EXTERN;
1859 scart = SCART_IN2;
1860 break;
1861 case AUDIO_TUNER:
1862 msp->mode = -1;
1863 break;
1864 }
1865 if (scart) {
1866 msp->rxsubchans = V4L2_TUNER_SUB_STEREO;
1867 msp->audmode = V4L2_TUNER_MODE_STEREO;
1868 msp3400c_set_scart(client,scart,0);
1869 msp3400c_write(client,I2C_MSP3400C_DFP,0x000d,0x1900);
1870 }
1871 if (sarg->capability==V4L2_AUDCAP_STEREO) {
1872 msp->audmode = V4L2_TUNER_MODE_STEREO;
1873 } else {
1874 msp->audmode &= ~V4L2_TUNER_MODE_STEREO;
1875 }
1876 msp_any_set_audmode(client, msp->audmode);
1877 msp_wake_thread(client);
1878 break;
1879 }
1785 case VIDIOC_G_TUNER: 1880 case VIDIOC_G_TUNER:
1786 { 1881 {
1787 struct v4l2_tuner *vt = arg; 1882 struct v4l2_tuner *vt = arg;