Lines Matching refs:dlpc

55 struct dlpc {  struct
70 static inline struct dlpc *bridge_to_dlpc(struct drm_bridge *bridge) in bridge_to_dlpc() argument
72 return container_of(bridge, struct dlpc, bridge); in bridge_to_dlpc()
110 struct dlpc *dlpc = bridge_to_dlpc(bridge); in dlpc_atomic_enable() local
111 struct device *dev = dlpc->dev; in dlpc_atomic_enable()
112 struct drm_display_mode *mode = &dlpc->mode; in dlpc_atomic_enable()
113 struct regmap *regmap = dlpc->regmap; in dlpc_atomic_enable()
175 struct dlpc *dlpc = bridge_to_dlpc(bridge); in dlpc_atomic_pre_enable() local
178 gpiod_set_value(dlpc->enable_gpio, 1); in dlpc_atomic_pre_enable()
182 ret = regulator_enable(dlpc->vcc_intf); in dlpc_atomic_pre_enable()
184 DRM_DEV_ERROR(dlpc->dev, in dlpc_atomic_pre_enable()
187 ret = regulator_enable(dlpc->vcc_flsh); in dlpc_atomic_pre_enable()
189 DRM_DEV_ERROR(dlpc->dev, in dlpc_atomic_pre_enable()
198 struct dlpc *dlpc = bridge_to_dlpc(bridge); in dlpc_atomic_post_disable() local
200 regulator_disable(dlpc->vcc_flsh); in dlpc_atomic_post_disable()
201 regulator_disable(dlpc->vcc_intf); in dlpc_atomic_post_disable()
205 gpiod_set_value(dlpc->enable_gpio, 0); in dlpc_atomic_post_disable()
240 struct dlpc *dlpc = bridge_to_dlpc(bridge); in dlpc_mode_set() local
242 drm_mode_copy(&dlpc->mode, adjusted_mode); in dlpc_mode_set()
248 struct dlpc *dlpc = bridge_to_dlpc(bridge); in dlpc_attach() local
250 return drm_bridge_attach(bridge->encoder, dlpc->next_bridge, bridge, flags); in dlpc_attach()
265 static int dlpc3433_parse_dt(struct dlpc *dlpc) in dlpc3433_parse_dt() argument
267 struct device *dev = dlpc->dev; in dlpc3433_parse_dt()
271 dlpc->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); in dlpc3433_parse_dt()
272 if (IS_ERR(dlpc->enable_gpio)) in dlpc3433_parse_dt()
273 return PTR_ERR(dlpc->enable_gpio); in dlpc3433_parse_dt()
275 dlpc->vcc_intf = devm_regulator_get(dlpc->dev, "vcc_intf"); in dlpc3433_parse_dt()
276 if (IS_ERR(dlpc->vcc_intf)) in dlpc3433_parse_dt()
277 return dev_err_probe(dev, PTR_ERR(dlpc->vcc_intf), in dlpc3433_parse_dt()
280 dlpc->vcc_flsh = devm_regulator_get(dlpc->dev, "vcc_flsh"); in dlpc3433_parse_dt()
281 if (IS_ERR(dlpc->vcc_flsh)) in dlpc3433_parse_dt()
282 return dev_err_probe(dev, PTR_ERR(dlpc->vcc_flsh), in dlpc3433_parse_dt()
285 dlpc->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0); in dlpc3433_parse_dt()
286 if (IS_ERR(dlpc->next_bridge)) in dlpc3433_parse_dt()
287 return PTR_ERR(dlpc->next_bridge); in dlpc3433_parse_dt()
290 dlpc->dsi_lanes = of_property_count_u32_elems(endpoint, "data-lanes"); in dlpc3433_parse_dt()
291 if (dlpc->dsi_lanes < 0 || dlpc->dsi_lanes > 4) { in dlpc3433_parse_dt()
296 dlpc->host_node = of_graph_get_remote_port_parent(endpoint); in dlpc3433_parse_dt()
297 if (!dlpc->host_node) { in dlpc3433_parse_dt()
307 of_node_put(dlpc->host_node); in dlpc3433_parse_dt()
313 static int dlpc_host_attach(struct dlpc *dlpc) in dlpc_host_attach() argument
315 struct device *dev = dlpc->dev; in dlpc_host_attach()
323 host = of_find_mipi_dsi_host_by_node(dlpc->host_node); in dlpc_host_attach()
329 dlpc->dsi = mipi_dsi_device_register_full(host, &info); in dlpc_host_attach()
330 if (IS_ERR(dlpc->dsi)) { in dlpc_host_attach()
332 return PTR_ERR(dlpc->dsi); in dlpc_host_attach()
335 dlpc->dsi->mode_flags = MIPI_DSI_MODE_VIDEO_BURST; in dlpc_host_attach()
336 dlpc->dsi->format = MIPI_DSI_FMT_RGB565; in dlpc_host_attach()
337 dlpc->dsi->lanes = dlpc->dsi_lanes; in dlpc_host_attach()
339 return devm_mipi_dsi_attach(dev, dlpc->dsi); in dlpc_host_attach()
345 struct dlpc *dlpc; in dlpc3433_probe() local
348 dlpc = devm_kzalloc(dev, sizeof(*dlpc), GFP_KERNEL); in dlpc3433_probe()
349 if (!dlpc) in dlpc3433_probe()
352 dlpc->dev = dev; in dlpc3433_probe()
354 dlpc->regmap = devm_regmap_init_i2c(client, &dlpc_regmap_config); in dlpc3433_probe()
355 if (IS_ERR(dlpc->regmap)) in dlpc3433_probe()
356 return PTR_ERR(dlpc->regmap); in dlpc3433_probe()
358 ret = dlpc3433_parse_dt(dlpc); in dlpc3433_probe()
362 dev_set_drvdata(dev, dlpc); in dlpc3433_probe()
363 i2c_set_clientdata(client, dlpc); in dlpc3433_probe()
365 dlpc->bridge.funcs = &dlpc_bridge_funcs; in dlpc3433_probe()
366 dlpc->bridge.of_node = dev->of_node; in dlpc3433_probe()
367 drm_bridge_add(&dlpc->bridge); in dlpc3433_probe()
369 ret = dlpc_host_attach(dlpc); in dlpc3433_probe()
378 drm_bridge_remove(&dlpc->bridge); in dlpc3433_probe()
384 struct dlpc *dlpc = i2c_get_clientdata(client); in dlpc3433_remove() local
386 drm_bridge_remove(&dlpc->bridge); in dlpc3433_remove()
387 of_node_put(dlpc->host_node); in dlpc3433_remove()