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

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * LED driver for Richtek RT8515 flash/torch white LEDs
 * found on some Samsung mobile phones.
 *
 * This is a 1.5A Boost dual channel driver produced around 2011.
 *
 * The component lacks a datasheet, but in the schematic picture
 * from the LG P970 service manual you can see the connections
 * from the RT8515 to the LED, with two resistors connected
 * from the pins "RFS" and "RTS" to ground.
 *
 * On the LG P970:
 * RFS (resistance flash setting?) is 20 kOhm
 * RTS (resistance torch setting?) is 39 kOhm
 *
 * Some sleuthing finds us the RT9387A which we have a datasheet for:
 * https://static5.arrow.com/pdfs/2014/7/27/8/21/12/794/rtt_/manual/94download_ds.jspprt9387a.jspprt9387a.pdf
 * This apparently works the same way so in theory this driver
 * should cover RT9387A as well. This has not been tested, please
 * update the compatibles if you add RT9387A support.
 *
 * Linus Walleij <[email protected]>
 */
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/led-class-flash.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>

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

/* We can provide 15-700 mA out to the LED */
#define RT8515_MIN_IOUT_MA
#define RT8515_MAX_IOUT_MA
/* The maximum intensity is 1-16 for flash and 1-100 for torch */
#define RT8515_FLASH_MAX
#define RT8515_TORCH_MAX

#define RT8515_TIMEOUT_US
#define RT8515_MAX_TIMEOUT_US

struct rt8515 {};

static struct rt8515 *to_rt8515(struct led_classdev_flash *fled)
{}

static void rt8515_gpio_led_off(struct rt8515 *rt)
{}

static void rt8515_gpio_brightness_commit(struct gpio_desc *gpiod,
					  int brightness)
{}

/* This is setting the torch light level */
static int rt8515_led_brightness_set(struct led_classdev *led,
				     enum led_brightness brightness)
{}

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

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

static int rt8515_led_flash_timeout_set(struct led_classdev_flash *fled,
					u32 timeout)
{}

static const struct led_flash_ops rt8515_flash_ops =;

static void rt8515_powerdown_timer(struct timer_list *t)
{}

static void rt8515_init_flash_timeout(struct rt8515 *rt)
{}

#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
/* Configure the V2L2 flash subdevice */
static void rt8515_init_v4l2_flash_config(struct rt8515 *rt,
					  struct v4l2_flash_config *v4l2_sd_cfg)
{}

static void rt8515_v4l2_flash_release(struct rt8515 *rt)
{}

#else
static void rt8515_init_v4l2_flash_config(struct rt8515 *rt,
					  struct v4l2_flash_config *v4l2_sd_cfg)
{
}

static void rt8515_v4l2_flash_release(struct rt8515 *rt)
{
}
#endif

static void rt8515_determine_max_intensity(struct rt8515 *rt,
					   struct fwnode_handle *led,
					   const char *resistance,
					   const char *max_ua_prop, int hw_max,
					   int *max_intensity_setting)
{}

static int rt8515_probe(struct platform_device *pdev)
{}

static void rt8515_remove(struct platform_device *pdev)
{}

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

static struct platform_driver rt8515_driver =;
module_platform_driver();

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