Lines Matching +full:dsi +full:- +full:lanes

1 // SPDX-License-Identifier: GPL-2.0-only
29 struct mipi_dsi_device *dsi = adv->dsi; in adv7511_dsi_config_timing_gen() local
30 struct drm_display_mode *mode = &adv->curr_mode; in adv7511_dsi_config_timing_gen()
32 static const u8 clock_div_by_lanes[] = { 6, 4, 3 }; /* 2, 3, 4 lanes */ in adv7511_dsi_config_timing_gen()
34 hsw = mode->hsync_end - mode->hsync_start; in adv7511_dsi_config_timing_gen()
35 hfp = mode->hsync_start - mode->hdisplay; in adv7511_dsi_config_timing_gen()
36 hbp = mode->htotal - mode->hsync_end; in adv7511_dsi_config_timing_gen()
37 vsw = mode->vsync_end - mode->vsync_start; in adv7511_dsi_config_timing_gen()
38 vfp = mode->vsync_start - mode->vdisplay; in adv7511_dsi_config_timing_gen()
39 vbp = mode->vtotal - mode->vsync_end; in adv7511_dsi_config_timing_gen()
42 regmap_write(adv->regmap_cec, 0x16, in adv7511_dsi_config_timing_gen()
43 clock_div_by_lanes[dsi->lanes - 2] << 3); in adv7511_dsi_config_timing_gen()
46 regmap_write(adv->regmap_cec, 0x28, mode->htotal >> 4); in adv7511_dsi_config_timing_gen()
47 regmap_write(adv->regmap_cec, 0x29, (mode->htotal << 4) & 0xff); in adv7511_dsi_config_timing_gen()
48 regmap_write(adv->regmap_cec, 0x2a, hsw >> 4); in adv7511_dsi_config_timing_gen()
49 regmap_write(adv->regmap_cec, 0x2b, (hsw << 4) & 0xff); in adv7511_dsi_config_timing_gen()
50 regmap_write(adv->regmap_cec, 0x2c, hfp >> 4); in adv7511_dsi_config_timing_gen()
51 regmap_write(adv->regmap_cec, 0x2d, (hfp << 4) & 0xff); in adv7511_dsi_config_timing_gen()
52 regmap_write(adv->regmap_cec, 0x2e, hbp >> 4); in adv7511_dsi_config_timing_gen()
53 regmap_write(adv->regmap_cec, 0x2f, (hbp << 4) & 0xff); in adv7511_dsi_config_timing_gen()
56 regmap_write(adv->regmap_cec, 0x30, mode->vtotal >> 4); in adv7511_dsi_config_timing_gen()
57 regmap_write(adv->regmap_cec, 0x31, (mode->vtotal << 4) & 0xff); in adv7511_dsi_config_timing_gen()
58 regmap_write(adv->regmap_cec, 0x32, vsw >> 4); in adv7511_dsi_config_timing_gen()
59 regmap_write(adv->regmap_cec, 0x33, (vsw << 4) & 0xff); in adv7511_dsi_config_timing_gen()
60 regmap_write(adv->regmap_cec, 0x34, vfp >> 4); in adv7511_dsi_config_timing_gen()
61 regmap_write(adv->regmap_cec, 0x35, (vfp << 4) & 0xff); in adv7511_dsi_config_timing_gen()
62 regmap_write(adv->regmap_cec, 0x36, vbp >> 4); in adv7511_dsi_config_timing_gen()
63 regmap_write(adv->regmap_cec, 0x37, (vbp << 4) & 0xff); in adv7511_dsi_config_timing_gen()
68 struct mipi_dsi_device *dsi = adv->dsi; in adv7533_dsi_power_on() local
70 if (adv->use_timing_gen) in adv7533_dsi_power_on()
73 /* set number of dsi lanes */ in adv7533_dsi_power_on()
74 regmap_write(adv->regmap_cec, 0x1c, dsi->lanes << 4); in adv7533_dsi_power_on()
76 if (adv->use_timing_gen) { in adv7533_dsi_power_on()
78 regmap_write(adv->regmap_cec, 0x27, 0xcb); in adv7533_dsi_power_on()
79 regmap_write(adv->regmap_cec, 0x27, 0x8b); in adv7533_dsi_power_on()
80 regmap_write(adv->regmap_cec, 0x27, 0xcb); in adv7533_dsi_power_on()
83 regmap_write(adv->regmap_cec, 0x27, 0x0b); in adv7533_dsi_power_on()
87 regmap_write(adv->regmap_cec, 0x03, 0x89); in adv7533_dsi_power_on()
89 regmap_write(adv->regmap_cec, 0x55, 0x00); in adv7533_dsi_power_on()
91 regmap_register_patch(adv->regmap_cec, adv7533_cec_fixed_registers, in adv7533_dsi_power_on()
98 regmap_write(adv->regmap_cec, 0x03, 0x0b); in adv7533_dsi_power_off()
100 regmap_write(adv->regmap_cec, 0x27, 0x0b); in adv7533_dsi_power_off()
106 struct mipi_dsi_device *dsi = adv->dsi; in adv7533_mode_valid() local
107 u8 bpp = mipi_dsi_pixel_format_to_bpp(dsi->format); in adv7533_mode_valid()
110 if (mode->clock > adv->info->max_mode_clock_khz) in adv7533_mode_valid()
114 if (mode->clock * bpp > adv->info->max_lane_freq_khz * adv->num_dsi_lanes) in adv7533_mode_valid()
122 return regmap_register_patch(adv->regmap, in adv7533_patch_registers()
129 return regmap_register_patch(adv->regmap_cec, in adv7533_patch_cec_registers()
136 struct device *dev = &adv->i2c_main->dev; in adv7533_attach_dsi()
138 struct mipi_dsi_device *dsi; in adv7533_attach_dsi() local
145 host = of_find_mipi_dsi_host_by_node(adv->host_node); in adv7533_attach_dsi()
147 return dev_err_probe(dev, -EPROBE_DEFER, in adv7533_attach_dsi()
148 "failed to find dsi host\n"); in adv7533_attach_dsi()
150 dsi = devm_mipi_dsi_device_register_full(dev, host, &info); in adv7533_attach_dsi()
151 if (IS_ERR(dsi)) in adv7533_attach_dsi()
152 return dev_err_probe(dev, PTR_ERR(dsi), in adv7533_attach_dsi()
153 "failed to create dsi device\n"); in adv7533_attach_dsi()
155 adv->dsi = dsi; in adv7533_attach_dsi()
157 dsi->lanes = adv->num_dsi_lanes; in adv7533_attach_dsi()
158 dsi->format = MIPI_DSI_FMT_RGB888; in adv7533_attach_dsi()
159 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | in adv7533_attach_dsi()
162 ret = devm_mipi_dsi_attach(dev, dsi); in adv7533_attach_dsi()
164 return dev_err_probe(dev, ret, "failed to attach dsi to host\n"); in adv7533_attach_dsi()
173 of_property_read_u32(np, "adi,dsi-lanes", &num_lanes); in adv7533_parse_dt()
176 return -EINVAL; in adv7533_parse_dt()
178 adv->num_dsi_lanes = num_lanes; in adv7533_parse_dt()
180 adv->host_node = of_graph_get_remote_node(np, 0, 0); in adv7533_parse_dt()
181 if (!adv->host_node) in adv7533_parse_dt()
182 return -ENODEV; in adv7533_parse_dt()
184 of_node_put(adv->host_node); in adv7533_parse_dt()
186 adv->use_timing_gen = !of_property_read_bool(np, in adv7533_parse_dt()
187 "adi,disable-timing-generator"); in adv7533_parse_dt()
190 adv->rgb = true; in adv7533_parse_dt()
191 adv->embedded_sync = false; in adv7533_parse_dt()