• Home
  • Raw
  • Download

Lines Matching +full:regulator +full:- +full:poweroff

1 // SPDX-License-Identifier: GPL-2.0-only
10 #include <linux/regulator/consumer.h>
21 /* the datasheet refers to them as DSI-LINK1 and DSI-LINK2 */
25 struct regulator *supply;
40 unsigned int refresh = drm_mode_vrefresh(sharp->mode); in sharp_wait_frames()
51 struct mipi_dsi_device *dsi = sharp->link1; in sharp_panel_write()
56 dev_err(&dsi->dev, "failed to write %02x to %04x: %zd\n", in sharp_panel_write()
63 dev_err(&dsi->dev, "failed to send DCS nop: %zd\n", err); in sharp_panel_write()
79 err = mipi_dsi_generic_read(sharp->link1, &offset, sizeof(offset), in sharp_panel_read()
82 dev_err(&sharp->link1->dev, "failed to read from %04x: %zd\n", in sharp_panel_read()
92 if (!sharp->enabled) in sharp_panel_disable()
95 sharp->enabled = false; in sharp_panel_disable()
105 if (!sharp->prepared) in sharp_panel_unprepare()
110 err = mipi_dsi_dcs_set_display_off(sharp->link1); in sharp_panel_unprepare()
112 dev_err(panel->dev, "failed to set display off: %d\n", err); in sharp_panel_unprepare()
114 err = mipi_dsi_dcs_enter_sleep_mode(sharp->link1); in sharp_panel_unprepare()
116 dev_err(panel->dev, "failed to enter sleep mode: %d\n", err); in sharp_panel_unprepare()
120 regulator_disable(sharp->supply); in sharp_panel_unprepare()
122 sharp->prepared = false; in sharp_panel_unprepare()
133 err = mipi_dsi_dcs_set_column_address(left, 0, mode->hdisplay / 2 - 1); in sharp_setup_symmetrical_split()
135 dev_err(&left->dev, "failed to set column address: %d\n", err); in sharp_setup_symmetrical_split()
139 err = mipi_dsi_dcs_set_page_address(left, 0, mode->vdisplay - 1); in sharp_setup_symmetrical_split()
141 dev_err(&left->dev, "failed to set page address: %d\n", err); in sharp_setup_symmetrical_split()
145 err = mipi_dsi_dcs_set_column_address(right, mode->hdisplay / 2, in sharp_setup_symmetrical_split()
146 mode->hdisplay - 1); in sharp_setup_symmetrical_split()
148 dev_err(&right->dev, "failed to set column address: %d\n", err); in sharp_setup_symmetrical_split()
152 err = mipi_dsi_dcs_set_page_address(right, 0, mode->vdisplay - 1); in sharp_setup_symmetrical_split()
154 dev_err(&right->dev, "failed to set page address: %d\n", err); in sharp_setup_symmetrical_split()
167 if (sharp->prepared) in sharp_panel_prepare()
170 err = regulator_enable(sharp->supply); in sharp_panel_prepare()
182 err = mipi_dsi_dcs_exit_sleep_mode(sharp->link1); in sharp_panel_prepare()
184 dev_err(panel->dev, "failed to exit sleep mode: %d\n", err); in sharp_panel_prepare()
185 goto poweroff; in sharp_panel_prepare()
197 /* set left-right mode */ in sharp_panel_prepare()
200 dev_err(panel->dev, "failed to set left-right mode: %d\n", err); in sharp_panel_prepare()
201 goto poweroff; in sharp_panel_prepare()
207 dev_err(panel->dev, "failed to enable command mode: %d\n", err); in sharp_panel_prepare()
208 goto poweroff; in sharp_panel_prepare()
211 err = mipi_dsi_dcs_set_pixel_format(sharp->link1, format); in sharp_panel_prepare()
213 dev_err(panel->dev, "failed to set pixel format: %d\n", err); in sharp_panel_prepare()
214 goto poweroff; in sharp_panel_prepare()
218 * TODO: The device supports both left-right and even-odd split in sharp_panel_prepare()
219 * configurations, but this driver currently supports only the left- in sharp_panel_prepare()
224 err = sharp_setup_symmetrical_split(sharp->link1, sharp->link2, in sharp_panel_prepare()
225 sharp->mode); in sharp_panel_prepare()
227 dev_err(panel->dev, "failed to set up symmetrical split: %d\n", in sharp_panel_prepare()
229 goto poweroff; in sharp_panel_prepare()
232 err = mipi_dsi_dcs_set_display_on(sharp->link1); in sharp_panel_prepare()
234 dev_err(panel->dev, "failed to set display on: %d\n", err); in sharp_panel_prepare()
235 goto poweroff; in sharp_panel_prepare()
238 sharp->prepared = true; in sharp_panel_prepare()
245 poweroff: in sharp_panel_prepare()
246 regulator_disable(sharp->supply); in sharp_panel_prepare()
254 if (sharp->enabled) in sharp_panel_enable()
257 sharp->enabled = true; in sharp_panel_enable()
279 mode = drm_mode_duplicate(connector->dev, &default_mode); in sharp_panel_get_modes()
281 dev_err(panel->dev, "failed to add mode %ux%ux@%u\n", in sharp_panel_get_modes()
284 return -ENOMEM; in sharp_panel_get_modes()
291 connector->display_info.width_mm = 217; in sharp_panel_get_modes()
292 connector->display_info.height_mm = 136; in sharp_panel_get_modes()
315 sharp->mode = &default_mode; in sharp_panel_add()
317 sharp->supply = devm_regulator_get(&sharp->link1->dev, "power"); in sharp_panel_add()
318 if (IS_ERR(sharp->supply)) in sharp_panel_add()
319 return PTR_ERR(sharp->supply); in sharp_panel_add()
321 drm_panel_init(&sharp->base, &sharp->link1->dev, &sharp_panel_funcs, in sharp_panel_add()
324 ret = drm_panel_of_backlight(&sharp->base); in sharp_panel_add()
328 drm_panel_add(&sharp->base); in sharp_panel_add()
335 if (sharp->base.dev) in sharp_panel_del()
336 drm_panel_remove(&sharp->base); in sharp_panel_del()
338 if (sharp->link2) in sharp_panel_del()
339 put_device(&sharp->link2->dev); in sharp_panel_del()
349 dsi->lanes = 4; in sharp_panel_probe()
350 dsi->format = MIPI_DSI_FMT_RGB888; in sharp_panel_probe()
351 dsi->mode_flags = MIPI_DSI_MODE_LPM; in sharp_panel_probe()
353 /* Find DSI-LINK1 */ in sharp_panel_probe()
354 np = of_parse_phandle(dsi->dev.of_node, "link2", 0); in sharp_panel_probe()
360 return -EPROBE_DEFER; in sharp_panel_probe()
363 /* register a panel for only the DSI-LINK1 interface */ in sharp_panel_probe()
365 sharp = devm_kzalloc(&dsi->dev, sizeof(*sharp), GFP_KERNEL); in sharp_panel_probe()
367 put_device(&secondary->dev); in sharp_panel_probe()
368 return -ENOMEM; in sharp_panel_probe()
373 sharp->link2 = secondary; in sharp_panel_probe()
374 sharp->link1 = dsi; in sharp_panel_probe()
378 put_device(&secondary->dev); in sharp_panel_probe()
399 /* only detach from host for the DSI-LINK2 interface */ in sharp_panel_remove()
405 err = drm_panel_disable(&sharp->base); in sharp_panel_remove()
407 dev_err(&dsi->dev, "failed to disable panel: %d\n", err); in sharp_panel_remove()
411 dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err); in sharp_panel_remove()
420 /* nothing to do for DSI-LINK2 */ in sharp_panel_shutdown()
424 drm_panel_disable(&sharp->base); in sharp_panel_shutdown()
429 .name = "panel-sharp-lq101r1sx01",