linux/drivers/leds/leds-lm3530.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2011 ST-Ericsson SA.
 * Copyright (C) 2009 Motorola, Inc.
 *
 * Simple driver for National Semiconductor LM3530 Backlight driver chip
 *
 * Author: Shreshtha Kumar SAHU <[email protected]>
 * based on leds-lm3530.c by Dan Murphy <[email protected]>
 */

#include <linux/i2c.h>
#include <linux/leds.h>
#include <linux/slab.h>
#include <linux/platform_device.h>
#include <linux/input.h>
#include <linux/led-lm3530.h>
#include <linux/types.h>
#include <linux/regulator/consumer.h>
#include <linux/module.h>

#define LM3530_LED_DEV
#define LM3530_NAME

#define LM3530_GEN_CONFIG
#define LM3530_ALS_CONFIG
#define LM3530_BRT_RAMP_RATE
#define LM3530_ALS_IMP_SELECT
#define LM3530_BRT_CTRL_REG
#define LM3530_ALS_ZB0_REG
#define LM3530_ALS_ZB1_REG
#define LM3530_ALS_ZB2_REG
#define LM3530_ALS_ZB3_REG
#define LM3530_ALS_Z0T_REG
#define LM3530_ALS_Z1T_REG
#define LM3530_ALS_Z2T_REG
#define LM3530_ALS_Z3T_REG
#define LM3530_ALS_Z4T_REG
#define LM3530_REG_MAX

/* General Control Register */
#define LM3530_EN_I2C_SHIFT
#define LM3530_RAMP_LAW_SHIFT
#define LM3530_MAX_CURR_SHIFT
#define LM3530_EN_PWM_SHIFT
#define LM3530_PWM_POL_SHIFT
#define LM3530_EN_PWM_SIMPLE_SHIFT

#define LM3530_ENABLE_I2C
#define LM3530_ENABLE_PWM
#define LM3530_POL_LOW
#define LM3530_ENABLE_PWM_SIMPLE

/* ALS Config Register Options */
#define LM3530_ALS_AVG_TIME_SHIFT
#define LM3530_EN_ALS_SHIFT
#define LM3530_ALS_SEL_SHIFT

#define LM3530_ENABLE_ALS

/* Brightness Ramp Rate Register */
#define LM3530_BRT_RAMP_FALL_SHIFT
#define LM3530_BRT_RAMP_RISE_SHIFT

/* ALS Resistor Select */
#define LM3530_ALS1_IMP_SHIFT
#define LM3530_ALS2_IMP_SHIFT

/* Zone Boundary Register defaults */
#define LM3530_ALS_ZB_MAX
#define LM3530_ALS_WINDOW_mV
#define LM3530_ALS_OFFSET_mV

/* Zone Target Register defaults */
#define LM3530_DEF_ZT_0
#define LM3530_DEF_ZT_1
#define LM3530_DEF_ZT_2
#define LM3530_DEF_ZT_3
#define LM3530_DEF_ZT_4

/* 7 bits are used for the brightness : LM3530_BRT_CTRL_REG */
#define MAX_BRIGHTNESS

struct lm3530_mode_map {};

static struct lm3530_mode_map mode_map[] =;

/**
 * struct lm3530_data
 * @led_dev: led class device
 * @client: i2c client
 * @pdata: LM3530 platform data
 * @mode: mode of operation - manual, ALS, PWM
 * @regulator: regulator
 * @brightness: previous brightness value
 * @enable: regulator is enabled
 */
struct lm3530_data {};

/*
 * struct lm3530_als_data
 * @config  : value of ALS configuration register
 * @imp_sel : value of ALS resistor select register
 * @zone    : values of ALS ZB(Zone Boundary) registers
 */
struct lm3530_als_data {};

static const u8 lm3530_reg[LM3530_REG_MAX] =;

static int lm3530_get_mode_from_str(const char *str)
{}

static void lm3530_als_configure(struct lm3530_platform_data *pdata,
				struct lm3530_als_data *als)
{}

static int lm3530_led_enable(struct lm3530_data *drvdata)
{}

static void lm3530_led_disable(struct lm3530_data *drvdata)
{}

static int lm3530_init_registers(struct lm3530_data *drvdata)
{}

static void lm3530_brightness_set(struct led_classdev *led_cdev,
				     enum led_brightness brt_val)
{}

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

static ssize_t mode_store(struct device *dev, struct device_attribute
			  *attr, const char *buf, size_t size)
{}
static DEVICE_ATTR_RW(mode);

static struct attribute *lm3530_attrs[] =;
ATTRIBUTE_GROUPS();

static int lm3530_probe(struct i2c_client *client)
{}

static void lm3530_remove(struct i2c_client *client)
{}

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

static struct i2c_driver lm3530_i2c_driver =;

module_i2c_driver();

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