amvideo: add video_global_output sysfs control interface
authorjintao xu <jintao.xu@amlogic.com>
Mon, 9 Apr 2018 03:20:20 +0000 (11:20 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Mon, 23 Apr 2018 03:10:54 +0000 (20:10 -0700)
PD#163190: screen still displays the last frame after HDMI disconnect

Change-Id: Ic3b31a6af6a00a83a58d5d293a2fcab2a4369b04
Signed-off-by: jintao xu <jintao.xu@amlogic.com>
drivers/amlogic/media/video_sink/video.c

index 44bd093..e1a03a9 100644 (file)
@@ -7839,6 +7839,27 @@ static ssize_t video_disable_store(struct class *cla,
        return count;
 }
 
+static ssize_t video_global_output_show(struct class *cla,
+                               struct class_attribute *attr, char *buf)
+{
+       return sprintf(buf, "%d\n", video_global_output);
+}
+
+static ssize_t video_global_output_store(struct class *cla,
+                               struct class_attribute *attr,
+                               const char *buf, size_t count)
+{
+       size_t r;
+
+       r = kstrtoint(buf, 0, &video_global_output);
+       if (r < 0)
+               return -EINVAL;
+
+       pr_info("%s(%d)\n", __func__, video_global_output);
+
+       return count;
+}
+
 static ssize_t video_freerun_mode_show(struct class *cla,
                                       struct class_attribute *attr, char *buf)
 {
@@ -8545,6 +8566,10 @@ static struct class_attribute amvideo_class_attrs[] = {
               0664,
               video_disable_show,
               video_disable_store),
+        __ATTR(video_global_output,
+                       0664,
+                       video_global_output_show,
+                       video_global_output_store),
        __ATTR(zoom,
               0664,
               video_zoom_show,