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

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/leds.h>
#include <linux/led-class-flash.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <media/v4l2-flash-led-class.h>

/* registers definitions */
#define FLASH_REVISION_REG
#define FLASH_4CH_REVISION_V0P1

#define FLASH_TYPE_REG
#define FLASH_TYPE_VAL

#define FLASH_SUBTYPE_REG
#define FLASH_SUBTYPE_3CH_PM8150_VAL
#define FLASH_SUBTYPE_3CH_PMI8998_VAL
#define FLASH_SUBTYPE_4CH_VAL

#define FLASH_STS_3CH_OTST1
#define FLASH_STS_3CH_OTST2
#define FLASH_STS_3CH_OTST3
#define FLASH_STS_3CH_BOB_THM_OVERLOAD
#define FLASH_STS_3CH_VPH_DROOP
#define FLASH_STS_3CH_BOB_ILIM_S1
#define FLASH_STS_3CH_BOB_ILIM_S2
#define FLASH_STS_3CH_BCL_IBAT

#define FLASH_STS_4CH_VPH_LOW
#define FLASH_STS_4CH_BCL_IBAT
#define FLASH_STS_4CH_BOB_ILIM_S1
#define FLASH_STS_4CH_BOB_ILIM_S2
#define FLASH_STS_4CH_OTST2
#define FLASH_STS_4CH_OTST1
#define FLASH_STS_4CHG_BOB_THM_OVERLOAD

#define FLASH_TIMER_EN_BIT
#define FLASH_TIMER_VAL_MASK
#define FLASH_TIMER_STEP_MS

#define FLASH_STROBE_HW_SW_SEL_BIT
#define SW_STROBE_VAL
#define HW_STROBE_VAL
#define FLASH_HW_STROBE_TRIGGER_SEL_BIT
#define STROBE_LEVEL_TRIGGER_VAL
#define STROBE_EDGE_TRIGGER_VAL
#define FLASH_STROBE_POLARITY_BIT
#define STROBE_ACTIVE_HIGH_VAL

#define FLASH_IRES_MASK_4CH
#define FLASH_IRES_MASK_3CH
#define FLASH_IRES_12P5MA_VAL
#define FLASH_IRES_5MA_VAL_4CH
#define FLASH_IRES_5MA_VAL_3CH

/* constants */
#define FLASH_CURRENT_MAX_UA
#define TORCH_CURRENT_MAX_UA
#define FLASH_TOTAL_CURRENT_MAX_UA
#define FLASH_CURRENT_DEFAULT_UA
#define TORCH_CURRENT_DEFAULT_UA

#define TORCH_IRES_UA
#define FLASH_IRES_UA

#define FLASH_TIMEOUT_MAX_US
#define FLASH_TIMEOUT_STEP_US

#define UA_PER_MA

/* thermal threshold constants */
#define OTST_3CH_MIN_VAL
#define OTST1_4CH_MIN_VAL
#define OTST1_4CH_V0P1_MIN_VAL
#define OTST2_4CH_MIN_VAL

#define OTST1_MAX_CURRENT_MA
#define OTST2_MAX_CURRENT_MA
#define OTST3_MAX_CURRENT_MA

enum hw_type {};

enum led_mode {};

enum led_strobe {};

enum {};

static struct reg_field mvflash_3ch_regs[REG_MAX_COUNT] =;

static struct reg_field mvflash_4ch_regs[REG_MAX_COUNT] =;

struct qcom_flash_data {};

struct qcom_flash_led {};

static int set_flash_module_en(struct qcom_flash_led *led, bool en)
{}

static int update_allowed_flash_current(struct qcom_flash_led *led, u32 *current_ma, bool strobe)
{}

static int set_flash_current(struct qcom_flash_led *led, u32 current_ma, enum led_mode mode)
{}

static int set_flash_timeout(struct qcom_flash_led *led, u32 timeout_ms)
{}

static int set_flash_strobe(struct qcom_flash_led *led, enum led_strobe strobe, bool state)
{}

static inline struct qcom_flash_led *flcdev_to_qcom_fled(struct led_classdev_flash *flcdev)
{}

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

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

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

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

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

static int qcom_flash_led_brightness_set(struct led_classdev *led_cdev,
					enum led_brightness brightness)
{}

static const struct led_flash_ops qcom_flash_ops =;

#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
static int qcom_flash_external_strobe_set(struct v4l2_flash *v4l2_flash, bool enable)
{}

static enum led_brightness
qcom_flash_intensity_to_led_brightness(struct v4l2_flash *v4l2_flash, s32 intensity)
{}

static s32 qcom_flash_brightness_to_led_intensity(struct v4l2_flash *v4l2_flash,
					enum led_brightness brightness)
{}

static const struct v4l2_flash_ops qcom_v4l2_flash_ops =;

static int
qcom_flash_v4l2_init(struct device *dev, struct qcom_flash_led *led, struct fwnode_handle *fwnode)
{}
# else
static int
qcom_flash_v4l2_init(struct device *dev, struct qcom_flash_led *led, struct fwnode_handle *fwnode)
{
	return 0;
}
#endif

static int qcom_flash_register_led_device(struct device *dev,
		struct fwnode_handle *node, struct qcom_flash_led *led)
{}

static int qcom_flash_led_probe(struct platform_device *pdev)
{}

static void qcom_flash_led_remove(struct platform_device *pdev)
{}

static const struct of_device_id qcom_flash_led_match_table[] =;

MODULE_DEVICE_TABLE(of, qcom_flash_led_match_table);
static struct platform_driver qcom_flash_led_driver =;

module_platform_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();