Lines Matching +full:bd +full:- +full:address

1 // SPDX-License-Identifier: GPL-2.0-or-later
36 struct backlight_device *bd; member
172 return spi_sync(lcd->spi, &msg); in ams369fg06_spi_write_byte()
175 static int ams369fg06_spi_write(struct ams369fg06 *lcd, unsigned char address, in ams369fg06_spi_write() argument
180 if (address != DATA_ONLY) in ams369fg06_spi_write()
181 ret = ams369fg06_spi_write_byte(lcd, 0x70, address); in ams369fg06_spi_write()
218 dev_err(lcd->dev, "failed to set gamma table.\n"); in _ams369fg06_gamma_ctl()
309 struct backlight_device *bd; in ams369fg06_power_on() local
311 pd = lcd->lcd_pd; in ams369fg06_power_on()
312 bd = lcd->bd; in ams369fg06_power_on()
314 if (pd->power_on) { in ams369fg06_power_on()
315 pd->power_on(lcd->ld, 1); in ams369fg06_power_on()
316 msleep(pd->power_on_delay); in ams369fg06_power_on()
319 if (!pd->reset) { in ams369fg06_power_on()
320 dev_err(lcd->dev, "reset is NULL.\n"); in ams369fg06_power_on()
321 return -EINVAL; in ams369fg06_power_on()
324 pd->reset(lcd->ld); in ams369fg06_power_on()
325 msleep(pd->reset_delay); in ams369fg06_power_on()
329 dev_err(lcd->dev, "failed to initialize ldi.\n"); in ams369fg06_power_on()
335 dev_err(lcd->dev, "failed to enable ldi.\n"); in ams369fg06_power_on()
340 ret = ams369fg06_gamma_ctl(lcd, bd->props.brightness); in ams369fg06_power_on()
342 dev_err(lcd->dev, "lcd gamma setting failed.\n"); in ams369fg06_power_on()
354 pd = lcd->lcd_pd; in ams369fg06_power_off()
358 dev_err(lcd->dev, "lcd setting failed.\n"); in ams369fg06_power_off()
359 return -EIO; in ams369fg06_power_off()
362 msleep(pd->power_off_delay); in ams369fg06_power_off()
364 if (pd->power_on) in ams369fg06_power_off()
365 pd->power_on(lcd->ld, 0); in ams369fg06_power_off()
375 !ams369fg06_power_is_on(lcd->power)) in ams369fg06_power()
378 ams369fg06_power_is_on(lcd->power)) in ams369fg06_power()
382 lcd->power = power; in ams369fg06_power()
391 return lcd->power; in ams369fg06_get_power()
400 dev_err(lcd->dev, "power value should be 0, 1 or 4.\n"); in ams369fg06_set_power()
401 return -EINVAL; in ams369fg06_set_power()
407 static int ams369fg06_set_brightness(struct backlight_device *bd) in ams369fg06_set_brightness() argument
410 int brightness = bd->props.brightness; in ams369fg06_set_brightness()
411 struct ams369fg06 *lcd = bl_get_data(bd); in ams369fg06_set_brightness()
414 brightness > bd->props.max_brightness) { in ams369fg06_set_brightness()
415 dev_err(&bd->dev, "lcd brightness should be %d to %d.\n", in ams369fg06_set_brightness()
417 return -EINVAL; in ams369fg06_set_brightness()
420 ret = ams369fg06_gamma_ctl(lcd, bd->props.brightness); in ams369fg06_set_brightness()
422 dev_err(&bd->dev, "lcd brightness setting failed.\n"); in ams369fg06_set_brightness()
423 return -EIO; in ams369fg06_set_brightness()
443 struct backlight_device *bd = NULL; in ams369fg06_probe() local
446 lcd = devm_kzalloc(&spi->dev, sizeof(struct ams369fg06), GFP_KERNEL); in ams369fg06_probe()
448 return -ENOMEM; in ams369fg06_probe()
450 /* ams369fg06 lcd panel uses 3-wire 16bits SPI Mode. */ in ams369fg06_probe()
451 spi->bits_per_word = 16; in ams369fg06_probe()
455 dev_err(&spi->dev, "spi setup failed.\n"); in ams369fg06_probe()
459 lcd->spi = spi; in ams369fg06_probe()
460 lcd->dev = &spi->dev; in ams369fg06_probe()
462 lcd->lcd_pd = dev_get_platdata(&spi->dev); in ams369fg06_probe()
463 if (!lcd->lcd_pd) { in ams369fg06_probe()
464 dev_err(&spi->dev, "platform data is NULL\n"); in ams369fg06_probe()
465 return -EINVAL; in ams369fg06_probe()
468 ld = devm_lcd_device_register(&spi->dev, "ams369fg06", &spi->dev, lcd, in ams369fg06_probe()
473 lcd->ld = ld; in ams369fg06_probe()
479 bd = devm_backlight_device_register(&spi->dev, "ams369fg06-bl", in ams369fg06_probe()
480 &spi->dev, lcd, in ams369fg06_probe()
482 if (IS_ERR(bd)) in ams369fg06_probe()
483 return PTR_ERR(bd); in ams369fg06_probe()
485 bd->props.brightness = DEFAULT_BRIGHTNESS; in ams369fg06_probe()
486 lcd->bd = bd; in ams369fg06_probe()
488 if (!lcd->lcd_pd->lcd_enabled) { in ams369fg06_probe()
494 lcd->power = BACKLIGHT_POWER_OFF; in ams369fg06_probe()
498 lcd->power = BACKLIGHT_POWER_ON; in ams369fg06_probe()
503 dev_info(&spi->dev, "ams369fg06 panel driver has been probed.\n"); in ams369fg06_probe()
520 dev_dbg(dev, "lcd->power = %d\n", lcd->power); in ams369fg06_suspend()
533 lcd->power = BACKLIGHT_POWER_OFF; in ams369fg06_resume()