Lines Matching +full:panel +full:- +full:width +full:- +full:mm
1 // SPDX-License-Identifier: GPL-2.0
3 * Panel driver for the TPO TPG110 400CH LTPS TFT LCD Single Chip
7 * display is actually connected to it, so the width and height of that
41 * struct tpg110_panel_mode - lookup struct for the supported modes
45 * @name: the name of this panel
53 * @mode: the DRM display mode for this panel
57 * @bus_flags: the DRM bus flags for this panel e.g. inverted clock
63 * struct tpg110 - state container for the TPG110 panel
75 * @panel: the DRM panel instance for this device
77 struct drm_panel panel; member
79 * @panel_mode: the panel mode as detected
83 * @width: the width of this panel in mm
85 u32 width; member
87 * @height: the height of this panel in mm
184 to_tpg110(struct drm_panel *panel) in to_tpg110() argument
186 return container_of(panel, struct tpg110, panel); in to_tpg110()
223 * The last bit/clock is Hi-Z turnaround cycle, so we need in tpg110_readwrite_reg()
225 * turn-around cycle. in tpg110_readwrite_reg()
238 ret = spi_sync(tpg->spi, &m); in tpg110_readwrite_reg()
240 dev_err(tpg->dev, "SPI message error %d\n", ret); in tpg110_readwrite_reg()
264 /* De-assert the reset signal */ in tpg110_startup()
265 gpiod_set_value_cansleep(tpg->grestb, 0); in tpg110_startup()
267 dev_dbg(tpg->dev, "de-asserted GRESTB\n"); in tpg110_startup()
273 dev_err(tpg->dev, "failed communication test\n"); in tpg110_startup()
274 return -ENODEV; in tpg110_startup()
278 dev_info(tpg->dev, "TPG110 chip ID: %d version: %d\n", in tpg110_startup()
286 dev_info(tpg->dev, "IN 400x240 RGB -> OUT 800x480 RGB (dual scan)\n"); in tpg110_startup()
289 dev_info(tpg->dev, "IN 480x272 RGB -> OUT 800x480 RGB (dual scan)\n"); in tpg110_startup()
292 dev_info(tpg->dev, "480x640 RGB\n"); in tpg110_startup()
295 dev_info(tpg->dev, "480x272 RGB\n"); in tpg110_startup()
298 dev_info(tpg->dev, "640x480 RGB\n"); in tpg110_startup()
301 dev_info(tpg->dev, "800x480 RGB\n"); in tpg110_startup()
304 dev_err(tpg->dev, "ILLEGAL RESOLUTION 0x%02x\n", val); in tpg110_startup()
316 if (pm->magic == val) { in tpg110_startup()
317 tpg->panel_mode = pm; in tpg110_startup()
322 dev_err(tpg->dev, "unsupported mode (%02x) detected\n", val); in tpg110_startup()
323 return -ENODEV; in tpg110_startup()
327 dev_info(tpg->dev, "resolution and standby is controlled by %s\n", in tpg110_startup()
336 static int tpg110_disable(struct drm_panel *panel) in tpg110_disable() argument
338 struct tpg110 *tpg = to_tpg110(panel); in tpg110_disable()
349 static int tpg110_enable(struct drm_panel *panel) in tpg110_enable() argument
351 struct tpg110 *tpg = to_tpg110(panel); in tpg110_enable()
363 * tpg110_get_modes() - return the appropriate mode
364 * @panel: the panel to get the mode for
371 static int tpg110_get_modes(struct drm_panel *panel, in tpg110_get_modes() argument
374 struct tpg110 *tpg = to_tpg110(panel); in tpg110_get_modes()
377 connector->display_info.width_mm = tpg->width; in tpg110_get_modes()
378 connector->display_info.height_mm = tpg->height; in tpg110_get_modes()
379 connector->display_info.bus_flags = tpg->panel_mode->bus_flags; in tpg110_get_modes()
381 mode = drm_mode_duplicate(connector->dev, &tpg->panel_mode->mode); in tpg110_get_modes()
383 return -ENOMEM; in tpg110_get_modes()
385 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in tpg110_get_modes()
387 mode->width_mm = tpg->width; in tpg110_get_modes()
388 mode->height_mm = tpg->height; in tpg110_get_modes()
403 struct device *dev = &spi->dev; in tpg110_probe()
404 struct device_node *np = dev->of_node; in tpg110_probe()
410 return -ENOMEM; in tpg110_probe()
411 tpg->dev = dev; in tpg110_probe()
414 ret = of_property_read_u32(np, "width-mm", &tpg->width); in tpg110_probe()
416 dev_err(dev, "no panel width specified\n"); in tpg110_probe()
417 ret = of_property_read_u32(np, "height-mm", &tpg->height); in tpg110_probe()
419 dev_err(dev, "no panel height specified\n"); in tpg110_probe()
422 tpg->grestb = devm_gpiod_get(dev, "grestb", GPIOD_OUT_HIGH); in tpg110_probe()
423 if (IS_ERR(tpg->grestb)) { in tpg110_probe()
425 return -ENODEV; in tpg110_probe()
428 spi->bits_per_word = 8; in tpg110_probe()
429 spi->mode |= SPI_3WIRE_HIZ; in tpg110_probe()
435 tpg->spi = spi; in tpg110_probe()
441 drm_panel_init(&tpg->panel, dev, &tpg110_drm_funcs, in tpg110_probe()
444 ret = drm_panel_of_backlight(&tpg->panel); in tpg110_probe()
450 drm_panel_add(&tpg->panel); in tpg110_probe()
459 drm_panel_remove(&tpg->panel); in tpg110_remove()
479 .name = "tpo-tpg110-panel",
486 MODULE_DESCRIPTION("TPO TPG110 panel driver");