Lines Matching refs:ser
59 struct max96755f_bridge *ser = to_max96755f_bridge(connector); in max96755f_bridge_connector_get_modes() local
61 if (ser->next_bridge) in max96755f_bridge_connector_get_modes()
62 return drm_bridge_get_modes(ser->next_bridge, connector); in max96755f_bridge_connector_get_modes()
64 return drm_panel_get_modes(ser->panel, connector); in max96755f_bridge_connector_get_modes()
75 struct max96755f_bridge *ser = to_max96755f_bridge(connector); in max96755f_bridge_connector_detect() local
80 return drm_bridge_detect(&ser->bridge); in max96755f_bridge_connector_detect()
126 static bool max96755f_bridge_link_locked(struct max96755f_bridge *ser) in max96755f_bridge_link_locked() argument
130 if (regmap_read(ser->regmap, 0x0013, &val)) in max96755f_bridge_link_locked()
142 struct max96755f_bridge *ser = to_max96755f_bridge(bridge); in max96755f_bridge_attach() local
143 struct drm_connector *connector = &ser->connector; in max96755f_bridge_attach()
146 ret = drm_of_find_panel_or_bridge(bridge->of_node, 1, -1, &ser->panel, in max96755f_bridge_attach()
147 &ser->next_bridge); in max96755f_bridge_attach()
151 if (ser->next_bridge) { in max96755f_bridge_attach()
152 ret = drm_bridge_attach(bridge->encoder, ser->next_bridge, in max96755f_bridge_attach()
166 ser->next_bridge ? ser->next_bridge->type : bridge->type); in max96755f_bridge_attach()
172 if (max96755f_bridge_link_locked(ser)) { in max96755f_bridge_attach()
174 enable_irq(ser->lock.irq); in max96755f_bridge_attach()
175 ser->lock.irq_enabled = true; in max96755f_bridge_attach()
182 ser->dsi = max96755f_attach_dsi(ser, ser->dsi_node); in max96755f_bridge_attach()
183 if (IS_ERR(ser->dsi)) in max96755f_bridge_attach()
184 return PTR_ERR(ser->dsi); in max96755f_bridge_attach()
191 struct max96755f_bridge *ser = to_max96755f_bridge(bridge); in max96755f_bridge_detach() local
193 if (ser->dsi) { in max96755f_bridge_detach()
194 mipi_dsi_detach(ser->dsi); in max96755f_bridge_detach()
195 mipi_dsi_device_unregister(ser->dsi); in max96755f_bridge_detach()
199 static void max96755f_mipi_dsi_rx_config(struct max96755f_bridge *ser) in max96755f_mipi_dsi_rx_config() argument
201 struct drm_display_mode *mode = &ser->mode; in max96755f_mipi_dsi_rx_config()
206 regmap_update_bits(ser->regmap, 0x330, MIPI_RX_RESET, in max96755f_mipi_dsi_rx_config()
209 regmap_update_bits(ser->regmap, 0x330, MIPI_RX_RESET, in max96755f_mipi_dsi_rx_config()
213 regmap_update_bits(ser->regmap, 0x331, NUM_LANES, in max96755f_mipi_dsi_rx_config()
214 FIELD_PREP(NUM_LANES, ser->num_lanes - 1)); in max96755f_mipi_dsi_rx_config()
216 lane_map = (ser->dsi_lane_map[0] & 0xff) << 4 | in max96755f_mipi_dsi_rx_config()
217 (ser->dsi_lane_map[1] & 0xff) << 6 | in max96755f_mipi_dsi_rx_config()
218 (ser->dsi_lane_map[2] & 0xff) << 0 | in max96755f_mipi_dsi_rx_config()
219 (ser->dsi_lane_map[3] & 0xff) << 2; in max96755f_mipi_dsi_rx_config()
220 regmap_write(ser->regmap, 0x332, lane_map); in max96755f_mipi_dsi_rx_config()
222 if (!ser->dpi_deskew_en) in max96755f_mipi_dsi_rx_config()
234 regmap_write(ser->regmap, 0x03A4, 0xc1); in max96755f_mipi_dsi_rx_config()
235 regmap_write(ser->regmap, 0x0385, FIELD_PREP(DPI_HSYNC_WIDTH_L, hsa)); in max96755f_mipi_dsi_rx_config()
236 regmap_write(ser->regmap, 0x0386, FIELD_PREP(DPI_VYSNC_WIDTH_L, vsa)); in max96755f_mipi_dsi_rx_config()
237 regmap_write(ser->regmap, 0x0387, in max96755f_mipi_dsi_rx_config()
240 regmap_write(ser->regmap, 0x03a5, FIELD_PREP(DPI_VFP_L, vfp)); in max96755f_mipi_dsi_rx_config()
241 regmap_write(ser->regmap, 0x03a6, in max96755f_mipi_dsi_rx_config()
244 regmap_write(ser->regmap, 0x03a7, FIELD_PREP(DPI_VBP_H, (vbp >> 4))); in max96755f_mipi_dsi_rx_config()
245 regmap_write(ser->regmap, 0x03a8, FIELD_PREP(DPI_VACT_L, vact)); in max96755f_mipi_dsi_rx_config()
246 regmap_write(ser->regmap, 0x03a9, FIELD_PREP(DPI_VACT_H, (vact >> 8))); in max96755f_mipi_dsi_rx_config()
247 regmap_write(ser->regmap, 0x03aa, FIELD_PREP(DPI_HFP_L, hfp)); in max96755f_mipi_dsi_rx_config()
248 regmap_write(ser->regmap, 0x03ab, in max96755f_mipi_dsi_rx_config()
251 regmap_write(ser->regmap, 0x03ac, FIELD_PREP(DPI_HBP_H, (hbp >> 4))); in max96755f_mipi_dsi_rx_config()
252 regmap_write(ser->regmap, 0x03ad, FIELD_PREP(DPI_HACT_L, hact)); in max96755f_mipi_dsi_rx_config()
253 regmap_write(ser->regmap, 0x03ae, FIELD_PREP(DPI_HACT_H, (hact >> 8))); in max96755f_mipi_dsi_rx_config()
258 struct max96755f_bridge *ser = to_max96755f_bridge(bridge); in max96755f_bridge_pre_enable() local
260 max96755f_mipi_dsi_rx_config(ser); in max96755f_bridge_pre_enable()
262 if (ser->split_mode) { in max96755f_bridge_pre_enable()
263 regmap_update_bits(ser->regmap, 0x0053, in max96755f_bridge_pre_enable()
268 regmap_update_bits(ser->regmap, 0x0057, in max96755f_bridge_pre_enable()
273 regmap_update_bits(ser->regmap, 0x032a, in max96755f_bridge_pre_enable()
275 FIELD_PREP(DV_SWP_AB, ser->dv_swp_ab) | in max96755f_bridge_pre_enable()
281 if (ser->panel) in max96755f_bridge_pre_enable()
282 drm_panel_prepare(ser->panel); in max96755f_bridge_pre_enable()
285 static void max96755f_bridge_reset_oneshot(struct max96755f_bridge *ser) in max96755f_bridge_reset_oneshot() argument
287 regmap_update_bits(ser->regmap, 0x0010, RESET_ONESHOT, in max96755f_bridge_reset_oneshot()
292 atomic_set(&ser->lock.triggered, 0); in max96755f_bridge_reset_oneshot()
297 struct max96755f_bridge *ser = to_max96755f_bridge(bridge); in max96755f_bridge_enable() local
298 struct max96755f *max96755f = ser->parent; in max96755f_bridge_enable()
302 if (ser->split_mode) { in max96755f_bridge_enable()
303 regmap_update_bits(ser->regmap, 0x0311, in max96755f_bridge_enable()
307 regmap_update_bits(ser->regmap, 0x0002, in max96755f_bridge_enable()
312 regmap_update_bits(ser->regmap, 0x0010, in max96755f_bridge_enable()
316 ret = regmap_read_poll_timeout(ser->regmap, 0x0013, val, in max96755f_bridge_enable()
320 dev_err(ser->dev, "GMSL2 link lock timeout\n"); in max96755f_bridge_enable()
322 regmap_update_bits(ser->regmap, 0x0311, in max96755f_bridge_enable()
326 regmap_update_bits(ser->regmap, 0x02, VID_TX_EN_X, in max96755f_bridge_enable()
328 if (ser->bridge_dual_link) { in max96755f_bridge_enable()
329 regmap_update_bits(ser->regmap, 0x0010, in max96755f_bridge_enable()
336 max96755f_bridge_reset_oneshot(ser); in max96755f_bridge_enable()
338 if (ser->panel) in max96755f_bridge_enable()
339 drm_panel_enable(ser->panel); in max96755f_bridge_enable()
341 if (!ser->lock.irq_enabled) { in max96755f_bridge_enable()
342 enable_irq(ser->lock.irq); in max96755f_bridge_enable()
343 ser->lock.irq_enabled = true; in max96755f_bridge_enable()
351 struct max96755f_bridge *ser = to_max96755f_bridge(bridge); in max96755f_bridge_disable() local
352 struct max96755f *max96755f = ser->parent; in max96755f_bridge_disable()
356 if (ser->lock.irq_enabled) { in max96755f_bridge_disable()
357 disable_irq(ser->lock.irq); in max96755f_bridge_disable()
358 ser->lock.irq_enabled = false; in max96755f_bridge_disable()
361 if (ser->panel) in max96755f_bridge_disable()
362 drm_panel_disable(ser->panel); in max96755f_bridge_disable()
364 regmap_update_bits(ser->regmap, 0x02, VID_TX_EN_X | VID_TX_EN_Y, in max96755f_bridge_disable()
368 if (ser->split_mode || ser->bridge_dual_link) in max96755f_bridge_disable()
369 regmap_update_bits(ser->regmap, 0x0010, in max96755f_bridge_disable()
377 struct max96755f_bridge *ser = to_max96755f_bridge(bridge); in max96755f_bridge_post_disable() local
379 if (ser->panel) in max96755f_bridge_post_disable()
380 drm_panel_unprepare(ser->panel); in max96755f_bridge_post_disable()
386 struct max96755f_bridge *ser = to_max96755f_bridge(bridge); in max96755f_bridge_detect() local
387 struct max96755f *max96755f = ser->parent; in max96755f_bridge_detect()
389 if (!max96755f_bridge_link_locked(ser)) in max96755f_bridge_detect()
393 if (atomic_cmpxchg(&ser->lock.triggered, 1, 0)) in max96755f_bridge_detect()
396 atomic_set(&ser->lock.triggered, 0); in max96755f_bridge_detect()
399 if (ser->next_bridge && (ser->next_bridge->ops & DRM_BRIDGE_OP_DETECT)) in max96755f_bridge_detect()
400 return drm_bridge_detect(ser->next_bridge); in max96755f_bridge_detect()
409 struct max96755f_bridge *ser = to_max96755f_bridge(bridge); in max96755f_bridge_mode_set() local
411 drm_mode_copy(&ser->mode, adj_mode); in max96755f_bridge_mode_set()
429 static int max96755f_link_parse(struct max96755f_bridge *ser) in max96755f_link_parse() argument
431 struct device *dev = ser->dev; in max96755f_link_parse()
440 ser->dpi_deskew_en = of_property_read_bool(np, "dpi-deskew-en"); in max96755f_link_parse()
441 ser->dv_swp_ab = of_property_read_bool(np, "vd-swap-ab"); in max96755f_link_parse()
444 ser->num_lanes = val; in max96755f_link_parse()
446 ser->num_lanes = 4; in max96755f_link_parse()
448 for (i = 0; i < ser->num_lanes; i++) in max96755f_link_parse()
449 ser->dsi_lane_map[i] = i; in max96755f_link_parse()
453 if (ser->num_lanes != len) { in max96755f_link_parse()
459 ser->dsi_lane_map, len); in max96755f_link_parse()
475 ser->split_mode = true; in max96755f_link_parse()
487 struct max96755f_bridge *ser = arg; in max96755f_bridge_lock_irq_handler() local
489 atomic_set(&ser->lock.triggered, 1); in max96755f_bridge_lock_irq_handler()
498 struct max96755f_bridge *ser; in max96755f_bridge_probe() local
501 ser = devm_kzalloc(dev, sizeof(*ser), GFP_KERNEL); in max96755f_bridge_probe()
502 if (!ser) in max96755f_bridge_probe()
505 ser->dev = dev; in max96755f_bridge_probe()
506 ser->parent = dev_get_drvdata(dev->parent); in max96755f_bridge_probe()
507 platform_set_drvdata(pdev, ser); in max96755f_bridge_probe()
509 ser->regmap = dev_get_regmap(dev->parent, NULL); in max96755f_bridge_probe()
510 if (!ser->regmap) in max96755f_bridge_probe()
513 ser->dsi_node = of_graph_get_remote_node(dev->of_node, 0, -1); in max96755f_bridge_probe()
514 if (!ser->dsi_node) { in max96755f_bridge_probe()
515 dev_err(ser->dev, "failed to get remote node for primary dsi\n"); in max96755f_bridge_probe()
519 ret = max96755f_link_parse(ser); in max96755f_bridge_probe()
523 ser->lock.gpio = devm_gpiod_get(dev, "lock", GPIOD_IN); in max96755f_bridge_probe()
524 if (IS_ERR(ser->lock.gpio)) in max96755f_bridge_probe()
525 return dev_err_probe(dev, PTR_ERR(ser->lock.gpio), in max96755f_bridge_probe()
528 ser->lock.irq = gpiod_to_irq(ser->lock.gpio); in max96755f_bridge_probe()
529 if (ser->lock.irq < 0) in max96755f_bridge_probe()
530 return ser->lock.irq; in max96755f_bridge_probe()
532 irq_set_status_flags(ser->lock.irq, IRQ_NOAUTOEN); in max96755f_bridge_probe()
533 ret = devm_request_threaded_irq(dev, ser->lock.irq, NULL, in max96755f_bridge_probe()
536 dev_name(dev), ser); in max96755f_bridge_probe()
540 ser->bridge_dual_link = of_property_read_bool(np, "bridge_dual_link"); in max96755f_bridge_probe()
542 ser->bridge.funcs = &max96755f_bridge_funcs; in max96755f_bridge_probe()
543 ser->bridge.of_node = dev->of_node; in max96755f_bridge_probe()
544 ser->bridge.ops = DRM_BRIDGE_OP_DETECT; in max96755f_bridge_probe()
545 ser->bridge.type = DRM_MODE_CONNECTOR_LVDS; in max96755f_bridge_probe()
547 drm_bridge_add(&ser->bridge); in max96755f_bridge_probe()
554 struct max96755f_bridge *ser = platform_get_drvdata(pdev); in max96755f_bridge_remove() local
556 drm_bridge_remove(&ser->bridge); in max96755f_bridge_remove()