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

// SPDX-License-Identifier: GPL-2.0-only
/*
 * drivers/leds/leds-as3645a.c - AS3645A and LM3555 flash controllers driver
 *
 * Copyright (C) 2008-2011 Nokia Corporation
 * Copyright (c) 2011, 2017 Intel Corporation.
 *
 * Based on drivers/media/i2c/as3645a.c.
 *
 * Contact: Sakari Ailus <[email protected]>
 */

#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/led-class-flash.h>
#include <linux/leds.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/property.h>
#include <linux/slab.h>

#include <media/v4l2-flash-led-class.h>

#define AS_TIMER_US_TO_CODE(t)
#define AS_TIMER_CODE_TO_US(c)

/* Register definitions */

/* Read-only Design info register: Reset state: xxxx 0001 */
#define AS_DESIGN_INFO_REG
#define AS_DESIGN_INFO_FACTORY(x)
#define AS_DESIGN_INFO_MODEL(x)

/* Read-only Version control register: Reset state: 0000 0000
 * for first engineering samples
 */
#define AS_VERSION_CONTROL_REG
#define AS_VERSION_CONTROL_RFU(x)
#define AS_VERSION_CONTROL_VERSION(x)

/* Read / Write	(Indicator and timer register): Reset state: 0000 1111 */
#define AS_INDICATOR_AND_TIMER_REG
#define AS_INDICATOR_AND_TIMER_TIMEOUT_SHIFT
#define AS_INDICATOR_AND_TIMER_VREF_SHIFT
#define AS_INDICATOR_AND_TIMER_INDICATOR_SHIFT

/* Read / Write	(Current set register): Reset state: 0110 1001 */
#define AS_CURRENT_SET_REG
#define AS_CURRENT_ASSIST_LIGHT_SHIFT
#define AS_CURRENT_LED_DET_ON
#define AS_CURRENT_FLASH_CURRENT_SHIFT

/* Read / Write	(Control register): Reset state: 1011 0100 */
#define AS_CONTROL_REG
#define AS_CONTROL_MODE_SETTING_SHIFT
#define AS_CONTROL_STROBE_ON
#define AS_CONTROL_OUT_ON
#define AS_CONTROL_EXT_TORCH_ON
#define AS_CONTROL_STROBE_TYPE_EDGE
#define AS_CONTROL_STROBE_TYPE_LEVEL
#define AS_CONTROL_COIL_PEAK_SHIFT

/* Read only (D3 is read / write) (Fault and info): Reset state: 0000 x000 */
#define AS_FAULT_INFO_REG
#define AS_FAULT_INFO_INDUCTOR_PEAK_LIMIT
#define AS_FAULT_INFO_INDICATOR_LED
#define AS_FAULT_INFO_LED_AMOUNT
#define AS_FAULT_INFO_TIMEOUT
#define AS_FAULT_INFO_OVER_TEMPERATURE
#define AS_FAULT_INFO_SHORT_CIRCUIT
#define AS_FAULT_INFO_OVER_VOLTAGE

/* Boost register */
#define AS_BOOST_REG
#define AS_BOOST_CURRENT_DISABLE
#define AS_BOOST_CURRENT_ENABLE

/* Password register is used to unlock boost register writing */
#define AS_PASSWORD_REG
#define AS_PASSWORD_UNLOCK_VALUE

#define AS_NAME
#define AS_I2C_ADDR

#define AS_FLASH_TIMEOUT_MIN
#define AS_FLASH_TIMEOUT_MAX
#define AS_FLASH_TIMEOUT_STEP

#define AS_FLASH_INTENSITY_MIN
#define AS_FLASH_INTENSITY_MAX_1LED
#define AS_FLASH_INTENSITY_MAX_2LEDS
#define AS_FLASH_INTENSITY_STEP

#define AS_TORCH_INTENSITY_MIN
#define AS_TORCH_INTENSITY_MAX
#define AS_TORCH_INTENSITY_STEP

#define AS_INDICATOR_INTENSITY_MIN
#define AS_INDICATOR_INTENSITY_MAX
#define AS_INDICATOR_INTENSITY_STEP

#define AS_PEAK_mA_MAX
#define AS_PEAK_mA_TO_REG(a)

/* LED numbers for Devicetree */
#define AS_LED_FLASH
#define AS_LED_INDICATOR

enum as_mode {};

struct as3645a_config {};

struct as3645a {};

#define fled_to_as3645a(__fled)
#define iled_cdev_to_as3645a(__iled_cdev)

/* Return negative errno else zero on success */
static int as3645a_write(struct as3645a *flash, u8 addr, u8 val)
{}

/* Return negative errno else a data byte received from the device. */
static int as3645a_read(struct as3645a *flash, u8 addr)
{}

/* -----------------------------------------------------------------------------
 * Hardware configuration and trigger
 */

/**
 * as3645a_set_current - Set flash configuration registers
 * @flash: The flash
 *
 * Configure the hardware with flash, assist and indicator currents, as well as
 * flash timeout.
 *
 * Return 0 on success, or a negative error code if an I2C communication error
 * occurred.
 */
static int as3645a_set_current(struct as3645a *flash)
{}

static int as3645a_set_timeout(struct as3645a *flash)
{}

/**
 * as3645a_set_control - Set flash control register
 * @flash: The flash
 * @mode: Desired output mode
 * @on: Desired output state
 *
 * Configure the hardware with output mode and state.
 *
 * Return 0 on success, or a negative error code if an I2C communication error
 * occurred.
 */
static int
as3645a_set_control(struct as3645a *flash, enum as_mode mode, bool on)
{}

static int as3645a_get_fault(struct led_classdev_flash *fled, u32 *fault)
{}

static unsigned int __as3645a_current_to_reg(unsigned int min, unsigned int max,
					     unsigned int step,
					     unsigned int val)
{}

static unsigned int as3645a_current_to_reg(struct as3645a *flash, bool is_flash,
					   unsigned int ua)
{}

static int as3645a_set_indicator_brightness(struct led_classdev *iled_cdev,
					    enum led_brightness brightness)
{}

static int as3645a_set_assist_brightness(struct led_classdev *fled_cdev,
					 enum led_brightness brightness)
{}

static int as3645a_set_flash_brightness(struct led_classdev_flash *fled,
					u32 brightness_ua)
{}

static int as3645a_set_flash_timeout(struct led_classdev_flash *fled,
				     u32 timeout_us)
{}

static int as3645a_set_strobe(struct led_classdev_flash *fled, bool state)
{}

static const struct led_flash_ops as3645a_led_flash_ops =;

static int as3645a_setup(struct as3645a *flash)
{}

static int as3645a_detect(struct as3645a *flash)
{}

static int as3645a_parse_node(struct device *dev, struct as3645a *flash)
{}

static int as3645a_led_class_setup(struct as3645a *flash)
{}

static int as3645a_v4l2_setup(struct as3645a *flash)
{}

static int as3645a_probe(struct i2c_client *client)
{}

static void as3645a_remove(struct i2c_client *client)
{}

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

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

static struct i2c_driver as3645a_i2c_driver =;

module_i2c_driver();

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