linux/drivers/video/backlight/pwm_bl.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Simple PWM based backlight control, board code has to setup
 * 1) pin configuration so PWM waveforms can output
 * 2) platform_data being correctly configured
 */

#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/backlight.h>
#include <linux/err.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>

struct pwm_bl_data {};

static void pwm_backlight_power_on(struct pwm_bl_data *pb)
{}

static void pwm_backlight_power_off(struct pwm_bl_data *pb)
{}

static int compute_duty_cycle(struct pwm_bl_data *pb, int brightness, struct pwm_state *state)
{}

static int pwm_backlight_update_status(struct backlight_device *bl)
{}

static const struct backlight_ops pwm_backlight_ops =;

#ifdef CONFIG_OF
#define PWM_LUMINANCE_SHIFT
#define PWM_LUMINANCE_SCALE

/*
 * CIE lightness to PWM conversion.
 *
 * The CIE 1931 lightness formula is what actually describes how we perceive
 * light:
 *          Y = (L* / 903.3)           if L* ≤ 8
 *          Y = ((L* + 16) / 116)^3    if L* > 8
 *
 * Where Y is the luminance, the amount of light coming out of the screen, and
 * is a number between 0.0 and 1.0; and L* is the lightness, how bright a human
 * perceives the screen to be, and is a number between 0 and 100.
 *
 * The following function does the fixed point maths needed to implement the
 * above formula.
 */
static u64 cie1931(unsigned int lightness)
{}

/*
 * Create a default correction table for PWM values to create linear brightness
 * for LED based backlights using the CIE1931 algorithm.
 */
static
int pwm_backlight_brightness_default(struct device *dev,
				     struct platform_pwm_backlight_data *data,
				     unsigned int period)
{}

static int pwm_backlight_parse_dt(struct device *dev,
				  struct platform_pwm_backlight_data *data)
{}

static const struct of_device_id pwm_backlight_of_match[] =;

MODULE_DEVICE_TABLE(of, pwm_backlight_of_match);
#else
static int pwm_backlight_parse_dt(struct device *dev,
				  struct platform_pwm_backlight_data *data)
{
	return -ENODEV;
}

static
int pwm_backlight_brightness_default(struct device *dev,
				     struct platform_pwm_backlight_data *data,
				     unsigned int period)
{
	return -ENODEV;
}
#endif

static bool pwm_backlight_is_linear(struct platform_pwm_backlight_data *data)
{}

static int pwm_backlight_initial_power_state(const struct pwm_bl_data *pb)
{}

static int pwm_backlight_probe(struct platform_device *pdev)
{}

static void pwm_backlight_remove(struct platform_device *pdev)
{}

static void pwm_backlight_shutdown(struct platform_device *pdev)
{}

#ifdef CONFIG_PM_SLEEP
static int pwm_backlight_suspend(struct device *dev)
{}

static int pwm_backlight_resume(struct device *dev)
{}
#endif

static const struct dev_pm_ops pwm_backlight_pm_ops =;

static struct platform_driver pwm_backlight_driver =;

module_platform_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_ALIAS();