Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BLN fixup thanks to Derteufel and mialwe, added back THS latest commi…

…ts for testing, rand. stuff
  • Loading branch information...
commit 918e494b9190fc5811b6d93c238cc7b2be6af4fd 1 parent 4553a36
Etienne Juvigny Tk-Glitch authored
35 arch/arm/mach-s5pv210/aries-touchkey-led.c
View
@@ -15,10 +15,11 @@
#include <linux/init.h>
#include <linux/gpio.h>
#include <linux/earlysuspend.h>
-#include <linux/bln.h>
#include <asm/mach-types.h>
-#include "aries.h"
+#ifdef CONFIG_GENERIC_BLN
+#include <linux/bln.h>
+#endif
static int led_gpios[] = { 2, 3, 6, 7 };
@@ -29,6 +30,7 @@ static void aries_touchkey_led_onoff(int onoff)
for (i = 0; i < ARRAY_SIZE(led_gpios); i++)
gpio_direction_output(S5PV210_GPJ3(led_gpios[i]), !!onoff);
}
+
#ifdef CONFIG_GENERIC_BLN
static void aries_touchkey_bln_enable(void)
{
@@ -66,29 +68,44 @@ static int __init aries_init_touchkey_led(void)
{
int i;
int ret = 0;
- u32 gpio;
+
+#ifdef CONFIG_GENERIC_BLN
+ u32 gpio;
+#endif
if (!machine_is_aries() || system_rev < 0x10)
return 0;
for (i = 0; i < ARRAY_SIZE(led_gpios); i++) {
- gpio = S5PV210_GPJ3(led_gpios[i]);
- ret = gpio_request(gpio, "touchkey led");
+#ifdef CONFIG_GENERIC_BLN
+ gpio = S5PV210_GPJ3(led_gpios[i]);
+ ret = gpio_request(gpio, "touchkey led");
+ if (ret) {
+ pr_err("Failed to request touchkey led gpio %d\n", i);
+ goto err_req;
+ }
+ s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+ s3c_gpio_slp_cfgpin(gpio, S3C_GPIO_SLP_PREV);
+ s3c_gpio_slp_setpull_updown(gpio, S3C_GPIO_PULL_NONE);
+#else
+ ret = gpio_request(S5PV210_GPJ3(led_gpios[i]), "touchkey led");
if (ret) {
pr_err("Failed to request touchkey led gpio %d\n", i);
goto err_req;
}
- s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
- s3c_gpio_slp_cfgpin(gpio, S3C_GPIO_SLP_PREV);
- s3c_gpio_slp_setpull_updown(gpio, S3C_GPIO_PULL_NONE);
+ s3c_gpio_setpull(S5PV210_GPJ3(led_gpios[i]),
+ S3C_GPIO_PULL_NONE);
+#endif
}
aries_touchkey_led_onoff(1);
register_early_suspend(&early_suspend);
+
#ifdef CONFIG_GENERIC_BLN
- register_bln_implementation(&aries_touchkey_bln);
+ register_bln_implementation(&aries_touchkey_bln);
#endif
+
return 0;
err_req:
102 arch/arm/mach-s5pv210/mach-aries.c
View
@@ -3133,7 +3133,7 @@ static struct gpio_init_data aries_init_gpios[] = {
.pud = S3C_GPIO_PULL_NONE,
.drv = S3C_GPIO_DRVSTR_1X,
},
-
+
// GPE0 ----------------------------
{
.num = S5PV210_GPE0(0), // GPIO_CAM_PCLK
@@ -4226,6 +4226,12 @@ static unsigned int aries_sleep_gpio_table[][3] = {
{ S5PV210_GPA0(7), S3C_GPIO_SLP_OUT1, S3C_GPIO_PULL_NONE},
#endif
+
+
+
+
+
+
// GPA1 ---------------------------------------------------
{ S5PV210_GPA1(0), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_DOWN},
{ S5PV210_GPA1(1), S3C_GPIO_SLP_OUT0, S3C_GPIO_PULL_NONE},
@@ -4268,6 +4274,14 @@ static unsigned int aries_sleep_gpio_table[][3] = {
{ S5PV210_GPC0(3), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_NONE},
{ S5PV210_GPC0(4), S3C_GPIO_SLP_OUT0, S3C_GPIO_PULL_NONE},
+
+
+
+
+
+
+
+
// GPC1 ---------------------------------------------------
#if defined (CONFIG_SAMSUNG_CAPTIVATE)
{ S5PV210_GPC1(0), S3C_GPIO_SLP_OUT0, S3C_GPIO_PULL_NONE}, //GPIO_GPC10
@@ -4390,6 +4404,15 @@ static unsigned int aries_sleep_gpio_table[][3] = {
{ S5PV210_GPG1(5), S3C_GPIO_SLP_OUT1, S3C_GPIO_PULL_NONE}, //GPIO_WLAN_SDIO_D2
{ S5PV210_GPG1(6), S3C_GPIO_SLP_OUT1, S3C_GPIO_PULL_NONE}, //GPIO_WLAN_SDIO_D3
+
+
+
+
+
+
+
+
+
// GPG2 ---------------------------------------------------
{ S5PV210_GPG2(0), S3C_GPIO_SLP_OUT0, S3C_GPIO_PULL_NONE}, //GPIO_T_FLASH_CLK
{ S5PV210_GPG2(1), S3C_GPIO_SLP_OUT0, S3C_GPIO_PULL_NONE}, //GPIO_T_FLASH_CMD
@@ -4403,6 +4426,15 @@ static unsigned int aries_sleep_gpio_table[][3] = {
{ S5PV210_GPG2(5), S3C_GPIO_SLP_OUT0, S3C_GPIO_PULL_NONE}, //GPIO_T_FLASH_D2
{ S5PV210_GPG2(6), S3C_GPIO_SLP_OUT0, S3C_GPIO_PULL_NONE}, //GPIO_T_FLASH_D3
+
+
+
+
+
+
+
+
+
// GPG3 ---------------------------------------------------
#if defined (CONFIG_SAMSUNG_VIBRANT)
{ S5PV210_GPG3(0), S3C_GPIO_SLP_PREV, S3C_GPIO_PULL_UP},
@@ -4431,6 +4463,23 @@ static unsigned int aries_sleep_gpio_table[][3] = {
{ S5PV210_GPG3(6), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_DOWN}, //GPIO_GPG36
#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
/* Alive part ending and off part start*/
// GPI ----------------------------------------------------
{ S5PV210_GPI(0), S3C_GPIO_SLP_PREV, S3C_GPIO_PULL_NONE}, //GPIO_CODEC_I2S_CLK
@@ -4450,6 +4499,15 @@ static unsigned int aries_sleep_gpio_table[][3] = {
{ S5PV210_GPI(6), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_DOWN}, //GPIO_GPI6
#endif
+
+
+
+
+
+
+
+
+
// GPJ0 ---------------------------------------------------
{ S5PV210_GPJ0(0), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_DOWN},
{ S5PV210_GPJ0(1), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_DOWN},
@@ -4472,8 +4530,10 @@ static unsigned int aries_sleep_gpio_table[][3] = {
#else
{ S5PV210_GPJ1(0), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_DOWN},
#endif
+
{ S5PV210_GPJ1(1), S3C_GPIO_SLP_OUT0, S3C_GPIO_PULL_NONE},
{ S5PV210_GPJ1(2), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_DOWN}, //GPIO_GPJ12
+
{ S5PV210_GPJ1(3), S3C_GPIO_SLP_OUT0, S3C_GPIO_PULL_NONE},
{ S5PV210_GPJ1(4), S3C_GPIO_SLP_PREV, S3C_GPIO_PULL_NONE},
{ S5PV210_GPJ1(5), S3C_GPIO_SLP_OUT0, S3C_GPIO_PULL_NONE},
@@ -4508,12 +4568,28 @@ static unsigned int aries_sleep_gpio_table[][3] = {
{ S5PV210_GPJ2(5), S3C_GPIO_SLP_PREV, S3C_GPIO_PULL_NONE}, //GPIO_SUB_MICBIAS_EN
#endif
{ S5PV210_GPJ2(6), S3C_GPIO_SLP_PREV, S3C_GPIO_PULL_NONE}, //GPIO_EARPATH_SEL
+
+
#if defined (CONFIG_SAMSUNG_GALAXYS) || defined (CONFIG_SAMSUNG_GALAXYSB)
+
+
+
+
+
+
+
+
{ S5PV210_GPJ2(7), S3C_GPIO_SLP_OUT1, S3C_GPIO_PULL_NONE}, //GPIO_MASSMEMORY_EN
#else
+
{ S5PV210_GPJ2(7), S3C_GPIO_SLP_OUT0, S3C_GPIO_PULL_NONE}, //GPIO_MASSMEMORY_EN
#endif
+
+
+
+
+
// GPJ3 ---------------------------------------------------
{ S5PV210_GPJ3(0), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_DOWN}, //_3_TOUCH_SDA_28V
{ S5PV210_GPJ3(1), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_DOWN}, //_3_TOUCH_SCL_28V
@@ -4522,12 +4598,15 @@ static unsigned int aries_sleep_gpio_table[][3] = {
{ S5PV210_GPJ3(3), S3C_GPIO_SLP_OUT0, S3C_GPIO_PULL_NONE}, //GPIO_GPJ33
#else
{ S5PV210_GPJ3(3), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_DOWN}, //GPIO_GPJ33
+
#endif
{ S5PV210_GPJ3(4), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_NONE}, //GPIO_USB_SDA_28V
{ S5PV210_GPJ3(5), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_NONE}, //GPIO_USB_SCL_28V
{ S5PV210_GPJ3(6), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_NONE}, //GPIO_AP_SDA_28V
+
{ S5PV210_GPJ3(7), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_NONE}, //GPIO_AP_SCL_28V
+
// GPJ4 ---------------------------------------------------
{ S5PV210_GPJ4(0), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_NONE},
{ S5PV210_GPJ4(1), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_DOWN},
@@ -4537,6 +4616,7 @@ static unsigned int aries_sleep_gpio_table[][3] = {
{ S5PV210_GPJ4(4), S3C_GPIO_SLP_PREV, S3C_GPIO_PULL_NONE}, //GPIO_EARMICBIAS_EN
#else
{ S5PV210_GPJ4(4), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_DOWN}, //GPIO_GPJ44
+
#endif
/* memory part */
@@ -4580,7 +4660,9 @@ static unsigned int aries_sleep_gpio_table[][3] = {
{ S5PV210_MP04(5), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_NONE}, //GPIO_MP045
#else
{ S5PV210_MP04(4), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_DOWN}, //GPIO_MP044
+
{ S5PV210_MP04(5), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_DOWN}, //GPIO_MP045
+
#endif
{ S5PV210_MP04(6), S3C_GPIO_SLP_OUT0, S3C_GPIO_PULL_NONE},
{ S5PV210_MP04(7), S3C_GPIO_SLP_INPUT, S3C_GPIO_PULL_DOWN},
@@ -5312,7 +5394,6 @@ static void aries_pm_restart(char mode, const char *cmd)
// Ugly hack to inject parameters (e.g. device serial, bootmode) into /proc/cmdline
static void __init aries_inject_cmdline(void) {
char *new_command_line;
- int bootmode = __raw_readl(S5P_INFORM6);
int size;
size = strlen(boot_command_line);
@@ -5320,13 +5401,7 @@ static void __init aries_inject_cmdline(void) {
strcpy(new_command_line, saved_command_line);
size += sprintf(new_command_line + size, " androidboot.serialno=%08X%08X",
system_serial_high, system_serial_low);
-
- // Only write bootmode when less than 10 to prevent confusion with watchdog
- // reboot (0xee = 238)
- if (bootmode < 10) {
- size += sprintf(new_command_line + size, " bootmode=%d", bootmode);
- }
-
+ size += sprintf(new_command_line + size, " bootmode=%d", __raw_readl(S5P_INFORM6));
saved_command_line = new_command_line;
}
@@ -5335,6 +5410,7 @@ static void __init aries_machine_init(void)
arm_pm_restart = aries_pm_restart;
setup_ram_console_mem();
+
aries_inject_cmdline();
platform_add_devices(aries_devices, ARRAY_SIZE(aries_devices));
@@ -5422,7 +5498,7 @@ static void __init aries_machine_init(void)
/* optical sensor */
gp2a_gpio_init();
i2c_register_board_info(11, i2c_devs11, ARRAY_SIZE(i2c_devs11));
-
+
/* yamaha magnetic sensor */
i2c_register_board_info(12, i2c_devs12, ARRAY_SIZE(i2c_devs12));
@@ -5519,10 +5595,10 @@ void otg_phy_init(void)
writel(readl(S3C_USBOTG_PHYTUNE) | (0x1<<20),
S3C_USBOTG_PHYTUNE);
- /* set DC level as 6 (6%) */
- writel((readl(S3C_USBOTG_PHYTUNE) & ~(0xf)) | (0x1<<2) | (0x1<<1),
- S3C_USBOTG_PHYTUNE);
+ /* set DC level as 0xf (24%) */
+ writel(readl(S3C_USBOTG_PHYTUNE) | 0xf, S3C_USBOTG_PHYTUNE);
}
+
EXPORT_SYMBOL(otg_phy_init);
/* USB Control request data struct must be located here for DMA transfer */
1  arch/arm/plat-samsung/include/plat/gpio-cfg.h 100644 → 100755
View
@@ -73,6 +73,7 @@ extern int s3c_gpio_setpin(unsigned int pin, s3c_gpio_pull_t level);
#define S3C_GPIO_INPUT (S3C_GPIO_SPECIAL(0))
#define S3C_GPIO_OUTPUT (S3C_GPIO_SPECIAL(1))
#define S3C_GPIO_SFN(x) (S3C_GPIO_SPECIAL(x))
+#define S3C_GPIO_EINT (S3C_GPIO_SPECIAL(0xF))
#define s3c_gpio_is_cfg_special(_cfg) \
(((_cfg) & S3C_GPIO_SPECIAL_MARK) == S3C_GPIO_SPECIAL_MARK)
152 drivers/input/keyboard/cypress-touchkey.c
View
@@ -48,11 +48,6 @@
#define DEVICE_NAME "cypress-touchkey"
-#ifdef CONFIG_GENERIC_BLN
- /* FIXME: keep a reference to the devdata, reason: i2c_touchkey_write_byte()*/
- struct cypress_touchkey_devdata *bln_devdata;
-#endif
-
int bl_on = 0;
static DEFINE_SEMAPHORE(enable_sem);
static DEFINE_SEMAPHORE(i2c_sem);
@@ -77,6 +72,10 @@ struct cypress_touchkey_devdata {
bool is_sleeping;
};
+#ifdef CONFIG_GENERIC_BLN
+static struct cypress_touchkey_devdata *blndevdata;
+#endif
+
static int i2c_touchkey_read_byte(struct cypress_touchkey_devdata *devdata,
u8 *val)
{
@@ -249,9 +248,7 @@ static irqreturn_t touchkey_interrupt_thread(int irq, void *touchkey_devdata)
}
input_sync(devdata->input_dev);
-
- if (!bln_is_ongoing())
- bl_set_timeout();
+ bl_set_timeout();
err:
return IRQ_HANDLED;
}
@@ -320,26 +317,27 @@ static void cypress_touchkey_early_suspend(struct early_suspend *h)
devdata->is_powering_on = true;
- if (unlikely(devdata->is_dead))
+ if (unlikely(devdata->is_dead)) {
goto out;
+ }
disable_irq(devdata->client->irq);
#ifdef CONFIG_GENERIC_BLN
- /*
- * Disallow powering off the touchkey controller
- * while a led notification is ongoing
- */
- if(!bln_is_ongoing())
- { //remove?
-#endif
- devdata->pdata->touchkey_onoff(TOUCHKEY_OFF);
- devdata->pdata->touchkey_sleep_onoff(TOUCHKEY_OFF);
- devdata->is_sleeping = true;
-#ifdef CONFIG_GENERIC_BLN
- } //remove?
+ /*
+ * Disallow powering off the touchkey controller
+ * while a led notification is ongoing
+ */
+ if(!bln_is_ongoing()) {
+ devdata->pdata->touchkey_onoff(TOUCHKEY_OFF);
+ devdata->pdata->touchkey_sleep_onoff(TOUCHKEY_OFF);
+ }
+#else
+ if (!bl_on)
+ devdata->pdata->touchkey_onoff(TOUCHKEY_OFF);
#endif
all_keys_up(devdata);
+ devdata->is_sleeping = true;
out:
up(&enable_sem);
@@ -370,8 +368,7 @@ static void cypress_touchkey_early_resume(struct early_suspend *h)
up(&enable_sem);
- if (!bln_is_ongoing())
- bl_set_timeout();
+ bl_set_timeout();
}
#endif
@@ -381,9 +378,6 @@ static ssize_t led_status_read(struct device *dev, struct device_attribute *attr
static ssize_t led_status_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
{
- if (bln_is_ongoing())
- return size;
-
unsigned int data;
if (sscanf(buf, "%u\n", &data)) {
@@ -423,48 +417,77 @@ static struct miscdevice bl_led_device = {
.name = "notification",
};
-
-
-
-
-
#ifdef CONFIG_GENERIC_BLN
-static int cypress_enable_touchkey_backlights(int led_mask)
-{
-return i2c_touchkey_write_byte(bln_devdata, bln_devdata->backlight_on);
+static void enable_touchkey_backlights(void){
+ i2c_touchkey_write_byte(blndevdata, blndevdata->backlight_on);
}
-static int cypress_disable_touchkey_backlights(int led_mask)
-{
-return i2c_touchkey_write_byte(bln_devdata, bln_devdata->backlight_off);
+
+static void disable_touchkey_backlights(void){
+ i2c_touchkey_write_byte(blndevdata, blndevdata->backlight_off);
}
-static int cypress_power_on_touchkey_controller(void)
-{
-if(bln_devdata->is_powering_on) {
- bln_devdata->pdata->touchkey_onoff(TOUCHKEY_ON);
- return 0;
- } else {
- return -EBUSY;
+
+static void cypress_touchkey_enable_led_notification(void){
+ /* is_powering_on signals whether touchkey lights are used for touchmode */
+ if (blndevdata->is_powering_on){
+ /* reconfigure gpio for sleep mode */
+ blndevdata->pdata->touchkey_sleep_onoff(TOUCHKEY_ON);
+
+ /*
+ * power on the touchkey controller
+ * This is actually not needed, but it is intentionally
+ * left for the case that the early_resume() function
+ * did not power on the touchkey controller for some reasons
+ */
+ blndevdata->pdata->touchkey_onoff(TOUCHKEY_ON);
+
+ /* write to i2cbus, enable backlights */
+ enable_touchkey_backlights();
}
+ else
+#ifdef CONFIG_TOUCH_WAKE
+ {
+ enable_touchkey_backlights();
+ }
+#else
+ pr_info("%s: cannot set notification led, touchkeys are enabled\n",__FUNCTION__);
+#endif
}
-static int cypress_power_off_touchkey_controller(void)
-{
- if(bln_devdata->is_powering_on) {
- bln_devdata->pdata->touchkey_onoff(TOUCHKEY_OFF);
- return 0;
- } else {
- return -EBUSY;
+
+static void cypress_touchkey_disable_led_notification(void){
+ /*
+ * reconfigure gpio for sleep mode, this has to be done
+ * independently from the power status
+ */
+ blndevdata->pdata->touchkey_sleep_onoff(TOUCHKEY_OFF);
+
+ /* if touchkeys lights are not used for touchmode */
+ if (blndevdata->is_powering_on){
+ disable_touchkey_backlights();
+
+ #if 0
+ /*
+ * power off the touchkey controller
+ * This is actually not needed, the early_suspend function
+ * should take care of powering off the touchkey controller
+ */
+ blndevdata->pdata->touchkey_onoff(TOUCHKEY_OFF);
+ #endif
}
+#ifdef CONFIG_TOUCH_WAKE
+ else
+ {
+ disable_touchkey_backlights();
+ }
+#endif
}
static struct bln_implementation cypress_touchkey_bln = {
- .enable = cypress_enable_touchkey_backlights,
- .disable = cypress_disable_touchkey_backlights,
- .power_on = cypress_power_on_touchkey_controller,
- .power_off = cypress_power_off_touchkey_controller,
- .led_count = 1
+ .enable = cypress_touchkey_enable_led_notification,
+ .disable = cypress_touchkey_disable_led_notification,
};
#endif
+
static int cypress_touchkey_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
@@ -576,6 +599,11 @@ static int cypress_touchkey_probe(struct i2c_client *client,
devdata->is_powering_on = false;
+#ifdef CONFIG_GENERIC_BLN
+ blndevdata = devdata;
+ register_bln_implementation(&cypress_touchkey_bln);
+#endif
+
if (misc_register(&bl_led_device))
printk("%s misc_register(%s) failed\n", __FUNCTION__, bl_led_device.name);
else {
@@ -585,12 +613,6 @@ static int cypress_touchkey_probe(struct i2c_client *client,
bl_devdata = devdata;
setup_timer(&bl_timer, bl_timer_callback, 0);
-#ifdef CONFIG_GENERIC_BLN
- bln_devdata = devdata;
-#endif
-
-
-
return 0;
@@ -614,7 +636,6 @@ static int __devexit i2c_touchkey_remove(struct i2c_client *client)
{
struct cypress_touchkey_devdata *devdata = i2c_get_clientdata(client);
-
dev_err(&client->dev, "%s: i2c_touchkey_remove\n", __func__);
misc_deregister(&bl_led_device);
@@ -630,7 +651,7 @@ static int __devexit i2c_touchkey_remove(struct i2c_client *client)
free_irq(client->irq, devdata);
all_keys_up(devdata);
input_unregister_device(devdata->input_dev);
- del_timer(&bl_timer);
+ del_timer(&bl_timer);
kfree(devdata);
return 0;
}
@@ -659,9 +680,6 @@ static int __init touchkey_init(void)
pr_err("%s: cypress touch keypad registration failed. (%d)\n",
__func__, ret);
-#ifdef CONFIG_GENERIC_BLN
- register_bln_implementation(&cypress_touchkey_bln);
-#endif
return ret;
}
342 drivers/misc/bln.c
View
@@ -15,64 +15,39 @@
#include <linux/miscdevice.h>
#include <linux/bln.h>
#include <linux/mutex.h>
+#include <linux/timer.h>
+#include <linux/wakelock.h>
-static bool bln_enabled = true;
+static bool bln_enabled = true; /* is BLN function is enabled */
static bool bln_ongoing = false; /* ongoing LED Notification */
static int bln_blink_state = 0;
+static int bln_blink_interval = 500;
+static int bln_blink_max_count = 600;
static bool bln_suspended = false; /* is system suspended */
static struct bln_implementation *bln_imp = NULL;
+static bool in_kernel_blink = false;
+static uint32_t blink_count;
-static long unsigned int notification_led_mask = 0x0;
+static struct wake_lock bln_wake_lock;
-#ifdef CONFIG_GENERIC_BLN_EMULATE_BUTTONS_LED
-static bool buttons_led_enabled = false;
-#endif
+void blink_timer_callback(unsigned long data);
+static struct timer_list blink_timer =
+ TIMER_INITIALIZER(blink_timer_callback, 0, 0);
+static void blink_callback(struct work_struct *blink_work);
+static DECLARE_WORK(blink_work, blink_callback);
#define BACKLIGHTNOTIFICATION_VERSION 9
-static int gen_all_leds_mask(void)
+static void bln_enable_backlights(void)
{
- int i = 0;
- int mask = 0x0;
-
- for(; i < bln_imp->led_count; i++)
- mask |= 1 << i;
-
- return mask;
-}
-
-static int get_led_mask(void){
- return (notification_led_mask != 0) ? notification_led_mask: gen_all_leds_mask();
-}
-
-static void reset_bln_states(void)
-{
- bln_blink_state = 0;
- bln_ongoing = false;
-}
-
-static void bln_enable_backlights(int mask)
-{
- if (likely(bln_imp && bln_imp->enable))
- bln_imp->enable(mask);
-}
-
-static void bln_disable_backlights(int mask)
-{
- if (likely(bln_imp && bln_imp->disable))
- bln_imp->disable(mask);
-}
-
-static void bln_power_on(void)
-{
- if (likely(bln_imp && bln_imp->power_on))
- bln_imp->power_on();
+ if (bln_imp)
+ bln_imp->enable();
}
-static void bln_power_off(void)
+static void bln_disable_backlights(void)
{
- if (likely(bln_imp && bln_imp->power_off))
- bln_imp->power_off();
+ if (bln_imp)
+ bln_imp->disable();
}
static void bln_early_suspend(struct early_suspend *h)
@@ -83,8 +58,6 @@ static void bln_early_suspend(struct early_suspend *h)
static void bln_late_resume(struct early_suspend *h)
{
bln_suspended = false;
-
- reset_bln_states();
}
static struct early_suspend bln_suspend_data = {
@@ -98,75 +71,64 @@ static void enable_led_notification(void)
if (!bln_enabled)
return;
- /* dont allow led notifications while the screen is on */
- if (!bln_suspended)
- return;
+ if (in_kernel_blink) {
+ wake_lock(&bln_wake_lock);
- bln_ongoing = true;
+ /* Start timer */
+ blink_timer.expires = jiffies +
+ msecs_to_jiffies(bln_blink_interval);
+ blink_count = bln_blink_max_count;
+ add_timer(&blink_timer);
+ }
- bln_power_on();
- bln_enable_backlights(get_led_mask());
+ bln_enable_backlights();
pr_info("%s: notification led enabled\n", __FUNCTION__);
+ bln_ongoing = true;
}
static void disable_led_notification(void)
{
- if (bln_suspended && bln_ongoing) {
- bln_disable_backlights(gen_all_leds_mask());
- bln_power_off();
- }
+ pr_info("%s: notification led disabled\n", __FUNCTION__);
- reset_bln_states();
+ bln_blink_state = 0;
+ bln_ongoing = false;
+
+ if (bln_suspended)
+ bln_disable_backlights();
+
+ if (in_kernel_blink)
+ del_timer(&blink_timer);
+
+ wake_unlock(&bln_wake_lock);
- pr_info("%s: notification led disabled\n", __FUNCTION__);
}
static ssize_t backlightnotification_status_read(struct device *dev,
struct device_attribute *attr, char *buf)
{
- int ret = 0;
-
- if(likely(bln_imp)) {
- if(bln_enabled) {
- ret = 1;
- } else {
- ret = 0;
- }
- } else {
- ret = -1;
- }
-
- return sprintf(buf, "%u\n", ret);
+ return sprintf(buf, "%u\n", (bln_enabled ? 1 : 0));
}
static ssize_t backlightnotification_status_write(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size)
{
unsigned int data;
-
- if(unlikely(!bln_imp)) {
- pr_err("%s: no BLN implementation registered!\n", __FUNCTION__);
- return size;
- }
-
- if (sscanf(buf, "%u\n", &data) != 1) {
- pr_info("%s: input error\n", __FUNCTION__);
- return size;
- }
-
- pr_devel("%s: %u \n", __FUNCTION__, data);
-
- if (data == 1) {
- pr_info("%s: BLN function enabled\n", __FUNCTION__);
- bln_enabled = true;
- } else if (data == 0) {
- pr_info("%s: BLN function disabled\n", __FUNCTION__);
- bln_enabled = false;
- if (bln_ongoing)
- disable_led_notification();
+ if(sscanf(buf, "%u\n", &data) == 1) {
+ pr_devel("%s: %u \n", __FUNCTION__, data);
+ if (data == 1) {
+ pr_info("%s: BLN function enabled\n", __FUNCTION__);
+ bln_enabled = true;
+ } else if (data == 0) {
+ pr_info("%s: BLN function disabled\n", __FUNCTION__);
+ bln_enabled = false;
+ if (bln_ongoing)
+ disable_led_notification();
+ } else {
+ pr_info("%s: invalid input range %u\n", __FUNCTION__,
+ data);
+ }
} else {
- pr_info("%s: invalid input range %u\n", __FUNCTION__,
- data);
+ pr_info("%s: invalid input\n", __FUNCTION__);
}
return size;
@@ -183,46 +145,38 @@ static ssize_t notification_led_status_write(struct device *dev,
{
unsigned int data;
- if (sscanf(buf, "%u\n", &data) != 1) {
- pr_info("%s: input error\n", __FUNCTION__);
- return size;
+ if (sscanf(buf, "%u\n", &data) == 1) {
+ if (data == 1)
+ enable_led_notification();
+ else if (data == 0)
+ disable_led_notification();
+ else
+ pr_info("%s: wrong input %u\n", __FUNCTION__, data);
+ } else {
+ pr_info("%s: input error\n", __FUNCTION__);
}
- if (data == 1)
- enable_led_notification();
- else if (data == 0)
- disable_led_notification();
- else
- pr_info("%s: wrong input %u\n", __FUNCTION__, data);
-
return size;
}
-static ssize_t notification_led_mask_read(struct device *dev,
+static ssize_t in_kernel_blink_status_read(struct device *dev,
struct device_attribute *attr, char *buf)
{
- return sprintf(buf,"%lu\n", notification_led_mask);
+ return sprintf(buf,"%u\n", (in_kernel_blink ? 1 : 0));
}
-static ssize_t notification_led_mask_write(struct device *dev,
+static ssize_t in_kernel_blink_status_write(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size)
{
unsigned int data;
- if (sscanf(buf, "%u\n", &data) != 1) {
- pr_info("%s: input error\n", __FUNCTION__);
- return size;
- }
-
- if(data & gen_all_leds_mask()){
- notification_led_mask = data;
- } else {
- notification_led_mask = 0x0;
- }
+ if (sscanf(buf, "%u\n", &data) == 1)
+ in_kernel_blink = !!(data);
+ else
+ pr_info("%s: input error\n", __FUNCTION__);
return size;
}
-
static ssize_t blink_control_read(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -237,108 +191,101 @@ static ssize_t blink_control_write(struct device *dev,
if (!bln_ongoing)
return size;
- if (sscanf(buf, "%u\n", &data) != 1) {
- pr_info("%s: input error\n", __FUNCTION__);
- return size;
- }
-
- /* reversed logic:
- * 1 = leds off
- * 0 = leds on
- */
- if (data == 1) {
- bln_blink_state = 1;
- bln_disable_backlights(get_led_mask());
- } else if (data == 0) {
- bln_blink_state = 0;
- bln_enable_backlights(get_led_mask());
+ if (sscanf(buf, "%u\n", &data) == 1) {
+ if (data == 1) {
+ bln_blink_state = 1;
+ bln_disable_backlights();
+ } else if (data == 0) {
+ bln_blink_state = 0;
+ bln_enable_backlights();
+ } else {
+ pr_info("%s: wrong input %u\n", __FUNCTION__, data);
+ }
} else {
- pr_info("%s: wrong input %u\n", __FUNCTION__, data);
+ pr_info("%s: input error\n", __FUNCTION__);
}
return size;
}
-static ssize_t backlightnotification_version(struct device *dev,
+static ssize_t blink_interval_read(struct device *dev,
struct device_attribute *attr, char *buf)
{
- return sprintf(buf, "%u\n", BACKLIGHTNOTIFICATION_VERSION);
+ return sprintf(buf, "%u\n", bln_blink_interval);
}
-static ssize_t led_count_read(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t blink_interval_write(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t size)
{
- unsigned int ret = 0x0;
-
- if (bln_imp)
- ret = bln_imp->led_count;
+ unsigned int data;
+ if (sscanf(buf, "%u\n", &data) == 1) {
+ if (data > 0) {
+ bln_blink_interval = data;
+ } else {
+ pr_info("%s: wrong input %u\n", __FUNCTION__, data);
+ }
+ } else {
+ pr_info("%s: input error\n", __FUNCTION__);
+ }
- return sprintf(buf,"%u\n", ret);
+ return size;
}
-#ifdef CONFIG_GENERIC_BLN_EMULATE_BUTTONS_LED
-static ssize_t buttons_led_status_read(struct device *dev,
+static ssize_t blink_maxtime_read(struct device *dev,
struct device_attribute *attr, char *buf)
{
- return sprintf(buf,"%u\n", (buttons_led_enabled ? 1 : 0));
+ return sprintf(buf, "%u\n", bln_blink_max_count);
}
-static ssize_t buttons_led_status_write(struct device *dev,
+static ssize_t blink_maxtime_write(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size)
{
unsigned int data;
-
- if (sscanf(buf, "%u\n", &data) != 1) {
- pr_info("%s: input error\n", __FUNCTION__);
- return size;
- }
-
- if (data == 1) {
- if(!bln_suspended){
- buttons_led_enabled = true;
- bln_power_on();
- bln_enable_backlights(gen_all_leds_mask());
- }
- } else if (data == 0) {
- if(!bln_suspended){
- buttons_led_enabled = false;
- bln_disable_backlights(gen_all_leds_mask());
+ if (sscanf(buf, "%u\n", &data) == 1) {
+ if (data > 0) {
+ bln_blink_max_count = data;
+ } else {
+ pr_info("%s: wrong input %u\n", __FUNCTION__, data);
}
} else {
- pr_info("%s: wrong input %u\n", __FUNCTION__, data);
+ pr_info("%s: input error\n", __FUNCTION__);
}
return size;
}
-static DEVICE_ATTR(buttons_led, S_IRUGO | S_IWUGO,
- buttons_led_status_read,
- buttons_led_status_write);
-#endif
+static ssize_t backlightnotification_version(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sprintf(buf, "%u\n", BACKLIGHTNOTIFICATION_VERSION);
+}
static DEVICE_ATTR(blink_control, S_IRUGO | S_IWUGO, blink_control_read,
blink_control_write);
static DEVICE_ATTR(enabled, S_IRUGO | S_IWUGO,
backlightnotification_status_read,
backlightnotification_status_write);
-static DEVICE_ATTR(led_count, S_IRUGO , led_count_read, NULL);
static DEVICE_ATTR(notification_led, S_IRUGO | S_IWUGO,
notification_led_status_read,
notification_led_status_write);
-static DEVICE_ATTR(notification_led_mask, S_IRUGO | S_IWUGO,
- notification_led_mask_read,
- notification_led_mask_write);
+static DEVICE_ATTR(in_kernel_blink, S_IRUGO | S_IWUGO,
+ in_kernel_blink_status_read,
+ in_kernel_blink_status_write);
+static DEVICE_ATTR(blink_interval, S_IRUGO | S_IWUGO,
+ blink_interval_read,
+ blink_interval_write);
+static DEVICE_ATTR(blink_maxtime, S_IRUGO | S_IWUGO,
+ blink_maxtime_read,
+ blink_maxtime_write);
static DEVICE_ATTR(version, S_IRUGO , backlightnotification_version, NULL);
static struct attribute *bln_notification_attributes[] = {
&dev_attr_blink_control.attr,
&dev_attr_enabled.attr,
- &dev_attr_led_count.attr,
&dev_attr_notification_led.attr,
- &dev_attr_notification_led_mask.attr,
-#ifdef CONFIG_GENERIC_BLN_EMULATE_BUTTONS_LED
- &dev_attr_buttons_led.attr,
-#endif
+ &dev_attr_in_kernel_blink.attr,
+ &dev_attr_blink_interval.attr,
+ &dev_attr_blink_maxtime.attr,
&dev_attr_version.attr,
NULL
};
@@ -352,29 +299,43 @@ static struct miscdevice bln_device = {
.name = "backlightnotification",
};
-/**
- * register_bln_implementation - register a bln implementation of a touchkey device device
- * @imp: bln implementation structure
- *
- * Register a bln implementation with the bln kernel module.
- */
void register_bln_implementation(struct bln_implementation *imp)
{
- if(likely(imp)){
- bln_imp = imp;
- }
+ bln_imp = imp;
}
EXPORT_SYMBOL(register_bln_implementation);
-/**
- * bln_is_ongoing - check if a bln (led) notification is ongoing
- */
bool bln_is_ongoing()
{
return bln_ongoing;
}
EXPORT_SYMBOL(bln_is_ongoing);
+
+static void blink_callback(struct work_struct *blink_work)
+{
+ if (--blink_count == 0) {
+ pr_info("%s: notification timed out\n", __FUNCTION__);
+ bln_enable_backlights();
+ del_timer(&blink_timer);
+ wake_unlock(&bln_wake_lock);
+ return;
+ }
+
+ if (bln_blink_state)
+ bln_enable_backlights();
+ else
+ bln_disable_backlights();
+
+ bln_blink_state = !bln_blink_state;
+}
+
+void blink_timer_callback(unsigned long data)
+{
+ schedule_work(&blink_work);
+ mod_timer(&blink_timer, jiffies + msecs_to_jiffies(bln_blink_interval));
+}
+
static int __init bln_control_init(void)
{
int ret;
@@ -397,6 +358,9 @@ static int __init bln_control_init(void)
register_early_suspend(&bln_suspend_data);
+ /* Initialize wake locks */
+ wake_lock_init(&bln_wake_lock, WAKE_LOCK_SUSPEND, "bln_wake");
+
return 0;
}
5 drivers/misc/samsung_modemctl/modemctl/modemctl.c
View
@@ -185,6 +185,9 @@ static const struct attribute_group modemctl_group = {
.attrs = modemctl_attributes,
};
+/* declare mailbox init function for xmm */
+extern void onedram_init_mailbox(void);
+
static void xmm_on(struct modemctl *mc)
{
dev_dbg(mc->dev, "%s\n", __func__);
@@ -193,6 +196,8 @@ static void xmm_on(struct modemctl *mc)
/* ensure pda active pin set to low */
gpio_set_value(mc->gpio_pda_active, 0);
+ /* call mailbox init : BA goes to high, AB goes to low */
+ onedram_init_mailbox();
/* ensure cp_reset pin set to low */
gpio_set_value(mc->gpio_cp_reset, 0);
if(mc->gpio_reset_req_n)
1  fs/namespace.c
View
@@ -2321,6 +2321,7 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
mnt_flags |= MNT_NOEXEC;
mnt_flags |= MNT_NOATIME;
+ if (flags & MS_NODIRATIME)
mnt_flags |= MNT_NODIRATIME;
if (flags & MS_RDONLY)
28 include/linux/bln.h
View
@@ -3,33 +3,9 @@
#ifndef _LINUX_BLN_H
#define _LINUX_BLN_H
-/**
- * struct bln_implementation - a structure containing BLN controls
- * @enable: enables the leds given by ledmask
- * @disable: disables the leds given by ledmask
- * @power_on: powers on the components to enable the leds
- * @power_off: powers off the components
- * @led_count: number of leds in this bln implementation (see ledmask)
- *
- * The BLN implementation structure contains all LED control functions of an
- * touchkey device.
- *
- * Enable/Disable functions should only affect the leds given by the ledmask.
- * It should not configure components necessary for powering the leds (e.g.
- * regulators, GPIOs).
- *
- * Ledmask: the least significant bit is the first led, e.g. 0x1 is the left
- * led, on the Nexus S is that the back button.
- *
- * Power On/Off functions take care of the necessary components that needs to
- * be (re-)configured so that enable/disable of leds could operate.
- */
struct bln_implementation {
- int (*enable)(int led_mask);
- int (*disable)(int led_mask);
- int (*power_on)(void);
- int (*power_off)(void);
- unsigned int led_count;
+ void (*enable)(void);
+ void (*disable)(void);
};
void register_bln_implementation(struct bln_implementation *imp);
Please sign in to comment.
Something went wrong with that request. Please try again.