Skip to content

Commit

Permalink
Add openvfd patch
Browse files Browse the repository at this point in the history
  • Loading branch information
unifreq committed Mar 10, 2022
1 parent 3cb9a70 commit e48a78d
Show file tree
Hide file tree
Showing 74 changed files with 6,857 additions and 0 deletions.
24 changes: 24 additions & 0 deletions drivers/auxdisplay/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,30 @@ config TM1628
It's a 3-wire SPI device controlling a two-dimensional grid of
LEDs. Dimming is applied to all outputs through an internal PWM.

config OPENVFD
tristate "OpenVFD LED display driver"
depends on SPI
depends on I2C
depends on OF
help
Say Y to enable support for openvfd LED controller.

This repository contains the source code for the FD628 and similar LED
display controllers.

The FD628 controller is often used in Android TV boxes with a 7 segment
LED display at the front.

Although the FD628 controller has support for a multitude of different
display configurations, the current implementation only supports common
cathode and common anode displays with 7 segments. The driver can also
support FD650, which uses a variation of the I2C communication protocol.

In addition it supports HD44780 text based LCD displays, using an I2C
backpack.

Sources: https://github.com/arthur-liberman/linux_openvfd

menuconfig PARPORT_PANEL
tristate "Parallel port LCD/Keypad Panel support"
depends on PARPORT
Expand Down
1 change: 1 addition & 0 deletions drivers/auxdisplay/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ obj-$(CONFIG_HD44780) += hd44780.o
obj-$(CONFIG_HT16K33) += ht16k33.o
obj-$(CONFIG_PARPORT_PANEL) += panel.o
obj-$(CONFIG_TM1628) += tm1628.o
obj-$(CONFIG_OPENVFD) += openvfd/
14 changes: 14 additions & 0 deletions drivers/auxdisplay/openvfd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
obj-$(CONFIG_OPENVFD) := openvfd.o
openvfd-objs += protocols/i2c_sw.o
openvfd-objs += protocols/i2c_hw.o
openvfd-objs += protocols/spi_sw.o
openvfd-objs += controllers/dummy.o
openvfd-objs += controllers/seg7_ctrl.o
openvfd-objs += controllers/fd628.o
openvfd-objs += controllers/fd650.o
openvfd-objs += controllers/hd44780.o
openvfd-objs += controllers/gfx_mono_ctrl.o
openvfd-objs += controllers/ssd1306.o
openvfd-objs += controllers/pcd8544.o
openvfd-objs += controllers/il3829.o
openvfd-objs += openvfd_drv.o
28 changes: 28 additions & 0 deletions drivers/auxdisplay/openvfd/controllers/controller.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef __CONTROLLERH__
#define __CONTROLLERH__

#include "../openvfd_drv.h"

struct controller_interface {
unsigned char (*init)(void);

unsigned short (*get_brightness_levels_count)(void);
unsigned short (*get_brightness_level)(void);
unsigned char (*set_brightness_level)(unsigned short level);

unsigned char (*get_power)(void);
void (*set_power)(unsigned char state);
void (*power_suspend)(void);
void (*power_resume)(void);

struct vfd_display *(*get_display_type)(void);
unsigned char (*set_display_type)(struct vfd_display *display);

void (*set_icon)(const char *name, unsigned char state);

size_t (*read_data)(unsigned char *data, size_t length);
size_t (*write_data)(const unsigned char *data, size_t length);
size_t (*write_display_data)(const struct vfd_display_data *data);
};

#endif
12 changes: 12 additions & 0 deletions drivers/auxdisplay/openvfd/controllers/controller_list.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef __CONTROLLER_LIST_H__
#define __CONTROLLER_LIST_H__

#include "dummy.h"
#include "fd628.h"
#include "fd650.h"
#include "hd44780.h"
#include "ssd1306.h"
#include "pcd8544.h"
#include "il3829.h"

#endif
99 changes: 99 additions & 0 deletions drivers/auxdisplay/openvfd/controllers/dummy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#include "dummy.h"

static unsigned char dummy_init(void);
static unsigned short dummy_get_brightness_levels_count(void);
static unsigned short dummy_get_brightness_level(void);
static unsigned char dummy_set_brightness_level(unsigned short level);
static unsigned char dummy_get_power(void);
static void dummy_set_power(unsigned char state);
static struct vfd_display *dummy_get_display_type(void);
static unsigned char dummy_set_display_type(struct vfd_display *display);
static void dummy_set_icon(const char *name, unsigned char state);
static size_t dummy_read_data(unsigned char *data, size_t length);
static size_t dummy_write_data(const unsigned char *data, size_t length);
static size_t dummy_write_display_data(const struct vfd_display_data *data);

static struct controller_interface dummy_interface = {
.init = dummy_init,
.get_brightness_levels_count = dummy_get_brightness_levels_count,
.get_brightness_level = dummy_get_brightness_level,
.set_brightness_level = dummy_set_brightness_level,
.get_power = dummy_get_power,
.set_power = dummy_set_power,
.get_display_type = dummy_get_display_type,
.set_display_type = dummy_set_display_type,
.set_icon = dummy_set_icon,
.read_data = dummy_read_data,
.write_data = dummy_write_data,
.write_display_data = dummy_write_display_data,
};

static struct vfd_dev *dev = NULL;

struct controller_interface *init_dummy(struct vfd_dev *_dev)
{
dev = _dev;
return &dummy_interface;
}

static unsigned char dummy_init(void)
{
return 1;
}

static unsigned short dummy_get_brightness_levels_count(void)
{
return 8;
}

static unsigned short dummy_get_brightness_level(void)
{
return dev->brightness;
}

static unsigned char dummy_set_brightness_level(unsigned short level)
{
dev->brightness = level & 0x7;
dev->power = 1;
return 1;
}

static unsigned char dummy_get_power(void)
{
return dev->power;
}

static void dummy_set_power(unsigned char state)
{
dev->power = state;
}

static struct vfd_display *dummy_get_display_type(void)
{
return &dev->dtb_active.display;
}

static unsigned char dummy_set_display_type(struct vfd_display *display)
{
dev->dtb_active.display = *display;
return 1;
}

static void dummy_set_icon(const char *name, unsigned char state)
{
}

static size_t dummy_read_data(unsigned char *data, size_t length)
{
return 0;
}

static size_t dummy_write_data(const unsigned char *_data, size_t length)
{
return length;
}

static size_t dummy_write_display_data(const struct vfd_display_data *data)
{
return sizeof(*data);
}
8 changes: 8 additions & 0 deletions drivers/auxdisplay/openvfd/controllers/dummy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef __DUMMYH__
#define __DUMMYH__

#include "controller.h"

struct controller_interface *init_dummy(struct vfd_dev *dev);

#endif
Loading

0 comments on commit e48a78d

Please sign in to comment.