Lines Matching refs:ps_bridge
173 static int _ps8640_wait_hpd_asserted(struct ps8640 *ps_bridge, unsigned long wait_us) in _ps8640_wait_hpd_asserted() argument
175 struct regmap *map = ps_bridge->regmap[PAGE2_TOP_CNTL]; in _ps8640_wait_hpd_asserted()
196 if (!ret && ps_bridge->need_post_hpd_delay) { in _ps8640_wait_hpd_asserted()
197 ps_bridge->need_post_hpd_delay = false; in _ps8640_wait_hpd_asserted()
206 struct ps8640 *ps_bridge = aux_to_ps8640(aux); in ps8640_wait_hpd_asserted() local
207 struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL]->dev; in ps8640_wait_hpd_asserted()
216 ret = _ps8640_wait_hpd_asserted(ps_bridge, wait_us); in ps8640_wait_hpd_asserted()
226 struct ps8640 *ps_bridge = aux_to_ps8640(aux); in ps8640_aux_transfer_msg() local
227 struct regmap *map = ps_bridge->regmap[PAGE0_DP_CNTL]; in ps8640_aux_transfer_msg()
228 struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL]->dev; in ps8640_aux_transfer_msg()
352 struct ps8640 *ps_bridge = aux_to_ps8640(aux); in ps8640_aux_transfer() local
353 struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL]->dev; in ps8640_aux_transfer()
364 static void ps8640_bridge_vdo_control(struct ps8640 *ps_bridge, in ps8640_bridge_vdo_control() argument
367 struct regmap *map = ps_bridge->regmap[PAGE3_DSI_CNTL1]; in ps8640_bridge_vdo_control()
368 struct device *dev = &ps_bridge->page[PAGE3_DSI_CNTL1]->dev; in ps8640_bridge_vdo_control()
382 struct ps8640 *ps_bridge = dev_get_drvdata(dev); in ps8640_resume() local
385 ret = regulator_bulk_enable(ARRAY_SIZE(ps_bridge->supplies), in ps8640_resume()
386 ps_bridge->supplies); in ps8640_resume()
392 gpiod_set_value(ps_bridge->gpio_powerdown, 0); in ps8640_resume()
393 gpiod_set_value(ps_bridge->gpio_reset, 1); in ps8640_resume()
395 gpiod_set_value(ps_bridge->gpio_reset, 0); in ps8640_resume()
398 gpiod_set_value(ps_bridge->gpio_reset, 1); in ps8640_resume()
400 gpiod_set_value(ps_bridge->gpio_reset, 0); in ps8640_resume()
403 ps_bridge->need_post_hpd_delay = true; in ps8640_resume()
419 struct ps8640 *ps_bridge = dev_get_drvdata(dev); in ps8640_suspend() local
422 gpiod_set_value(ps_bridge->gpio_reset, 1); in ps8640_suspend()
423 gpiod_set_value(ps_bridge->gpio_powerdown, 1); in ps8640_suspend()
424 ret = regulator_bulk_disable(ARRAY_SIZE(ps_bridge->supplies), in ps8640_suspend()
425 ps_bridge->supplies); in ps8640_suspend()
440 struct ps8640 *ps_bridge = bridge_to_ps8640(bridge); in ps8640_pre_enable() local
441 struct regmap *map = ps_bridge->regmap[PAGE2_TOP_CNTL]; in ps8640_pre_enable()
442 struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL]->dev; in ps8640_pre_enable()
446 ret = _ps8640_wait_hpd_asserted(ps_bridge, 200 * 1000); in ps8640_pre_enable()
467 ps8640_bridge_vdo_control(ps_bridge, ENABLE); in ps8640_pre_enable()
469 ps_bridge->pre_enabled = true; in ps8640_pre_enable()
474 struct ps8640 *ps_bridge = bridge_to_ps8640(bridge); in ps8640_post_disable() local
476 ps_bridge->pre_enabled = false; in ps8640_post_disable()
478 ps8640_bridge_vdo_control(ps_bridge, DISABLE); in ps8640_post_disable()
479 pm_runtime_put_sync_suspend(&ps_bridge->page[PAGE0_DP_CNTL]->dev); in ps8640_post_disable()
485 struct ps8640 *ps_bridge = bridge_to_ps8640(bridge); in ps8640_bridge_attach() local
486 struct device *dev = &ps_bridge->page[0]->dev; in ps8640_bridge_attach()
492 ps_bridge->aux.drm_dev = bridge->dev; in ps8640_bridge_attach()
493 ret = drm_dp_aux_register(&ps_bridge->aux); in ps8640_bridge_attach()
499 ps_bridge->link = device_link_add(bridge->dev->dev, dev, DL_FLAG_STATELESS); in ps8640_bridge_attach()
500 if (!ps_bridge->link) { in ps8640_bridge_attach()
507 ret = drm_bridge_attach(bridge->encoder, ps_bridge->panel_bridge, in ps8640_bridge_attach()
508 &ps_bridge->bridge, flags); in ps8640_bridge_attach()
515 device_link_del(ps_bridge->link); in ps8640_bridge_attach()
517 drm_dp_aux_unregister(&ps_bridge->aux); in ps8640_bridge_attach()
524 struct ps8640 *ps_bridge = bridge_to_ps8640(bridge); in ps8640_bridge_detach() local
526 drm_dp_aux_unregister(&ps_bridge->aux); in ps8640_bridge_detach()
527 if (ps_bridge->link) in ps8640_bridge_detach()
528 device_link_del(ps_bridge->link); in ps8640_bridge_detach()
534 struct ps8640 *ps_bridge = bridge_to_ps8640(bridge); in ps8640_bridge_get_edid() local
535 bool poweroff = !ps_bridge->pre_enabled; in ps8640_bridge_get_edid()
553 ps_bridge->page[PAGE0_DP_CNTL]->adapter); in ps8640_bridge_get_edid()
579 static int ps8640_bridge_get_dsi_resources(struct device *dev, struct ps8640 *ps_bridge) in ps8640_bridge_get_dsi_resources() argument
610 ps_bridge->dsi = dsi; in ps8640_bridge_get_dsi_resources()
623 struct ps8640 *ps_bridge = aux_to_ps8640(aux); in ps8640_bridge_link_panel() local
638 ps_bridge->panel_bridge = devm_drm_of_get_bridge(dev, np, 1, 0); in ps8640_bridge_link_panel()
639 if (IS_ERR(ps_bridge->panel_bridge)) in ps8640_bridge_link_panel()
640 return PTR_ERR(ps_bridge->panel_bridge); in ps8640_bridge_link_panel()
642 ret = devm_drm_bridge_add(dev, &ps_bridge->bridge); in ps8640_bridge_link_panel()
646 return devm_mipi_dsi_attach(dev, ps_bridge->dsi); in ps8640_bridge_link_panel()
652 struct ps8640 *ps_bridge; in ps8640_probe() local
656 ps_bridge = devm_kzalloc(dev, sizeof(*ps_bridge), GFP_KERNEL); in ps8640_probe()
657 if (!ps_bridge) in ps8640_probe()
660 ps_bridge->supplies[0].supply = "vdd12"; in ps8640_probe()
661 ps_bridge->supplies[1].supply = "vdd33"; in ps8640_probe()
662 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ps_bridge->supplies), in ps8640_probe()
663 ps_bridge->supplies); in ps8640_probe()
667 ps_bridge->gpio_powerdown = devm_gpiod_get(&client->dev, "powerdown", in ps8640_probe()
669 if (IS_ERR(ps_bridge->gpio_powerdown)) in ps8640_probe()
670 return PTR_ERR(ps_bridge->gpio_powerdown); in ps8640_probe()
675 ps_bridge->gpio_reset = devm_gpiod_get(&client->dev, "reset", in ps8640_probe()
677 if (IS_ERR(ps_bridge->gpio_reset)) in ps8640_probe()
678 return PTR_ERR(ps_bridge->gpio_reset); in ps8640_probe()
680 ps_bridge->bridge.funcs = &ps8640_bridge_funcs; in ps8640_probe()
681 ps_bridge->bridge.of_node = dev->of_node; in ps8640_probe()
682 ps_bridge->bridge.type = DRM_MODE_CONNECTOR_eDP; in ps8640_probe()
690 ps_bridge->bridge.ops = DRM_BRIDGE_OP_EDID; in ps8640_probe()
696 ret = ps8640_bridge_get_dsi_resources(&client->dev, ps_bridge); in ps8640_probe()
700 ps_bridge->page[PAGE0_DP_CNTL] = client; in ps8640_probe()
702 ps_bridge->regmap[PAGE0_DP_CNTL] = devm_regmap_init_i2c(client, ps8640_regmap_config); in ps8640_probe()
703 if (IS_ERR(ps_bridge->regmap[PAGE0_DP_CNTL])) in ps8640_probe()
704 return PTR_ERR(ps_bridge->regmap[PAGE0_DP_CNTL]); in ps8640_probe()
706 for (i = 1; i < ARRAY_SIZE(ps_bridge->page); i++) { in ps8640_probe()
707 ps_bridge->page[i] = devm_i2c_new_dummy_device(&client->dev, in ps8640_probe()
710 if (IS_ERR(ps_bridge->page[i])) in ps8640_probe()
711 return PTR_ERR(ps_bridge->page[i]); in ps8640_probe()
713 ps_bridge->regmap[i] = devm_regmap_init_i2c(ps_bridge->page[i], in ps8640_probe()
715 if (IS_ERR(ps_bridge->regmap[i])) in ps8640_probe()
716 return PTR_ERR(ps_bridge->regmap[i]); in ps8640_probe()
719 i2c_set_clientdata(client, ps_bridge); in ps8640_probe()
721 ps_bridge->aux.name = "parade-ps8640-aux"; in ps8640_probe()
722 ps_bridge->aux.dev = dev; in ps8640_probe()
723 ps_bridge->aux.transfer = ps8640_aux_transfer; in ps8640_probe()
724 ps_bridge->aux.wait_hpd_asserted = ps8640_wait_hpd_asserted; in ps8640_probe()
725 drm_dp_aux_init(&ps_bridge->aux); in ps8640_probe()
743 ret = devm_of_dp_aux_populate_bus(&ps_bridge->aux, ps8640_bridge_link_panel); in ps8640_probe()
751 return ps8640_bridge_link_panel(&ps_bridge->aux); in ps8640_probe()