Lines Matching defs:tpg

189 static u8 tpg110_readwrite_reg(struct tpg110 *tpg, bool write,
238 ret = spi_sync(tpg->spi, &m);
240 dev_err(tpg->dev, "SPI message error %d\n", ret);
249 static u8 tpg110_read_reg(struct tpg110 *tpg, u8 address)
251 return tpg110_readwrite_reg(tpg, false, address, 0);
254 static void tpg110_write_reg(struct tpg110 *tpg, u8 address, u8 outval)
256 tpg110_readwrite_reg(tpg, true, address, outval);
259 static int tpg110_startup(struct tpg110 *tpg)
265 gpiod_set_value_cansleep(tpg->grestb, 0);
267 dev_dbg(tpg->dev, "de-asserted GRESTB\n");
270 tpg110_write_reg(tpg, TPG110_TEST, 0x55);
271 val = tpg110_read_reg(tpg, TPG110_TEST);
273 dev_err(tpg->dev, "failed communication test\n");
277 val = tpg110_read_reg(tpg, TPG110_CHIPID);
278 dev_info(tpg->dev, "TPG110 chip ID: %d version: %d\n",
282 val = tpg110_read_reg(tpg, TPG110_CTRL1);
286 dev_info(tpg->dev, "IN 400x240 RGB -> OUT 800x480 RGB (dual scan)\n");
289 dev_info(tpg->dev, "IN 480x272 RGB -> OUT 800x480 RGB (dual scan)\n");
292 dev_info(tpg->dev, "480x640 RGB\n");
295 dev_info(tpg->dev, "480x272 RGB\n");
298 dev_info(tpg->dev, "640x480 RGB\n");
301 dev_info(tpg->dev, "800x480 RGB\n");
304 dev_err(tpg->dev, "ILLEGAL RESOLUTION 0x%02x\n", val);
317 tpg->panel_mode = pm;
322 dev_err(tpg->dev, "unsupported mode (%02x) detected\n", val);
326 val = tpg110_read_reg(tpg, TPG110_CTRL2);
327 dev_info(tpg->dev, "resolution and standby is controlled by %s\n",
331 tpg110_write_reg(tpg, TPG110_CTRL2, val);
338 struct tpg110 *tpg = to_tpg110(panel);
342 val = tpg110_read_reg(tpg, TPG110_CTRL2_PM);
344 tpg110_write_reg(tpg, TPG110_CTRL2_PM, val);
351 struct tpg110 *tpg = to_tpg110(panel);
355 val = tpg110_read_reg(tpg, TPG110_CTRL2_PM);
357 tpg110_write_reg(tpg, TPG110_CTRL2_PM, val);
374 struct tpg110 *tpg = to_tpg110(panel);
377 connector->display_info.width_mm = tpg->width;
378 connector->display_info.height_mm = tpg->height;
379 connector->display_info.bus_flags = tpg->panel_mode->bus_flags;
381 mode = drm_mode_duplicate(connector->dev, &tpg->panel_mode->mode);
387 mode->width_mm = tpg->width;
388 mode->height_mm = tpg->height;
405 struct tpg110 *tpg;
408 tpg = devm_kzalloc(dev, sizeof(*tpg), GFP_KERNEL);
409 if (!tpg)
411 tpg->dev = dev;
414 ret = of_property_read_u32(np, "width-mm", &tpg->width);
417 ret = of_property_read_u32(np, "height-mm", &tpg->height);
422 tpg->grestb = devm_gpiod_get(dev, "grestb", GPIOD_OUT_HIGH);
423 if (IS_ERR(tpg->grestb)) {
435 tpg->spi = spi;
437 ret = tpg110_startup(tpg);
441 drm_panel_init(&tpg->panel, dev, &tpg110_drm_funcs,
444 ret = drm_panel_of_backlight(&tpg->panel);
448 spi_set_drvdata(spi, tpg);
450 drm_panel_add(&tpg->panel);
457 struct tpg110 *tpg = spi_get_drvdata(spi);
459 drm_panel_remove(&tpg->panel);