1 /* SPDX-License-Identifier: GPL-2.0-only */
4 * DRM driver for Solomon SSD130x OLED displays
6 * Copyright 2022 Red Hat Inc.
7 * Author: Javier Martinez Canillas <javierm@redhat.com>
9 * Based on drivers/video/fbdev/ssd1307fb.c
10 * Copyright 2012 Free Electrons
16 #include <drm/drm_connector.h>
17 #include <drm/drm_crtc.h>
18 #include <drm/drm_drv.h>
19 #include <drm/drm_encoder.h>
20 #include <drm/drm_plane_helper.h>
22 #include <linux/regmap.h>
24 #define SSD13XX_DATA 0x40
25 #define SSD13XX_COMMAND 0x80
27 enum ssd130x_family_ids {
31 enum ssd130x_variants {
41 struct ssd130x_deviceinfo {
51 enum ssd130x_family_ids family_id;
54 struct ssd130x_device {
55 struct drm_device drm;
57 struct drm_display_mode mode;
58 struct drm_plane primary_plane;
60 struct drm_encoder encoder;
61 struct drm_connector connector;
62 struct i2c_client *client;
64 struct regmap *regmap;
66 const struct ssd130x_deviceinfo *device_info;
68 unsigned page_address_mode : 1;
69 unsigned area_color_enable : 1;
70 unsigned com_invdir : 1;
71 unsigned com_lrremap : 1;
73 unsigned lookup_table_set : 1;
74 unsigned low_power : 1;
75 unsigned seg_remap : 1;
87 struct backlight_device *bl_dev;
88 struct pwm_device *pwm;
89 struct gpio_desc *reset;
90 struct regulator *vcc_reg;
93 /* Cached address ranges */
100 extern const struct ssd130x_deviceinfo ssd130x_variants[];
102 struct ssd130x_device *ssd130x_probe(struct device *dev, struct regmap *regmap);
103 void ssd130x_remove(struct ssd130x_device *ssd130x);
104 void ssd130x_shutdown(struct ssd130x_device *ssd130x);
106 #endif /* __SSD130X_H__ */