linux/drivers/leds/leds-lm3533.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * leds-lm3533.c -- LM3533 LED driver
 *
 * Copyright (C) 2011-2012 Texas Instruments
 *
 * Author: Johan Hovold <[email protected]>
 */

#include <linux/module.h>
#include <linux/leds.h>
#include <linux/mfd/core.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/slab.h>

#include <linux/mfd/lm3533.h>


#define LM3533_LVCTRLBANK_MIN
#define LM3533_LVCTRLBANK_MAX
#define LM3533_LVCTRLBANK_COUNT
#define LM3533_RISEFALLTIME_MAX
#define LM3533_ALS_CHANNEL_LV_MIN
#define LM3533_ALS_CHANNEL_LV_MAX

#define LM3533_REG_CTRLBANK_BCONF_BASE
#define LM3533_REG_PATTERN_ENABLE
#define LM3533_REG_PATTERN_LOW_TIME_BASE
#define LM3533_REG_PATTERN_HIGH_TIME_BASE
#define LM3533_REG_PATTERN_RISETIME_BASE
#define LM3533_REG_PATTERN_FALLTIME_BASE

#define LM3533_REG_PATTERN_STEP

#define LM3533_REG_CTRLBANK_BCONF_MAPPING_MASK
#define LM3533_REG_CTRLBANK_BCONF_ALS_EN_MASK
#define LM3533_REG_CTRLBANK_BCONF_ALS_CHANNEL_MASK

#define LM3533_LED_FLAG_PATTERN_ENABLE


struct lm3533_led {};


static inline struct lm3533_led *to_lm3533_led(struct led_classdev *cdev)
{}

static inline int lm3533_led_get_ctrlbank_id(struct lm3533_led *led)
{}

static inline u8 lm3533_led_get_lv_reg(struct lm3533_led *led, u8 base)
{}

static inline u8 lm3533_led_get_pattern(struct lm3533_led *led)
{}

static inline u8 lm3533_led_get_pattern_reg(struct lm3533_led *led,
								u8 base)
{}

static int lm3533_led_pattern_enable(struct lm3533_led *led, int enable)
{}

static int lm3533_led_set(struct led_classdev *cdev,
						enum led_brightness value)
{}

static enum led_brightness lm3533_led_get(struct led_classdev *cdev)
{}

/* Pattern generator defines (delays in us). */
#define LM3533_LED_DELAY1_VMIN
#define LM3533_LED_DELAY2_VMIN
#define LM3533_LED_DELAY3_VMIN

#define LM3533_LED_DELAY1_VMAX
#define LM3533_LED_DELAY2_VMAX
#define LM3533_LED_DELAY3_VMAX

#define LM3533_LED_DELAY1_TMIN
#define LM3533_LED_DELAY2_TMIN
#define LM3533_LED_DELAY3_TMIN

#define LM3533_LED_DELAY1_TMAX
#define LM3533_LED_DELAY2_TMAX
#define LM3533_LED_DELAY3_TMAX

/* t_step = (t_max - t_min) / (v_max - v_min) */
#define LM3533_LED_DELAY1_TSTEP
#define LM3533_LED_DELAY2_TSTEP
#define LM3533_LED_DELAY3_TSTEP

/* Delay limits for hardware accelerated blinking (in ms). */
#define LM3533_LED_DELAY_ON_MAX
#define LM3533_LED_DELAY_OFF_MAX

/*
 * Returns linear map of *t from [t_min,t_max] to [v_min,v_max] with a step
 * size of t_step, where
 *
 *	t_step = (t_max - t_min) / (v_max - v_min)
 *
 * and updates *t to reflect the mapped value.
 */
static u8 time_to_val(unsigned *t, unsigned t_min, unsigned t_step,
							u8 v_min, u8 v_max)
{}

/*
 * Returns time code corresponding to *delay (in ms) and updates *delay to
 * reflect actual hardware delay.
 *
 * Hardware supports 256 discrete delay times, divided into three groups with
 * the following ranges and step-sizes:
 *
 *	[   16,   999]	[0x00, 0x3e]	step  16 ms
 *	[ 1130,  9781]	[0x3d, 0x7f]	step 131 ms
 *	[10306, 76890]	[0x80, 0xff]	step 524 ms
 *
 * Note that delay group 3 is only available for delay_off.
 */
static u8 lm3533_led_get_hw_delay(unsigned *delay)
{}

/*
 * Set delay register base to *delay (in ms) and update *delay to reflect
 * actual hardware delay used.
 */
static u8 lm3533_led_delay_set(struct lm3533_led *led, u8 base,
							unsigned long *delay)
{}

static int lm3533_led_delay_on_set(struct lm3533_led *led, unsigned long *t)
{}

static int lm3533_led_delay_off_set(struct lm3533_led *led, unsigned long *t)
{}

static int lm3533_led_blink_set(struct led_classdev *cdev,
				unsigned long *delay_on,
				unsigned long *delay_off)
{}

static ssize_t show_id(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

/*
 * Pattern generator rise/fall times:
 *
 *   0 - 2048 us (default)
 *   1 - 262 ms
 *   2 - 524 ms
 *   3 - 1.049 s
 *   4 - 2.097 s
 *   5 - 4.194 s
 *   6 - 8.389 s
 *   7 - 16.78 s
 */
static ssize_t show_risefalltime(struct device *dev,
					struct device_attribute *attr,
					char *buf, u8 base)
{}

static ssize_t show_risetime(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static ssize_t show_falltime(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static ssize_t store_risefalltime(struct device *dev,
					struct device_attribute *attr,
					const char *buf, size_t len, u8 base)
{}

static ssize_t store_risetime(struct device *dev,
					struct device_attribute *attr,
					const char *buf, size_t len)
{}

static ssize_t store_falltime(struct device *dev,
					struct device_attribute *attr,
					const char *buf, size_t len)
{}

static ssize_t show_als_channel(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static ssize_t store_als_channel(struct device *dev,
					struct device_attribute *attr,
					const char *buf, size_t len)
{}

static ssize_t show_als_en(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static ssize_t store_als_en(struct device *dev,
					struct device_attribute *attr,
					const char *buf, size_t len)
{}

static ssize_t show_linear(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static ssize_t store_linear(struct device *dev,
					struct device_attribute *attr,
					const char *buf, size_t len)
{}

static ssize_t show_pwm(struct device *dev,
					struct device_attribute *attr,
					char *buf)
{}

static ssize_t store_pwm(struct device *dev,
					struct device_attribute *attr,
					const char *buf, size_t len)
{}

static LM3533_ATTR_RW(als_channel);
static LM3533_ATTR_RW(als_en);
static LM3533_ATTR_RW(falltime);
static LM3533_ATTR_RO(id);
static LM3533_ATTR_RW(linear);
static LM3533_ATTR_RW(pwm);
static LM3533_ATTR_RW(risetime);

static struct attribute *lm3533_led_attributes[] =;

static umode_t lm3533_led_attr_is_visible(struct kobject *kobj,
					     struct attribute *attr, int n)
{
	struct device *dev = kobj_to_dev(kobj);
	struct led_classdev *led_cdev = dev_get_drvdata(dev);
	struct lm3533_led *led = to_lm3533_led(led_cdev);
	umode_t mode = attr->mode;

	if (attr == &dev_attr_als_channel.attr ||
					attr == &dev_attr_als_en.attr) {
		if (!led->lm3533->have_als)
			mode = 0;
	}

	return mode;
};

static const struct attribute_group lm3533_led_attribute_group =;

static const struct attribute_group *lm3533_led_attribute_groups[] =;

static int lm3533_led_setup(struct lm3533_led *led,
					struct lm3533_led_platform_data *pdata)
{}

static int lm3533_led_probe(struct platform_device *pdev)
{}

static void lm3533_led_remove(struct platform_device *pdev)
{}

static void lm3533_led_shutdown(struct platform_device *pdev)
{}

static struct platform_driver lm3533_led_driver =;
module_platform_driver();

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