linux/drivers/leds/flash/leds-lm3601x.c

// SPDX-License-Identifier: GPL-2.0
// Flash and torch driver for Texas Instruments LM3601X LED
// Flash driver chip family
// Copyright (C) 2018 Texas Instruments Incorporated - https://www.ti.com/

#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/leds.h>
#include <linux/led-class-flash.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/slab.h>

#define LM3601X_LED_IR
#define LM3601X_LED_TORCH

/* Registers */
#define LM3601X_ENABLE_REG
#define LM3601X_CFG_REG
#define LM3601X_LED_FLASH_REG
#define LM3601X_LED_TORCH_REG
#define LM3601X_FLAGS_REG
#define LM3601X_DEV_ID_REG

#define LM3601X_SW_RESET

/* Enable Mode bits */
#define LM3601X_MODE_STANDBY
#define LM3601X_MODE_IR_DRV
#define LM3601X_MODE_TORCH
#define LM3601X_MODE_STROBE
#define LM3601X_STRB_EN
#define LM3601X_STRB_EDGE_TRIG
#define LM3601X_IVFM_EN

#define LM36010_BOOST_LIMIT_28
#define LM36010_BOOST_FREQ_4MHZ
#define LM36010_BOOST_MODE_PASS

/* Flag Mask */
#define LM3601X_FLASH_TIME_OUT
#define LM3601X_UVLO_FAULT
#define LM3601X_THERM_SHUTDOWN
#define LM3601X_THERM_CURR
#define LM36010_CURR_LIMIT
#define LM3601X_SHORT_FAULT
#define LM3601X_IVFM_TRIP
#define LM36010_OVP_FAULT

#define LM3601X_MAX_TORCH_I_UA
#define LM3601X_MIN_TORCH_I_UA
#define LM3601X_TORCH_REG_DIV

#define LM3601X_MAX_STROBE_I_UA
#define LM3601X_MIN_STROBE_I_UA
#define LM3601X_STROBE_REG_DIV

#define LM3601X_TIMEOUT_MASK
#define LM3601X_ENABLE_MASK

#define LM3601X_LOWER_STEP_US
#define LM3601X_UPPER_STEP_US
#define LM3601X_MIN_TIMEOUT_US
#define LM3601X_MAX_TIMEOUT_US
#define LM3601X_TIMEOUT_XOVER_US

enum lm3601x_type {};

/**
 * struct lm3601x_led - private lm3601x LED data
 * @fled_cdev: flash LED class device pointer
 * @client: Pointer to the I2C client
 * @regmap: Devices register map
 * @lock: Lock for reading/writing the device
 * @flash_timeout: the timeout for the flash
 * @last_flag: last known flags register value
 * @torch_current_max: maximum current for the torch
 * @flash_current_max: maximum current for the flash
 * @max_flash_timeout: maximum timeout for the flash
 * @led_mode: The mode to enable either IR or Torch
 */
struct lm3601x_led {};

static const struct reg_default lm3601x_regmap_defs[] =;

static bool lm3601x_volatile_reg(struct device *dev, unsigned int reg)
{}

static const struct regmap_config lm3601x_regmap =;

static struct lm3601x_led *fled_cdev_to_led(struct led_classdev_flash *fled_cdev)
{}

static int lm3601x_read_faults(struct lm3601x_led *led)
{}

static int lm3601x_brightness_set(struct led_classdev *cdev,
					enum led_brightness brightness)
{}

static int lm3601x_strobe_set(struct led_classdev_flash *fled_cdev,
				bool state)
{}

static int lm3601x_flash_brightness_set(struct led_classdev_flash *fled_cdev,
					u32 brightness)
{}

static int lm3601x_flash_timeout_set(struct led_classdev_flash *fled_cdev,
				u32 timeout)
{}

static int lm3601x_strobe_get(struct led_classdev_flash *fled_cdev, bool *state)
{}

static int lm3601x_flash_fault_get(struct led_classdev_flash *fled_cdev,
				u32 *fault)
{}

static const struct led_flash_ops flash_ops =;

static int lm3601x_register_leds(struct lm3601x_led *led,
				 struct fwnode_handle *fwnode)
{}

static int lm3601x_parse_node(struct lm3601x_led *led,
			      struct fwnode_handle **fwnode)
{}

static int lm3601x_probe(struct i2c_client *client)
{}

static void lm3601x_remove(struct i2c_client *client)
{}

static const struct i2c_device_id lm3601x_id[] =;
MODULE_DEVICE_TABLE(i2c, lm3601x_id);

static const struct of_device_id of_lm3601x_leds_match[] =;
MODULE_DEVICE_TABLE(of, of_lm3601x_leds_match);

static struct i2c_driver lm3601x_i2c_driver =;
module_i2c_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();