aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2009-09-22 19:47:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:52 -0400
commitafbd3c12aca5a29f1627c0c68e6bc77f32459935 (patch)
tree2ca4df24ed72980f75019ba798b8cf259bf24cc3 /drivers/video
parentc3e25673843153ea75fda79a47cf12f10a25ca37 (diff)
viafb: switch to seq_file
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Acked-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Scott Fang <ScottFang@viatech.com.cn> Cc: Joseph Chan <JosephChan@via.com.tw> Cc: Harald Welte <laforge@gnumonks.org> Cc: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/via/viafbdev.c179
1 files changed, 110 insertions, 69 deletions
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 66921de373fe..7626325ed7f8 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/seq_file.h>
23#define _MASTER_FILE 24#define _MASTER_FILE
24 25
25#include "global.h" 26#include "global.h"
@@ -1485,10 +1486,8 @@ static void parse_dvi_port(void)
1485 * DVP1Driving, DFPHigh, DFPLow CR96, SR2A[5], SR1B[1], SR2A[4], SR1E[2], 1486 * DVP1Driving, DFPHigh, DFPLow CR96, SR2A[5], SR1B[1], SR2A[4], SR1E[2],
1486 * CR9B, SR65, CR97, CR99 1487 * CR9B, SR65, CR97, CR99
1487 */ 1488 */
1488static int viafb_dvp0_proc_read(char *buf, char **start, off_t offset, 1489static int viafb_dvp0_proc_show(struct seq_file *m, void *v)
1489int count, int *eof, void *data)
1490{ 1490{
1491 int len = 0;
1492 u8 dvp0_data_dri = 0, dvp0_clk_dri = 0, dvp0 = 0; 1491 u8 dvp0_data_dri = 0, dvp0_clk_dri = 0, dvp0 = 0;
1493 dvp0_data_dri = 1492 dvp0_data_dri =
1494 (viafb_read_reg(VIASR, SR2A) & BIT5) >> 4 | 1493 (viafb_read_reg(VIASR, SR2A) & BIT5) >> 4 |
@@ -1497,13 +1496,17 @@ int count, int *eof, void *data)
1497 (viafb_read_reg(VIASR, SR2A) & BIT4) >> 3 | 1496 (viafb_read_reg(VIASR, SR2A) & BIT4) >> 3 |
1498 (viafb_read_reg(VIASR, SR1E) & BIT2) >> 2; 1497 (viafb_read_reg(VIASR, SR1E) & BIT2) >> 2;
1499 dvp0 = viafb_read_reg(VIACR, CR96) & 0x0f; 1498 dvp0 = viafb_read_reg(VIACR, CR96) & 0x0f;
1500 len += 1499 seq_printf(m, "%x %x %x\n", dvp0, dvp0_data_dri, dvp0_clk_dri);
1501 sprintf(buf + len, "%x %x %x\n", dvp0, dvp0_data_dri, dvp0_clk_dri); 1500 return 0;
1502 *eof = 1; /*Inform kernel end of data */ 1501}
1503 return len; 1502
1503static int viafb_dvp0_proc_open(struct inode *inode, struct file *file)
1504{
1505 return single_open(file, viafb_dvp0_proc_show, NULL);
1504} 1506}
1505static int viafb_dvp0_proc_write(struct file *file, 1507
1506 const char __user *buffer, unsigned long count, void *data) 1508static ssize_t viafb_dvp0_proc_write(struct file *file,
1509 const char __user *buffer, size_t count, loff_t *pos)
1507{ 1510{
1508 char buf[20], *value, *pbuf; 1511 char buf[20], *value, *pbuf;
1509 u8 reg_val = 0; 1512 u8 reg_val = 0;
@@ -1547,21 +1550,33 @@ static int viafb_dvp0_proc_write(struct file *file,
1547 } 1550 }
1548 return count; 1551 return count;
1549} 1552}
1550static int viafb_dvp1_proc_read(char *buf, char **start, off_t offset, 1553
1551 int count, int *eof, void *data) 1554static const struct file_operations viafb_dvp0_proc_fops = {
1555 .owner = THIS_MODULE,
1556 .open = viafb_dvp0_proc_open,
1557 .read = seq_read,
1558 .llseek = seq_lseek,
1559 .release = single_release,
1560 .write = viafb_dvp0_proc_write,
1561};
1562
1563static int viafb_dvp1_proc_show(struct seq_file *m, void *v)
1552{ 1564{
1553 int len = 0;
1554 u8 dvp1 = 0, dvp1_data_dri = 0, dvp1_clk_dri = 0; 1565 u8 dvp1 = 0, dvp1_data_dri = 0, dvp1_clk_dri = 0;
1555 dvp1 = viafb_read_reg(VIACR, CR9B) & 0x0f; 1566 dvp1 = viafb_read_reg(VIACR, CR9B) & 0x0f;
1556 dvp1_data_dri = (viafb_read_reg(VIASR, SR65) & 0x0c) >> 2; 1567 dvp1_data_dri = (viafb_read_reg(VIASR, SR65) & 0x0c) >> 2;
1557 dvp1_clk_dri = viafb_read_reg(VIASR, SR65) & 0x03; 1568 dvp1_clk_dri = viafb_read_reg(VIASR, SR65) & 0x03;
1558 len += 1569 seq_printf(m, "%x %x %x\n", dvp1, dvp1_data_dri, dvp1_clk_dri);
1559 sprintf(buf + len, "%x %x %x\n", dvp1, dvp1_data_dri, dvp1_clk_dri); 1570 return 0;
1560 *eof = 1; /*Inform kernel end of data */ 1571}
1561 return len; 1572
1573static int viafb_dvp1_proc_open(struct inode *inode, struct file *file)
1574{
1575 return single_open(file, viafb_dvp1_proc_show, NULL);
1562} 1576}
1563static int viafb_dvp1_proc_write(struct file *file, 1577
1564 const char __user *buffer, unsigned long count, void *data) 1578static ssize_t viafb_dvp1_proc_write(struct file *file,
1579 const char __user *buffer, size_t count, loff_t *pos)
1565{ 1580{
1566 char buf[20], *value, *pbuf; 1581 char buf[20], *value, *pbuf;
1567 u8 reg_val = 0; 1582 u8 reg_val = 0;
@@ -1600,18 +1615,30 @@ static int viafb_dvp1_proc_write(struct file *file,
1600 return count; 1615 return count;
1601} 1616}
1602 1617
1603static int viafb_dfph_proc_read(char *buf, char **start, off_t offset, 1618static const struct file_operations viafb_dvp1_proc_fops = {
1604 int count, int *eof, void *data) 1619 .owner = THIS_MODULE,
1620 .open = viafb_dvp1_proc_open,
1621 .read = seq_read,
1622 .llseek = seq_lseek,
1623 .release = single_release,
1624 .write = viafb_dvp1_proc_write,
1625};
1626
1627static int viafb_dfph_proc_show(struct seq_file *m, void *v)
1605{ 1628{
1606 int len = 0;
1607 u8 dfp_high = 0; 1629 u8 dfp_high = 0;
1608 dfp_high = viafb_read_reg(VIACR, CR97) & 0x0f; 1630 dfp_high = viafb_read_reg(VIACR, CR97) & 0x0f;
1609 len += sprintf(buf + len, "%x\n", dfp_high); 1631 seq_printf(m, "%x\n", dfp_high);
1610 *eof = 1; /*Inform kernel end of data */ 1632 return 0;
1611 return len;
1612} 1633}
1613static int viafb_dfph_proc_write(struct file *file, 1634
1614 const char __user *buffer, unsigned long count, void *data) 1635static int viafb_dfph_proc_open(struct inode *inode, struct file *file)
1636{
1637 return single_open(file, viafb_dfph_proc_show, NULL);
1638}
1639
1640static ssize_t viafb_dfph_proc_write(struct file *file,
1641 const char __user *buffer, size_t count, loff_t *pos)
1615{ 1642{
1616 char buf[20]; 1643 char buf[20];
1617 u8 reg_val = 0; 1644 u8 reg_val = 0;
@@ -1626,18 +1653,31 @@ static int viafb_dfph_proc_write(struct file *file,
1626 viafb_write_reg_mask(CR97, VIACR, reg_val, 0x0f); 1653 viafb_write_reg_mask(CR97, VIACR, reg_val, 0x0f);
1627 return count; 1654 return count;
1628} 1655}
1629static int viafb_dfpl_proc_read(char *buf, char **start, off_t offset, 1656
1630 int count, int *eof, void *data) 1657static const struct file_operations viafb_dfph_proc_fops = {
1658 .owner = THIS_MODULE,
1659 .open = viafb_dfph_proc_open,
1660 .read = seq_read,
1661 .llseek = seq_lseek,
1662 .release = single_release,
1663 .write = viafb_dfph_proc_write,
1664};
1665
1666static int viafb_dfpl_proc_show(struct seq_file *m, void *v)
1631{ 1667{
1632 int len = 0;
1633 u8 dfp_low = 0; 1668 u8 dfp_low = 0;
1634 dfp_low = viafb_read_reg(VIACR, CR99) & 0x0f; 1669 dfp_low = viafb_read_reg(VIACR, CR99) & 0x0f;
1635 len += sprintf(buf + len, "%x\n", dfp_low); 1670 seq_printf(m, "%x\n", dfp_low);
1636 *eof = 1; /*Inform kernel end of data */ 1671 return 0;
1637 return len; 1672}
1673
1674static int viafb_dfpl_proc_open(struct inode *inode, struct file *file)
1675{
1676 return single_open(file, viafb_dfpl_proc_show, NULL);
1638} 1677}
1639static int viafb_dfpl_proc_write(struct file *file, 1678
1640 const char __user *buffer, unsigned long count, void *data) 1679static ssize_t viafb_dfpl_proc_write(struct file *file,
1680 const char __user *buffer, size_t count, loff_t *pos)
1641{ 1681{
1642 char buf[20]; 1682 char buf[20];
1643 u8 reg_val = 0; 1683 u8 reg_val = 0;
@@ -1652,10 +1692,18 @@ static int viafb_dfpl_proc_write(struct file *file,
1652 viafb_write_reg_mask(CR99, VIACR, reg_val, 0x0f); 1692 viafb_write_reg_mask(CR99, VIACR, reg_val, 0x0f);
1653 return count; 1693 return count;
1654} 1694}
1655static int viafb_vt1636_proc_read(char *buf, char **start, 1695
1656 off_t offset, int count, int *eof, void *data) 1696static const struct file_operations viafb_dfpl_proc_fops = {
1697 .owner = THIS_MODULE,
1698 .open = viafb_dfpl_proc_open,
1699 .read = seq_read,
1700 .llseek = seq_lseek,
1701 .release = single_release,
1702 .write = viafb_dfpl_proc_write,
1703};
1704
1705static int viafb_vt1636_proc_show(struct seq_file *m, void *v)
1657{ 1706{
1658 int len = 0;
1659 u8 vt1636_08 = 0, vt1636_09 = 0; 1707 u8 vt1636_08 = 0, vt1636_09 = 0;
1660 switch (viaparinfo->chip_info->lvds_chip_info.lvds_chip_name) { 1708 switch (viaparinfo->chip_info->lvds_chip_info.lvds_chip_name) {
1661 case VT1636_LVDS: 1709 case VT1636_LVDS:
@@ -1665,7 +1713,7 @@ static int viafb_vt1636_proc_read(char *buf, char **start,
1665 vt1636_09 = 1713 vt1636_09 =
1666 viafb_gpio_i2c_read_lvds(viaparinfo->lvds_setting_info, 1714 viafb_gpio_i2c_read_lvds(viaparinfo->lvds_setting_info,
1667 &viaparinfo->chip_info->lvds_chip_info, 0x09) & 0x1f; 1715 &viaparinfo->chip_info->lvds_chip_info, 0x09) & 0x1f;
1668 len += sprintf(buf + len, "%x %x\n", vt1636_08, vt1636_09); 1716 seq_printf(m, "%x %x\n", vt1636_08, vt1636_09);
1669 break; 1717 break;
1670 default: 1718 default:
1671 break; 1719 break;
@@ -1678,16 +1726,21 @@ static int viafb_vt1636_proc_read(char *buf, char **start,
1678 vt1636_09 = 1726 vt1636_09 =
1679 viafb_gpio_i2c_read_lvds(viaparinfo->lvds_setting_info2, 1727 viafb_gpio_i2c_read_lvds(viaparinfo->lvds_setting_info2,
1680 &viaparinfo->chip_info->lvds_chip_info2, 0x09) & 0x1f; 1728 &viaparinfo->chip_info->lvds_chip_info2, 0x09) & 0x1f;
1681 len += sprintf(buf + len, " %x %x\n", vt1636_08, vt1636_09); 1729 seq_printf(m, " %x %x\n", vt1636_08, vt1636_09);
1682 break; 1730 break;
1683 default: 1731 default:
1684 break; 1732 break;
1685 } 1733 }
1686 *eof = 1; /*Inform kernel end of data */ 1734 return 0;
1687 return len;
1688} 1735}
1689static int viafb_vt1636_proc_write(struct file *file, 1736
1690 const char __user *buffer, unsigned long count, void *data) 1737static int viafb_vt1636_proc_open(struct inode *inode, struct file *file)
1738{
1739 return single_open(file, viafb_vt1636_proc_show, NULL);
1740}
1741
1742static ssize_t viafb_vt1636_proc_write(struct file *file,
1743 const char __user *buffer, size_t count, loff_t *pos)
1691{ 1744{
1692 char buf[30], *value, *pbuf; 1745 char buf[30], *value, *pbuf;
1693 struct IODATA reg_val; 1746 struct IODATA reg_val;
@@ -1776,39 +1829,27 @@ static int viafb_vt1636_proc_write(struct file *file,
1776 return count; 1829 return count;
1777} 1830}
1778 1831
1832static const struct file_operations viafb_vt1636_proc_fops = {
1833 .owner = THIS_MODULE,
1834 .open = viafb_vt1636_proc_open,
1835 .read = seq_read,
1836 .llseek = seq_lseek,
1837 .release = single_release,
1838 .write = viafb_vt1636_proc_write,
1839};
1840
1779static void viafb_init_proc(struct proc_dir_entry **viafb_entry) 1841static void viafb_init_proc(struct proc_dir_entry **viafb_entry)
1780{ 1842{
1781 struct proc_dir_entry *entry;
1782 *viafb_entry = proc_mkdir("viafb", NULL); 1843 *viafb_entry = proc_mkdir("viafb", NULL);
1783 if (viafb_entry) { 1844 if (viafb_entry) {
1784 entry = create_proc_entry("dvp0", 0, *viafb_entry); 1845 proc_create("dvp0", 0, *viafb_entry, &viafb_dvp0_proc_fops);
1785 if (entry) { 1846 proc_create("dvp1", 0, *viafb_entry, &viafb_dvp1_proc_fops);
1786 entry->read_proc = viafb_dvp0_proc_read; 1847 proc_create("dfph", 0, *viafb_entry, &viafb_dfph_proc_fops);
1787 entry->write_proc = viafb_dvp0_proc_write; 1848 proc_create("dfpl", 0, *viafb_entry, &viafb_dfpl_proc_fops);
1788 }
1789 entry = create_proc_entry("dvp1", 0, *viafb_entry);
1790 if (entry) {
1791 entry->read_proc = viafb_dvp1_proc_read;
1792 entry->write_proc = viafb_dvp1_proc_write;
1793 }
1794 entry = create_proc_entry("dfph", 0, *viafb_entry);
1795 if (entry) {
1796 entry->read_proc = viafb_dfph_proc_read;
1797 entry->write_proc = viafb_dfph_proc_write;
1798 }
1799 entry = create_proc_entry("dfpl", 0, *viafb_entry);
1800 if (entry) {
1801 entry->read_proc = viafb_dfpl_proc_read;
1802 entry->write_proc = viafb_dfpl_proc_write;
1803 }
1804 if (VT1636_LVDS == viaparinfo->chip_info->lvds_chip_info. 1849 if (VT1636_LVDS == viaparinfo->chip_info->lvds_chip_info.
1805 lvds_chip_name || VT1636_LVDS == 1850 lvds_chip_name || VT1636_LVDS ==
1806 viaparinfo->chip_info->lvds_chip_info2.lvds_chip_name) { 1851 viaparinfo->chip_info->lvds_chip_info2.lvds_chip_name) {
1807 entry = create_proc_entry("vt1636", 0, *viafb_entry); 1852 proc_create("vt1636", 0, *viafb_entry, &viafb_vt1636_proc_fops);
1808 if (entry) {
1809 entry->read_proc = viafb_vt1636_proc_read;
1810 entry->write_proc = viafb_vt1636_proc_write;
1811 }
1812 } 1853 }
1813 1854
1814 } 1855 }