diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-12-15 20:37:00 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-12-15 20:37:00 +0300 |
commit | 9fa4abc9ad2a18410a7087e6cea15ad1ffb172c6 (patch) | |
tree | e5bc6edc5938d395d4b615b485abadad3348d4cb /drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c | |
parent | 504a73d46bad8964be2cdaa63a2bedaef198ea3b (diff) | |
parent | 3c3bfb8586f848317ceba5d777e11204ba3e5758 (diff) | |
download | linux-9fa4abc9ad2a18410a7087e6cea15ad1ffb172c6.tar.xz |
Merge tag 'fbdev-for-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev
Pull fbdev updates from Helge Deller:
"The most relevant change are the patches from Dmitry Torokhov to
switch omapfb to the gpiod API.
The other patches are small and fix e.g. UML build issues, improve the
error paths and cleanup code"
* tag 'fbdev-for-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev: (32 commits)
fbdev: fbcon: release buffer when fbcon_do_set_font() failed
fbdev: sh_mobile_lcdcfb: use sysfs_emit() to instead of scnprintf()
fbdev: uvesafb: use sysfs_emit() to instead of scnprintf()
fbdev: uvesafb: Simplify uvesafb_remove()
fbdev: uvesafb: Fixes an error handling path in uvesafb_probe()
fbdev: uvesafb: don't build on UML
fbdev: geode: don't build on UML
fbdev: ep93xx-fb: Add missing clk_disable_unprepare in ep93xxfb_probe()
fbdev: matroxfb: Convert to i2c's .probe_new()
fbdev: da8xx-fb: add missing regulator_disable() in fb_probe
fbdev: controlfb: fix spelling mistake "paramaters"->"parameters"
fbdev: vermilion: decrease reference count in error path
fbdev: smscufx: fix error handling code in ufx_usb_probe
fbdev: via: Fix error in via_core_init()
fbdev: pm2fb: fix missing pci_disable_device()
fbdev: pxafb: Remove unnecessary print function dev_err()
fbdev: omapfb: panel-sharp-ls037v7dw01: fix included headers
fbdev: omapfb: panel-tpo-td028ttec1: stop including gpio.h
fbdev: omapfb: panel-lgphilips-lb035q02: remove backlight GPIO handling
fbdev: omapfb: encoder-opa362: fix included headers
...
Diffstat (limited to 'drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c')
-rw-r--r-- | drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c | 105 |
1 files changed, 34 insertions, 71 deletions
diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c index c0965bee12c5..685c63aa4e03 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c @@ -18,12 +18,10 @@ #include <linux/sched.h> #include <linux/backlight.h> #include <linux/fb.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/of.h> -#include <linux/of_gpio.h> #include <video/omapfb_dss.h> -#include <video/omap-panel-data.h> #define MIPID_CMD_READ_DISP_ID 0x04 #define MIPID_CMD_READ_RED 0x06 @@ -57,7 +55,8 @@ struct panel_drv_data { struct omap_dss_device dssdev; struct omap_dss_device *in; - int reset_gpio; + struct gpio_desc *reset_gpio; + int datapairs; struct omap_video_timings videomode; @@ -546,8 +545,13 @@ static int acx565akm_panel_power_on(struct omap_dss_device *dssdev) /*FIXME tweak me */ msleep(50); - if (gpio_is_valid(ddata->reset_gpio)) - gpio_set_value(ddata->reset_gpio, 1); + /* + * Note that we appear to activate the reset line here. However + * existing DTSes specified incorrect polarity for it (active high), + * so in fact this deasserts the reset line. + */ + if (ddata->reset_gpio) + gpiod_set_value_cansleep(ddata->reset_gpio, 1); if (ddata->enabled) { dev_dbg(&ddata->spi->dev, "panel already enabled\n"); @@ -596,8 +600,9 @@ static void acx565akm_panel_power_off(struct omap_dss_device *dssdev) */ msleep(50); - if (gpio_is_valid(ddata->reset_gpio)) - gpio_set_value(ddata->reset_gpio, 0); + /* see comment in acx565akm_panel_power_on() */ + if (ddata->reset_gpio) + gpiod_set_value_cansleep(ddata->reset_gpio, 0); /* FIXME need to tweak this delay */ msleep(100); @@ -688,48 +693,6 @@ static struct omap_dss_driver acx565akm_ops = { .get_resolution = omapdss_default_get_resolution, }; -static int acx565akm_probe_pdata(struct spi_device *spi) -{ - const struct panel_acx565akm_platform_data *pdata; - struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); - struct omap_dss_device *dssdev, *in; - - pdata = dev_get_platdata(&spi->dev); - - ddata->reset_gpio = pdata->reset_gpio; - - in = omap_dss_find_output(pdata->source); - if (in == NULL) { - dev_err(&spi->dev, "failed to find video source '%s'\n", - pdata->source); - return -EPROBE_DEFER; - } - ddata->in = in; - - ddata->datapairs = pdata->datapairs; - - dssdev = &ddata->dssdev; - dssdev->name = pdata->name; - - return 0; -} - -static int acx565akm_probe_of(struct spi_device *spi) -{ - struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); - struct device_node *np = spi->dev.of_node; - - ddata->reset_gpio = of_get_named_gpio(np, "reset-gpios", 0); - - ddata->in = omapdss_of_find_source_for_first_ep(np); - if (IS_ERR(ddata->in)) { - dev_err(&spi->dev, "failed to find video source\n"); - return PTR_ERR(ddata->in); - } - - return 0; -} - static int acx565akm_probe(struct spi_device *spi) { struct panel_drv_data *ddata; @@ -741,6 +704,9 @@ static int acx565akm_probe(struct spi_device *spi) dev_dbg(&spi->dev, "%s\n", __func__); + if (!spi->dev.of_node) + return -ENODEV; + spi->mode = SPI_MODE_3; ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); @@ -753,28 +719,25 @@ static int acx565akm_probe(struct spi_device *spi) mutex_init(&ddata->mutex); - if (dev_get_platdata(&spi->dev)) { - r = acx565akm_probe_pdata(spi); - if (r) - return r; - } else if (spi->dev.of_node) { - r = acx565akm_probe_of(spi); - if (r) - return r; - } else { - dev_err(&spi->dev, "platform data missing!\n"); - return -ENODEV; + ddata->in = omapdss_of_find_source_for_first_ep(spi->dev.of_node); + r = PTR_ERR_OR_ZERO(ddata->in); + if (r) { + dev_err(&spi->dev, "failed to find video source\n"); + return r; } - if (gpio_is_valid(ddata->reset_gpio)) { - r = devm_gpio_request_one(&spi->dev, ddata->reset_gpio, - GPIOF_OUT_INIT_LOW, "lcd reset"); - if (r) - goto err_gpio; - } + ddata->reset_gpio = devm_gpiod_get_optional(&spi->dev, "reset", + GPIOD_OUT_LOW); + r = PTR_ERR_OR_ZERO(ddata->reset_gpio); + if (r) + goto err_gpio; - if (gpio_is_valid(ddata->reset_gpio)) - gpio_set_value(ddata->reset_gpio, 1); + if (ddata->reset_gpio) { + gpiod_set_consumer_name(ddata->reset_gpio, "lcd reset"); + + /* release the reset line */ + gpiod_set_value_cansleep(ddata->reset_gpio, 1); + } /* * After reset we have to wait 5 msec before the first @@ -786,8 +749,8 @@ static int acx565akm_probe(struct spi_device *spi) r = panel_detect(ddata); - if (!ddata->enabled && gpio_is_valid(ddata->reset_gpio)) - gpio_set_value(ddata->reset_gpio, 0); + if (!ddata->enabled && ddata->reset_gpio) + gpiod_set_value_cansleep(ddata->reset_gpio, 0); if (r) { dev_err(&spi->dev, "%s panel detect error\n", __func__); |