#include <linux/led-class-flash.h>
#include <linux/mfd/max77693.h>
#include <linux/mfd/max77693-common.h>
#include <linux/mfd/max77693-private.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <media/v4l2-flash-led-class.h>
#define MODE_OFF …
#define MODE_FLASH(a) …
#define MODE_TORCH(a) …
#define MODE_FLASH_EXTERNAL(a) …
#define MODE_FLASH_MASK …
#define MODE_TORCH_MASK …
#define FLED1_IOUT …
#define FLED2_IOUT …
enum max77693_fled { … };
enum max77693_led_mode { … };
struct max77693_led_config_data { … };
struct max77693_sub_led { … };
struct max77693_led_device { … };
static u8 max77693_led_iout_to_reg(u32 ua)
{ … }
static u8 max77693_flash_timeout_to_reg(u32 us)
{ … }
static inline struct max77693_sub_led *flcdev_to_sub_led(
struct led_classdev_flash *fled_cdev)
{ … }
static inline struct max77693_led_device *sub_led_to_led(
struct max77693_sub_led *sub_led)
{ … }
static inline u8 max77693_led_vsys_to_reg(u32 mv)
{ … }
static inline u8 max77693_led_vout_to_reg(u32 mv)
{ … }
static inline bool max77693_fled_used(struct max77693_led_device *led,
int fled_id)
{ … }
static int max77693_set_mode_reg(struct max77693_led_device *led, u8 mode)
{ … }
static int max77693_add_mode(struct max77693_led_device *led, u8 mode)
{ … }
static int max77693_clear_mode(struct max77693_led_device *led,
u8 mode)
{ … }
static void max77693_add_allowed_modes(struct max77693_led_device *led,
int fled_id, enum max77693_led_mode mode)
{ … }
static void max77693_distribute_currents(struct max77693_led_device *led,
int fled_id, enum max77693_led_mode mode,
u32 micro_amp, u32 iout_max[2], u32 iout[2])
{ … }
static int max77693_set_torch_current(struct max77693_led_device *led,
int fled_id, u32 micro_amp)
{ … }
static int max77693_set_flash_current(struct max77693_led_device *led,
int fled_id,
u32 micro_amp)
{ … }
static int max77693_set_timeout(struct max77693_led_device *led, u32 microsec)
{ … }
static int max77693_get_strobe_status(struct max77693_led_device *led,
bool *state)
{ … }
static int max77693_get_flash_faults(struct max77693_sub_led *sub_led)
{ … }
static int max77693_setup(struct max77693_led_device *led,
struct max77693_led_config_data *led_cfg)
{ … }
static int max77693_led_brightness_set(struct led_classdev *led_cdev,
enum led_brightness value)
{ … }
static int max77693_led_flash_brightness_set(
struct led_classdev_flash *fled_cdev,
u32 brightness)
{ … }
static int max77693_led_flash_strobe_set(
struct led_classdev_flash *fled_cdev,
bool state)
{ … }
static int max77693_led_flash_fault_get(
struct led_classdev_flash *fled_cdev,
u32 *fault)
{ … }
static int max77693_led_flash_strobe_get(
struct led_classdev_flash *fled_cdev,
bool *state)
{ … }
static int max77693_led_flash_timeout_set(
struct led_classdev_flash *fled_cdev,
u32 timeout)
{ … }
static int max77693_led_parse_dt(struct max77693_led_device *led,
struct max77693_led_config_data *cfg,
struct device_node **sub_nodes)
{ … }
static void clamp_align(u32 *v, u32 min, u32 max, u32 step)
{ … }
static void max77693_align_iout_current(struct max77693_led_device *led,
u32 *iout, u32 min, u32 max, u32 step)
{ … }
static void max77693_led_validate_configuration(struct max77693_led_device *led,
struct max77693_led_config_data *cfg)
{ … }
static int max77693_led_get_configuration(struct max77693_led_device *led,
struct max77693_led_config_data *cfg,
struct device_node **sub_nodes)
{ … }
static const struct led_flash_ops flash_ops = …;
static void max77693_init_flash_settings(struct max77693_sub_led *sub_led,
struct max77693_led_config_data *led_cfg)
{ … }
#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
static int max77693_led_external_strobe_set(
struct v4l2_flash *v4l2_flash,
bool enable)
{ … }
static void max77693_init_v4l2_flash_config(struct max77693_sub_led *sub_led,
struct max77693_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 max77693_init_v4l2_flash_config(
struct max77693_sub_led *sub_led,
struct max77693_led_config_data *led_cfg,
struct v4l2_flash_config *v4l2_sd_cfg)
{
}
static const struct v4l2_flash_ops v4l2_flash_ops;
#endif
static void max77693_init_fled_cdev(struct max77693_sub_led *sub_led,
struct max77693_led_config_data *led_cfg)
{ … }
static int max77693_register_led(struct max77693_sub_led *sub_led,
struct max77693_led_config_data *led_cfg,
struct device_node *sub_node)
{ … }
static int max77693_led_probe(struct platform_device *pdev)
{ … }
static void max77693_led_remove(struct platform_device *pdev)
{ … }
static const struct of_device_id max77693_led_dt_match[] = …;
MODULE_DEVICE_TABLE(of, max77693_led_dt_match);
static struct platform_driver max77693_led_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;