Lines Matching +full:revision +full:- +full:id1
1 // SPDX-License-Identifier: GPL-2.0-only
92 ddata->hw_guard_wait = msecs_to_jiffies(guard_msec); in hw_guard_start()
93 ddata->hw_guard_end = jiffies + ddata->hw_guard_wait; in hw_guard_start()
98 unsigned long wait = ddata->hw_guard_end - jiffies; in hw_guard_wait()
100 if ((long)wait > 0 && time_before_eq(wait, ddata->hw_guard_wait)) { in hw_guard_wait()
108 struct omap_dss_device *in = ddata->in; in dsicm_dcs_read_1()
112 r = in->ops.dsi->dcs_read(in, ddata->channel, dcs_cmd, buf, 1); in dsicm_dcs_read_1()
124 struct omap_dss_device *in = ddata->in; in dsicm_dcs_write_0()
125 return in->ops.dsi->dcs_write(in, ddata->channel, &dcs_cmd, 1); in dsicm_dcs_write_0()
130 struct omap_dss_device *in = ddata->in; in dsicm_dcs_write_1()
133 return in->ops.dsi->dcs_write(in, ddata->channel, buf, 2); in dsicm_dcs_write_1()
139 struct omap_dss_device *in = ddata->in; in dsicm_sleep_in()
146 r = in->ops.dsi->dcs_write_nosync(in, ddata->channel, &cmd, 1); in dsicm_sleep_in()
174 static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3) in dsicm_get_id() argument
178 r = dsicm_dcs_read_1(ddata, DCS_GET_ID1, id1); in dsicm_get_id()
194 struct omap_dss_device *in = ddata->in; in dsicm_set_update_window()
197 u16 x2 = x + w - 1; in dsicm_set_update_window()
199 u16 y2 = y + h - 1; in dsicm_set_update_window()
208 r = in->ops.dsi->dcs_write_nosync(in, ddata->channel, buf, sizeof(buf)); in dsicm_set_update_window()
218 r = in->ops.dsi->dcs_write_nosync(in, ddata->channel, buf, sizeof(buf)); in dsicm_set_update_window()
222 in->ops.dsi->bta_sync(in, ddata->channel); in dsicm_set_update_window()
229 if (ddata->ulps_timeout > 0) in dsicm_queue_ulps_work()
230 schedule_delayed_work(&ddata->ulps_work, in dsicm_queue_ulps_work()
231 msecs_to_jiffies(ddata->ulps_timeout)); in dsicm_queue_ulps_work()
236 cancel_delayed_work(&ddata->ulps_work); in dsicm_cancel_ulps_work()
241 struct omap_dss_device *in = ddata->in; in dsicm_enter_ulps()
244 if (ddata->ulps_enabled) in dsicm_enter_ulps()
253 if (ddata->ext_te_gpio) in dsicm_enter_ulps()
254 disable_irq(gpiod_to_irq(ddata->ext_te_gpio)); in dsicm_enter_ulps()
256 in->ops.dsi->disable(in, false, true); in dsicm_enter_ulps()
258 ddata->ulps_enabled = true; in dsicm_enter_ulps()
263 dev_err(&ddata->pdev->dev, "enter ULPS failed"); in dsicm_enter_ulps()
266 ddata->ulps_enabled = false; in dsicm_enter_ulps()
275 struct omap_dss_device *in = ddata->in; in dsicm_exit_ulps()
278 if (!ddata->ulps_enabled) in dsicm_exit_ulps()
281 r = in->ops.dsi->enable(in); in dsicm_exit_ulps()
283 dev_err(&ddata->pdev->dev, "failed to enable DSI\n"); in dsicm_exit_ulps()
287 in->ops.dsi->enable_hs(in, ddata->channel, true); in dsicm_exit_ulps()
291 dev_err(&ddata->pdev->dev, "failed to re-enable TE"); in dsicm_exit_ulps()
295 if (ddata->ext_te_gpio) in dsicm_exit_ulps()
296 enable_irq(gpiod_to_irq(ddata->ext_te_gpio)); in dsicm_exit_ulps()
300 ddata->ulps_enabled = false; in dsicm_exit_ulps()
305 dev_err(&ddata->pdev->dev, "failed to exit ULPS"); in dsicm_exit_ulps()
309 if (ddata->ext_te_gpio) in dsicm_exit_ulps()
310 enable_irq(gpiod_to_irq(ddata->ext_te_gpio)); in dsicm_exit_ulps()
311 ddata->ulps_enabled = false; in dsicm_exit_ulps()
321 if (ddata->ulps_enabled) in dsicm_wake_up()
331 struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev); in dsicm_bl_update_status()
332 struct omap_dss_device *in = ddata->in; in dsicm_bl_update_status()
336 dev_dbg(&ddata->pdev->dev, "update brightness to %d\n", level); in dsicm_bl_update_status()
338 mutex_lock(&ddata->lock); in dsicm_bl_update_status()
340 if (ddata->enabled) { in dsicm_bl_update_status()
341 in->ops.dsi->bus_lock(in); in dsicm_bl_update_status()
347 in->ops.dsi->bus_unlock(in); in dsicm_bl_update_status()
352 mutex_unlock(&ddata->lock); in dsicm_bl_update_status()
370 *xres = dssdev->panel.timings.x_res; in dsicm_get_resolution()
371 *yres = dssdev->panel.timings.y_res; in dsicm_get_resolution()
378 struct omap_dss_device *in = ddata->in; in dsicm_num_errors_show()
382 mutex_lock(&ddata->lock); in dsicm_num_errors_show()
384 if (ddata->enabled) { in dsicm_num_errors_show()
385 in->ops.dsi->bus_lock(in); in dsicm_num_errors_show()
392 in->ops.dsi->bus_unlock(in); in dsicm_num_errors_show()
394 r = -ENODEV; in dsicm_num_errors_show()
397 mutex_unlock(&ddata->lock); in dsicm_num_errors_show()
409 struct omap_dss_device *in = ddata->in; in dsicm_hw_revision_show()
410 u8 id1, id2, id3; in dsicm_hw_revision_show() local
413 mutex_lock(&ddata->lock); in dsicm_hw_revision_show()
415 if (ddata->enabled) { in dsicm_hw_revision_show()
416 in->ops.dsi->bus_lock(in); in dsicm_hw_revision_show()
420 r = dsicm_get_id(ddata, &id1, &id2, &id3); in dsicm_hw_revision_show()
422 in->ops.dsi->bus_unlock(in); in dsicm_hw_revision_show()
424 r = -ENODEV; in dsicm_hw_revision_show()
427 mutex_unlock(&ddata->lock); in dsicm_hw_revision_show()
432 return sysfs_emit(buf, "%02x.%02x.%02x\n", id1, id2, id3); in dsicm_hw_revision_show()
440 struct omap_dss_device *in = ddata->in; in dsicm_store_ulps()
448 mutex_lock(&ddata->lock); in dsicm_store_ulps()
450 if (ddata->enabled) { in dsicm_store_ulps()
451 in->ops.dsi->bus_lock(in); in dsicm_store_ulps()
458 in->ops.dsi->bus_unlock(in); in dsicm_store_ulps()
461 mutex_unlock(&ddata->lock); in dsicm_store_ulps()
476 mutex_lock(&ddata->lock); in dsicm_show_ulps()
477 t = ddata->ulps_enabled; in dsicm_show_ulps()
478 mutex_unlock(&ddata->lock); in dsicm_show_ulps()
488 struct omap_dss_device *in = ddata->in; in dsicm_store_ulps_timeout()
496 mutex_lock(&ddata->lock); in dsicm_store_ulps_timeout()
497 ddata->ulps_timeout = t; in dsicm_store_ulps_timeout()
499 if (ddata->enabled) { in dsicm_store_ulps_timeout()
501 in->ops.dsi->bus_lock(in); in dsicm_store_ulps_timeout()
503 in->ops.dsi->bus_unlock(in); in dsicm_store_ulps_timeout()
506 mutex_unlock(&ddata->lock); in dsicm_store_ulps_timeout()
521 mutex_lock(&ddata->lock); in dsicm_show_ulps_timeout()
522 t = ddata->ulps_timeout; in dsicm_show_ulps_timeout()
523 mutex_unlock(&ddata->lock); in dsicm_show_ulps_timeout()
554 gpiod_set_value_cansleep(ddata->reset_gpio, 1); in dsicm_hw_reset()
557 gpiod_set_value_cansleep(ddata->reset_gpio, 0); in dsicm_hw_reset()
561 gpiod_set_value_cansleep(ddata->reset_gpio, 1); in dsicm_hw_reset()
568 struct omap_dss_device *in = ddata->in; in dsicm_power_on()
569 u8 id1, id2, id3; in dsicm_power_on() local
574 .timings = &ddata->timings, in dsicm_power_on()
581 if (ddata->pin_config.num_pins > 0) { in dsicm_power_on()
582 r = in->ops.dsi->configure_pins(in, &ddata->pin_config); in dsicm_power_on()
584 dev_err(&ddata->pdev->dev, in dsicm_power_on()
590 r = in->ops.dsi->set_config(in, &dsi_config); in dsicm_power_on()
592 dev_err(&ddata->pdev->dev, "failed to configure DSI\n"); in dsicm_power_on()
596 r = in->ops.dsi->enable(in); in dsicm_power_on()
598 dev_err(&ddata->pdev->dev, "failed to enable DSI\n"); in dsicm_power_on()
604 in->ops.dsi->enable_hs(in, ddata->channel, false); in dsicm_power_on()
610 r = dsicm_get_id(ddata, &id1, &id2, &id3); in dsicm_power_on()
632 r = _dsicm_enable_te(ddata, ddata->te_enabled); in dsicm_power_on()
636 r = in->ops.dsi->enable_video_output(in, ddata->channel); in dsicm_power_on()
640 ddata->enabled = 1; in dsicm_power_on()
642 if (!ddata->intro_printed) { in dsicm_power_on()
643 dev_info(&ddata->pdev->dev, "panel revision %02x.%02x.%02x\n", in dsicm_power_on()
644 id1, id2, id3); in dsicm_power_on()
645 ddata->intro_printed = true; in dsicm_power_on()
648 in->ops.dsi->enable_hs(in, ddata->channel, true); in dsicm_power_on()
652 dev_err(&ddata->pdev->dev, "error while enabling panel, issuing HW reset\n"); in dsicm_power_on()
656 in->ops.dsi->disable(in, true, false); in dsicm_power_on()
663 struct omap_dss_device *in = ddata->in; in dsicm_power_off()
666 in->ops.dsi->disable_video_output(in, ddata->channel); in dsicm_power_off()
673 dev_err(&ddata->pdev->dev, in dsicm_power_off()
678 in->ops.dsi->disable(in, true, false); in dsicm_power_off()
680 ddata->enabled = 0; in dsicm_power_off()
685 dev_err(&ddata->pdev->dev, "performing LCD reset\n"); in dsicm_panel_reset()
695 struct omap_dss_device *in = ddata->in; in dsicm_connect()
696 struct device *dev = &ddata->pdev->dev; in dsicm_connect()
702 r = in->ops.dsi->connect(in, dssdev); in dsicm_connect()
708 r = in->ops.dsi->request_vc(ddata->in, &ddata->channel); in dsicm_connect()
714 r = in->ops.dsi->set_vc_id(ddata->in, ddata->channel, TCH); in dsicm_connect()
723 in->ops.dsi->release_vc(ddata->in, ddata->channel); in dsicm_connect()
725 in->ops.dsi->disconnect(in, dssdev); in dsicm_connect()
732 struct omap_dss_device *in = ddata->in; in dsicm_disconnect()
737 in->ops.dsi->release_vc(in, ddata->channel); in dsicm_disconnect()
738 in->ops.dsi->disconnect(in, dssdev); in dsicm_disconnect()
744 struct omap_dss_device *in = ddata->in; in dsicm_enable()
747 dev_dbg(&ddata->pdev->dev, "enable\n"); in dsicm_enable()
749 mutex_lock(&ddata->lock); in dsicm_enable()
752 r = -ENODEV; in dsicm_enable()
761 in->ops.dsi->bus_lock(in); in dsicm_enable()
765 in->ops.dsi->bus_unlock(in); in dsicm_enable()
770 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; in dsicm_enable()
772 mutex_unlock(&ddata->lock); in dsicm_enable()
776 dev_dbg(&ddata->pdev->dev, "enable failed\n"); in dsicm_enable()
777 mutex_unlock(&ddata->lock); in dsicm_enable()
784 struct omap_dss_device *in = ddata->in; in dsicm_disable()
787 dev_dbg(&ddata->pdev->dev, "disable\n"); in dsicm_disable()
789 mutex_lock(&ddata->lock); in dsicm_disable()
793 in->ops.dsi->bus_lock(in); in dsicm_disable()
801 in->ops.dsi->bus_unlock(in); in dsicm_disable()
803 dssdev->state = OMAP_DSS_DISPLAY_DISABLED; in dsicm_disable()
805 mutex_unlock(&ddata->lock); in dsicm_disable()
811 struct omap_dss_device *in = ddata->in; in dsicm_framedone_cb()
813 dev_dbg(&ddata->pdev->dev, "framedone, err %d\n", err); in dsicm_framedone_cb()
814 in->ops.dsi->bus_unlock(ddata->in); in dsicm_framedone_cb()
820 struct omap_dss_device *in = ddata->in; in dsicm_te_isr()
824 old = atomic_cmpxchg(&ddata->do_update, 1, 0); in dsicm_te_isr()
827 cancel_delayed_work(&ddata->te_timeout_work); in dsicm_te_isr()
829 r = in->ops.dsi->update(in, ddata->channel, dsicm_framedone_cb, in dsicm_te_isr()
837 dev_err(&ddata->pdev->dev, "start update failed\n"); in dsicm_te_isr()
838 in->ops.dsi->bus_unlock(in); in dsicm_te_isr()
846 struct omap_dss_device *in = ddata->in; in dsicm_te_timeout_work_callback()
848 dev_err(&ddata->pdev->dev, "TE not received for 250ms!\n"); in dsicm_te_timeout_work_callback()
850 atomic_set(&ddata->do_update, 0); in dsicm_te_timeout_work_callback()
851 in->ops.dsi->bus_unlock(in); in dsicm_te_timeout_work_callback()
858 struct omap_dss_device *in = ddata->in; in dsicm_update()
861 dev_dbg(&ddata->pdev->dev, "update %d, %d, %d x %d\n", x, y, w, h); in dsicm_update()
863 mutex_lock(&ddata->lock); in dsicm_update()
864 in->ops.dsi->bus_lock(in); in dsicm_update()
870 if (!ddata->enabled) { in dsicm_update()
877 dssdev->panel.timings.x_res, in dsicm_update()
878 dssdev->panel.timings.y_res); in dsicm_update()
882 if (ddata->te_enabled && ddata->ext_te_gpio) { in dsicm_update()
883 schedule_delayed_work(&ddata->te_timeout_work, in dsicm_update()
885 atomic_set(&ddata->do_update, 1); in dsicm_update()
887 r = in->ops.dsi->update(in, ddata->channel, dsicm_framedone_cb, in dsicm_update()
894 mutex_unlock(&ddata->lock); in dsicm_update()
897 in->ops.dsi->bus_unlock(in); in dsicm_update()
898 mutex_unlock(&ddata->lock); in dsicm_update()
905 struct omap_dss_device *in = ddata->in; in dsicm_sync()
907 dev_dbg(&ddata->pdev->dev, "sync\n"); in dsicm_sync()
909 mutex_lock(&ddata->lock); in dsicm_sync()
910 in->ops.dsi->bus_lock(in); in dsicm_sync()
911 in->ops.dsi->bus_unlock(in); in dsicm_sync()
912 mutex_unlock(&ddata->lock); in dsicm_sync()
914 dev_dbg(&ddata->pdev->dev, "sync done\n"); in dsicm_sync()
921 struct omap_dss_device *in = ddata->in; in _dsicm_enable_te()
929 if (!ddata->ext_te_gpio) in _dsicm_enable_te()
930 in->ops.dsi->enable_te(in, enable); in _dsicm_enable_te()
941 struct omap_dss_device *in = ddata->in; in dsicm_enable_te()
944 mutex_lock(&ddata->lock); in dsicm_enable_te()
946 if (ddata->te_enabled == enable) in dsicm_enable_te()
949 in->ops.dsi->bus_lock(in); in dsicm_enable_te()
951 if (ddata->enabled) { in dsicm_enable_te()
961 ddata->te_enabled = enable; in dsicm_enable_te()
963 in->ops.dsi->bus_unlock(in); in dsicm_enable_te()
965 mutex_unlock(&ddata->lock); in dsicm_enable_te()
969 in->ops.dsi->bus_unlock(in); in dsicm_enable_te()
970 mutex_unlock(&ddata->lock); in dsicm_enable_te()
980 mutex_lock(&ddata->lock); in dsicm_get_te()
981 r = ddata->te_enabled; in dsicm_get_te()
982 mutex_unlock(&ddata->lock); in dsicm_get_te()
992 struct omap_dss_device *in = ddata->in; in dsicm_memory_read()
999 return -ENOMEM; in dsicm_memory_read()
1001 mutex_lock(&ddata->lock); in dsicm_memory_read()
1003 if (!ddata->enabled) { in dsicm_memory_read()
1004 r = -ENODEV; in dsicm_memory_read()
1009 dssdev->panel.timings.x_res * in dsicm_memory_read()
1010 dssdev->panel.timings.y_res * 3); in dsicm_memory_read()
1012 in->ops.dsi->bus_lock(in); in dsicm_memory_read()
1028 r = in->ops.dsi->set_max_rx_packet_size(in, ddata->channel, plen); in dsicm_memory_read()
1036 r = in->ops.dsi->dcs_read(in, ddata->channel, dcs_cmd, in dsicm_memory_read()
1037 buf + buf_used, size - buf_used); in dsicm_memory_read()
1040 dev_err(dssdev->dev, "read error\n"); in dsicm_memory_read()
1047 dev_err(&ddata->pdev->dev, "short read\n"); in dsicm_memory_read()
1052 dev_err(&ddata->pdev->dev, "signal pending, " in dsicm_memory_read()
1054 r = -ERESTARTSYS; in dsicm_memory_read()
1062 in->ops.dsi->set_max_rx_packet_size(in, ddata->channel, 1); in dsicm_memory_read()
1064 in->ops.dsi->bus_unlock(in); in dsicm_memory_read()
1066 mutex_unlock(&ddata->lock); in dsicm_memory_read()
1074 struct omap_dss_device *dssdev = &ddata->dssdev; in dsicm_ulps_work()
1075 struct omap_dss_device *in = ddata->in; in dsicm_ulps_work()
1077 mutex_lock(&ddata->lock); in dsicm_ulps_work()
1079 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE || !ddata->enabled) { in dsicm_ulps_work()
1080 mutex_unlock(&ddata->lock); in dsicm_ulps_work()
1084 in->ops.dsi->bus_lock(in); in dsicm_ulps_work()
1088 in->ops.dsi->bus_unlock(in); in dsicm_ulps_work()
1089 mutex_unlock(&ddata->lock); in dsicm_ulps_work()
1116 struct device *dev = &pdev->dev; in dsicm_probe()
1122 if (!pdev->dev.of_node) in dsicm_probe()
1123 return -ENODEV; in dsicm_probe()
1127 return -ENOMEM; in dsicm_probe()
1130 ddata->pdev = pdev; in dsicm_probe()
1132 ddata->in = omapdss_of_find_source_for_first_ep(pdev->dev.of_node); in dsicm_probe()
1133 r = PTR_ERR_OR_ZERO(ddata->in); in dsicm_probe()
1135 dev_err(&pdev->dev, "failed to find video source: %d\n", r); in dsicm_probe()
1139 ddata->timings.x_res = 864; in dsicm_probe()
1140 ddata->timings.y_res = 480; in dsicm_probe()
1141 ddata->timings.pixelclock = 864 * 480 * 60; in dsicm_probe()
1143 dssdev = &ddata->dssdev; in dsicm_probe()
1144 dssdev->dev = dev; in dsicm_probe()
1145 dssdev->driver = &dsicm_ops; in dsicm_probe()
1146 dssdev->panel.timings = ddata->timings; in dsicm_probe()
1147 dssdev->type = OMAP_DISPLAY_TYPE_DSI; in dsicm_probe()
1148 dssdev->owner = THIS_MODULE; in dsicm_probe()
1150 dssdev->panel.dsi_pix_fmt = OMAP_DSS_DSI_FMT_RGB888; in dsicm_probe()
1151 dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE | in dsicm_probe()
1160 mutex_init(&ddata->lock); in dsicm_probe()
1162 atomic_set(&ddata->do_update, 0); in dsicm_probe()
1164 ddata->reset_gpio = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW); in dsicm_probe()
1165 r = PTR_ERR_OR_ZERO(ddata->reset_gpio); in dsicm_probe()
1167 dev_err(&pdev->dev, "Failed to request reset gpio: %d\n", r); in dsicm_probe()
1171 gpiod_set_consumer_name(ddata->reset_gpio, "taal rst"); in dsicm_probe()
1173 ddata->ext_te_gpio = devm_gpiod_get_optional(&pdev->dev, "te", in dsicm_probe()
1175 r = PTR_ERR_OR_ZERO(ddata->ext_te_gpio); in dsicm_probe()
1177 dev_err(&pdev->dev, "Failed to request TE gpio: %d\n", r); in dsicm_probe()
1181 if (ddata->ext_te_gpio) { in dsicm_probe()
1182 gpiod_set_consumer_name(ddata->ext_te_gpio, "taal irq"); in dsicm_probe()
1184 r = devm_request_irq(dev, gpiod_to_irq(ddata->ext_te_gpio), in dsicm_probe()
1194 INIT_DEFERRABLE_WORK(&ddata->te_timeout_work, in dsicm_probe()
1200 INIT_DELAYED_WORK(&ddata->ulps_work, dsicm_ulps_work); in dsicm_probe()
1204 if (ddata->use_dsi_backlight) { in dsicm_probe()
1216 ddata->bldev = bldev; in dsicm_probe()
1218 bldev->props.power = FB_BLANK_UNBLANK; in dsicm_probe()
1219 bldev->props.brightness = 255; in dsicm_probe()
1224 r = sysfs_create_group(&dev->kobj, &dsicm_attr_group); in dsicm_probe()
1242 struct omap_dss_device *dssdev = &ddata->dssdev; in dsicm_remove()
1245 dev_dbg(&pdev->dev, "remove\n"); in dsicm_remove()
1252 sysfs_remove_group(&pdev->dev.kobj, &dsicm_attr_group); in dsicm_remove()
1254 bldev = ddata->bldev; in dsicm_remove()
1256 bldev->props.power = FB_BLANK_POWERDOWN; in dsicm_remove()
1261 omap_dss_put_device(ddata->in); in dsicm_remove()
1270 { .compatible = "omapdss,panel-dsi-cm", },
1280 .name = "panel-dsi-cm",