Lines Matching +full:vcc +full:- +full:dsi +full:- +full:supply
1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2018-2019, Bridge Systems BV
4 * Copyright (C) 2018-2019, Bootlin
7 * This file based on panel-ilitek-ili9881c.c
15 #include <linux/media-bus-format.h>
29 struct mipi_dsi_device *dsi; member
30 struct regulator *supply; member
50 ret = regulator_enable(ctx->supply); in rb070d30_panel_prepare()
52 dev_err(&ctx->dsi->dev, "Failed to enable supply: %d\n", ret); in rb070d30_panel_prepare()
57 gpiod_set_value(ctx->gpios.power, 1); in rb070d30_panel_prepare()
59 gpiod_set_value(ctx->gpios.reset, 1); in rb070d30_panel_prepare()
68 gpiod_set_value(ctx->gpios.reset, 0); in rb070d30_panel_unprepare()
69 gpiod_set_value(ctx->gpios.power, 0); in rb070d30_panel_unprepare()
70 regulator_disable(ctx->supply); in rb070d30_panel_unprepare()
79 return mipi_dsi_dcs_exit_sleep_mode(ctx->dsi); in rb070d30_panel_enable()
86 return mipi_dsi_dcs_enter_sleep_mode(ctx->dsi); in rb070d30_panel_disable()
112 mode = drm_mode_duplicate(connector->dev, &default_mode); in rb070d30_panel_get_modes()
114 dev_err(&ctx->dsi->dev, "Failed to add mode " DRM_MODE_FMT "\n", in rb070d30_panel_get_modes()
116 return -EINVAL; in rb070d30_panel_get_modes()
121 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in rb070d30_panel_get_modes()
124 connector->display_info.bpc = 8; in rb070d30_panel_get_modes()
125 connector->display_info.width_mm = mode->width_mm; in rb070d30_panel_get_modes()
126 connector->display_info.height_mm = mode->height_mm; in rb070d30_panel_get_modes()
127 drm_display_info_set_bus_formats(&connector->display_info, in rb070d30_panel_get_modes()
141 static int rb070d30_panel_dsi_probe(struct mipi_dsi_device *dsi) in rb070d30_panel_dsi_probe() argument
146 ctx = devm_kzalloc(&dsi->dev, sizeof(*ctx), GFP_KERNEL); in rb070d30_panel_dsi_probe()
148 return -ENOMEM; in rb070d30_panel_dsi_probe()
150 ctx->supply = devm_regulator_get(&dsi->dev, "vcc-lcd"); in rb070d30_panel_dsi_probe()
151 if (IS_ERR(ctx->supply)) in rb070d30_panel_dsi_probe()
152 return PTR_ERR(ctx->supply); in rb070d30_panel_dsi_probe()
154 mipi_dsi_set_drvdata(dsi, ctx); in rb070d30_panel_dsi_probe()
155 ctx->dsi = dsi; in rb070d30_panel_dsi_probe()
157 drm_panel_init(&ctx->panel, &dsi->dev, &rb070d30_panel_funcs, in rb070d30_panel_dsi_probe()
160 ctx->gpios.reset = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW); in rb070d30_panel_dsi_probe()
161 if (IS_ERR(ctx->gpios.reset)) { in rb070d30_panel_dsi_probe()
162 dev_err(&dsi->dev, "Couldn't get our reset GPIO\n"); in rb070d30_panel_dsi_probe()
163 return PTR_ERR(ctx->gpios.reset); in rb070d30_panel_dsi_probe()
166 ctx->gpios.power = devm_gpiod_get(&dsi->dev, "power", GPIOD_OUT_LOW); in rb070d30_panel_dsi_probe()
167 if (IS_ERR(ctx->gpios.power)) { in rb070d30_panel_dsi_probe()
168 dev_err(&dsi->dev, "Couldn't get our power GPIO\n"); in rb070d30_panel_dsi_probe()
169 return PTR_ERR(ctx->gpios.power); in rb070d30_panel_dsi_probe()
176 ctx->gpios.updn = devm_gpiod_get(&dsi->dev, "updn", GPIOD_OUT_LOW); in rb070d30_panel_dsi_probe()
177 if (IS_ERR(ctx->gpios.updn)) { in rb070d30_panel_dsi_probe()
178 dev_err(&dsi->dev, "Couldn't get our updn GPIO\n"); in rb070d30_panel_dsi_probe()
179 return PTR_ERR(ctx->gpios.updn); in rb070d30_panel_dsi_probe()
186 ctx->gpios.shlr = devm_gpiod_get(&dsi->dev, "shlr", GPIOD_OUT_LOW); in rb070d30_panel_dsi_probe()
187 if (IS_ERR(ctx->gpios.shlr)) { in rb070d30_panel_dsi_probe()
188 dev_err(&dsi->dev, "Couldn't get our shlr GPIO\n"); in rb070d30_panel_dsi_probe()
189 return PTR_ERR(ctx->gpios.shlr); in rb070d30_panel_dsi_probe()
192 ret = drm_panel_of_backlight(&ctx->panel); in rb070d30_panel_dsi_probe()
196 drm_panel_add(&ctx->panel); in rb070d30_panel_dsi_probe()
198 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_LPM; in rb070d30_panel_dsi_probe()
199 dsi->format = MIPI_DSI_FMT_RGB888; in rb070d30_panel_dsi_probe()
200 dsi->lanes = 4; in rb070d30_panel_dsi_probe()
202 ret = mipi_dsi_attach(dsi); in rb070d30_panel_dsi_probe()
204 drm_panel_remove(&ctx->panel); in rb070d30_panel_dsi_probe()
211 static void rb070d30_panel_dsi_remove(struct mipi_dsi_device *dsi) in rb070d30_panel_dsi_remove() argument
213 struct rb070d30_panel *ctx = mipi_dsi_get_drvdata(dsi); in rb070d30_panel_dsi_remove()
215 mipi_dsi_detach(dsi); in rb070d30_panel_dsi_remove()
216 drm_panel_remove(&ctx->panel); in rb070d30_panel_dsi_remove()
229 .name = "panel-ronbo-rb070d30",