Lines Matching refs:tpg

189 static u8 tpg110_readwrite_reg(struct tpg110 *tpg, bool write,  in tpg110_readwrite_reg()  argument
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()
249 static u8 tpg110_read_reg(struct tpg110 *tpg, u8 address) in tpg110_read_reg() argument
251 return tpg110_readwrite_reg(tpg, false, address, 0); in tpg110_read_reg()
254 static void tpg110_write_reg(struct tpg110 *tpg, u8 address, u8 outval) in tpg110_write_reg() argument
256 tpg110_readwrite_reg(tpg, true, address, outval); in tpg110_write_reg()
259 static int tpg110_startup(struct tpg110 *tpg) in tpg110_startup() argument
265 gpiod_set_value_cansleep(tpg->grestb, 0); in tpg110_startup()
267 dev_dbg(tpg->dev, "de-asserted GRESTB\n"); in tpg110_startup()
270 tpg110_write_reg(tpg, TPG110_TEST, 0x55); in tpg110_startup()
271 val = tpg110_read_reg(tpg, TPG110_TEST); in tpg110_startup()
273 dev_err(tpg->dev, "failed communication test\n"); in tpg110_startup()
277 val = tpg110_read_reg(tpg, TPG110_CHIPID); in tpg110_startup()
278 dev_info(tpg->dev, "TPG110 chip ID: %d version: %d\n", in tpg110_startup()
282 val = tpg110_read_reg(tpg, TPG110_CTRL1); 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()
317 tpg->panel_mode = pm; in tpg110_startup()
322 dev_err(tpg->dev, "unsupported mode (%02x) detected\n", val); in tpg110_startup()
326 val = tpg110_read_reg(tpg, TPG110_CTRL2); in tpg110_startup()
327 dev_info(tpg->dev, "resolution and standby is controlled by %s\n", in tpg110_startup()
331 tpg110_write_reg(tpg, TPG110_CTRL2, val); in tpg110_startup()
338 struct tpg110 *tpg = to_tpg110(panel); in tpg110_disable() local
342 val = tpg110_read_reg(tpg, TPG110_CTRL2_PM); in tpg110_disable()
344 tpg110_write_reg(tpg, TPG110_CTRL2_PM, val); in tpg110_disable()
351 struct tpg110 *tpg = to_tpg110(panel); in tpg110_enable() local
355 val = tpg110_read_reg(tpg, TPG110_CTRL2_PM); in tpg110_enable()
357 tpg110_write_reg(tpg, TPG110_CTRL2_PM, val); in tpg110_enable()
374 struct tpg110 *tpg = to_tpg110(panel); in tpg110_get_modes() local
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()
385 mode->width_mm = tpg->width; in tpg110_get_modes()
386 mode->height_mm = tpg->height; in tpg110_get_modes()
403 struct tpg110 *tpg; in tpg110_probe() local
406 tpg = devm_kzalloc(dev, sizeof(*tpg), GFP_KERNEL); in tpg110_probe()
407 if (!tpg) in tpg110_probe()
409 tpg->dev = dev; in tpg110_probe()
412 ret = of_property_read_u32(np, "width-mm", &tpg->width); in tpg110_probe()
415 ret = of_property_read_u32(np, "height-mm", &tpg->height); in tpg110_probe()
420 tpg->grestb = devm_gpiod_get(dev, "grestb", GPIOD_OUT_HIGH); in tpg110_probe()
421 if (IS_ERR(tpg->grestb)) { in tpg110_probe()
433 tpg->spi = spi; in tpg110_probe()
435 ret = tpg110_startup(tpg); in tpg110_probe()
439 drm_panel_init(&tpg->panel, dev, &tpg110_drm_funcs, in tpg110_probe()
442 ret = drm_panel_of_backlight(&tpg->panel); in tpg110_probe()
446 spi_set_drvdata(spi, tpg); in tpg110_probe()
448 drm_panel_add(&tpg->panel); in tpg110_probe()
455 struct tpg110 *tpg = spi_get_drvdata(spi); in tpg110_remove() local
457 drm_panel_remove(&tpg->panel); in tpg110_remove()