Lines Matching refs:ps_bridge

158 static int _ps8640_wait_hpd_asserted(struct ps8640 *ps_bridge, unsigned long wait_us)  in _ps8640_wait_hpd_asserted()  argument
160 struct regmap *map = ps_bridge->regmap[PAGE2_TOP_CNTL]; in _ps8640_wait_hpd_asserted()
181 if (!ret && ps_bridge->need_post_hpd_delay) { in _ps8640_wait_hpd_asserted()
182 ps_bridge->need_post_hpd_delay = false; in _ps8640_wait_hpd_asserted()
191 struct ps8640 *ps_bridge = aux_to_ps8640(aux); in ps8640_wait_hpd_asserted() local
192 struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL]->dev; in ps8640_wait_hpd_asserted()
201 ret = _ps8640_wait_hpd_asserted(ps_bridge, wait_us); in ps8640_wait_hpd_asserted()
211 struct ps8640 *ps_bridge = aux_to_ps8640(aux); in ps8640_aux_transfer_msg() local
212 struct regmap *map = ps_bridge->regmap[PAGE0_DP_CNTL]; in ps8640_aux_transfer_msg()
213 struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL]->dev; in ps8640_aux_transfer_msg()
345 struct ps8640 *ps_bridge = aux_to_ps8640(aux); in ps8640_aux_transfer() local
346 struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL]->dev; in ps8640_aux_transfer()
349 mutex_lock(&ps_bridge->aux_lock); in ps8640_aux_transfer()
351 ret = _ps8640_wait_hpd_asserted(ps_bridge, 200 * 1000); in ps8640_aux_transfer()
361 mutex_unlock(&ps_bridge->aux_lock); in ps8640_aux_transfer()
366 static void ps8640_bridge_vdo_control(struct ps8640 *ps_bridge, in ps8640_bridge_vdo_control() argument
369 struct regmap *map = ps_bridge->regmap[PAGE3_DSI_CNTL1]; in ps8640_bridge_vdo_control()
370 struct device *dev = &ps_bridge->page[PAGE3_DSI_CNTL1]->dev; in ps8640_bridge_vdo_control()
384 struct ps8640 *ps_bridge = dev_get_drvdata(dev); in ps8640_resume() local
387 ret = regulator_bulk_enable(ARRAY_SIZE(ps_bridge->supplies), in ps8640_resume()
388 ps_bridge->supplies); in ps8640_resume()
394 gpiod_set_value(ps_bridge->gpio_powerdown, 0); in ps8640_resume()
395 gpiod_set_value(ps_bridge->gpio_reset, 1); in ps8640_resume()
397 gpiod_set_value(ps_bridge->gpio_reset, 0); in ps8640_resume()
400 gpiod_set_value(ps_bridge->gpio_reset, 1); in ps8640_resume()
402 gpiod_set_value(ps_bridge->gpio_reset, 0); in ps8640_resume()
405 ps_bridge->need_post_hpd_delay = true; in ps8640_resume()
421 struct ps8640 *ps_bridge = dev_get_drvdata(dev); in ps8640_suspend() local
424 gpiod_set_value(ps_bridge->gpio_reset, 1); in ps8640_suspend()
425 gpiod_set_value(ps_bridge->gpio_powerdown, 1); in ps8640_suspend()
426 ret = regulator_bulk_disable(ARRAY_SIZE(ps_bridge->supplies), in ps8640_suspend()
427 ps_bridge->supplies); in ps8640_suspend()
443 struct ps8640 *ps_bridge = bridge_to_ps8640(bridge); in ps8640_atomic_pre_enable() local
444 struct regmap *map = ps_bridge->regmap[PAGE2_TOP_CNTL]; in ps8640_atomic_pre_enable()
445 struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL]->dev; in ps8640_atomic_pre_enable()
449 ret = _ps8640_wait_hpd_asserted(ps_bridge, 200 * 1000); in ps8640_atomic_pre_enable()
470 ps8640_bridge_vdo_control(ps_bridge, ENABLE); in ps8640_atomic_pre_enable()
472 ps_bridge->pre_enabled = true; in ps8640_atomic_pre_enable()
478 struct ps8640 *ps_bridge = bridge_to_ps8640(bridge); in ps8640_atomic_post_disable() local
480 ps_bridge->pre_enabled = false; in ps8640_atomic_post_disable()
482 ps8640_bridge_vdo_control(ps_bridge, DISABLE); in ps8640_atomic_post_disable()
490 mutex_lock(&ps_bridge->aux_lock); in ps8640_atomic_post_disable()
492 pm_runtime_put_sync_suspend(&ps_bridge->page[PAGE0_DP_CNTL]->dev); in ps8640_atomic_post_disable()
494 mutex_unlock(&ps_bridge->aux_lock); in ps8640_atomic_post_disable()
500 struct ps8640 *ps_bridge = bridge_to_ps8640(bridge); in ps8640_bridge_attach() local
501 struct device *dev = &ps_bridge->page[0]->dev; in ps8640_bridge_attach()
507 ps_bridge->aux.drm_dev = bridge->dev; in ps8640_bridge_attach()
508 ret = drm_dp_aux_register(&ps_bridge->aux); in ps8640_bridge_attach()
514 ps_bridge->link = device_link_add(bridge->dev->dev, dev, DL_FLAG_STATELESS); in ps8640_bridge_attach()
515 if (!ps_bridge->link) { in ps8640_bridge_attach()
522 ret = drm_bridge_attach(bridge->encoder, ps_bridge->panel_bridge, in ps8640_bridge_attach()
523 &ps_bridge->bridge, flags); in ps8640_bridge_attach()
530 device_link_del(ps_bridge->link); in ps8640_bridge_attach()
532 drm_dp_aux_unregister(&ps_bridge->aux); in ps8640_bridge_attach()
539 struct ps8640 *ps_bridge = bridge_to_ps8640(bridge); in ps8640_bridge_detach() local
541 drm_dp_aux_unregister(&ps_bridge->aux); in ps8640_bridge_detach()
542 if (ps_bridge->link) in ps8640_bridge_detach()
543 device_link_del(ps_bridge->link); in ps8640_bridge_detach()
562 static int ps8640_bridge_get_dsi_resources(struct device *dev, struct ps8640 *ps_bridge) in ps8640_bridge_get_dsi_resources() argument
593 ps_bridge->dsi = dsi; in ps8640_bridge_get_dsi_resources()
606 struct ps8640 *ps_bridge = aux_to_ps8640(aux); in ps8640_bridge_link_panel() local
621 ps_bridge->panel_bridge = devm_drm_of_get_bridge(dev, np, 1, 0); in ps8640_bridge_link_panel()
622 if (IS_ERR(ps_bridge->panel_bridge)) in ps8640_bridge_link_panel()
623 return PTR_ERR(ps_bridge->panel_bridge); in ps8640_bridge_link_panel()
625 ret = devm_drm_bridge_add(dev, &ps_bridge->bridge); in ps8640_bridge_link_panel()
629 return devm_mipi_dsi_attach(dev, ps_bridge->dsi); in ps8640_bridge_link_panel()
635 struct ps8640 *ps_bridge; in ps8640_probe() local
639 ps_bridge = devm_kzalloc(dev, sizeof(*ps_bridge), GFP_KERNEL); in ps8640_probe()
640 if (!ps_bridge) in ps8640_probe()
643 mutex_init(&ps_bridge->aux_lock); in ps8640_probe()
645 ps_bridge->supplies[0].supply = "vdd12"; in ps8640_probe()
646 ps_bridge->supplies[1].supply = "vdd33"; in ps8640_probe()
647 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ps_bridge->supplies), in ps8640_probe()
648 ps_bridge->supplies); in ps8640_probe()
652 ps_bridge->gpio_powerdown = devm_gpiod_get(&client->dev, "powerdown", in ps8640_probe()
654 if (IS_ERR(ps_bridge->gpio_powerdown)) in ps8640_probe()
655 return PTR_ERR(ps_bridge->gpio_powerdown); in ps8640_probe()
660 ps_bridge->gpio_reset = devm_gpiod_get(&client->dev, "reset", in ps8640_probe()
662 if (IS_ERR(ps_bridge->gpio_reset)) in ps8640_probe()
663 return PTR_ERR(ps_bridge->gpio_reset); in ps8640_probe()
665 ps_bridge->bridge.funcs = &ps8640_bridge_funcs; in ps8640_probe()
666 ps_bridge->bridge.of_node = dev->of_node; in ps8640_probe()
667 ps_bridge->bridge.type = DRM_MODE_CONNECTOR_eDP; in ps8640_probe()
673 ret = ps8640_bridge_get_dsi_resources(&client->dev, ps_bridge); in ps8640_probe()
677 ps_bridge->page[PAGE0_DP_CNTL] = client; in ps8640_probe()
679 ps_bridge->regmap[PAGE0_DP_CNTL] = devm_regmap_init_i2c(client, ps8640_regmap_config); in ps8640_probe()
680 if (IS_ERR(ps_bridge->regmap[PAGE0_DP_CNTL])) in ps8640_probe()
681 return PTR_ERR(ps_bridge->regmap[PAGE0_DP_CNTL]); in ps8640_probe()
683 for (i = 1; i < ARRAY_SIZE(ps_bridge->page); i++) { in ps8640_probe()
684 ps_bridge->page[i] = devm_i2c_new_dummy_device(&client->dev, in ps8640_probe()
687 if (IS_ERR(ps_bridge->page[i])) in ps8640_probe()
688 return PTR_ERR(ps_bridge->page[i]); in ps8640_probe()
690 ps_bridge->regmap[i] = devm_regmap_init_i2c(ps_bridge->page[i], in ps8640_probe()
692 if (IS_ERR(ps_bridge->regmap[i])) in ps8640_probe()
693 return PTR_ERR(ps_bridge->regmap[i]); in ps8640_probe()
696 i2c_set_clientdata(client, ps_bridge); in ps8640_probe()
698 ps_bridge->aux.name = "parade-ps8640-aux"; in ps8640_probe()
699 ps_bridge->aux.dev = dev; in ps8640_probe()
700 ps_bridge->aux.transfer = ps8640_aux_transfer; in ps8640_probe()
701 ps_bridge->aux.wait_hpd_asserted = ps8640_wait_hpd_asserted; in ps8640_probe()
702 drm_dp_aux_init(&ps_bridge->aux); in ps8640_probe()
720 ret = devm_of_dp_aux_populate_bus(&ps_bridge->aux, ps8640_bridge_link_panel); in ps8640_probe()
728 return ps8640_bridge_link_panel(&ps_bridge->aux); in ps8640_probe()