Commit d1a2e700 authored by Meghana Madhyastha's avatar Meghana Madhyastha Committed by Sean Paul

drm/tinydrm: Replace tinydrm_of_find_backlight with of_find_backlight

Remove tinydrm_of_find_backlight from tinydrm-helpers.c. We now have
a generic of_find_backlight defined in backlight.c. Let the callers
of tinydrm_of_find_backlight call of_find_backlight. Also, remove
select BACKLIGHT_LCD_SUPPORT and select BACKLIGHT_CLASS_DEVICE from
tinydrm/Kconfig as it is a hack that is no longer needed.
Reviewed-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Reviewed-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarMeghana Madhyastha <meghana.madhyastha@gmail.com>
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/11dd1cabd098a730d07ab04c5987b139d14d8b21.1516810725.git.meghana.madhyastha@gmail.com
parent 414147e8
...@@ -3,8 +3,6 @@ menuconfig DRM_TINYDRM ...@@ -3,8 +3,6 @@ menuconfig DRM_TINYDRM
depends on DRM depends on DRM
select DRM_KMS_HELPER select DRM_KMS_HELPER
select DRM_KMS_CMA_HELPER select DRM_KMS_CMA_HELPER
select BACKLIGHT_LCD_SUPPORT
select BACKLIGHT_CLASS_DEVICE
help help
Choose this option if you have a tinydrm supported display. Choose this option if you have a tinydrm supported display.
If M is selected the module will be called tinydrm. If M is selected the module will be called tinydrm.
......
...@@ -236,46 +236,6 @@ void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb, ...@@ -236,46 +236,6 @@ void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb,
} }
EXPORT_SYMBOL(tinydrm_xrgb8888_to_gray8); EXPORT_SYMBOL(tinydrm_xrgb8888_to_gray8);
/**
* tinydrm_of_find_backlight - Find backlight device in device-tree
* @dev: Device
*
* This function looks for a DT node pointed to by a property named 'backlight'
* and uses of_find_backlight_by_node() to get the backlight device.
* Additionally if the brightness property is zero, it is set to
* max_brightness.
*
* Returns:
* NULL if there's no backlight property.
* Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device
* is found.
* If the backlight device is found, a pointer to the structure is returned.
*/
struct backlight_device *tinydrm_of_find_backlight(struct device *dev)
{
struct backlight_device *backlight;
struct device_node *np;
np = of_parse_phandle(dev->of_node, "backlight", 0);
if (!np)
return NULL;
backlight = of_find_backlight_by_node(np);
of_node_put(np);
if (!backlight)
return ERR_PTR(-EPROBE_DEFER);
if (!backlight->props.brightness) {
backlight->props.brightness = backlight->props.max_brightness;
DRM_DEBUG_KMS("Backlight brightness set to %d\n",
backlight->props.brightness);
}
return backlight;
}
EXPORT_SYMBOL(tinydrm_of_find_backlight);
#if IS_ENABLED(CONFIG_SPI) #if IS_ENABLED(CONFIG_SPI)
/** /**
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* (at your option) any later version. * (at your option) any later version.
*/ */
#include <linux/backlight.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -195,7 +196,7 @@ static int mi0283qt_probe(struct spi_device *spi) ...@@ -195,7 +196,7 @@ static int mi0283qt_probe(struct spi_device *spi)
if (IS_ERR(mipi->regulator)) if (IS_ERR(mipi->regulator))
return PTR_ERR(mipi->regulator); return PTR_ERR(mipi->regulator);
mipi->backlight = tinydrm_of_find_backlight(dev); mipi->backlight = of_find_backlight(dev);
if (IS_ERR(mipi->backlight)) if (IS_ERR(mipi->backlight))
return PTR_ERR(mipi->backlight); return PTR_ERR(mipi->backlight);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Copyright 2017 David Lechner <david@lechnology.com> * Copyright 2017 David Lechner <david@lechnology.com>
*/ */
#include <linux/backlight.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/dma-buf.h> #include <linux/dma-buf.h>
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
...@@ -163,7 +164,7 @@ static int st7735r_probe(struct spi_device *spi) ...@@ -163,7 +164,7 @@ static int st7735r_probe(struct spi_device *spi)
return PTR_ERR(dc); return PTR_ERR(dc);
} }
mipi->backlight = tinydrm_of_find_backlight(dev); mipi->backlight = of_find_backlight(dev);
if (IS_ERR(mipi->backlight)) if (IS_ERR(mipi->backlight))
return PTR_ERR(mipi->backlight); return PTR_ERR(mipi->backlight);
......
...@@ -46,8 +46,6 @@ void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr, ...@@ -46,8 +46,6 @@ void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr,
void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb, void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb,
struct drm_clip_rect *clip); struct drm_clip_rect *clip);
struct backlight_device *tinydrm_of_find_backlight(struct device *dev);
size_t tinydrm_spi_max_transfer_size(struct spi_device *spi, size_t max_len); size_t tinydrm_spi_max_transfer_size(struct spi_device *spi, size_t max_len);
bool tinydrm_spi_bpw_supported(struct spi_device *spi, u8 bpw); bool tinydrm_spi_bpw_supported(struct spi_device *spi, u8 bpw);
int tinydrm_spi_transfer(struct spi_device *spi, u32 speed_hz, int tinydrm_spi_transfer(struct spi_device *spi, u32 speed_hz,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment