linux/drivers/leds/leds-lp5521.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * LP5521 LED chip driver.
 *
 * Copyright (C) 2010 Nokia Corporation
 * Copyright (C) 2012 Texas Instruments
 *
 * Contact: Samu Onkalo <[email protected]>
 *          Milo(Woogyom) Kim <[email protected]>
 */

#include <linux/cleanup.h>
#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/i2c.h>
#include <linux/leds.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/platform_data/leds-lp55xx.h>
#include <linux/slab.h>
#include <linux/of.h>

#include "leds-lp55xx-common.h"

#define LP5521_MAX_LEDS
#define LP5521_CMD_DIRECT

/* Registers */
#define LP5521_REG_ENABLE
#define LP5521_REG_OP_MODE
#define LP5521_REG_R_PWM
#define LP5521_REG_G_PWM
#define LP5521_REG_B_PWM
#define LP5521_REG_R_CURRENT
#define LP5521_REG_G_CURRENT
#define LP5521_REG_B_CURRENT
#define LP5521_REG_CONFIG
#define LP5521_REG_STATUS
#define LP5521_REG_RESET
#define LP5521_REG_R_PROG_MEM
#define LP5521_REG_G_PROG_MEM
#define LP5521_REG_B_PROG_MEM

/* Base register to set LED current */
#define LP5521_REG_LED_CURRENT_BASE
/* Base register to set the brightness */
#define LP5521_REG_LED_PWM_BASE

/* Bits in ENABLE register */
#define LP5521_MASTER_ENABLE
#define LP5521_LOGARITHMIC_PWM
#define LP5521_EXEC_RUN
#define LP5521_ENABLE_DEFAULT
#define LP5521_ENABLE_RUN_PROGRAM

/* CONFIG register */
#define LP5521_PWM_HF
#define LP5521_PWRSAVE_EN
#define LP5521_CP_MODE_MASK
#define LP5521_CP_MODE_SHIFT
#define LP5521_R_TO_BATT
#define LP5521_CLK_INT
#define LP5521_DEFAULT_CFG

/* Status */
#define LP5521_EXT_CLK_USED

/* default R channel current register value */
#define LP5521_REG_R_CURR_DEFAULT

/* Reset register value */
#define LP5521_RESET

static inline void lp5521_wait_opmode_done(void)
{}

static inline void lp5521_wait_enable_done(void)
{}

static void lp5521_run_engine(struct lp55xx_chip *chip, bool start)
{}

static int lp5521_post_init_device(struct lp55xx_chip *chip)
{}

static int lp5521_run_selftest(struct lp55xx_chip *chip, char *buf)
{}

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

/* device attributes */
LP55XX_DEV_ATTR_ENGINE_MODE();
LP55XX_DEV_ATTR_ENGINE_MODE();
LP55XX_DEV_ATTR_ENGINE_MODE();
LP55XX_DEV_ATTR_ENGINE_LOAD();
LP55XX_DEV_ATTR_ENGINE_LOAD();
LP55XX_DEV_ATTR_ENGINE_LOAD();
static LP55XX_DEV_ATTR_RO(selftest, lp5521_selftest);

static struct attribute *lp5521_attributes[] =;

static const struct attribute_group lp5521_group =;

/* Chip specific configurations */
static struct lp55xx_device_config lp5521_cfg =;

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

static const struct of_device_id of_lp5521_leds_match[] =;

MODULE_DEVICE_TABLE(of, of_lp5521_leds_match);

static struct i2c_driver lp5521_driver =;

module_i2c_driver();

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