Lines Matching +full:in +full:-

1 // SPDX-License-Identifier: GPL-2.0-only
40 struct omap_dss_device *in; member
51 * issue the next sleep in/out command
53 unsigned long hw_guard_wait; /* max guard time in jiffies */
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() local
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() local
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() local
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() local
146 r = in->ops.dsi->dcs_write_nosync(in, ddata->channel, &cmd, 1); in dsicm_sleep_in()
194 struct omap_dss_device *in = ddata->in; in dsicm_set_update_window() local
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() local
244 if (ddata->ulps_enabled) in dsicm_enter_ulps()
253 if (gpio_is_valid(ddata->ext_te_gpio)) in dsicm_enter_ulps()
254 disable_irq(gpio_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() local
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 (gpio_is_valid(ddata->ext_te_gpio)) in dsicm_exit_ulps()
296 enable_irq(gpio_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 (gpio_is_valid(ddata->ext_te_gpio)) in dsicm_exit_ulps()
310 enable_irq(gpio_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() local
336 if (dev->props.fb_blank == FB_BLANK_UNBLANK && in dsicm_bl_update_status()
337 dev->props.power == FB_BLANK_UNBLANK) in dsicm_bl_update_status()
338 level = dev->props.brightness; in dsicm_bl_update_status()
342 dev_dbg(&ddata->pdev->dev, "update brightness to %d\n", level); in dsicm_bl_update_status()
344 mutex_lock(&ddata->lock); in dsicm_bl_update_status()
346 if (ddata->enabled) { in dsicm_bl_update_status()
347 in->ops.dsi->bus_lock(in); in dsicm_bl_update_status()
353 in->ops.dsi->bus_unlock(in); in dsicm_bl_update_status()
358 mutex_unlock(&ddata->lock); in dsicm_bl_update_status()
365 if (dev->props.fb_blank == FB_BLANK_UNBLANK && in dsicm_bl_get_intensity()
366 dev->props.power == FB_BLANK_UNBLANK) in dsicm_bl_get_intensity()
367 return dev->props.brightness; in dsicm_bl_get_intensity()
380 *xres = dssdev->panel.timings.x_res; in dsicm_get_resolution()
381 *yres = dssdev->panel.timings.y_res; in dsicm_get_resolution()
388 struct omap_dss_device *in = ddata->in; in dsicm_num_errors_show() local
392 mutex_lock(&ddata->lock); in dsicm_num_errors_show()
394 if (ddata->enabled) { in dsicm_num_errors_show()
395 in->ops.dsi->bus_lock(in); in dsicm_num_errors_show()
402 in->ops.dsi->bus_unlock(in); in dsicm_num_errors_show()
404 r = -ENODEV; in dsicm_num_errors_show()
407 mutex_unlock(&ddata->lock); in dsicm_num_errors_show()
419 struct omap_dss_device *in = ddata->in; in dsicm_hw_revision_show() local
423 mutex_lock(&ddata->lock); in dsicm_hw_revision_show()
425 if (ddata->enabled) { in dsicm_hw_revision_show()
426 in->ops.dsi->bus_lock(in); in dsicm_hw_revision_show()
432 in->ops.dsi->bus_unlock(in); in dsicm_hw_revision_show()
434 r = -ENODEV; in dsicm_hw_revision_show()
437 mutex_unlock(&ddata->lock); in dsicm_hw_revision_show()
450 struct omap_dss_device *in = ddata->in; in dsicm_store_ulps() local
458 mutex_lock(&ddata->lock); in dsicm_store_ulps()
460 if (ddata->enabled) { in dsicm_store_ulps()
461 in->ops.dsi->bus_lock(in); in dsicm_store_ulps()
468 in->ops.dsi->bus_unlock(in); in dsicm_store_ulps()
471 mutex_unlock(&ddata->lock); in dsicm_store_ulps()
486 mutex_lock(&ddata->lock); in dsicm_show_ulps()
487 t = ddata->ulps_enabled; in dsicm_show_ulps()
488 mutex_unlock(&ddata->lock); in dsicm_show_ulps()
498 struct omap_dss_device *in = ddata->in; in dsicm_store_ulps_timeout() local
506 mutex_lock(&ddata->lock); in dsicm_store_ulps_timeout()
507 ddata->ulps_timeout = t; in dsicm_store_ulps_timeout()
509 if (ddata->enabled) { in dsicm_store_ulps_timeout()
511 in->ops.dsi->bus_lock(in); in dsicm_store_ulps_timeout()
513 in->ops.dsi->bus_unlock(in); in dsicm_store_ulps_timeout()
516 mutex_unlock(&ddata->lock); in dsicm_store_ulps_timeout()
531 mutex_lock(&ddata->lock); in dsicm_show_ulps_timeout()
532 t = ddata->ulps_timeout; in dsicm_show_ulps_timeout()
533 mutex_unlock(&ddata->lock); in dsicm_show_ulps_timeout()
559 if (!gpio_is_valid(ddata->reset_gpio)) in dsicm_hw_reset()
562 gpio_set_value(ddata->reset_gpio, 1); in dsicm_hw_reset()
565 gpio_set_value(ddata->reset_gpio, 0); in dsicm_hw_reset()
568 gpio_set_value(ddata->reset_gpio, 1); in dsicm_hw_reset()
575 struct omap_dss_device *in = ddata->in; in dsicm_power_on() local
581 .timings = &ddata->timings, in dsicm_power_on()
588 if (ddata->pin_config.num_pins > 0) { in dsicm_power_on()
589 r = in->ops.dsi->configure_pins(in, &ddata->pin_config); in dsicm_power_on()
591 dev_err(&ddata->pdev->dev, in dsicm_power_on()
597 r = in->ops.dsi->set_config(in, &dsi_config); in dsicm_power_on()
599 dev_err(&ddata->pdev->dev, "failed to configure DSI\n"); in dsicm_power_on()
603 r = in->ops.dsi->enable(in); in dsicm_power_on()
605 dev_err(&ddata->pdev->dev, "failed to enable DSI\n"); in dsicm_power_on()
611 in->ops.dsi->enable_hs(in, ddata->channel, false); in dsicm_power_on()
639 r = _dsicm_enable_te(ddata, ddata->te_enabled); in dsicm_power_on()
643 r = in->ops.dsi->enable_video_output(in, ddata->channel); in dsicm_power_on()
647 ddata->enabled = 1; in dsicm_power_on()
649 if (!ddata->intro_printed) { in dsicm_power_on()
650 dev_info(&ddata->pdev->dev, "panel revision %02x.%02x.%02x\n", in dsicm_power_on()
652 ddata->intro_printed = true; in dsicm_power_on()
655 in->ops.dsi->enable_hs(in, ddata->channel, true); in dsicm_power_on()
659 dev_err(&ddata->pdev->dev, "error while enabling panel, issuing HW reset\n"); in dsicm_power_on()
663 in->ops.dsi->disable(in, true, false); in dsicm_power_on()
670 struct omap_dss_device *in = ddata->in; in dsicm_power_off() local
673 in->ops.dsi->disable_video_output(in, ddata->channel); in dsicm_power_off()
680 dev_err(&ddata->pdev->dev, in dsicm_power_off()
685 in->ops.dsi->disable(in, true, false); in dsicm_power_off()
687 ddata->enabled = 0; in dsicm_power_off()
692 dev_err(&ddata->pdev->dev, "performing LCD reset\n"); in dsicm_panel_reset()
702 struct omap_dss_device *in = ddata->in; in dsicm_connect() local
703 struct device *dev = &ddata->pdev->dev; in dsicm_connect()
709 r = in->ops.dsi->connect(in, dssdev); in dsicm_connect()
715 r = in->ops.dsi->request_vc(ddata->in, &ddata->channel); in dsicm_connect()
721 r = in->ops.dsi->set_vc_id(ddata->in, ddata->channel, TCH); in dsicm_connect()
730 in->ops.dsi->release_vc(ddata->in, ddata->channel); in dsicm_connect()
732 in->ops.dsi->disconnect(in, dssdev); in dsicm_connect()
739 struct omap_dss_device *in = ddata->in; in dsicm_disconnect() local
744 in->ops.dsi->release_vc(in, ddata->channel); in dsicm_disconnect()
745 in->ops.dsi->disconnect(in, dssdev); in dsicm_disconnect()
751 struct omap_dss_device *in = ddata->in; in dsicm_enable() local
754 dev_dbg(&ddata->pdev->dev, "enable\n"); in dsicm_enable()
756 mutex_lock(&ddata->lock); in dsicm_enable()
759 r = -ENODEV; in dsicm_enable()
768 in->ops.dsi->bus_lock(in); in dsicm_enable()
772 in->ops.dsi->bus_unlock(in); in dsicm_enable()
777 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; in dsicm_enable()
779 mutex_unlock(&ddata->lock); in dsicm_enable()
783 dev_dbg(&ddata->pdev->dev, "enable failed\n"); in dsicm_enable()
784 mutex_unlock(&ddata->lock); in dsicm_enable()
791 struct omap_dss_device *in = ddata->in; in dsicm_disable() local
794 dev_dbg(&ddata->pdev->dev, "disable\n"); in dsicm_disable()
796 mutex_lock(&ddata->lock); in dsicm_disable()
800 in->ops.dsi->bus_lock(in); in dsicm_disable()
808 in->ops.dsi->bus_unlock(in); in dsicm_disable()
810 dssdev->state = OMAP_DSS_DISPLAY_DISABLED; in dsicm_disable()
812 mutex_unlock(&ddata->lock); in dsicm_disable()
818 struct omap_dss_device *in = ddata->in; in dsicm_framedone_cb() local
820 dev_dbg(&ddata->pdev->dev, "framedone, err %d\n", err); in dsicm_framedone_cb()
821 in->ops.dsi->bus_unlock(ddata->in); in dsicm_framedone_cb()
827 struct omap_dss_device *in = ddata->in; in dsicm_te_isr() local
831 old = atomic_cmpxchg(&ddata->do_update, 1, 0); in dsicm_te_isr()
834 cancel_delayed_work(&ddata->te_timeout_work); in dsicm_te_isr()
836 r = in->ops.dsi->update(in, ddata->channel, dsicm_framedone_cb, in dsicm_te_isr()
844 dev_err(&ddata->pdev->dev, "start update failed\n"); in dsicm_te_isr()
845 in->ops.dsi->bus_unlock(in); in dsicm_te_isr()
853 struct omap_dss_device *in = ddata->in; in dsicm_te_timeout_work_callback() local
855 dev_err(&ddata->pdev->dev, "TE not received for 250ms!\n"); in dsicm_te_timeout_work_callback()
857 atomic_set(&ddata->do_update, 0); in dsicm_te_timeout_work_callback()
858 in->ops.dsi->bus_unlock(in); in dsicm_te_timeout_work_callback()
865 struct omap_dss_device *in = ddata->in; in dsicm_update() local
868 dev_dbg(&ddata->pdev->dev, "update %d, %d, %d x %d\n", x, y, w, h); in dsicm_update()
870 mutex_lock(&ddata->lock); in dsicm_update()
871 in->ops.dsi->bus_lock(in); in dsicm_update()
877 if (!ddata->enabled) { in dsicm_update()
884 dssdev->panel.timings.x_res, in dsicm_update()
885 dssdev->panel.timings.y_res); in dsicm_update()
889 if (ddata->te_enabled && gpio_is_valid(ddata->ext_te_gpio)) { in dsicm_update()
890 schedule_delayed_work(&ddata->te_timeout_work, in dsicm_update()
892 atomic_set(&ddata->do_update, 1); in dsicm_update()
894 r = in->ops.dsi->update(in, ddata->channel, dsicm_framedone_cb, in dsicm_update()
900 /* note: no bus_unlock here. unlock is in framedone_cb */ in dsicm_update()
901 mutex_unlock(&ddata->lock); in dsicm_update()
904 in->ops.dsi->bus_unlock(in); in dsicm_update()
905 mutex_unlock(&ddata->lock); in dsicm_update()
912 struct omap_dss_device *in = ddata->in; in dsicm_sync() local
914 dev_dbg(&ddata->pdev->dev, "sync\n"); in dsicm_sync()
916 mutex_lock(&ddata->lock); in dsicm_sync()
917 in->ops.dsi->bus_lock(in); in dsicm_sync()
918 in->ops.dsi->bus_unlock(in); in dsicm_sync()
919 mutex_unlock(&ddata->lock); in dsicm_sync()
921 dev_dbg(&ddata->pdev->dev, "sync done\n"); in dsicm_sync()
928 struct omap_dss_device *in = ddata->in; in _dsicm_enable_te() local
936 if (!gpio_is_valid(ddata->ext_te_gpio)) in _dsicm_enable_te()
937 in->ops.dsi->enable_te(in, enable); in _dsicm_enable_te()
948 struct omap_dss_device *in = ddata->in; in dsicm_enable_te() local
951 mutex_lock(&ddata->lock); in dsicm_enable_te()
953 if (ddata->te_enabled == enable) in dsicm_enable_te()
956 in->ops.dsi->bus_lock(in); in dsicm_enable_te()
958 if (ddata->enabled) { in dsicm_enable_te()
968 ddata->te_enabled = enable; in dsicm_enable_te()
970 in->ops.dsi->bus_unlock(in); in dsicm_enable_te()
972 mutex_unlock(&ddata->lock); in dsicm_enable_te()
976 in->ops.dsi->bus_unlock(in); in dsicm_enable_te()
977 mutex_unlock(&ddata->lock); in dsicm_enable_te()
987 mutex_lock(&ddata->lock); in dsicm_get_te()
988 r = ddata->te_enabled; in dsicm_get_te()
989 mutex_unlock(&ddata->lock); in dsicm_get_te()
999 struct omap_dss_device *in = ddata->in; in dsicm_memory_read() local
1006 return -ENOMEM; in dsicm_memory_read()
1008 mutex_lock(&ddata->lock); in dsicm_memory_read()
1010 if (!ddata->enabled) { in dsicm_memory_read()
1011 r = -ENODEV; in dsicm_memory_read()
1016 dssdev->panel.timings.x_res * in dsicm_memory_read()
1017 dssdev->panel.timings.y_res * 3); in dsicm_memory_read()
1019 in->ops.dsi->bus_lock(in); in dsicm_memory_read()
1035 r = in->ops.dsi->set_max_rx_packet_size(in, ddata->channel, plen); in dsicm_memory_read()
1043 r = in->ops.dsi->dcs_read(in, ddata->channel, dcs_cmd, in dsicm_memory_read()
1044 buf + buf_used, size - buf_used); in dsicm_memory_read()
1047 dev_err(dssdev->dev, "read error\n"); in dsicm_memory_read()
1054 dev_err(&ddata->pdev->dev, "short read\n"); in dsicm_memory_read()
1059 dev_err(&ddata->pdev->dev, "signal pending, " in dsicm_memory_read()
1061 r = -ERESTARTSYS; in dsicm_memory_read()
1069 in->ops.dsi->set_max_rx_packet_size(in, ddata->channel, 1); in dsicm_memory_read()
1071 in->ops.dsi->bus_unlock(in); in dsicm_memory_read()
1073 mutex_unlock(&ddata->lock); in dsicm_memory_read()
1081 struct omap_dss_device *dssdev = &ddata->dssdev; in dsicm_ulps_work()
1082 struct omap_dss_device *in = ddata->in; in dsicm_ulps_work() local
1084 mutex_lock(&ddata->lock); in dsicm_ulps_work()
1086 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE || !ddata->enabled) { in dsicm_ulps_work()
1087 mutex_unlock(&ddata->lock); in dsicm_ulps_work()
1091 in->ops.dsi->bus_lock(in); in dsicm_ulps_work()
1095 in->ops.dsi->bus_unlock(in); in dsicm_ulps_work()
1096 mutex_unlock(&ddata->lock); in dsicm_ulps_work()
1120 struct device_node *node = pdev->dev.of_node; in dsicm_probe_of()
1122 struct omap_dss_device *in; in dsicm_probe_of() local
1125 gpio = of_get_named_gpio(node, "reset-gpios", 0); in dsicm_probe_of()
1127 dev_err(&pdev->dev, "failed to parse reset gpio\n"); in dsicm_probe_of()
1130 ddata->reset_gpio = gpio; in dsicm_probe_of()
1132 gpio = of_get_named_gpio(node, "te-gpios", 0); in dsicm_probe_of()
1133 if (gpio_is_valid(gpio) || gpio == -ENOENT) { in dsicm_probe_of()
1134 ddata->ext_te_gpio = gpio; in dsicm_probe_of()
1136 dev_err(&pdev->dev, "failed to parse TE gpio\n"); in dsicm_probe_of()
1140 in = omapdss_of_find_source_for_first_ep(node); in dsicm_probe_of()
1141 if (IS_ERR(in)) { in dsicm_probe_of()
1142 dev_err(&pdev->dev, "failed to find video source\n"); in dsicm_probe_of()
1143 return PTR_ERR(in); in dsicm_probe_of()
1146 ddata->in = in; in dsicm_probe_of()
1158 struct device *dev = &pdev->dev; in dsicm_probe()
1164 if (!pdev->dev.of_node) in dsicm_probe()
1165 return -ENODEV; in dsicm_probe()
1169 return -ENOMEM; in dsicm_probe()
1172 ddata->pdev = pdev; in dsicm_probe()
1178 ddata->timings.x_res = 864; in dsicm_probe()
1179 ddata->timings.y_res = 480; in dsicm_probe()
1180 ddata->timings.pixelclock = 864 * 480 * 60; in dsicm_probe()
1182 dssdev = &ddata->dssdev; in dsicm_probe()
1183 dssdev->dev = dev; in dsicm_probe()
1184 dssdev->driver = &dsicm_ops; in dsicm_probe()
1185 dssdev->panel.timings = ddata->timings; in dsicm_probe()
1186 dssdev->type = OMAP_DISPLAY_TYPE_DSI; in dsicm_probe()
1187 dssdev->owner = THIS_MODULE; in dsicm_probe()
1189 dssdev->panel.dsi_pix_fmt = OMAP_DSS_DSI_FMT_RGB888; in dsicm_probe()
1190 dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE | in dsicm_probe()
1199 mutex_init(&ddata->lock); in dsicm_probe()
1201 atomic_set(&ddata->do_update, 0); in dsicm_probe()
1203 if (gpio_is_valid(ddata->reset_gpio)) { in dsicm_probe()
1204 r = devm_gpio_request_one(dev, ddata->reset_gpio, in dsicm_probe()
1212 if (gpio_is_valid(ddata->ext_te_gpio)) { in dsicm_probe()
1213 r = devm_gpio_request_one(dev, ddata->ext_te_gpio, in dsicm_probe()
1220 r = devm_request_irq(dev, gpio_to_irq(ddata->ext_te_gpio), in dsicm_probe()
1230 INIT_DEFERRABLE_WORK(&ddata->te_timeout_work, in dsicm_probe()
1236 INIT_DELAYED_WORK(&ddata->ulps_work, dsicm_ulps_work); in dsicm_probe()
1240 if (ddata->use_dsi_backlight) { in dsicm_probe()
1252 ddata->bldev = bldev; in dsicm_probe()
1254 bldev->props.fb_blank = FB_BLANK_UNBLANK; in dsicm_probe()
1255 bldev->props.power = FB_BLANK_UNBLANK; in dsicm_probe()
1256 bldev->props.brightness = 255; in dsicm_probe()
1261 r = sysfs_create_group(&dev->kobj, &dsicm_attr_group); in dsicm_probe()
1279 struct omap_dss_device *dssdev = &ddata->dssdev; in dsicm_remove()
1282 dev_dbg(&pdev->dev, "remove\n"); in dsicm_remove()
1289 sysfs_remove_group(&pdev->dev.kobj, &dsicm_attr_group); in dsicm_remove()
1291 bldev = ddata->bldev; in dsicm_remove()
1293 bldev->props.power = FB_BLANK_POWERDOWN; in dsicm_remove()
1298 omap_dss_put_device(ddata->in); in dsicm_remove()
1302 /* reset, to be sure that the panel is in a valid state */ in dsicm_remove()
1309 { .compatible = "omapdss,panel-dsi-cm", },
1319 .name = "panel-dsi-cm",