0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef __SSD1307X_H__
0014 #define __SSD1307X_H__
0015
0016 #include <drm/drm_drv.h>
0017 #include <drm/drm_simple_kms_helper.h>
0018
0019 #include <linux/regmap.h>
0020
0021 #define SSD130X_DATA 0x40
0022 #define SSD130X_COMMAND 0x80
0023
0024 enum ssd130x_variants {
0025 SH1106_ID,
0026 SSD1305_ID,
0027 SSD1306_ID,
0028 SSD1307_ID,
0029 SSD1309_ID,
0030 NR_SSD130X_VARIANTS
0031 };
0032
0033 struct ssd130x_deviceinfo {
0034 u32 default_vcomh;
0035 u32 default_dclk_div;
0036 u32 default_dclk_frq;
0037 int need_pwm;
0038 int need_chargepump;
0039 bool page_mode_only;
0040 };
0041
0042 struct ssd130x_device {
0043 struct drm_device drm;
0044 struct device *dev;
0045 struct drm_simple_display_pipe pipe;
0046 struct drm_display_mode mode;
0047 struct drm_connector connector;
0048 struct i2c_client *client;
0049
0050 struct regmap *regmap;
0051
0052 const struct ssd130x_deviceinfo *device_info;
0053
0054 unsigned page_address_mode : 1;
0055 unsigned area_color_enable : 1;
0056 unsigned com_invdir : 1;
0057 unsigned com_lrremap : 1;
0058 unsigned com_seq : 1;
0059 unsigned lookup_table_set : 1;
0060 unsigned low_power : 1;
0061 unsigned seg_remap : 1;
0062 u32 com_offset;
0063 u32 contrast;
0064 u32 dclk_div;
0065 u32 dclk_frq;
0066 u32 height;
0067 u8 lookup_table[4];
0068 u32 page_offset;
0069 u32 col_offset;
0070 u32 prechargep1;
0071 u32 prechargep2;
0072
0073 struct backlight_device *bl_dev;
0074 struct pwm_device *pwm;
0075 struct gpio_desc *reset;
0076 struct regulator *vcc_reg;
0077 u32 vcomh;
0078 u32 width;
0079
0080 u8 col_start;
0081 u8 col_end;
0082 u8 page_start;
0083 u8 page_end;
0084 };
0085
0086 extern const struct ssd130x_deviceinfo ssd130x_variants[];
0087
0088 struct ssd130x_device *ssd130x_probe(struct device *dev, struct regmap *regmap);
0089 void ssd130x_remove(struct ssd130x_device *ssd130x);
0090 void ssd130x_shutdown(struct ssd130x_device *ssd130x);
0091
0092 #endif