linux/drivers/leds/rgb/leds-ktd202x.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Kinetic KTD2026/7 RGB/White LED driver with I2C interface
 *
 * Copyright 2023 André Apitzsch <[email protected]>
 *
 * Datasheet: https://www.kinet-ic.com/uploads/KTD2026-7-04h.pdf
 */

#include <linux/i2c.h>
#include <linux/led-class-multicolor.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>

#define KTD2026_NUM_LEDS
#define KTD2027_NUM_LEDS
#define KTD202X_MAX_LEDS

/* Register bank */
#define KTD202X_REG_RESET_CONTROL
#define KTD202X_REG_FLASH_PERIOD
#define KTD202X_REG_PWM1_TIMER
#define KTD202X_REG_PWM2_TIMER
#define KTD202X_REG_CHANNEL_CTRL
#define KTD202X_REG_TRISE_FALL
#define KTD202X_REG_LED_IOUT(x)

/* Register 0 */
#define KTD202X_TIMER_SLOT_CONTROL_TSLOT1
#define KTD202X_TIMER_SLOT_CONTROL_TSLOT2
#define KTD202X_TIMER_SLOT_CONTROL_TSLOT3
#define KTD202X_TIMER_SLOT_CONTROL_TSLOT4
#define KTD202X_RSTR_RESET

#define KTD202X_ENABLE_CTRL_WAKE
#define KTD202X_ENABLE_CTRL_SLEEP

#define KTD202X_TRISE_FALL_SCALE_NORMAL
#define KTD202X_TRISE_FALL_SCALE_SLOW_X2
#define KTD202X_TRISE_FALL_SCALE_SLOW_X4
#define KTD202X_TRISE_FALL_SCALE_FAST_X8

/* Register 1 */
#define KTD202X_FLASH_PERIOD_256_MS_LOG_RAMP

/* Register 2-3 */
#define KTD202X_FLASH_ON_TIME_0_4_PERCENT

/* Register 4 */
#define KTD202X_CHANNEL_CTRL_MASK(x)
#define KTD202X_CHANNEL_CTRL_OFF
#define KTD202X_CHANNEL_CTRL_ON(x)
#define KTD202X_CHANNEL_CTRL_PWM1(x)
#define KTD202X_CHANNEL_CTRL_PWM2(x)

/* Register 5 */
#define KTD202X_RAMP_TIMES_2_MS

/* Register 6-9 */
#define KTD202X_LED_CURRENT_10_mA

#define KTD202X_FLASH_PERIOD_MIN_MS
#define KTD202X_FLASH_PERIOD_STEP_MS
#define KTD202X_FLASH_PERIOD_MAX_STEPS
#define KTD202X_FLASH_ON_MAX

#define KTD202X_MAX_BRIGHTNESS

static const struct reg_default ktd202x_reg_defaults[] =;

struct ktd202x_led {};

struct ktd202x {};

static int ktd202x_chip_disable(struct ktd202x *chip)
{}

static int ktd202x_chip_enable(struct ktd202x *chip)
{}

static bool ktd202x_chip_in_use(struct ktd202x *chip)
{}

static int ktd202x_brightness_set(struct ktd202x_led *led,
				  struct mc_subled *subleds,
				  unsigned int num_channels)
{}

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

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

static int ktd202x_blink_set(struct ktd202x_led *led, unsigned long *delay_on,
			     unsigned long *delay_off, struct mc_subled *subleds,
			     unsigned int num_channels)
{}

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

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

static int ktd202x_setup_led_rgb(struct ktd202x *chip, struct fwnode_handle *fwnode,
				 struct ktd202x_led *led, struct led_init_data *init_data)
{}

static int ktd202x_setup_led_single(struct ktd202x *chip, struct fwnode_handle *fwnode,
				    struct ktd202x_led *led, struct led_init_data *init_data)
{}

static int ktd202x_add_led(struct ktd202x *chip, struct fwnode_handle *fwnode, unsigned int index)
{}

static int ktd202x_probe_fw(struct ktd202x *chip)
{}

static const struct regmap_config ktd202x_regmap_config =;

static int ktd202x_probe(struct i2c_client *client)
{}

static void ktd202x_remove(struct i2c_client *client)
{}

static void ktd202x_shutdown(struct i2c_client *client)
{}

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

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

static struct i2c_driver ktd202x_driver =;
module_i2c_driver();

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