Chinaunix首页 | 论坛 | 博客
  • 博客访问: 126436
  • 博文数量: 16
  • 博客积分: 355
  • 博客等级: 一等列兵
  • 技术积分: 237
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-01 22:01
文章分类

全部博文(16)

文章存档

2012年(16)

我的朋友

分类: 嵌入式

2012-06-26 09:16:25

平台是全志A10 android4.0

点击(此处)折叠或打开

  1. linux-3.0/drivers/video/sun4i/disp/dev_disp.c

  2. static ssize_t show_hdmi_ctrl(struct device *dev, struct device_attribute *attr, char *buf)
  3. {
  4.     return sprintf(buf, "%s\n", suspend_status & 1 ? "off":"on");
  5. }

  6. static ssize_t set_hdmi_ctrl(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
  7. {
  8.     unsigned long val = 0;
  9.     if (count <= 0)
  10.         return 0;
  11.     val = simple_strtoul(buf, NULL, 0);
  12.     /*
  13.      * sscanf用于解析echo 0x00,0x2 > hdmi_ctrl这类命令。
  14.      * sscanf(buf, "%d,%d", &i2c_reg,&i2c_data);
  15.      */
  16.     if (val)
  17.         backlight_early_suspend(NULL);
  18.     else
  19.         backlight_late_resume(NULL);
  20.     
  21.     return count;
  22. }

  23. static DEVICE_ATTR(hdmictrl, S_IRUGO | S_IWUSR, show_hdmi_ctrl, set_hdmion_ctrl);
  24. static struct attribute *dev_attrs[] = {
  25.     &dev_attr_hdmion.attr,
  26.     NULL,
  27. };

  28. static struct attribute_group dev_attr_grp = {
  29.     .attrs = dev_attrs,
  30. };

  31. static int __init disp_probe(struct platform_device *pdev)//called when platform_driver_register
  32. {
  33.     int err = 0;
  34.     sysfs_create_group(&pdev->dev.kobj, &dev_attr_grp);
  35.     err = sysfs_create_group(&pdev->dev.kobj, &dev_attr_grp);
  36.     if (err < 0)
  37.     {
  38.         printk("disp : sysfs_create_group err\n");
  39.         return err;
  40.     }

  41.     return 0;
  42. }

  43. static int disp_remove(struct platform_device *pdev)
  44. {
  45.     sysfs_remove_group(&pdev->dev.kobj, &dev_attr_grp);

  46.     return 0;
  47. }

HDMI关:echo 1 > /sys/devices/platform/disp/hdmi_ctrl
HDMI开:echo 0 > /sys/devices/platform/disp/hdmi_ctrl
阅读(4063) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~