Lines Matching +full:vcom +full:- +full:mode

1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
61 const struct drm_display_mode *mode; member
74 u8 vcom; member
114 static inline void sharp_memory_set_tx_buffer_mode(u8 *buffer, u8 mode, u8 vcom) in sharp_memory_set_tx_buffer_mode() argument
116 *buffer = mode | (vcom << 1); in sharp_memory_set_tx_buffer_mode()
142 iosys_map_set_vaddr(&vmap, dma_obj->vaddr); in sharp_memory_set_tx_buffer_data()
155 u32 pitch = smd->pitch; in sharp_memory_update_display()
156 u8 vcom = smd->vcom; in sharp_memory_update_display() local
157 u8 *tx_buffer = smd->tx_buffer; in sharp_memory_update_display()
158 u32 tx_buffer_size = smd->tx_buffer_size; in sharp_memory_update_display()
160 mutex_lock(&smd->tx_mutex); in sharp_memory_update_display()
164 SHARP_MEMORY_DISPLAY_UPDATE_MODE, vcom); in sharp_memory_update_display()
168 ret = sharp_memory_spi_write(smd->spi, tx_buffer, tx_buffer_size); in sharp_memory_update_display()
170 mutex_unlock(&smd->tx_mutex); in sharp_memory_update_display()
178 u8 vcom = smd->vcom; in sharp_memory_maintain_display() local
179 u8 *tx_buffer = smd->tx_buffer; in sharp_memory_maintain_display()
181 mutex_lock(&smd->tx_mutex); in sharp_memory_maintain_display()
183 sharp_memory_set_tx_buffer_mode(&tx_buffer[0], SHARP_MEMORY_DISPLAY_MAINTAIN_MODE, vcom); in sharp_memory_maintain_display()
185 ret = sharp_memory_spi_write(smd->spi, tx_buffer, 2); in sharp_memory_maintain_display()
187 mutex_unlock(&smd->tx_mutex); in sharp_memory_maintain_display()
195 u8 vcom = smd->vcom; in sharp_memory_clear_display() local
196 u8 *tx_buffer = smd->tx_buffer; in sharp_memory_clear_display()
198 mutex_lock(&smd->tx_mutex); in sharp_memory_clear_display()
200 sharp_memory_set_tx_buffer_mode(&tx_buffer[0], SHARP_MEMORY_DISPLAY_CLEAR_MODE, vcom); in sharp_memory_clear_display()
202 ret = sharp_memory_spi_write(smd->spi, tx_buffer, 2); in sharp_memory_clear_display()
204 mutex_unlock(&smd->tx_mutex); in sharp_memory_clear_display()
213 struct sharp_memory_device *smd = drm_to_sharp_memory_device(fb->dev); in sharp_memory_fb_dirty()
217 clip.x2 = fb->width; in sharp_memory_fb_dirty()
218 clip.y1 = rect->y1; in sharp_memory_fb_dirty()
219 clip.y2 = rect->y2; in sharp_memory_fb_dirty()
232 crtc_state = drm_atomic_get_new_crtc_state(state, &smd->crtc); in sharp_memory_plane_atomic_check()
244 struct drm_plane_state *plane_state = plane->state; in sharp_memory_plane_atomic_update()
250 if (!smd->crtc.state->active) in sharp_memory_plane_atomic_update()
254 sharp_memory_fb_dirty(plane_state->fb, &rect, &fmtcnv_state); in sharp_memory_plane_atomic_update()
283 const struct drm_display_mode *mode) in sharp_memory_crtc_mode_valid() argument
285 struct sharp_memory_device *smd = drm_to_sharp_memory_device(crtc->dev); in sharp_memory_crtc_mode_valid()
287 return drm_crtc_helper_mode_valid_fixed(crtc, mode, smd->mode); in sharp_memory_crtc_mode_valid()
296 if (!crtc_state->enable) in sharp_memory_crtc_check()
312 smd->vcom ^= 1; /* Toggle vcom */ in sharp_memory_sw_vcom_signal_thread()
323 struct sharp_memory_device *smd = drm_to_sharp_memory_device(crtc->dev); in sharp_memory_crtc_enable()
327 if (smd->enable_gpio) in sharp_memory_crtc_enable()
328 gpiod_set_value(smd->enable_gpio, 1); in sharp_memory_crtc_enable()
334 struct sharp_memory_device *smd = drm_to_sharp_memory_device(crtc->dev); in sharp_memory_crtc_disable()
338 if (smd->enable_gpio) in sharp_memory_crtc_disable()
339 gpiod_set_value(smd->enable_gpio, 0); in sharp_memory_crtc_disable()
364 struct sharp_memory_device *smd = drm_to_sharp_memory_device(connector->dev); in sharp_memory_connector_get_modes()
366 return drm_connector_helper_get_modes_fixed(connector, smd->mode); in sharp_memory_connector_get_modes()
464 struct drm_encoder *encoder = &smd->encoder; in sharp_memory_pipe_init()
465 struct drm_plane *plane = &smd->plane; in sharp_memory_pipe_init()
466 struct drm_crtc *crtc = &smd->crtc; in sharp_memory_pipe_init()
467 struct drm_connector *connector = &smd->connector; in sharp_memory_pipe_init()
484 encoder->possible_crtcs = drm_crtc_mask(crtc); in sharp_memory_pipe_init()
490 ret = drm_connector_init(&smd->drm, &smd->connector, in sharp_memory_pipe_init()
496 drm_connector_helper_add(&smd->connector, in sharp_memory_pipe_init()
505 struct device *dev = &smd->spi->dev; in sharp_memory_init_pwm_vcom_signal()
508 smd->pwm_vcom_signal = devm_pwm_get(dev, NULL); in sharp_memory_init_pwm_vcom_signal()
509 if (IS_ERR(smd->pwm_vcom_signal)) in sharp_memory_init_pwm_vcom_signal()
510 return dev_err_probe(dev, PTR_ERR(smd->pwm_vcom_signal), in sharp_memory_init_pwm_vcom_signal()
513 pwm_init_state(smd->pwm_vcom_signal, &pwm_state); in sharp_memory_init_pwm_vcom_signal()
516 ret = pwm_apply_might_sleep(smd->pwm_vcom_signal, &pwm_state); in sharp_memory_init_pwm_vcom_signal()
518 return dev_err_probe(dev, -EINVAL, "Could not apply pwm state\n"); in sharp_memory_init_pwm_vcom_signal()
531 dev = &spi->dev; in sharp_memory_probe()
537 if (!dev->coherent_dma_mask) { in sharp_memory_probe()
546 return -ENOMEM; in sharp_memory_probe()
550 smd->spi = spi; in sharp_memory_probe()
551 drm = &smd->drm; in sharp_memory_probe()
556 smd->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH); in sharp_memory_probe()
557 if (!smd->enable_gpio) in sharp_memory_probe()
560 drm->mode_config.funcs = &sharp_memory_mode_config_funcs; in sharp_memory_probe()
561 smd->mode = spi_get_device_match_data(spi); in sharp_memory_probe()
563 smd->pitch = (SHARP_ADDR_PERIOD + smd->mode->hdisplay + SHARP_DUMMY_PERIOD) / 8; in sharp_memory_probe()
564 smd->tx_buffer_size = (SHARP_MODE_PERIOD + in sharp_memory_probe()
565 (SHARP_ADDR_PERIOD + (smd->mode->hdisplay) + SHARP_DUMMY_PERIOD) * in sharp_memory_probe()
566 smd->mode->vdisplay) / 8; in sharp_memory_probe()
568 smd->tx_buffer = devm_kzalloc(dev, smd->tx_buffer_size, GFP_KERNEL); in sharp_memory_probe()
569 if (!smd->tx_buffer) in sharp_memory_probe()
570 return -ENOMEM; in sharp_memory_probe()
572 mutex_init(&smd->tx_mutex); in sharp_memory_probe()
575 * VCOM is a signal that prevents DC bias from being built up in in sharp_memory_probe()
581 * software (EXTMODE = L) - This mode uses a kthread to in sharp_memory_probe()
583 * toggling the vcom bit on and off with each message in sharp_memory_probe()
585 * external (EXTMODE = H) - This mode relies on an external in sharp_memory_probe()
588 * pwm (EXTMODE = H) - This mode uses a pwm device to generate in sharp_memory_probe()
592 if (device_property_read_string(dev, "sharp,vcom-mode", &vcom_mode_str)) in sharp_memory_probe()
593 return dev_err_probe(dev, -EINVAL, in sharp_memory_probe()
594 "Unable to find sharp,vcom-mode node in device tree\n"); in sharp_memory_probe()
597 smd->vcom_mode = SHARP_MEMORY_SOFTWARE_VCOM; in sharp_memory_probe()
598 smd->sw_vcom_signal = kthread_run(sharp_memory_sw_vcom_signal_thread, in sharp_memory_probe()
602 smd->vcom_mode = SHARP_MEMORY_EXTERNAL_VCOM; in sharp_memory_probe()
605 smd->vcom_mode = SHARP_MEMORY_PWM_VCOM; in sharp_memory_probe()
610 return dev_err_probe(dev, -EINVAL, "Invalid value set for vcom-mode\n"); in sharp_memory_probe()
613 drm->mode_config.min_width = smd->mode->hdisplay; in sharp_memory_probe()
614 drm->mode_config.max_width = smd->mode->hdisplay; in sharp_memory_probe()
615 drm->mode_config.min_height = smd->mode->vdisplay; in sharp_memory_probe()
616 drm->mode_config.max_height = smd->mode->vdisplay; in sharp_memory_probe()
624 drm_plane_enable_fb_damage_clips(&smd->plane); in sharp_memory_probe()
640 drm_dev_unplug(&smd->drm); in sharp_memory_remove()
641 drm_atomic_helper_shutdown(&smd->drm); in sharp_memory_remove()
643 switch (smd->vcom_mode) { in sharp_memory_remove()
645 kthread_stop(smd->sw_vcom_signal); in sharp_memory_remove()
652 pwm_disable(smd->pwm_vcom_signal); in sharp_memory_remove()