linux/include/linux/backlight.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Backlight Lowlevel Control Abstraction
 *
 * Copyright (C) 2003,2004 Hewlett-Packard Company
 *
 */

#ifndef _LINUX_BACKLIGHT_H
#define _LINUX_BACKLIGHT_H

#include <linux/device.h>
#include <linux/fb.h>
#include <linux/mutex.h>
#include <linux/notifier.h>
#include <linux/types.h>

/**
 * enum backlight_update_reason - what method was used to update backlight
 *
 * A driver indicates the method (reason) used for updating the backlight
 * when calling backlight_force_update().
 */
enum backlight_update_reason {};

/**
 * enum backlight_type - the type of backlight control
 *
 * The type of interface used to control the backlight.
 */
enum backlight_type {};

/**
 * enum backlight_notification - the type of notification
 *
 * The notifications that is used for notification sent to the receiver
 * that registered notifications using backlight_register_notifier().
 */
enum backlight_notification {};

/** enum backlight_scale - the type of scale used for brightness values
 *
 * The type of scale used for brightness values.
 */
enum backlight_scale {};

struct backlight_device;

/**
 * struct backlight_ops - backlight operations
 *
 * The backlight operations are specified when the backlight device is registered.
 */
struct backlight_ops {};

/**
 * struct backlight_properties - backlight properties
 *
 * This structure defines all the properties of a backlight.
 */
struct backlight_properties {};

/**
 * struct backlight_device - backlight device data
 *
 * This structure holds all data required by a backlight device.
 */
struct backlight_device {};

/**
 * backlight_update_status - force an update of the backlight device status
 * @bd: the backlight device
 */
static inline int backlight_update_status(struct backlight_device *bd)
{}

/**
 * backlight_enable - Enable backlight
 * @bd: the backlight device to enable
 */
static inline int backlight_enable(struct backlight_device *bd)
{}

/**
 * backlight_disable - Disable backlight
 * @bd: the backlight device to disable
 */
static inline int backlight_disable(struct backlight_device *bd)
{}

/**
 * backlight_is_blank - Return true if display is expected to be blank
 * @bd: the backlight device
 *
 * Display is expected to be blank if any of these is true::
 *
 *   1) if power in not UNBLANK
 *   2) if state indicate BLANK or SUSPENDED
 *
 * Returns true if display is expected to be blank, false otherwise.
 */
static inline bool backlight_is_blank(const struct backlight_device *bd)
{}

/**
 * backlight_get_brightness - Returns the current brightness value
 * @bd: the backlight device
 *
 * Returns the current brightness value, taking in consideration the current
 * state. If backlight_is_blank() returns true then return 0 as brightness
 * otherwise return the current brightness property value.
 *
 * Backlight drivers are expected to use this function in their update_status()
 * operation to get the brightness value.
 */
static inline int backlight_get_brightness(const struct backlight_device *bd)
{}

struct backlight_device *
backlight_device_register(const char *name, struct device *dev, void *devdata,
			  const struct backlight_ops *ops,
			  const struct backlight_properties *props);
struct backlight_device *
devm_backlight_device_register(struct device *dev, const char *name,
			       struct device *parent, void *devdata,
			       const struct backlight_ops *ops,
			       const struct backlight_properties *props);
void backlight_device_unregister(struct backlight_device *bd);
void devm_backlight_device_unregister(struct device *dev,
				      struct backlight_device *bd);
void backlight_force_update(struct backlight_device *bd,
			    enum backlight_update_reason reason);
int backlight_register_notifier(struct notifier_block *nb);
int backlight_unregister_notifier(struct notifier_block *nb);
struct backlight_device *backlight_device_get_by_name(const char *name);
struct backlight_device *backlight_device_get_by_type(enum backlight_type type);
int backlight_device_set_brightness(struct backlight_device *bd,
				    unsigned long brightness);

#define to_backlight_device(obj)

/**
 * bl_get_data - access devdata
 * @bl_dev: pointer to backlight device
 *
 * When a backlight device is registered the driver has the possibility
 * to supply a void * devdata. bl_get_data() return a pointer to the
 * devdata.
 *
 * RETURNS:
 *
 * pointer to devdata stored while registering the backlight device.
 */
static inline void * bl_get_data(struct backlight_device *bl_dev)
{}

#ifdef CONFIG_OF
struct backlight_device *of_find_backlight_by_node(struct device_node *node);
#else
static inline struct backlight_device *
of_find_backlight_by_node(struct device_node *node)
{
	return NULL;
}
#endif

#if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
struct backlight_device *devm_of_find_backlight(struct device *dev);
#else
static inline struct backlight_device *
devm_of_find_backlight(struct device *dev)
{
	return NULL;
}
#endif

#endif