#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/led-class-flash.h>
#include <linux/leds.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <media/v4l2-flash-led-class.h>
#define AAT1290_MOVIE_MODE_CURRENT_ADDR …
#define AAT1290_MAX_MM_CURR_PERCENT_0 …
#define AAT1290_MAX_MM_CURR_PERCENT_100 …
#define AAT1290_FLASH_SAFETY_TIMER_ADDR …
#define AAT1290_MOVIE_MODE_CONFIG_ADDR …
#define AAT1290_MOVIE_MODE_OFF …
#define AAT1290_MOVIE_MODE_ON …
#define AAT1290_MM_CURRENT_RATIO_ADDR …
#define AAT1290_MM_TO_FL_1_92 …
#define AAT1290_MM_TO_FL_RATIO …
#define AAT1290_MAX_MM_CURRENT(fl_max) …
#define AAT1290_LATCH_TIME_MIN_US …
#define AAT1290_LATCH_TIME_MAX_US …
#define AAT1290_EN_SET_TICK_TIME_US …
#define AAT1290_FLEN_OFF_DELAY_TIME_US …
#define AAT1290_FLASH_TM_NUM_LEVELS …
#define AAT1290_MM_CURRENT_SCALE_SIZE …
#define AAT1290_NAME …
struct aat1290_led_config_data { … };
struct aat1290_led { … };
static struct aat1290_led *fled_cdev_to_led(
struct led_classdev_flash *fled_cdev)
{ … }
static struct led_classdev_flash *led_cdev_to_fled_cdev(
struct led_classdev *led_cdev)
{ … }
static void aat1290_as2cwire_write(struct aat1290_led *led, int addr, int value)
{ … }
static void aat1290_set_flash_safety_timer(struct aat1290_led *led,
unsigned int micro_sec)
{ … }
static int aat1290_led_brightness_set(struct led_classdev *led_cdev,
enum led_brightness brightness)
{ … }
static int aat1290_led_flash_strobe_set(struct led_classdev_flash *fled_cdev,
bool state)
{ … }
static int aat1290_led_flash_timeout_set(struct led_classdev_flash *fled_cdev,
u32 timeout)
{ … }
static int aat1290_led_parse_dt(struct aat1290_led *led,
struct aat1290_led_config_data *cfg,
struct device_node **sub_node)
{ … }
static void aat1290_led_validate_mm_current(struct aat1290_led *led,
struct aat1290_led_config_data *cfg)
{ … }
static int init_mm_current_scale(struct aat1290_led *led,
struct aat1290_led_config_data *cfg)
{ … }
static int aat1290_led_get_configuration(struct aat1290_led *led,
struct aat1290_led_config_data *cfg,
struct device_node **sub_node)
{ … }
static void aat1290_init_flash_timeout(struct aat1290_led *led,
struct aat1290_led_config_data *cfg)
{ … }
#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
static enum led_brightness aat1290_intensity_to_brightness(
struct v4l2_flash *v4l2_flash,
s32 intensity)
{ … }
static s32 aat1290_brightness_to_intensity(struct v4l2_flash *v4l2_flash,
enum led_brightness brightness)
{ … }
static int aat1290_led_external_strobe_set(struct v4l2_flash *v4l2_flash,
bool enable)
{ … }
static void aat1290_init_v4l2_flash_config(struct aat1290_led *led,
struct aat1290_led_config_data *led_cfg,
struct v4l2_flash_config *v4l2_sd_cfg)
{ … }
static const struct v4l2_flash_ops v4l2_flash_ops = …;
#else
static inline void aat1290_init_v4l2_flash_config(struct aat1290_led *led,
struct aat1290_led_config_data *led_cfg,
struct v4l2_flash_config *v4l2_sd_cfg)
{
}
static const struct v4l2_flash_ops v4l2_flash_ops;
#endif
static const struct led_flash_ops flash_ops = …;
static int aat1290_led_probe(struct platform_device *pdev)
{ … }
static void aat1290_led_remove(struct platform_device *pdev)
{ … }
static const struct of_device_id aat1290_led_dt_match[] = …;
MODULE_DEVICE_TABLE(of, aat1290_led_dt_match);
static struct platform_driver aat1290_led_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;