Lines Matching +full:panel +full:- +full:mipi +full:- +full:dbi +full:- +full:spi

1 // SPDX-License-Identifier: GPL-2.0
3 * Panel driver for the Samsung LMS397KF04 480x800 DPI RGB panel.
5 * Found in the Samsung Galaxy Beam GT-I8350 mobile phone.
16 #include <linux/media-bus-format.h>
20 #include <linux/spi/spi.h>
49 * struct db7430 - state container for a panel controlled by the DB7430
55 /** @dbi: the DBI bus abstraction handle */
56 struct mipi_dbi dbi; member
57 /** @panel: the DRM panel instance for this device */
58 struct drm_panel panel; member
59 /** @width: the width of this panel in mm */
61 /** @height: the height of this panel in mm */
88 static inline struct db7430 *to_db7430(struct drm_panel *panel) in to_db7430() argument
90 return container_of(panel, struct db7430, panel); in to_db7430()
95 struct mipi_dbi *dbi = &db->dbi; in db7430_power_on() local
99 ret = regulator_bulk_enable(ARRAY_SIZE(db->regulators), in db7430_power_on()
100 db->regulators); in db7430_power_on()
102 dev_err(db->dev, "failed to enable regulators: %d\n", ret); in db7430_power_on()
108 gpiod_set_value_cansleep(db->reset, 1); in db7430_power_on()
110 /* De-assert reset */ in db7430_power_on()
111 gpiod_set_value_cansleep(db->reset, 0); in db7430_power_on()
114 dev_dbg(db->dev, "de-asserted RESET\n"); in db7430_power_on()
122 mipi_dbi_command(dbi, MIPI_DCS_SET_ADDRESS_MODE, 0x0a); in db7430_power_on()
123 mipi_dbi_command(dbi, MIPI_DCS_SET_ADDRESS_MODE, 0x0a); in db7430_power_on()
124 mipi_dbi_command(dbi, DB7430_ACCESS_PROT_OFF, 0x00); in db7430_power_on()
125 mipi_dbi_command(dbi, DB7430_PANEL_DRIVING, 0x28, 0x08); in db7430_power_on()
126 mipi_dbi_command(dbi, DB7430_SOURCE_CONTROL, in db7430_power_on()
128 mipi_dbi_command(dbi, DB7430_GATE_INTERFACE, in db7430_power_on()
130 mipi_dbi_command(dbi, DB7430_DISPLAY_H_TIMING, in db7430_power_on()
137 mipi_dbi_command(dbi, DB7430_RGB_SYNC_OPTION, 0x01); in db7430_power_on()
138 mipi_dbi_command(dbi, DB7430_GAMMA_SET_RED, in db7430_power_on()
145 mipi_dbi_command(dbi, DB7430_GAMMA_SET_GREEN, in db7430_power_on()
152 mipi_dbi_command(dbi, DB7430_GAMMA_SET_BLUE, in db7430_power_on()
159 mipi_dbi_command(dbi, DB7430_BIAS_CURRENT_CTRL, 0x33, 0x13); in db7430_power_on()
160 mipi_dbi_command(dbi, DB7430_DDV_CTRL, 0x11, 0x00, 0x00); in db7430_power_on()
161 mipi_dbi_command(dbi, DB7430_GAMMA_CTRL_REF, 0x50, 0x50); in db7430_power_on()
162 mipi_dbi_command(dbi, DB7430_DCDC_CTRL, 0x2f, 0x11, 0x1e, 0x46); in db7430_power_on()
163 mipi_dbi_command(dbi, DB7430_VCL_CTRL, 0x11, 0x0a); in db7430_power_on()
171 gpiod_set_value_cansleep(db->reset, 1); in db7430_power_off()
172 return regulator_bulk_disable(ARRAY_SIZE(db->regulators), in db7430_power_off()
173 db->regulators); in db7430_power_off()
176 static int db7430_unprepare(struct drm_panel *panel) in db7430_unprepare() argument
178 return db7430_power_off(to_db7430(panel)); in db7430_unprepare()
181 static int db7430_disable(struct drm_panel *panel) in db7430_disable() argument
183 struct db7430 *db = to_db7430(panel); in db7430_disable()
184 struct mipi_dbi *dbi = &db->dbi; in db7430_disable() local
186 mipi_dbi_command(dbi, MIPI_DCS_SET_DISPLAY_OFF); in db7430_disable()
188 mipi_dbi_command(dbi, MIPI_DCS_ENTER_SLEEP_MODE); in db7430_disable()
194 static int db7430_prepare(struct drm_panel *panel) in db7430_prepare() argument
196 return db7430_power_on(to_db7430(panel)); in db7430_prepare()
199 static int db7430_enable(struct drm_panel *panel) in db7430_enable() argument
201 struct db7430 *db = to_db7430(panel); in db7430_enable()
202 struct mipi_dbi *dbi = &db->dbi; in db7430_enable() local
205 mipi_dbi_command(dbi, MIPI_DCS_EXIT_SLEEP_MODE); in db7430_enable()
208 /* NVM (non-volatile memory) load sequence */ in db7430_enable()
209 mipi_dbi_command(dbi, DB7430_UNKNOWN_D4, 0x52, 0x5e); in db7430_enable()
210 mipi_dbi_command(dbi, DB7430_UNKNOWN_F8, 0x01, 0xf5, 0xf2, 0x71, 0x44); in db7430_enable()
211 mipi_dbi_command(dbi, DB7430_UNKNOWN_FC, 0x00, 0x08); in db7430_enable()
215 mipi_dbi_command(dbi, DB7430_UNKNOWN_B4, 0x0f, 0x00, 0x50); in db7430_enable()
216 mipi_dbi_command(dbi, DB7430_USER_SELECT, 0x80); in db7430_enable()
217 mipi_dbi_command(dbi, DB7430_UNKNOWN_B7, 0x24); in db7430_enable()
218 mipi_dbi_command(dbi, DB7430_UNKNOWN_B8, 0x01); in db7430_enable()
221 mipi_dbi_command(dbi, MIPI_DCS_SET_DISPLAY_ON); in db7430_enable()
227 * db7430_get_modes() - return the mode
228 * @panel: the panel to get the mode for
231 static int db7430_get_modes(struct drm_panel *panel, in db7430_get_modes() argument
234 struct db7430 *db = to_db7430(panel); in db7430_get_modes()
238 mode = drm_mode_duplicate(connector->dev, &db7430_480_800_mode); in db7430_get_modes()
240 dev_err(db->dev, "failed to add mode\n"); in db7430_get_modes()
241 return -ENOMEM; in db7430_get_modes()
244 connector->display_info.bpc = 8; in db7430_get_modes()
245 connector->display_info.width_mm = mode->width_mm; in db7430_get_modes()
246 connector->display_info.height_mm = mode->height_mm; in db7430_get_modes()
247 connector->display_info.bus_flags = in db7430_get_modes()
249 drm_display_info_set_bus_formats(&connector->display_info, in db7430_get_modes()
253 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in db7430_get_modes()
268 static int db7430_probe(struct spi_device *spi) in db7430_probe() argument
270 struct device *dev = &spi->dev; in db7430_probe()
276 return -ENOMEM; in db7430_probe()
277 db->dev = dev; in db7430_probe()
283 db->regulators[0].supply = "vci"; in db7430_probe()
284 db->regulators[1].supply = "vccio"; in db7430_probe()
286 ARRAY_SIZE(db->regulators), in db7430_probe()
287 db->regulators); in db7430_probe()
291 db->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in db7430_probe()
292 if (IS_ERR(db->reset)) { in db7430_probe()
293 ret = PTR_ERR(db->reset); in db7430_probe()
297 ret = mipi_dbi_spi_init(spi, &db->dbi, NULL); in db7430_probe()
299 return dev_err_probe(dev, ret, "MIPI DBI init failed\n"); in db7430_probe()
301 drm_panel_init(&db->panel, dev, &db7430_drm_funcs, in db7430_probe()
305 ret = drm_panel_of_backlight(&db->panel); in db7430_probe()
309 spi_set_drvdata(spi, db); in db7430_probe()
311 drm_panel_add(&db->panel); in db7430_probe()
312 dev_dbg(dev, "added panel\n"); in db7430_probe()
317 static void db7430_remove(struct spi_device *spi) in db7430_remove() argument
319 struct db7430 *db = spi_get_drvdata(spi); in db7430_remove()
321 drm_panel_remove(&db->panel); in db7430_remove()
326 * so list the different variants here and add per-variant data if needed.
338 .name = "db7430-panel",
345 MODULE_DESCRIPTION("Samsung DB7430 panel driver");