mirror of
https://github.com/AetherDroid/android_kernel_samsung_on5xelte.git
synced 2025-09-07 00:38:05 -04:00
171 lines
4 KiB
C
171 lines
4 KiB
C
/*
|
|
* leds-S2MU003.h - Flash-led driver for Samsung S2MU003
|
|
*
|
|
* Copyright (C) 2014 Samsung Electronics
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
*/
|
|
#ifndef __LEDS_S2MU003_H__
|
|
#define __LEDS_S2MU003_H__
|
|
|
|
#ifdef CONFIG_MUIC_NOTIFIER
|
|
#include <linux/muic/muic.h>
|
|
#include <linux/muic/muic_notifier.h>
|
|
#endif /* CONFIG_MUIC_NOTIFIER */
|
|
|
|
#define S2MU003_EN_CHANNEL_SHARE_MASK 0x80
|
|
|
|
#define S2MU003_FLASH_TORCH_CURRENT_MAX 0xF
|
|
#define S2MU003_TIMEOUT_MAX 0xF
|
|
|
|
#define S2MU003_BOOST_VOUT_FLASH_MASK 0x3F
|
|
|
|
#define S2MU003_FLASH_IOUT_MASK 0x3F
|
|
#define S2MU003_TORCH_IOUT_MASK 0x0F
|
|
|
|
#define S2MU003_FLASH_ON_I2C 0xC0
|
|
#define S2MU003_TORCH_ON_I2C 0x0C
|
|
|
|
#define S2MU003_FLASH_ON_GPIO 0x40
|
|
#define S2MU003_TORCH_ON_GPIO 0x08
|
|
|
|
#define S2MU003_FLASH_ENABLE_MASK 0xC0
|
|
#define S2MU003_TORCH_ENABLE_MASK 0x0C
|
|
|
|
#define S2MU003_FLASH_TORCH_OFF 0x00
|
|
#define S2MU003_BOOST_FLASH_MODE_MASK 0x04
|
|
|
|
enum s2mu003_led_id {
|
|
S2MU003_OFF,
|
|
S2MU003_FLASH_LED = 0,
|
|
S2MU003_TORCH_LED,
|
|
S2MU003_LED_MAX,
|
|
};
|
|
|
|
enum s2mu003_flash_current {
|
|
S2MU003_FLASH_OUT_I_100MA = 0x3,
|
|
S2MU003_FLASH_OUT_I_125MA,
|
|
S2MU003_FLASH_OUT_I_150MA,
|
|
S2MU003_FLASH_OUT_I_175MA,
|
|
S2MU003_FLASH_OUT_I_200MA,
|
|
S2MU003_FLASH_OUT_I_225MA,
|
|
S2MU003_FLASH_OUT_I_250MA,
|
|
S2MU003_FLASH_OUT_I_275MA,
|
|
S2MU003_FLASH_OUT_I_300MA,
|
|
S2MU003_FLASH_OUT_I_325MA,
|
|
S2MU003_FLASH_OUT_I_350MA,
|
|
S2MU003_FLASH_OUT_I_375MA,
|
|
S2MU003_FLASH_OUT_I_400MA,
|
|
S2MU003_FLASH_OUT_I_425MA,
|
|
S2MU003_FLASH_OUT_I_450MA,
|
|
S2MU003_FLASH_OUT_I_475MA,
|
|
S2MU003_FLASH_OUT_I_500MA,
|
|
S2MU003_FLASH_OUT_I_525MA,
|
|
S2MU003_FLASH_OUT_I_550MA,
|
|
S2MU003_FLASH_OUT_I_575MA,
|
|
S2MU003_FLASH_OUT_I_600MA,
|
|
S2MU003_FLASH_OUT_I_625MA,
|
|
S2MU003_FLASH_OUT_I_650MA,
|
|
S2MU003_FLASH_OUT_I_675MA,
|
|
S2MU003_FLASH_OUT_I_700MA,
|
|
S2MU003_FLASH_OUT_I_725MA,
|
|
S2MU003_FLASH_OUT_I_750MA,
|
|
S2MU003_FLASH_OUT_I_775MA,
|
|
S2MU003_FLASH_OUT_I_800MA,
|
|
S2MU003_FLASH_OUT_I_825MA,
|
|
S2MU003_FLASH_OUT_I_850MA,
|
|
S2MU003_FLASH_OUT_I_875MA,
|
|
S2MU003_FLASH_OUT_I_900MA,
|
|
S2MU003_FLASH_OUT_I_MAX,
|
|
};
|
|
|
|
enum s2mu003_torch_current {
|
|
S2MU003_TORCH_OUT_I_25MA,
|
|
S2MU003_TORCH_OUT_I_50MA,
|
|
S2MU003_TORCH_OUT_I_75MA,
|
|
S2MU003_TORCH_OUT_I_100MA,
|
|
S2MU003_TORCH_OUT_I_125MA,
|
|
S2MU003_TORCH_OUT_I_150MA,
|
|
S2MU003_TORCH_OUT_I_175MA,
|
|
S2MU003_TORCH_OUT_I_200MA,
|
|
S2MU003_TORCH_OUT_I_225MA,
|
|
S2MU003_TORCH_OUT_I_250MA,
|
|
S2MU003_TORCH_OUT_I_275MA,
|
|
S2MU003_TORCH_OUT_I_300MA,
|
|
S2MU003_TORCH_OUT_I_325MA,
|
|
S2MU003_TORCH_OUT_I_350MA,
|
|
S2MU003_TORCH_OUT_I_375MA,
|
|
S2MU003_TORCH_OUT_I_400MA,
|
|
S2MU003_TORCH_OUT_I_MAX,
|
|
};
|
|
|
|
enum s2mu003_flash_timeout {
|
|
S2MU003_FLASH_TIMEOUT_62MS,
|
|
S2MU003_FLASH_TIMEOUT_124MS,
|
|
S2MU003_FLASH_TIMEOUT_186MS,
|
|
S2MU003_FLASH_TIMEOUT_248MS,
|
|
S2MU003_FLASH_TIMEOUT_310MS,
|
|
S2MU003_FLASH_TIMEOUT_372MS,
|
|
S2MU003_FLASH_TIMEOUT_434MS,
|
|
S2MU003_FLASH_TIMEOUT_496MS,
|
|
S2MU003_FLASH_TIMEOUT_558MS,
|
|
S2MU003_FLASH_TIMEOUT_620MS,
|
|
S2MU003_FLASH_TIMEOUT_682MS,
|
|
S2MU003_FLASH_TIMEOUT_744MS,
|
|
S2MU003_FLASH_TIMEOUT_806MS,
|
|
S2MU003_FLASH_TIMEOUT_868MS,
|
|
S2MU003_FLASH_TIMEOUT_930MS,
|
|
S2MU003_FLASH_TIMEOUT_992MS,
|
|
S2MU003_FLASH_TIMEOUT_MAX,
|
|
};
|
|
|
|
|
|
enum s2mu003_torch_timeout {
|
|
S2MU003_TORCH_TIMEOUT_262MS,
|
|
S2MU003_TORCH_TIMEOUT_524MS,
|
|
S2MU003_TORCH_TIMEOUT_768MS,
|
|
S2MU003_TORCH_TIMEOUT_1048MS,
|
|
S2MU003_TORCH_TIMEOUT_1572MS,
|
|
S2MU003_TORCH_TIMEOUT_2096MS,
|
|
S2MU003_TORCH_TIMEOUT_2620MS,
|
|
S2MU003_TORCH_TIMEOUT_3144MS,
|
|
S2MU003_TORCH_TIMEOUT_4192MS,
|
|
S2MU003_TORCH_TIMEOUT_5242MS,
|
|
S2MU003_TORCH_TIMEOUT_6291MS,
|
|
S2MU003_TORCH_TIMEOUT_7340MS,
|
|
S2MU003_TORCH_TIMEOUT_9437MS,
|
|
S2MU003_TORCH_TIMEOUT_11534MS,
|
|
S2MU003_TORCH_TIMEOUT_13631MS,
|
|
S2MU003_TORCH_TIMEOUT_15728MS,
|
|
S2MU003_TORCH_TIMEOUT_MAX,
|
|
};
|
|
|
|
static u8 leds_cur_max[] = {
|
|
S2MU003_FLASH_OUT_I_900MA,
|
|
S2MU003_TORCH_OUT_I_400MA,
|
|
};
|
|
|
|
static u8 leds_time_max[] = {
|
|
S2MU003_FLASH_TIMEOUT_992MS,
|
|
S2MU003_TORCH_TIMEOUT_15728MS,
|
|
};
|
|
|
|
struct s2mu003_led {
|
|
const char *name;
|
|
int id;
|
|
int brightness;
|
|
int timeout;
|
|
int max_brightness;
|
|
};
|
|
|
|
struct s2mu003_fled_platform_data {
|
|
int num_leds;
|
|
struct s2mu003_led leds[S2MU003_LED_MAX];
|
|
int torch_pin;
|
|
int flash_pin;
|
|
};
|
|
|
|
#endif
|