Lines Matching +full:revision +full:- +full:id1
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com/
81 if (ddata->bldev) in dsicm_bl_power()
82 backlight = ddata->bldev; in dsicm_bl_power()
83 else if (ddata->extbldev) in dsicm_bl_power()
84 backlight = ddata->extbldev; in dsicm_bl_power()
96 ddata->hw_guard_wait = msecs_to_jiffies(guard_msec); in hw_guard_start()
97 ddata->hw_guard_end = jiffies + ddata->hw_guard_wait; in hw_guard_start()
102 unsigned long wait = ddata->hw_guard_end - jiffies; in hw_guard_wait()
104 if ((long)wait > 0 && wait <= ddata->hw_guard_wait) { in hw_guard_wait()
112 return mipi_dsi_dcs_read(ddata->dsi, dcs_cmd, data, 1); in dsicm_dcs_read_1()
117 return mipi_dsi_dcs_write(ddata->dsi, dcs_cmd, ¶m, 1); in dsicm_dcs_write_1()
127 r = mipi_dsi_dcs_enter_sleep_mode(ddata->dsi); in dsicm_sleep_in()
144 r = mipi_dsi_dcs_exit_sleep_mode(ddata->dsi); in dsicm_sleep_out()
155 static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3) in dsicm_get_id() argument
159 r = dsicm_dcs_read_1(ddata, DCS_GET_ID1, id1); in dsicm_get_id()
174 struct mipi_dsi_device *dsi = ddata->dsi; in dsicm_set_update_window()
177 r = mipi_dsi_dcs_set_column_address(dsi, 0, ddata->mode.hdisplay - 1); in dsicm_set_update_window()
181 r = mipi_dsi_dcs_set_page_address(dsi, 0, ddata->mode.vdisplay - 1); in dsicm_set_update_window()
190 struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev); in dsicm_bl_update_status()
194 dev_dbg(&ddata->dsi->dev, "update brightness to %d\n", level); in dsicm_bl_update_status()
196 mutex_lock(&ddata->lock); in dsicm_bl_update_status()
198 if (ddata->enabled) in dsicm_bl_update_status()
202 mutex_unlock(&ddata->lock); in dsicm_bl_update_status()
222 int r = -ENODEV; in num_dsi_errors_show()
224 mutex_lock(&ddata->lock); in num_dsi_errors_show()
226 if (ddata->enabled) in num_dsi_errors_show()
229 mutex_unlock(&ddata->lock); in num_dsi_errors_show()
241 u8 id1, id2, id3; in hw_revision_show() local
242 int r = -ENODEV; in hw_revision_show()
244 mutex_lock(&ddata->lock); in hw_revision_show()
246 if (ddata->enabled) in hw_revision_show()
247 r = dsicm_get_id(ddata, &id1, &id2, &id3); in hw_revision_show()
249 mutex_unlock(&ddata->lock); in hw_revision_show()
254 return sysfs_emit(buf, "%02x.%02x.%02x\n", id1, id2, id3); in hw_revision_show()
272 gpiod_set_value(ddata->reset_gpio, 1); in dsicm_hw_reset()
275 gpiod_set_value(ddata->reset_gpio, 0); in dsicm_hw_reset()
278 gpiod_set_value(ddata->reset_gpio, 1); in dsicm_hw_reset()
285 u8 id1, id2, id3; in dsicm_power_on() local
290 ddata->dsi->mode_flags |= MIPI_DSI_MODE_LPM; in dsicm_power_on()
296 r = dsicm_get_id(ddata, &id1, &id2, &id3); in dsicm_power_on()
309 r = mipi_dsi_dcs_set_pixel_format(ddata->dsi, MIPI_DCS_PIXEL_FMT_24BIT); in dsicm_power_on()
317 r = mipi_dsi_dcs_set_display_on(ddata->dsi); in dsicm_power_on()
321 if (ddata->panel_data->te_support) { in dsicm_power_on()
322 r = mipi_dsi_dcs_set_tear_on(ddata->dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK); in dsicm_power_on()
330 ddata->enabled = true; in dsicm_power_on()
332 if (!ddata->intro_printed) { in dsicm_power_on()
333 dev_info(&ddata->dsi->dev, "panel revision %02x.%02x.%02x\n", in dsicm_power_on()
334 id1, id2, id3); in dsicm_power_on()
335 ddata->intro_printed = true; in dsicm_power_on()
338 ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; in dsicm_power_on()
342 dev_err(&ddata->dsi->dev, "error while enabling panel, issuing HW reset\n"); in dsicm_power_on()
353 ddata->enabled = false; in dsicm_power_off()
355 r = mipi_dsi_dcs_set_display_off(ddata->dsi); in dsicm_power_off()
360 dev_err(&ddata->dsi->dev, in dsicm_power_off()
373 r = regulator_bulk_enable(ARRAY_SIZE(ddata->supplies), ddata->supplies); in dsicm_prepare()
375 dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r); in dsicm_prepare()
385 mutex_lock(&ddata->lock); in dsicm_enable()
391 mutex_unlock(&ddata->lock); in dsicm_enable()
397 dev_err(&ddata->dsi->dev, "enable failed (%d)\n", r); in dsicm_enable()
398 mutex_unlock(&ddata->lock); in dsicm_enable()
407 r = regulator_bulk_disable(ARRAY_SIZE(ddata->supplies), ddata->supplies); in dsicm_unprepare()
409 dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r); in dsicm_unprepare()
421 mutex_lock(&ddata->lock); in dsicm_disable()
425 mutex_unlock(&ddata->lock); in dsicm_disable()
436 mode = drm_mode_duplicate(connector->dev, &ddata->mode); in dsicm_get_modes()
438 dev_err(&ddata->dsi->dev, "failed to add mode %ux%ux@%u kHz\n", in dsicm_get_modes()
439 ddata->mode.hdisplay, ddata->mode.vdisplay, in dsicm_get_modes()
440 ddata->mode.clock); in dsicm_get_modes()
441 return -ENOMEM; in dsicm_get_modes()
444 connector->display_info.width_mm = ddata->panel_data->width_mm; in dsicm_get_modes()
445 connector->display_info.height_mm = ddata->panel_data->height_mm; in dsicm_get_modes()
465 struct drm_display_mode *mode = &ddata->mode; in dsicm_probe_of()
467 ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW); in dsicm_probe_of()
468 if (IS_ERR(ddata->reset_gpio)) { in dsicm_probe_of()
469 err = PTR_ERR(ddata->reset_gpio); in dsicm_probe_of()
470 dev_err(&dsi->dev, "reset gpio request failed: %d", err); in dsicm_probe_of()
474 mode->hdisplay = mode->hsync_start = mode->hsync_end = mode->htotal = in dsicm_probe_of()
475 ddata->panel_data->xres; in dsicm_probe_of()
476 mode->vdisplay = mode->vsync_start = mode->vsync_end = mode->vtotal = in dsicm_probe_of()
477 ddata->panel_data->yres; in dsicm_probe_of()
478 mode->clock = ddata->panel_data->xres * ddata->panel_data->yres * in dsicm_probe_of()
479 ddata->panel_data->refresh / 1000; in dsicm_probe_of()
480 mode->width_mm = ddata->panel_data->width_mm; in dsicm_probe_of()
481 mode->height_mm = ddata->panel_data->height_mm; in dsicm_probe_of()
482 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in dsicm_probe_of()
485 ddata->supplies[0].supply = "vpnl"; in dsicm_probe_of()
486 ddata->supplies[1].supply = "vddi"; in dsicm_probe_of()
487 err = devm_regulator_bulk_get(&dsi->dev, ARRAY_SIZE(ddata->supplies), in dsicm_probe_of()
488 ddata->supplies); in dsicm_probe_of()
492 backlight = devm_of_find_backlight(&dsi->dev); in dsicm_probe_of()
498 ddata->extbldev = backlight; in dsicm_probe_of()
500 ddata->use_dsi_backlight = true; in dsicm_probe_of()
509 struct device *dev = &dsi->dev; in dsicm_probe()
516 return -ENOMEM; in dsicm_probe()
519 ddata->dsi = dsi; in dsicm_probe()
521 ddata->panel_data = of_device_get_match_data(dev); in dsicm_probe()
522 if (!ddata->panel_data) in dsicm_probe()
523 return -ENODEV; in dsicm_probe()
529 mutex_init(&ddata->lock); in dsicm_probe()
533 drm_panel_init(&ddata->panel, dev, &dsicm_panel_funcs, in dsicm_probe()
536 if (ddata->use_dsi_backlight) { in dsicm_probe()
548 ddata->bldev = bldev; in dsicm_probe()
551 r = sysfs_create_group(&dev->kobj, &dsicm_attr_group); in dsicm_probe()
557 dsi->lanes = 2; in dsicm_probe()
558 dsi->format = MIPI_DSI_FMT_RGB888; in dsicm_probe()
559 dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS | in dsicm_probe()
561 dsi->hs_rate = ddata->panel_data->max_hs_rate; in dsicm_probe()
562 dsi->lp_rate = ddata->panel_data->max_lp_rate; in dsicm_probe()
564 drm_panel_add(&ddata->panel); in dsicm_probe()
573 drm_panel_remove(&ddata->panel); in dsicm_probe()
574 sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group); in dsicm_probe()
576 if (ddata->extbldev) in dsicm_probe()
577 put_device(&ddata->extbldev->dev); in dsicm_probe()
586 dev_dbg(&dsi->dev, "remove\n"); in dsicm_remove()
590 drm_panel_remove(&ddata->panel); in dsicm_remove()
592 sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group); in dsicm_remove()
594 if (ddata->extbldev) in dsicm_remove()
595 put_device(&ddata->extbldev->dev); in dsicm_remove()
634 { .compatible = "motorola,droid4-panel", &droid4_data },
644 .name = "panel-dsi-cm",