Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions arch/arm/configs/miyoo_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ CONFIG_MFD_SYSCON=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_FB=y
CONFIG_FB_MIYOO_VIDEO=y
CONFIG_FB_R61520=m
CONFIG_FB_GC9306=m
CONFIG_FB_ST7789S=m
Expand Down
7 changes: 7 additions & 0 deletions drivers/video/fbdev/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2237,6 +2237,13 @@ config FB_SM712
This driver is also available as a module. The module will be
called sm712fb. If you want to compile it as a module, say M
here and read <file:Documentation/kbuild/modules.rst>.

config FB_MIYOO_VIDEO
tristate "Get video driver chosen by uboot"
depends on FB
help
Returns name of video driver in /sys/kernel/miyoo_video/miyoo_video file

config FB_R61520
tristate "Renesas R61520 SLCD framebuffer support"
depends on FB
Expand Down
10 changes: 6 additions & 4 deletions drivers/video/fbdev/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,13 @@ obj-$(CONFIG_FB_OPENCORES) += ocfb.o
obj-$(CONFIG_FB_SM712) += sm712fb.o
obj-$(CONFIG_FB_R61520) += r61520fb.o
obj-$(CONFIG_FB_GC9306) += gc9306fb.o
obj-$(CONFIG_FB_ST7789S) += st7789sfb.o
obj-$(CONFIG_FB_ST7789S_TE) += st7789sTEfb.o
obj-$(CONFIG_FB_RM68090) += rm68090fb.o
obj-$(CONFIG_FB_HX8347D) += hx8347dfb.o
obj-$(CONFIG_FB_ST7789S) += st7789sfb.o
obj-$(CONFIG_FB_ST7789S_TE) += st7789sTEfb.o
obj-$(CONFIG_FB_RM68090) += rm68090fb.o
obj-$(CONFIG_FB_HX8347D) += hx8347dfb.o
obj-$(CONFIG_FB_TVOUT) += miyoo-tvout.o
obj-$(CONFIG_FB_MIYOO_VIDEO) += miyoo-video.o


# Platform or fallback drivers go here
obj-$(CONFIG_FB_UVESA) += uvesafb.o
Expand Down
70 changes: 70 additions & 0 deletions drivers/video/fbdev/miyoo-video.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/sysfs.h>

#define SYSFS_DIR "miyoo_video"
#define SYSFS_FILE "miyoo_video"

static struct kobject *video_kobj;
static char *driver = "";

module_param(driver, charp, S_IRUGO);
MODULE_PARM_DESC(driver, "Name of video driver to load");

static ssize_t miyoo_video_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%s", driver);
}

static ssize_t miyoo_video_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count)
{
pr_info("Received %zu bytes: %s\n", count, buf);
return count;
}

static struct kobj_attribute miyoo_video_attribute =
__ATTR(miyoo_video, 0664, miyoo_video_show, miyoo_video_store);

static int __init sysfs_miyoo_init(void)
{
int result;

pr_info("Miyoo video driver name module loaded\n");

video_kobj = kobject_create_and_add(SYSFS_DIR, kernel_kobj);
if (!video_kobj)
{
pr_err("Failed to create sysfs directory\n");
return -ENOMEM;
}

result = sysfs_create_file(video_kobj, &miyoo_video_attribute.attr);
if (result)
{
pr_err("Failed to create sysfs file\n");
kobject_put(video_kobj);
return result;
}

return 0;
}

static void __exit sysfs_miyoo_exit(void)
{
pr_info("Miyoo video driver name module unloaded\n");

if (video_kobj)
{
kobject_put(video_kobj);
sysfs_remove_file(kernel_kobj, &miyoo_video_attribute.attr);
}
}

module_init(sysfs_miyoo_init);
module_exit(sysfs_miyoo_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("tiopex tiopxyz@gmail.com");
MODULE_DESCRIPTION("Kernel module with a name of video driver from uboot");