linux/drivers/leds/leds-cht-wcove.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Driver for LEDs connected to the Intel Cherry Trail Whiskey Cove PMIC
 *
 * Copyright 2019 Yauhen Kharuzhy <[email protected]>
 * Copyright 2023 Hans de Goede <[email protected]>
 *
 * Register info comes from the Lenovo Yoga Book Android opensource code
 * available from Lenovo. File lenovo_yb1_x90f_l_osc_201803.7z path in the 7z:
 * YB1_source_code/kernel/cht/drivers/misc/charger_gp_led.c
 */

#include <linux/kernel.h>
#include <linux/leds.h>
#include <linux/mfd/intel_soc_pmic.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/suspend.h>

#define CHT_WC_LED1_CTRL
#define CHT_WC_LED1_FSM
#define CHT_WC_LED1_PWM

#define CHT_WC_LED2_CTRL
#define CHT_WC_LED2_FSM
#define CHT_WC_LED2_PWM

#define CHT_WC_LED1_SWCTL
#define CHT_WC_LED1_ON

#define CHT_WC_LED2_ON
#define CHT_WC_LED_I_MA2_5
#define CHT_WC_LED_I_MASK

#define CHT_WC_LED_F_1_4_HZ
#define CHT_WC_LED_F_1_2_HZ
#define CHT_WC_LED_F_1_HZ
#define CHT_WC_LED_F_2_HZ
#define CHT_WC_LED_F_MASK

#define CHT_WC_LED_EFF_OFF
#define CHT_WC_LED_EFF_ON
#define CHT_WC_LED_EFF_BLINKING
#define CHT_WC_LED_EFF_BREATHING
#define CHT_WC_LED_EFF_MASK

#define CHT_WC_LED_COUNT

struct cht_wc_led_regs {};

struct cht_wc_led_saved_regs {};

struct cht_wc_led {};

struct cht_wc_leds {};

static const struct cht_wc_led_regs cht_wc_led_regs[CHT_WC_LED_COUNT] =;

static const char * const cht_wc_leds_names[CHT_WC_LED_COUNT] =;

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

static enum led_brightness cht_wc_leds_brightness_get(struct led_classdev *cdev)
{}

/* Return blinking period for given CTRL reg value */
static unsigned long cht_wc_leds_get_period(int ctrl)
{}

/*
 * Find suitable hardware blink mode for given period.
 * period < 750 ms - select 2 HZ
 * 750 ms <= period < 1500 ms - select 1 HZ
 * 1500 ms <= period < 3000 ms - select 1/2 HZ
 * 3000 ms <= period < 5000 ms - select 1/4 HZ
 * 5000 ms <= period - return -1
 */
static int cht_wc_leds_find_freq(unsigned long period)
{}

static int cht_wc_leds_set_effect(struct led_classdev *cdev,
				  unsigned long *delay_on,
				  unsigned long *delay_off,
				  u8 effect)
{}

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

static int cht_wc_leds_pattern_set(struct led_classdev *cdev,
				   struct led_pattern *pattern,
				   u32 len, int repeat)
{}

static int cht_wc_leds_pattern_clear(struct led_classdev *cdev)
{}

static int cht_wc_led_save_regs(struct cht_wc_led *led,
				struct cht_wc_led_saved_regs *saved_regs)
{}

static void cht_wc_led_restore_regs(struct cht_wc_led *led,
				    const struct cht_wc_led_saved_regs *saved_regs)
{}

static int cht_wc_leds_probe(struct platform_device *pdev)
{}

static void cht_wc_leds_remove(struct platform_device *pdev)
{}

static void cht_wc_leds_disable(struct platform_device *pdev)
{}

/* On suspend save current settings and turn LEDs off */
static int cht_wc_leds_suspend(struct device *dev)
{}

/* On resume restore the saved settings */
static int cht_wc_leds_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(cht_wc_leds_pm, cht_wc_leds_suspend, cht_wc_leds_resume);

static struct platform_driver cht_wc_leds_driver =;
module_platform_driver();

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