linux/drivers/leds/leds-lp5569.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2024 Christian Marangi <[email protected]>
 */

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

#include "leds-lp55xx-common.h"

#define LP5569_MAX_LEDS

/* Memory is used like this:
 * 0x00 engine 1 program (4 pages)
 * 0x40 engine 2 program (4 pages)
 * 0x80 engine 3 program (4 pages)
 * 0xc0 engine 1 muxing info (1 page)
 * 0xd0 engine 2 muxing info (1 page)
 * 0xe0 engine 3 muxing info (1 page)
 */
#define LP5569_PAGES_PER_ENGINE

#define LP5569_REG_ENABLE
#define LP5569_ENABLE

#define LP5569_REG_EXEC_CTRL
#define LP5569_MODE_ENG_SHIFT

#define LP5569_REG_OP_MODE
#define LP5569_EXEC_ENG_SHIFT

#define LP5569_REG_ENABLE_LEDS_MSB
#define LP5569_REG_ENABLE_LEDS_LSB
#define LP5569_REG_LED_CTRL_BASE
#define LP5569_FADER_MAPPING_MASK
#define LP5569_REG_LED_PWM_BASE
#define LP5569_REG_LED_CURRENT_BASE
#define LP5569_REG_MISC
#define LP5569_AUTO_INC
#define LP5569_PWR_SAVE
#define LP5569_CP_MODE_MASK
#define LP5569_PWM_PWR_SAVE
#define LP5569_INTERNAL_CLK
#define LP5569_REG_MISC2
#define LP5569_LED_SHORT_TEST
#define LP5569_LED_OPEN_TEST
#define LP5569_REG_STATUS
#define LP5569_MASK_BUSY
#define LP5569_STARTUP_BUSY
#define LP5569_ENGINE_BUSY
#define LP5569_ENGINE1_INT
#define LP5569_ENGINE2_INT
#define LP5569_ENGINE3_INT
#define LP5569_ENG_STATUS_MASK
#define LP5569_REG_IO_CONTROL
#define LP5569_CLK_OUTPUT
#define LP5569_REG_RESET
#define LP5569_RESET
#define LP5569_REG_MASTER_FADER_BASE
#define LP5569_REG_CH1_PROG_START
#define LP5569_REG_CH2_PROG_START
#define LP5569_REG_CH3_PROG_START
#define LP5569_REG_PROG_PAGE_SEL
#define LP5569_REG_PROG_MEM
#define LP5569_REG_LED_FAULT1
#define LP5569_LED_FAULT8
#define LP5569_REG_LED_FAULT2
#define LP5569_LED_FAULT7
#define LP5569_LED_FAULT6
#define LP5569_LED_FAULT5
#define LP5569_LED_FAULT4
#define LP5569_LED_FAULT3
#define LP5569_LED_FAULT2
#define LP5569_LED_FAULT1
#define LP5569_LED_FAULT0

#define LP5569_ENG1_PROG_ADDR
#define LP5569_ENG2_PROG_ADDR
#define LP5569_ENG3_PROG_ADDR
#define LP5569_ENG1_MUX_ADDR
#define LP5569_ENG2_MUX_ADDR
#define LP5569_ENG3_MUX_ADDR

#define LP5569_STARTUP_SLEEP

#define LEDn_STATUS_FAULT(n, status)

#define LP5569_DEFAULT_CONFIG

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

static int lp5569_init_program_engine(struct lp55xx_chip *chip)
{}

static int lp5569_post_init_device(struct lp55xx_chip *chip)
{}

static ssize_t lp5569_led_open_test(struct lp55xx_led *led, char *buf)
{}

static ssize_t lp5569_led_short_test(struct lp55xx_led *led, char *buf)
{}

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

LP55XX_DEV_ATTR_ENGINE_MODE();
LP55XX_DEV_ATTR_ENGINE_MODE();
LP55XX_DEV_ATTR_ENGINE_MODE();
LP55XX_DEV_ATTR_ENGINE_LEDS();
LP55XX_DEV_ATTR_ENGINE_LEDS();
LP55XX_DEV_ATTR_ENGINE_LEDS();
LP55XX_DEV_ATTR_ENGINE_LOAD();
LP55XX_DEV_ATTR_ENGINE_LOAD();
LP55XX_DEV_ATTR_ENGINE_LOAD();
static LP55XX_DEV_ATTR_RO(selftest, lp5569_selftest);
LP55XX_DEV_ATTR_MASTER_FADER();
LP55XX_DEV_ATTR_MASTER_FADER();
LP55XX_DEV_ATTR_MASTER_FADER();
static LP55XX_DEV_ATTR_RW(master_fader_leds, lp55xx_show_master_fader_leds,
			  lp55xx_store_master_fader_leds);

static struct attribute *lp5569_attributes[] =;

static const struct attribute_group lp5569_group =;

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

static const struct i2c_device_id lp5569_id[] =;

MODULE_DEVICE_TABLE(i2c, lp5569_id);

static const struct of_device_id of_lp5569_leds_match[] =;

MODULE_DEVICE_TABLE(of, of_lp5569_leds_match);

static struct i2c_driver lp5569_driver =;

module_i2c_driver();

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