aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorMartin Bugge <marbugge@cisco.com>2013-12-10 10:01:59 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-01-07 03:42:20 -0500
commit019aa8be84bf543677146e2586412a2905ba99c0 (patch)
tree2659e446be1a05a5b353700d5dca34862fb30290 /drivers/media/i2c
parentb82e2793476e7fd031ba9e3b0cad357d1534d1d1 (diff)
[media] adv7842: enable HDMI/DVI mode irq
Signed-off-by: Martin Bugge <marbugge@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/adv7842.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 108e1b02d6c8..e6932f46bf98 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -1834,12 +1834,15 @@ static void adv7842_irq_enable(struct v4l2_subdev *sd, bool enable)
1834 io_write(sd, 0x78, 0x03); 1834 io_write(sd, 0x78, 0x03);
1835 /* Enable SDP Standard Detection Change and SDP Video Detected */ 1835 /* Enable SDP Standard Detection Change and SDP Video Detected */
1836 io_write(sd, 0xa0, 0x09); 1836 io_write(sd, 0xa0, 0x09);
1837 /* Enable HDMI_MODE interrupt */
1838 io_write(sd, 0x69, 0x08);
1837 } else { 1839 } else {
1838 io_write(sd, 0x46, 0x0); 1840 io_write(sd, 0x46, 0x0);
1839 io_write(sd, 0x5a, 0x0); 1841 io_write(sd, 0x5a, 0x0);
1840 io_write(sd, 0x73, 0x0); 1842 io_write(sd, 0x73, 0x0);
1841 io_write(sd, 0x78, 0x0); 1843 io_write(sd, 0x78, 0x0);
1842 io_write(sd, 0xa0, 0x0); 1844 io_write(sd, 0xa0, 0x0);
1845 io_write(sd, 0x69, 0x0);
1843 } 1846 }
1844} 1847}
1845 1848
@@ -1847,7 +1850,7 @@ static int adv7842_isr(struct v4l2_subdev *sd, u32 status, bool *handled)
1847{ 1850{
1848 struct adv7842_state *state = to_state(sd); 1851 struct adv7842_state *state = to_state(sd);
1849 u8 fmt_change_cp, fmt_change_digital, fmt_change_sdp; 1852 u8 fmt_change_cp, fmt_change_digital, fmt_change_sdp;
1850 u8 irq_status[5]; 1853 u8 irq_status[6];
1851 1854
1852 adv7842_irq_enable(sd, false); 1855 adv7842_irq_enable(sd, false);
1853 1856
@@ -1857,6 +1860,7 @@ static int adv7842_isr(struct v4l2_subdev *sd, u32 status, bool *handled)
1857 irq_status[2] = io_read(sd, 0x70); 1860 irq_status[2] = io_read(sd, 0x70);
1858 irq_status[3] = io_read(sd, 0x75); 1861 irq_status[3] = io_read(sd, 0x75);
1859 irq_status[4] = io_read(sd, 0x9d); 1862 irq_status[4] = io_read(sd, 0x9d);
1863 irq_status[5] = io_read(sd, 0x66);
1860 1864
1861 /* and clear */ 1865 /* and clear */
1862 if (irq_status[0]) 1866 if (irq_status[0])
@@ -1869,12 +1873,14 @@ static int adv7842_isr(struct v4l2_subdev *sd, u32 status, bool *handled)
1869 io_write(sd, 0x76, irq_status[3]); 1873 io_write(sd, 0x76, irq_status[3]);
1870 if (irq_status[4]) 1874 if (irq_status[4])
1871 io_write(sd, 0x9e, irq_status[4]); 1875 io_write(sd, 0x9e, irq_status[4]);
1876 if (irq_status[5])
1877 io_write(sd, 0x67, irq_status[5]);
1872 1878
1873 adv7842_irq_enable(sd, true); 1879 adv7842_irq_enable(sd, true);
1874 1880
1875 v4l2_dbg(1, debug, sd, "%s: irq %x, %x, %x, %x, %x\n", __func__, 1881 v4l2_dbg(1, debug, sd, "%s: irq %x, %x, %x, %x, %x, %x\n", __func__,
1876 irq_status[0], irq_status[1], irq_status[2], 1882 irq_status[0], irq_status[1], irq_status[2],
1877 irq_status[3], irq_status[4]); 1883 irq_status[3], irq_status[4], irq_status[5]);
1878 1884
1879 /* format change CP */ 1885 /* format change CP */
1880 fmt_change_cp = irq_status[0] & 0x9c; 1886 fmt_change_cp = irq_status[0] & 0x9c;
@@ -1891,22 +1897,32 @@ static int adv7842_isr(struct v4l2_subdev *sd, u32 status, bool *handled)
1891 else 1897 else
1892 fmt_change_digital = 0; 1898 fmt_change_digital = 0;
1893 1899
1894 /* notify */ 1900 /* format change */
1895 if (fmt_change_cp || fmt_change_digital || fmt_change_sdp) { 1901 if (fmt_change_cp || fmt_change_digital || fmt_change_sdp) {
1896 v4l2_dbg(1, debug, sd, 1902 v4l2_dbg(1, debug, sd,
1897 "%s: fmt_change_cp = 0x%x, fmt_change_digital = 0x%x, fmt_change_sdp = 0x%x\n", 1903 "%s: fmt_change_cp = 0x%x, fmt_change_digital = 0x%x, fmt_change_sdp = 0x%x\n",
1898 __func__, fmt_change_cp, fmt_change_digital, 1904 __func__, fmt_change_cp, fmt_change_digital,
1899 fmt_change_sdp); 1905 fmt_change_sdp);
1900 v4l2_subdev_notify(sd, ADV7842_FMT_CHANGE, NULL); 1906 v4l2_subdev_notify(sd, ADV7842_FMT_CHANGE, NULL);
1907 if (handled)
1908 *handled = true;
1901 } 1909 }
1902 1910
1903 /* 5v cable detect */ 1911 /* HDMI/DVI mode */
1904 if (irq_status[2]) 1912 if (irq_status[5] & 0x08) {
1905 adv7842_s_detect_tx_5v_ctrl(sd); 1913 v4l2_dbg(1, debug, sd, "%s: irq %s mode\n", __func__,
1906 1914 (io_read(sd, 0x65) & 0x08) ? "HDMI" : "DVI");
1907 if (handled) 1915 if (handled)
1908 *handled = true; 1916 *handled = true;
1917 }
1909 1918
1919 /* tx 5v detect */
1920 if (irq_status[2] & 0x3) {
1921 v4l2_dbg(1, debug, sd, "%s: irq tx_5v\n", __func__);
1922 adv7842_s_detect_tx_5v_ctrl(sd);
1923 if (handled)
1924 *handled = true;
1925 }
1910 return 0; 1926 return 0;
1911} 1927}
1912 1928