Lines Matching refs:spi
64 struct spi_device *spi; member
99 static int tpo_td043_write(struct spi_device *spi, u8 addr, u8 data) in tpo_td043_write() argument
116 r = spi_sync(spi, &m); in tpo_td043_write()
118 dev_warn(&spi->dev, "failed to write to LCD reg (%d)\n", r); in tpo_td043_write()
122 static void tpo_td043_write_gamma(struct spi_device *spi, u16 gamma[12]) in tpo_td043_write_gamma() argument
129 tpo_td043_write(spi, 0x11, val); in tpo_td043_write_gamma()
133 tpo_td043_write(spi, 0x12, val); in tpo_td043_write_gamma()
137 tpo_td043_write(spi, 0x13, val); in tpo_td043_write_gamma()
141 tpo_td043_write(spi, 0x14 + i, gamma[i] & 0xff); in tpo_td043_write_gamma()
144 static int tpo_td043_write_mirror(struct spi_device *spi, bool h, bool v) in tpo_td043_write_mirror() argument
153 return tpo_td043_write(spi, 4, reg4); in tpo_td043_write_mirror()
161 return tpo_td043_write_mirror(ddata->spi, ddata->hmirror, in tpo_td043_set_hmirror()
193 ret = tpo_td043_write_mirror(ddata->spi, ddata->hmirror, val); in tpo_td043_vmirror_store()
224 tpo_td043_write(ddata->spi, 2, val); in tpo_td043_mode_store()
267 tpo_td043_write_gamma(ddata->spi, ddata->gamma); in tpo_td043_gamma_store()
307 tpo_td043_write(ddata->spi, 2, in tpo_td043_power_on()
309 tpo_td043_write(ddata->spi, 3, TPO_R03_VAL_NORMAL); in tpo_td043_power_on()
310 tpo_td043_write(ddata->spi, 0x20, 0xf0); in tpo_td043_power_on()
311 tpo_td043_write(ddata->spi, 0x21, 0xf0); in tpo_td043_power_on()
312 tpo_td043_write_mirror(ddata->spi, ddata->hmirror, in tpo_td043_power_on()
314 tpo_td043_write_gamma(ddata->spi, ddata->gamma); in tpo_td043_power_on()
325 tpo_td043_write(ddata->spi, 3, in tpo_td043_power_off()
334 tpo_td043_write(ddata->spi, 3, TPO_R03_VAL_STANDBY); in tpo_td043_power_off()
468 static int tpo_td043_probe_pdata(struct spi_device *spi) in tpo_td043_probe_pdata() argument
471 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); in tpo_td043_probe_pdata()
474 pdata = dev_get_platdata(&spi->dev); in tpo_td043_probe_pdata()
480 dev_err(&spi->dev, "failed to find video source '%s'\n", in tpo_td043_probe_pdata()
494 static int tpo_td043_probe_of(struct spi_device *spi) in tpo_td043_probe_of() argument
496 struct device_node *node = spi->dev.of_node; in tpo_td043_probe_of()
497 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); in tpo_td043_probe_of()
503 dev_err(&spi->dev, "failed to parse enable gpio\n"); in tpo_td043_probe_of()
510 dev_err(&spi->dev, "failed to find video source\n"); in tpo_td043_probe_of()
519 static int tpo_td043_probe(struct spi_device *spi) in tpo_td043_probe() argument
525 dev_dbg(&spi->dev, "%s\n", __func__); in tpo_td043_probe()
527 spi->bits_per_word = 16; in tpo_td043_probe()
528 spi->mode = SPI_MODE_0; in tpo_td043_probe()
530 r = spi_setup(spi); in tpo_td043_probe()
532 dev_err(&spi->dev, "spi_setup failed: %d\n", r); in tpo_td043_probe()
536 ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); in tpo_td043_probe()
540 dev_set_drvdata(&spi->dev, ddata); in tpo_td043_probe()
542 ddata->spi = spi; in tpo_td043_probe()
544 if (dev_get_platdata(&spi->dev)) { in tpo_td043_probe()
545 r = tpo_td043_probe_pdata(spi); in tpo_td043_probe()
548 } else if (spi->dev.of_node) { in tpo_td043_probe()
549 r = tpo_td043_probe_of(spi); in tpo_td043_probe()
559 ddata->vcc_reg = devm_regulator_get(&spi->dev, "vcc"); in tpo_td043_probe()
561 dev_err(&spi->dev, "failed to get LCD VCC regulator\n"); in tpo_td043_probe()
567 r = devm_gpio_request_one(&spi->dev, in tpo_td043_probe()
571 dev_err(&spi->dev, "couldn't request reset GPIO\n"); in tpo_td043_probe()
576 r = sysfs_create_group(&spi->dev.kobj, &tpo_td043_attr_group); in tpo_td043_probe()
578 dev_err(&spi->dev, "failed to create sysfs files\n"); in tpo_td043_probe()
585 dssdev->dev = &spi->dev; in tpo_td043_probe()
593 dev_err(&spi->dev, "Failed to register panel\n"); in tpo_td043_probe()
600 sysfs_remove_group(&spi->dev.kobj, &tpo_td043_attr_group); in tpo_td043_probe()
608 static int tpo_td043_remove(struct spi_device *spi) in tpo_td043_remove() argument
610 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); in tpo_td043_remove()
614 dev_dbg(&ddata->spi->dev, "%s\n", __func__); in tpo_td043_remove()
623 sysfs_remove_group(&spi->dev.kobj, &tpo_td043_attr_group); in tpo_td043_remove()