Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0b3cfee authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull backlight updates from Lee Jones:
 "Core Frameworks
   - Obtain scale type through sysfs

  New Functionality:
   - Provide Device Tree functionality in rave-sp-backlight
   - Calculate if scale type is (non-)linear in pwm_bl

  Fix-ups:
   - Simplify code in lm3630a_bl
   - Trivial rename/whitespace/typo fixes in lms283gf05
   - Remove superfluous NULL check in tosa_lcd
   - Fix power state initialisation in gpio_backlight
   - List supported file in MAINTAINERS

  Bug Fixes:
   - Kconfig - default to not building unless requested in
     {LED,BACKLIGHT}_CLASS_DEVICE"

* tag 'backlight-next-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight:
  backlight: pwm_bl: Set scale type for brightness curves specified in the DT
  backlight: pwm_bl: Set scale type for CIE 1931 curves
  backlight: Expose brightness curve type through sysfs
  MAINTAINERS: Add entry for stable backlight sysfs ABI documentation
  backlight: gpio-backlight: Correct initial power state handling
  video: backlight: tosa_lcd: drop check because i2c_unregister_device() is NULL safe
  video: backlight: Drop default m for {LCD,BACKLIGHT_CLASS_DEVICE}
  backlight: lms283gf05: Fix a typo in the description passed to 'devm_gpio_request_one()'
  backlight: lm3630a: Switch to use fwnode_property_count_uXX()
  backlight: rave-sp: Leave initial state and register with correct device
parents 299d14d4 c0b64faf
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
What:		/sys/class/backlight/<backlight>/scale
Date:		July 2019
KernelVersion:	5.4
Contact:	Daniel Thompson <daniel.thompson@linaro.org>
Description:
		Description of the scale of the brightness curve.

		The human eye senses brightness approximately logarithmically,
		hence linear changes in brightness are perceived as being
		non-linear. To achieve a linear perception of brightness changes
		controls like sliders need to apply a logarithmic mapping for
		backlights with a linear brightness curve.

		Possible values of the attribute are:

		unknown
		  The scale of the brightness curve is unknown.

		linear
		  The brightness changes linearly with each step. Brightness
		  controls should apply a logarithmic mapping for a linear
		  perception.

		non-linear
		  The brightness changes non-linearly with each step. Brightness
		  controls should use a linear mapping for a linear perception.
+2 −0
Original line number Diff line number Diff line
@@ -2921,6 +2921,8 @@ F: drivers/video/backlight/
F:	include/linux/backlight.h
F:	include/linux/pwm_backlight.h
F:	Documentation/devicetree/bindings/leds/backlight
F:	Documentation/ABI/stable/sysfs-class-backlight
F:	Documentation/ABI/testing/sysfs-class-backlight
BATMAN ADVANCED
M:	Marek Lindner <mareklindner@neomailbox.ch>
+0 −2
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@ menu "Backlight & LCD device support"
#
config LCD_CLASS_DEVICE
        tristate "Lowlevel LCD controls"
	default m
	help
	  This framework adds support for low-level control of LCD.
	  Some framebuffer devices connect to platform-specific LCD modules
@@ -143,7 +142,6 @@ endif # LCD_CLASS_DEVICE
#
config BACKLIGHT_CLASS_DEVICE
        tristate "Lowlevel Backlight controls"
	default m
	help
	  This framework adds support for low-level control of the LCD
          backlight. This includes support for brightness and power.
+19 −0
Original line number Diff line number Diff line
@@ -32,6 +32,12 @@ static const char *const backlight_types[] = {
	[BACKLIGHT_FIRMWARE] = "firmware",
};

static const char *const backlight_scale_types[] = {
	[BACKLIGHT_SCALE_UNKNOWN]	= "unknown",
	[BACKLIGHT_SCALE_LINEAR]	= "linear",
	[BACKLIGHT_SCALE_NON_LINEAR]	= "non-linear",
};

#if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \
			   defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE))
/* This callback gets called when something important happens inside a
@@ -246,6 +252,18 @@ static ssize_t actual_brightness_show(struct device *dev,
}
static DEVICE_ATTR_RO(actual_brightness);

static ssize_t scale_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct backlight_device *bd = to_backlight_device(dev);

	if (WARN_ON(bd->props.scale > BACKLIGHT_SCALE_NON_LINEAR))
		return sprintf(buf, "unknown\n");

	return sprintf(buf, "%s\n", backlight_scale_types[bd->props.scale]);
}
static DEVICE_ATTR_RO(scale);

static struct class *backlight_class;

#ifdef CONFIG_PM_SLEEP
@@ -292,6 +310,7 @@ static struct attribute *bl_device_attrs[] = {
	&dev_attr_brightness.attr,
	&dev_attr_actual_brightness.attr,
	&dev_attr_max_brightness.attr,
	&dev_attr_scale.attr,
	&dev_attr_type.attr,
	NULL,
};
+20 −4
Original line number Diff line number Diff line
@@ -59,13 +59,11 @@ static int gpio_backlight_probe_dt(struct platform_device *pdev,
				   struct gpio_backlight *gbl)
{
	struct device *dev = &pdev->dev;
	enum gpiod_flags flags;
	int ret;

	gbl->def_value = device_property_read_bool(dev, "default-on");
	flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;

	gbl->gpiod = devm_gpiod_get(dev, NULL, flags);
	gbl->gpiod = devm_gpiod_get(dev, NULL, GPIOD_ASIS);
	if (IS_ERR(gbl->gpiod)) {
		ret = PTR_ERR(gbl->gpiod);

@@ -79,6 +77,22 @@ static int gpio_backlight_probe_dt(struct platform_device *pdev,
	return 0;
}

static int gpio_backlight_initial_power_state(struct gpio_backlight *gbl)
{
	struct device_node *node = gbl->dev->of_node;

	/* Not booted with device tree or no phandle link to the node */
	if (!node || !node->phandle)
		return gbl->def_value ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;

	/* if the enable GPIO is disabled, do not enable the backlight */
	if (gpiod_get_value_cansleep(gbl->gpiod) == 0)
		return FB_BLANK_POWERDOWN;

	return FB_BLANK_UNBLANK;
}


static int gpio_backlight_probe(struct platform_device *pdev)
{
	struct gpio_backlight_platform_data *pdata =
@@ -136,7 +150,9 @@ static int gpio_backlight_probe(struct platform_device *pdev)
		return PTR_ERR(bl);
	}

	bl->props.brightness = gbl->def_value;
	bl->props.power = gpio_backlight_initial_power_state(gbl);
	bl->props.brightness = 1;

	backlight_update_status(bl);

	platform_set_drvdata(pdev, bl);
Loading