mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
luowei modified battery driver on 100530
This commit is contained in:
@@ -422,6 +422,34 @@ static struct platform_device *devices[] __initdata = {
|
||||
};
|
||||
|
||||
extern struct sys_timer rk2818_timer;
|
||||
#define POWER_PIN RK2818_PIN_PA3
|
||||
static void rk2818_power_on(void)
|
||||
{
|
||||
int ret;
|
||||
ret = gpio_request(POWER_PIN, NULL);
|
||||
if (ret) {
|
||||
printk("failed to request power_off gpio\n");
|
||||
goto err_free_gpio;
|
||||
}
|
||||
|
||||
gpio_pull_updown(POWER_PIN, GPIOPullUp);
|
||||
ret = gpio_direction_output(POWER_PIN, GPIO_HIGH);
|
||||
if (ret) {
|
||||
printk("failed to set power_off gpio output\n");
|
||||
goto err_free_gpio;
|
||||
}
|
||||
|
||||
gpio_set_value(POWER_PIN, 1);/*power on*/
|
||||
|
||||
err_free_gpio:
|
||||
gpio_free(POWER_PIN);
|
||||
}
|
||||
|
||||
static void rk2818_power_off(void)
|
||||
{
|
||||
printk("shut down system now ...\n");
|
||||
gpio_set_value(POWER_PIN, 0);/*power down*/
|
||||
}
|
||||
|
||||
static void __init machine_rk2818_init_irq(void)
|
||||
{
|
||||
@@ -432,6 +460,8 @@ static void __init machine_rk2818_init_irq(void)
|
||||
|
||||
static void __init machine_rk2818_board_init(void)
|
||||
{
|
||||
rk2818_power_on();
|
||||
pm_power_off = rk2818_power_off;
|
||||
#ifdef CONFIG_I2C0_RK2818
|
||||
i2c_register_board_info(default_i2c0_data.bus_num, board_i2c0_devices,
|
||||
ARRAY_SIZE(board_i2c0_devices));
|
||||
|
||||
@@ -112,7 +112,7 @@ unsigned int rk28_get_keycode(unsigned int advalue,pADC_keyst ptab)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static irqreturn_t rk2818_playkey_irq(int irq, void *handle)
|
||||
static irqreturn_t rk28_playkey_irq(int irq, void *handle)
|
||||
{
|
||||
input_report_key(pRk28AdcKey->input_dev,KEYSTART,1);
|
||||
input_sync(pRk28AdcKey->input_dev);
|
||||
@@ -123,6 +123,15 @@ static irqreturn_t rk2818_playkey_irq(int irq, void *handle)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
|
||||
void rk28_send_wakeup_key( void )
|
||||
{
|
||||
input_report_key(pRk28AdcKey->input_dev,KEY_WAKEUP,1);
|
||||
input_sync(pRk28AdcKey->input_dev);
|
||||
input_report_key(pRk28AdcKey->input_dev,KEY_WAKEUP,0);
|
||||
input_sync(pRk28AdcKey->input_dev);
|
||||
}
|
||||
|
||||
static int rk28_adckey_open(struct input_dev *dev)
|
||||
{
|
||||
//struct rk28_adckey *adckey = input_get_drvdata(dev);
|
||||
@@ -298,7 +307,7 @@ static int __devinit rk28_adckey_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
gpio_pull_updown(KEY_PLAYON_PIN,GPIOPullUp);
|
||||
error = request_irq(gpio_to_irq(KEY_PLAYON_PIN),rk2818_playkey_irq,IRQF_TRIGGER_FALLING,NULL,NULL);
|
||||
error = request_irq(gpio_to_irq(KEY_PLAYON_PIN),rk28_playkey_irq,IRQF_TRIGGER_FALLING,NULL,NULL);
|
||||
if(error)
|
||||
{
|
||||
printk("unable to request play key irq\n");
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <mach/adc.h>
|
||||
#include <mach/iomux.h>
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
#define DBG(x...) printk(x)
|
||||
#else
|
||||
#define DBG(x...)
|
||||
|
||||
Reference in New Issue
Block a user