Lines Matching +full:reset +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0
5 * Found in the Samsung Galaxy Ace 2 GT-I8160 mobile phone.
7 * Inspired by code and know-how in the vendor driver by Gareth Phillips.
18 #include <linux/media-bus-format.h>
29 #define WS2401_BCMODE 0xc1 /* Backlight control mode */
33 #define WS2401_WRMIE 0xc7 /* Write MIE mode */
58 * struct ws2401 - state container for a panel controlled by the WS2401
72 /** @reset: reset GPIO line */
73 struct gpio_desc *reset; member
106 struct mipi_dbi *dbi = &ws->dbi; in ws2401_read_mtp_id()
112 dev_err(ws->dev, "unable to read MTP ID 1\n"); in ws2401_read_mtp_id()
117 dev_err(ws->dev, "unable to read MTP ID 2\n"); in ws2401_read_mtp_id()
122 dev_err(ws->dev, "unable to read MTP ID 3\n"); in ws2401_read_mtp_id()
125 dev_info(ws->dev, "MTP ID: %02x %02x %02x\n", id1, id2, id3); in ws2401_read_mtp_id()
130 struct mipi_dbi *dbi = &ws->dbi; in ws2401_power_on()
134 ret = regulator_bulk_enable(ARRAY_SIZE(ws->regulators), in ws2401_power_on()
135 ws->regulators); in ws2401_power_on()
137 dev_err(ws->dev, "failed to enable regulators: %d\n", ret); in ws2401_power_on()
142 /* Assert reset >=1 ms */ in ws2401_power_on()
143 gpiod_set_value_cansleep(ws->reset, 1); in ws2401_power_on()
145 /* De-assert reset */ in ws2401_power_on()
146 gpiod_set_value_cansleep(ws->reset, 0); in ws2401_power_on()
149 dev_dbg(ws->dev, "de-asserted RESET\n"); in ws2401_power_on()
152 * Exit sleep mode and initialize display - some hammering is in ws2401_power_on()
163 /* Set addressing mode Flip V(d0), Flip H(d1) RGB/BGR(d3) */ in ws2401_power_on()
170 mipi_dbi_command(dbi, WS2401_NSMPS, 0x06, 0x03, /* DDVDH: -4.6v */ in ws2401_power_on()
174 0xb4, /* VGH:16.1v, VGL:-13.8v */ in ws2401_power_on()
176 0x50, /* GREFN:-4.2v (default) */ in ws2401_power_on()
178 0x44); /* VOUTL:-10v (default) */ in ws2401_power_on()
188 /* Set up gamma, probably these are P-gamma and N-gamma for each color */ in ws2401_power_on()
208 if (ws->internal_bl) { in ws2401_power_on()
225 /* Go into RESET and disable regulators */ in ws2401_power_off()
226 gpiod_set_value_cansleep(ws->reset, 1); in ws2401_power_off()
227 return regulator_bulk_disable(ARRAY_SIZE(ws->regulators), in ws2401_power_off()
228 ws->regulators); in ws2401_power_off()
234 struct mipi_dbi *dbi = &ws->dbi; in ws2401_unprepare()
237 if (ws->internal_bl) in ws2401_unprepare()
247 struct mipi_dbi *dbi = &ws->dbi; in ws2401_disable()
263 struct mipi_dbi *dbi = &ws->dbi; in ws2401_enable()
271 * ws2401_get_modes() - return the mode
272 * @panel: the panel to get the mode for
279 struct drm_display_mode *mode; in ws2401_get_modes() local
284 * this mode, the following connector display_info settings and in ws2401_get_modes()
288 mode = drm_mode_duplicate(connector->dev, &lms380kf01_480_800_mode); in ws2401_get_modes()
289 if (!mode) { in ws2401_get_modes()
290 dev_err(ws->dev, "failed to add mode\n"); in ws2401_get_modes()
291 return -ENOMEM; in ws2401_get_modes()
294 connector->display_info.bpc = 8; in ws2401_get_modes()
295 connector->display_info.width_mm = mode->width_mm; in ws2401_get_modes()
296 connector->display_info.height_mm = mode->height_mm; in ws2401_get_modes()
297 connector->display_info.bus_flags = in ws2401_get_modes()
299 drm_display_info_set_bus_formats(&connector->display_info, in ws2401_get_modes()
302 drm_mode_set_name(mode); in ws2401_get_modes()
303 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in ws2401_get_modes()
305 drm_mode_probed_add(connector, mode); in ws2401_get_modes()
321 struct mipi_dbi *dbi = &ws->dbi; in ws2401_set_brightness()
346 struct device *dev = &spi->dev; in ws2401_probe()
352 return -ENOMEM; in ws2401_probe()
353 ws->dev = dev; in ws2401_probe()
359 ws->regulators[0].supply = "vci"; in ws2401_probe()
360 ws->regulators[1].supply = "vccio"; in ws2401_probe()
362 ARRAY_SIZE(ws->regulators), in ws2401_probe()
363 ws->regulators); in ws2401_probe()
367 ws->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in ws2401_probe()
368 if (IS_ERR(ws->reset)) { in ws2401_probe()
369 ret = PTR_ERR(ws->reset); in ws2401_probe()
370 return dev_err_probe(dev, ret, "no RESET GPIO\n"); in ws2401_probe()
373 ret = mipi_dbi_spi_init(spi, &ws->dbi, NULL); in ws2401_probe()
376 ws->dbi.read_commands = ws2401_dbi_read_commands; in ws2401_probe()
382 drm_panel_init(&ws->panel, dev, &ws2401_drm_funcs, in ws2401_probe()
385 ret = drm_panel_of_backlight(&ws->panel); in ws2401_probe()
390 if (!ws->panel.backlight) { in ws2401_probe()
392 ws->panel.backlight = in ws2401_probe()
395 if (IS_ERR(ws->panel.backlight)) in ws2401_probe()
396 return dev_err_probe(dev, PTR_ERR(ws->panel.backlight), in ws2401_probe()
404 drm_panel_add(&ws->panel); in ws2401_probe()
414 drm_panel_remove(&ws->panel); in ws2401_remove()
439 .name = "ws2401-panel",