Lines Matching refs:intel_dsi

96 	struct intel_dsi *intel_dsi;  member
130 static enum port intel_dsi_seq_port_to_port(struct intel_dsi *intel_dsi, in intel_dsi_seq_port_to_port() argument
138 if (hweight8(intel_dsi->ports) == 1) in intel_dsi_seq_port_to_port()
139 return ffs(intel_dsi->ports) - 1; in intel_dsi_seq_port_to_port()
142 if (intel_dsi->ports & BIT(PORT_B)) in intel_dsi_seq_port_to_port()
144 else if (intel_dsi->ports & BIT(PORT_C)) in intel_dsi_seq_port_to_port()
151 static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi, in mipi_exec_send_packet() argument
154 struct drm_i915_private *dev_priv = to_i915(intel_dsi->base.base.dev); in mipi_exec_send_packet()
170 port = intel_dsi_seq_port_to_port(intel_dsi, seq_port); in mipi_exec_send_packet()
172 if (drm_WARN_ON(&dev_priv->drm, !intel_dsi->dsi_hosts[port])) in mipi_exec_send_packet()
175 dsi_device = intel_dsi->dsi_hosts[port]->device; in mipi_exec_send_packet()
224 vlv_dsi_wait_for_fifo_empty(intel_dsi, port); in mipi_exec_send_packet()
232 static const u8 *mipi_exec_delay(struct intel_dsi *intel_dsi, const u8 *data) in mipi_exec_delay() argument
234 struct drm_i915_private *i915 = to_i915(intel_dsi->base.base.dev); in mipi_exec_delay()
461 static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data) in mipi_exec_gpio() argument
463 struct drm_device *dev = intel_dsi->base.base.dev; in mipi_exec_gpio()
465 struct intel_connector *connector = intel_dsi->attached_connector; in mipi_exec_gpio()
508 struct intel_dsi *intel_dsi = lookup->intel_dsi; in i2c_adapter_lookup() local
528 intel_dsi->i2c_bus_num = adapter->nr; in i2c_adapter_lookup()
533 static void i2c_acpi_find_adapter(struct intel_dsi *intel_dsi, in i2c_acpi_find_adapter() argument
536 struct drm_device *drm_dev = intel_dsi->base.base.dev; in i2c_acpi_find_adapter()
540 .intel_dsi = intel_dsi, in i2c_acpi_find_adapter()
549 static inline void i2c_acpi_find_adapter(struct intel_dsi *intel_dsi, in i2c_acpi_find_adapter() argument
555 static const u8 *mipi_exec_i2c(struct intel_dsi *intel_dsi, const u8 *data) in mipi_exec_i2c() argument
557 struct drm_i915_private *i915 = to_i915(intel_dsi->base.base.dev); in mipi_exec_i2c()
567 if (intel_dsi->i2c_bus_num < 0) { in mipi_exec_i2c()
568 intel_dsi->i2c_bus_num = vbt_i2c_bus_num; in mipi_exec_i2c()
569 i2c_acpi_find_adapter(intel_dsi, slave_addr); in mipi_exec_i2c()
572 adapter = i2c_get_adapter(intel_dsi->i2c_bus_num); in mipi_exec_i2c()
603 static const u8 *mipi_exec_spi(struct intel_dsi *intel_dsi, const u8 *data) in mipi_exec_spi() argument
605 struct drm_i915_private *i915 = to_i915(intel_dsi->base.base.dev); in mipi_exec_spi()
612 static const u8 *mipi_exec_pmic(struct intel_dsi *intel_dsi, const u8 *data) in mipi_exec_pmic() argument
614 struct drm_i915_private *i915 = to_i915(intel_dsi->base.base.dev); in mipi_exec_pmic()
639 typedef const u8 * (*fn_mipi_elem_exec)(struct intel_dsi *intel_dsi,
678 static void intel_dsi_vbt_exec(struct intel_dsi *intel_dsi, in intel_dsi_vbt_exec() argument
681 struct drm_i915_private *dev_priv = to_i915(intel_dsi->base.base.dev); in intel_dsi_vbt_exec()
682 struct intel_connector *connector = intel_dsi->attached_connector; in intel_dsi_vbt_exec()
725 data = mipi_elem_exec(intel_dsi, data); in intel_dsi_vbt_exec()
749 void intel_dsi_vbt_exec_sequence(struct intel_dsi *intel_dsi, in intel_dsi_vbt_exec_sequence() argument
752 if (seq_id == MIPI_SEQ_POWER_ON && intel_dsi->gpio_panel) in intel_dsi_vbt_exec_sequence()
753 gpiod_set_value_cansleep(intel_dsi->gpio_panel, 1); in intel_dsi_vbt_exec_sequence()
754 if (seq_id == MIPI_SEQ_BACKLIGHT_ON && intel_dsi->gpio_backlight) in intel_dsi_vbt_exec_sequence()
755 gpiod_set_value_cansleep(intel_dsi->gpio_backlight, 1); in intel_dsi_vbt_exec_sequence()
757 intel_dsi_vbt_exec(intel_dsi, seq_id); in intel_dsi_vbt_exec_sequence()
759 if (seq_id == MIPI_SEQ_POWER_OFF && intel_dsi->gpio_panel) in intel_dsi_vbt_exec_sequence()
760 gpiod_set_value_cansleep(intel_dsi->gpio_panel, 0); in intel_dsi_vbt_exec_sequence()
761 if (seq_id == MIPI_SEQ_BACKLIGHT_OFF && intel_dsi->gpio_backlight) in intel_dsi_vbt_exec_sequence()
762 gpiod_set_value_cansleep(intel_dsi->gpio_backlight, 0); in intel_dsi_vbt_exec_sequence()
765 void intel_dsi_msleep(struct intel_dsi *intel_dsi, int msec) in intel_dsi_msleep() argument
767 struct intel_connector *connector = intel_dsi->attached_connector; in intel_dsi_msleep()
770 if (is_vid_mode(intel_dsi) && connector->panel.vbt.dsi.seq_version >= 3) in intel_dsi_msleep()
776 void intel_dsi_log_params(struct intel_dsi *intel_dsi) in intel_dsi_log_params() argument
778 struct drm_i915_private *i915 = to_i915(intel_dsi->base.base.dev); in intel_dsi_log_params()
780 drm_dbg_kms(&i915->drm, "Pclk %d\n", intel_dsi->pclk); in intel_dsi_log_params()
782 intel_dsi->pixel_overlap); in intel_dsi_log_params()
783 drm_dbg_kms(&i915->drm, "Lane count %d\n", intel_dsi->lane_count); in intel_dsi_log_params()
784 drm_dbg_kms(&i915->drm, "DPHY param reg 0x%x\n", intel_dsi->dphy_reg); in intel_dsi_log_params()
786 intel_dsi->video_mode == NON_BURST_SYNC_PULSE ? in intel_dsi_log_params()
788 intel_dsi->video_mode == NON_BURST_SYNC_EVENTS ? in intel_dsi_log_params()
790 intel_dsi->video_mode == BURST_MODE ? in intel_dsi_log_params()
793 intel_dsi->burst_mode_ratio); in intel_dsi_log_params()
794 drm_dbg_kms(&i915->drm, "Reset timer %d\n", intel_dsi->rst_timer_val); in intel_dsi_log_params()
796 str_enabled_disabled(intel_dsi->eotp_pkt)); in intel_dsi_log_params()
798 str_enabled_disabled(!intel_dsi->clock_stop)); in intel_dsi_log_params()
800 intel_dsi->operation_mode ? "command" : "video"); in intel_dsi_log_params()
801 if (intel_dsi->dual_link == DSI_DUAL_LINK_FRONT_BACK) in intel_dsi_log_params()
804 else if (intel_dsi->dual_link == DSI_DUAL_LINK_PIXEL_ALT) in intel_dsi_log_params()
809 drm_dbg_kms(&i915->drm, "Pixel Format %d\n", intel_dsi->pixel_format); in intel_dsi_log_params()
810 drm_dbg_kms(&i915->drm, "TLPX %d\n", intel_dsi->escape_clk_div); in intel_dsi_log_params()
812 intel_dsi->lp_rx_timeout); in intel_dsi_log_params()
814 intel_dsi->turn_arnd_val); in intel_dsi_log_params()
815 drm_dbg_kms(&i915->drm, "Init Count 0x%x\n", intel_dsi->init_count); in intel_dsi_log_params()
817 intel_dsi->hs_to_lp_count); in intel_dsi_log_params()
818 drm_dbg_kms(&i915->drm, "LP Byte Clock %d\n", intel_dsi->lp_byte_clk); in intel_dsi_log_params()
819 drm_dbg_kms(&i915->drm, "DBI BW Timer 0x%x\n", intel_dsi->bw_timer); in intel_dsi_log_params()
821 intel_dsi->clk_lp_to_hs_count); in intel_dsi_log_params()
823 intel_dsi->clk_hs_to_lp_count); in intel_dsi_log_params()
825 str_enabled_disabled(!(intel_dsi->video_frmt_cfg_bits & DISABLE_VIDEO_BTA))); in intel_dsi_log_params()
828 bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id) in intel_dsi_vbt_init() argument
830 struct drm_device *dev = intel_dsi->base.base.dev; in intel_dsi_vbt_init()
832 struct intel_connector *connector = intel_dsi->attached_connector; in intel_dsi_vbt_init()
841 intel_dsi->eotp_pkt = mipi_config->eot_pkt_disabled ? 0 : 1; in intel_dsi_vbt_init()
842 intel_dsi->clock_stop = mipi_config->enable_clk_stop ? 1 : 0; in intel_dsi_vbt_init()
843 intel_dsi->lane_count = mipi_config->lane_cnt + 1; in intel_dsi_vbt_init()
844 intel_dsi->pixel_format = in intel_dsi_vbt_init()
848 intel_dsi->dual_link = mipi_config->dual_link; in intel_dsi_vbt_init()
849 intel_dsi->pixel_overlap = mipi_config->pixel_overlap; in intel_dsi_vbt_init()
850 intel_dsi->operation_mode = mipi_config->is_cmd_mode; in intel_dsi_vbt_init()
851 intel_dsi->video_mode = mipi_config->video_transfer_mode; in intel_dsi_vbt_init()
852 intel_dsi->escape_clk_div = mipi_config->byte_clk_sel; in intel_dsi_vbt_init()
853 intel_dsi->lp_rx_timeout = mipi_config->lp_rx_timeout; in intel_dsi_vbt_init()
854 intel_dsi->hs_tx_timeout = mipi_config->hs_tx_timeout; in intel_dsi_vbt_init()
855 intel_dsi->turn_arnd_val = mipi_config->turn_around_timeout; in intel_dsi_vbt_init()
856 intel_dsi->rst_timer_val = mipi_config->device_reset_timer; in intel_dsi_vbt_init()
857 intel_dsi->init_count = mipi_config->master_init_timer; in intel_dsi_vbt_init()
858 intel_dsi->bw_timer = mipi_config->dbi_bw_timer; in intel_dsi_vbt_init()
859 intel_dsi->video_frmt_cfg_bits = in intel_dsi_vbt_init()
861 intel_dsi->bgr_enabled = mipi_config->rgb_flip; in intel_dsi_vbt_init()
864 intel_dsi->pclk = mode->clock; in intel_dsi_vbt_init()
867 if (intel_dsi->dual_link) { in intel_dsi_vbt_init()
868 intel_dsi->pclk /= 2; in intel_dsi_vbt_init()
873 if (intel_dsi->dual_link == DSI_DUAL_LINK_FRONT_BACK) { in intel_dsi_vbt_init()
874 intel_dsi->pclk += DIV_ROUND_UP(mode->vtotal * intel_dsi->pixel_overlap * 60, 1000); in intel_dsi_vbt_init()
882 if (intel_dsi->video_mode == BURST_MODE) { in intel_dsi_vbt_init()
884 u32 bitrate = intel_dsi_bitrate(intel_dsi); in intel_dsi_vbt_init()
907 intel_dsi->pclk = DIV_ROUND_UP(intel_dsi->pclk * burst_mode_ratio, 100); in intel_dsi_vbt_init()
916 intel_dsi->burst_mode_ratio = burst_mode_ratio; in intel_dsi_vbt_init()
921 intel_dsi->backlight_off_delay = pps->bl_disable_delay / 10; in intel_dsi_vbt_init()
922 intel_dsi->backlight_on_delay = pps->bl_enable_delay / 10; in intel_dsi_vbt_init()
923 intel_dsi->panel_on_delay = pps->panel_on_delay / 10; in intel_dsi_vbt_init()
924 intel_dsi->panel_off_delay = pps->panel_off_delay / 10; in intel_dsi_vbt_init()
925 intel_dsi->panel_pwr_cycle_delay = pps->panel_power_cycle_delay / 10; in intel_dsi_vbt_init()
927 intel_dsi->i2c_bus_num = -1; in intel_dsi_vbt_init()
930 for_each_dsi_port(port, intel_dsi->ports) { in intel_dsi_vbt_init()
931 mipi_dsi_attach(intel_dsi->dsi_hosts[port]->device); in intel_dsi_vbt_init()
967 void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_dsi, bool panel_is_on) in intel_dsi_vbt_gpio_init() argument
969 struct drm_device *dev = intel_dsi->base.base.dev; in intel_dsi_vbt_gpio_init()
971 struct intel_connector *connector = intel_dsi->attached_connector; in intel_dsi_vbt_gpio_init()
1004 intel_dsi->gpio_panel = gpiod_get(dev->dev, "panel", flags); in intel_dsi_vbt_gpio_init()
1005 if (IS_ERR(intel_dsi->gpio_panel)) { in intel_dsi_vbt_gpio_init()
1008 intel_dsi->gpio_panel = NULL; in intel_dsi_vbt_gpio_init()
1013 intel_dsi->gpio_backlight = in intel_dsi_vbt_gpio_init()
1015 if (IS_ERR(intel_dsi->gpio_backlight)) { in intel_dsi_vbt_gpio_init()
1018 intel_dsi->gpio_backlight = NULL; in intel_dsi_vbt_gpio_init()
1023 void intel_dsi_vbt_gpio_cleanup(struct intel_dsi *intel_dsi) in intel_dsi_vbt_gpio_cleanup() argument
1025 struct drm_device *dev = intel_dsi->base.base.dev; in intel_dsi_vbt_gpio_cleanup()
1027 struct intel_connector *connector = intel_dsi->attached_connector; in intel_dsi_vbt_gpio_cleanup()
1030 if (intel_dsi->gpio_panel) { in intel_dsi_vbt_gpio_cleanup()
1031 gpiod_put(intel_dsi->gpio_panel); in intel_dsi_vbt_gpio_cleanup()
1032 intel_dsi->gpio_panel = NULL; in intel_dsi_vbt_gpio_cleanup()
1035 if (intel_dsi->gpio_backlight) { in intel_dsi_vbt_gpio_cleanup()
1036 gpiod_put(intel_dsi->gpio_backlight); in intel_dsi_vbt_gpio_cleanup()
1037 intel_dsi->gpio_backlight = NULL; in intel_dsi_vbt_gpio_cleanup()