Lines Matching refs:nt

91 static void nt35950_reset(struct nt35950 *nt)
93 gpiod_set_value_cansleep(nt->reset_gpio, 1);
95 gpiod_set_value_cansleep(nt->reset_gpio, 0);
97 gpiod_set_value_cansleep(nt->reset_gpio, 1);
104 * @nt: Main driver structure
108 struct nt35950 *nt, u8 page)
116 nt->last_page = page;
122 * @nt: Main driver structure
126 struct nt35950 *nt, u8 comp_mode)
131 u8 last_page = nt->last_page;
135 nt35950_set_cmd2_page(dsi_ctx, nt, 0);
143 nt35950_set_cmd2_page(dsi_ctx, nt, 4);
150 nt35950_set_cmd2_page(dsi_ctx, nt, last_page);
215 * @nt: Main driver structure
219 struct nt35950 *nt)
222 const struct nt35950_panel_mode *mode_data = nt->desc->mode_data;
224 if (mode_data[nt->cur_mode].is_video_mode)
226 if (mode_data[nt->cur_mode].enable_sram)
233 static int nt35950_get_current_mode(struct nt35950 *nt)
235 struct drm_connector *connector = nt->connector;
245 for (i = 0; i < nt->desc->num_modes; i++) {
247 &nt->desc->mode_data[i].mode,
255 static int nt35950_on(struct nt35950 *nt)
257 const struct nt35950_panel_mode *mode_data = nt->desc->mode_data;
258 struct mipi_dsi_device *dsi = nt->dsi[0];
261 nt->cur_mode = nt35950_get_current_mode(nt);
262 nt->dsi[0]->mode_flags |= MIPI_DSI_MODE_LPM;
263 nt->dsi[1]->mode_flags |= MIPI_DSI_MODE_LPM;
265 nt35950_set_cmd2_page(&dsi_ctx, nt, 0);
266 nt35950_set_data_compression(&dsi_ctx, nt, mode_data[nt->cur_mode].compression);
267 nt35950_set_scale_mode(&dsi_ctx, mode_data[nt->cur_mode].scaler_mode);
268 nt35950_set_scaler(&dsi_ctx, mode_data[nt->cur_mode].scaler_on);
269 nt35950_set_dispout(&dsi_ctx, nt);
275 nt35950_set_cmd2_page(&dsi_ctx, nt, 1);
281 nt35950_set_cmd2_page(&dsi_ctx, nt, 7);
301 nt->dsi[0]->mode_flags &= ~MIPI_DSI_MODE_LPM;
302 nt->dsi[1]->mode_flags &= ~MIPI_DSI_MODE_LPM;
307 static void nt35950_off(struct nt35950 *nt)
309 struct mipi_dsi_device *dsi = nt->dsi[0];
318 nt->dsi[0]->mode_flags |= MIPI_DSI_MODE_LPM;
319 nt->dsi[1]->mode_flags |= MIPI_DSI_MODE_LPM;
322 static int nt35950_sharp_init_vregs(struct nt35950 *nt, struct device *dev)
326 nt->vregs[0].supply = "vddio";
327 nt->vregs[1].supply = "avdd";
328 nt->vregs[2].supply = "avee";
329 nt->vregs[3].supply = "dvdd";
330 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(nt->vregs),
331 nt->vregs);
335 ret = regulator_is_supported_voltage(nt->vregs[0].consumer,
339 ret = regulator_is_supported_voltage(nt->vregs[1].consumer,
344 ret = regulator_is_supported_voltage(nt->vregs[2].consumer,
349 ret = regulator_is_supported_voltage(nt->vregs[3].consumer,
359 struct nt35950 *nt = to_nt35950(panel);
362 ret = regulator_enable(nt->vregs[0].consumer);
367 ret = regulator_enable(nt->vregs[3].consumer);
372 ret = regulator_enable(nt->vregs[1].consumer);
376 ret = regulator_enable(nt->vregs[2].consumer);
381 nt35950_reset(nt);
383 ret = nt35950_on(nt);
387 regulator_bulk_disable(ARRAY_SIZE(nt->vregs), nt->vregs);
396 struct nt35950 *nt = to_nt35950(panel);
398 nt35950_off(nt);
400 gpiod_set_value_cansleep(nt->reset_gpio, 0);
401 regulator_bulk_disable(ARRAY_SIZE(nt->vregs), nt->vregs);
409 struct nt35950 *nt = to_nt35950(panel);
412 for (i = 0; i < nt->desc->num_modes; i++) {
416 &nt->desc->mode_data[i].mode);
423 if (nt->desc->num_modes == 1)
430 connector->display_info.height_mm = nt->desc->mode_data[0].mode.height_mm;
431 connector->display_info.width_mm = nt->desc->mode_data[0].mode.width_mm;
432 nt->connector = connector;
434 return nt->desc->num_modes;
448 struct nt35950 *nt;
452 nt = devm_drm_panel_alloc(dev, struct nt35950, panel, &nt35950_panel_funcs,
454 if (IS_ERR(nt))
455 return PTR_ERR(nt);
457 ret = nt35950_sharp_init_vregs(nt, dev);
461 nt->desc = of_device_get_match_data(dev);
462 if (!nt->desc)
465 nt->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_ASIS);
466 if (IS_ERR(nt->reset_gpio)) {
467 return dev_err_probe(dev, PTR_ERR(nt->reset_gpio),
472 if (nt->desc->is_dual_dsi) {
473 info = &nt->desc->dsi_info;
484 nt->dsi[1] = mipi_dsi_device_register_full(dsi_r_host, info);
485 if (IS_ERR(nt->dsi[1])) {
487 return PTR_ERR(nt->dsi[1]);
492 nt->dsi[0] = dsi;
493 mipi_dsi_set_drvdata(dsi, nt);
495 ret = drm_panel_of_backlight(&nt->panel);
498 mipi_dsi_device_unregister(nt->dsi[1]);
503 drm_panel_add(&nt->panel);
506 nt->dsi[i]->lanes = nt->desc->num_lanes;
507 nt->dsi[i]->format = MIPI_DSI_FMT_RGB888;
509 nt->dsi[i]->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS |
512 if (nt->desc->mode_data[0].is_video_mode)
513 nt->dsi[i]->mode_flags |= MIPI_DSI_MODE_VIDEO;
515 ret = mipi_dsi_attach(nt->dsi[i]);
519 mipi_dsi_device_unregister(nt->dsi[1]);
527 gpiod_set_value_cansleep(nt->reset_gpio, 0);
533 struct nt35950 *nt = mipi_dsi_get_drvdata(dsi);
536 ret = mipi_dsi_detach(nt->dsi[0]);
541 if (nt->dsi[1]) {
542 ret = mipi_dsi_detach(nt->dsi[1]);
546 mipi_dsi_device_unregister(nt->dsi[1]);
549 drm_panel_remove(&nt->panel);