linux/drivers/leds/leds-lp3944.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * leds-lp3944.c - driver for National Semiconductor LP3944 Funlight Chip
 *
 * Copyright (C) 2009 Antonio Ospite <[email protected]>
 */

/*
 * I2C driver for National Semiconductor LP3944 Funlight Chip
 * http://www.national.com/pf/LP/LP3944.html
 *
 * This helper chip can drive up to 8 leds, with two programmable DIM modes;
 * it could even be used as a gpio expander but this driver assumes it is used
 * as a led controller.
 *
 * The DIM modes are used to set _blink_ patterns for leds, the pattern is
 * specified supplying two parameters:
 *   - period: from 0s to 1.6s
 *   - duty cycle: percentage of the period the led is on, from 0 to 100
 *
 * LP3944 can be found on Motorola A910 smartphone, where it drives the rgb
 * leds, the camera flash light and the displays backlights.
 */

#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/leds.h>
#include <linux/mutex.h>
#include <linux/leds-lp3944.h>

/* Read Only Registers */
#define LP3944_REG_INPUT1
#define LP3944_REG_REGISTER1

#define LP3944_REG_PSC0
#define LP3944_REG_PWM0
#define LP3944_REG_PSC1
#define LP3944_REG_PWM1
#define LP3944_REG_LS0
#define LP3944_REG_LS1

/* These registers are not used to control leds in LP3944, they can store
 * arbitrary values which the chip will ignore.
 */
#define LP3944_REG_REGISTER8
#define LP3944_REG_REGISTER9

#define LP3944_DIM0
#define LP3944_DIM1

/* period in ms */
#define LP3944_PERIOD_MIN
#define LP3944_PERIOD_MAX

/* duty cycle is a percentage */
#define LP3944_DUTY_CYCLE_MIN
#define LP3944_DUTY_CYCLE_MAX

#define ldev_to_led(c)

/* Saved data */
struct lp3944_led_data {};

struct lp3944_data {};

static int lp3944_reg_read(struct i2c_client *client, u8 reg, u8 *value)
{}

static int lp3944_reg_write(struct i2c_client *client, u8 reg, u8 value)
{}

/**
 * lp3944_dim_set_period() - Set the period for DIM status
 *
 * @client: the i2c client
 * @dim: either LP3944_DIM0 or LP3944_DIM1
 * @period: period of a blink, that is a on/off cycle, expressed in ms.
 */
static int lp3944_dim_set_period(struct i2c_client *client, u8 dim, u16 period)
{}

/**
 * lp3944_dim_set_dutycycle - Set the duty cycle for DIM status
 *
 * @client: the i2c client
 * @dim: either LP3944_DIM0 or LP3944_DIM1
 * @duty_cycle: percentage of a period during which a led is ON
 */
static int lp3944_dim_set_dutycycle(struct i2c_client *client, u8 dim,
				    u8 duty_cycle)
{}

/**
 * lp3944_led_set() - Set the led status
 *
 * @led: a lp3944_led_data structure
 * @status: one of LP3944_LED_STATUS_OFF
 *                 LP3944_LED_STATUS_ON
 *                 LP3944_LED_STATUS_DIM0
 *                 LP3944_LED_STATUS_DIM1
 */
static int lp3944_led_set(struct lp3944_led_data *led, u8 status)
{}

static int lp3944_led_set_blink(struct led_classdev *led_cdev,
				unsigned long *delay_on,
				unsigned long *delay_off)
{}

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

static int lp3944_configure(struct i2c_client *client,
			    struct lp3944_data *data,
			    struct lp3944_platform_data *pdata)
{}

static int lp3944_probe(struct i2c_client *client)
{}

static void lp3944_remove(struct i2c_client *client)
{}

/* lp3944 i2c driver struct */
static const struct i2c_device_id lp3944_id[] =;

MODULE_DEVICE_TABLE(i2c, lp3944_id);

static struct i2c_driver lp3944_driver =;

module_i2c_driver();

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