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
84 static inline struct db7430 *to_db7430(struct drm_panel *panel) in to_db7430() argument
86 return container_of(panel, struct db7430, panel); in to_db7430()
91 struct mipi_dbi *dbi = &db->dbi; in db7430_power_on() local
95 ret = regulator_bulk_enable(ARRAY_SIZE(db->regulators), in db7430_power_on()
96 db->regulators); in db7430_power_on()
98 dev_err(db->dev, "failed to enable regulators: %d\n", ret); in db7430_power_on()
104 gpiod_set_value_cansleep(db->reset, 1); in db7430_power_on()
106 /* De-assert reset */ in db7430_power_on()
107 gpiod_set_value_cansleep(db->reset, 0); in db7430_power_on()
110 dev_dbg(db->dev, "de-asserted RESET\n"); in db7430_power_on()
118 mipi_dbi_command(dbi, MIPI_DCS_SET_ADDRESS_MODE, 0x0a); in db7430_power_on()
119 mipi_dbi_command(dbi, MIPI_DCS_SET_ADDRESS_MODE, 0x0a); in db7430_power_on()
120 mipi_dbi_command(dbi, DB7430_ACCESS_PROT_OFF, 0x00); in db7430_power_on()
121 mipi_dbi_command(dbi, DB7430_PANEL_DRIVING, 0x28, 0x08); in db7430_power_on()
122 mipi_dbi_command(dbi, DB7430_SOURCE_CONTROL, in db7430_power_on()
124 mipi_dbi_command(dbi, DB7430_GATE_INTERFACE, in db7430_power_on()
126 mipi_dbi_command(dbi, DB7430_DISPLAY_H_TIMING, in db7430_power_on()
133 mipi_dbi_command(dbi, DB7430_RGB_SYNC_OPTION, 0x01); in db7430_power_on()
134 mipi_dbi_command(dbi, DB7430_GAMMA_SET_RED, in db7430_power_on()
141 mipi_dbi_command(dbi, DB7430_GAMMA_SET_GREEN, in db7430_power_on()
148 mipi_dbi_command(dbi, DB7430_GAMMA_SET_BLUE, in db7430_power_on()
155 mipi_dbi_command(dbi, DB7430_BIAS_CURRENT_CTRL, 0x33, 0x13); in db7430_power_on()
156 mipi_dbi_command(dbi, DB7430_DDV_CTRL, 0x11, 0x00, 0x00); in db7430_power_on()
157 mipi_dbi_command(dbi, DB7430_GAMMA_CTRL_REF, 0x50, 0x50); in db7430_power_on()
158 mipi_dbi_command(dbi, DB7430_DCDC_CTRL, 0x2f, 0x11, 0x1e, 0x46); in db7430_power_on()
159 mipi_dbi_command(dbi, DB7430_VCL_CTRL, 0x11, 0x0a); in db7430_power_on()
167 gpiod_set_value_cansleep(db->reset, 1); in db7430_power_off()
168 return regulator_bulk_disable(ARRAY_SIZE(db->regulators), in db7430_power_off()
169 db->regulators); in db7430_power_off()
172 static int db7430_unprepare(struct drm_panel *panel) in db7430_unprepare() argument
174 return db7430_power_off(to_db7430(panel)); in db7430_unprepare()
177 static int db7430_disable(struct drm_panel *panel) in db7430_disable() argument
179 struct db7430 *db = to_db7430(panel); in db7430_disable()
180 struct mipi_dbi *dbi = &db->dbi; in db7430_disable() local
182 mipi_dbi_command(dbi, MIPI_DCS_SET_DISPLAY_OFF); in db7430_disable()
184 mipi_dbi_command(dbi, MIPI_DCS_ENTER_SLEEP_MODE); in db7430_disable()
190 static int db7430_prepare(struct drm_panel *panel) in db7430_prepare() argument
192 return db7430_power_on(to_db7430(panel)); in db7430_prepare()
195 static int db7430_enable(struct drm_panel *panel) in db7430_enable() argument
197 struct db7430 *db = to_db7430(panel); in db7430_enable()
198 struct mipi_dbi *dbi = &db->dbi; in db7430_enable() local
201 mipi_dbi_command(dbi, MIPI_DCS_EXIT_SLEEP_MODE); in db7430_enable()
204 /* NVM (non-volatile memory) load sequence */ in db7430_enable()
205 mipi_dbi_command(dbi, DB7430_UNKNOWN_D4, 0x52, 0x5e); in db7430_enable()
206 mipi_dbi_command(dbi, DB7430_UNKNOWN_F8, 0x01, 0xf5, 0xf2, 0x71, 0x44); in db7430_enable()
207 mipi_dbi_command(dbi, DB7430_UNKNOWN_FC, 0x00, 0x08); in db7430_enable()
211 mipi_dbi_command(dbi, DB7430_UNKNOWN_B4, 0x0f, 0x00, 0x50); in db7430_enable()
212 mipi_dbi_command(dbi, DB7430_USER_SELECT, 0x80); in db7430_enable()
213 mipi_dbi_command(dbi, DB7430_UNKNOWN_B7, 0x24); in db7430_enable()
214 mipi_dbi_command(dbi, DB7430_UNKNOWN_B8, 0x01); in db7430_enable()
217 mipi_dbi_command(dbi, MIPI_DCS_SET_DISPLAY_ON); in db7430_enable()
223 * db7430_get_modes() - return the mode
224 * @panel: the panel to get the mode for
227 static int db7430_get_modes(struct drm_panel *panel, in db7430_get_modes() argument
230 struct db7430 *db = to_db7430(panel); in db7430_get_modes()
234 mode = drm_mode_duplicate(connector->dev, &db7430_480_800_mode); in db7430_get_modes()
236 dev_err(db->dev, "failed to add mode\n"); in db7430_get_modes()
237 return -ENOMEM; in db7430_get_modes()
240 connector->display_info.bpc = 8; in db7430_get_modes()
241 connector->display_info.width_mm = mode->width_mm; in db7430_get_modes()
242 connector->display_info.height_mm = mode->height_mm; in db7430_get_modes()
243 connector->display_info.bus_flags = in db7430_get_modes()
245 drm_display_info_set_bus_formats(&connector->display_info, in db7430_get_modes()
249 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in db7430_get_modes()
264 static int db7430_probe(struct spi_device *spi) in db7430_probe() argument
266 struct device *dev = &spi->dev; in db7430_probe()
272 return -ENOMEM; in db7430_probe()
273 db->dev = dev; in db7430_probe()
279 db->regulators[0].supply = "vci"; in db7430_probe()
280 db->regulators[1].supply = "vccio"; in db7430_probe()
282 ARRAY_SIZE(db->regulators), in db7430_probe()
283 db->regulators); in db7430_probe()
287 db->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in db7430_probe()
288 if (IS_ERR(db->reset)) { in db7430_probe()
289 ret = PTR_ERR(db->reset); in db7430_probe()
293 ret = mipi_dbi_spi_init(spi, &db->dbi, NULL); in db7430_probe()
295 return dev_err_probe(dev, ret, "MIPI DBI init failed\n"); in db7430_probe()
297 drm_panel_init(&db->panel, dev, &db7430_drm_funcs, in db7430_probe()
301 ret = drm_panel_of_backlight(&db->panel); in db7430_probe()
305 spi_set_drvdata(spi, db); in db7430_probe()
307 drm_panel_add(&db->panel); in db7430_probe()
308 dev_dbg(dev, "added panel\n"); in db7430_probe()
313 static void db7430_remove(struct spi_device *spi) in db7430_remove() argument
315 struct db7430 *db = spi_get_drvdata(spi); in db7430_remove()
317 drm_panel_remove(&db->panel); in db7430_remove()
322 * so list the different variants here and add per-variant data if needed.
334 MODULE_DEVICE_TABLE(spi, db7430_ids);
341 .name = "db7430-panel",
348 MODULE_DESCRIPTION("Samsung DB7430 panel driver");