mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
board-raho-0928: add new board type, use make rk2818_raho_0928_defconfig to config new board
This commit is contained in:
1744
arch/arm/configs/rk2818_raho_0928_defconfig
Executable file
1744
arch/arm/configs/rk2818_raho_0928_defconfig
Executable file
File diff suppressed because it is too large
Load Diff
@@ -24,6 +24,13 @@ config MACH_RAHO
|
||||
help
|
||||
Support for the ROCKCHIP Board For raho Phone.
|
||||
|
||||
config MACH_RAHO_0928
|
||||
depends on ARCH_RK2818
|
||||
default n
|
||||
bool "ROCKCHIP Board For raho 0928"
|
||||
help
|
||||
Support for the ROCKCHIP Board For raho 0928 Phone.
|
||||
|
||||
config MACH_RK2818INFO
|
||||
depends on ARCH_RK2818
|
||||
default n
|
||||
|
||||
@@ -9,6 +9,7 @@ obj-$(CONFIG_RK28_ADC) += adc.o
|
||||
obj-$(CONFIG_MACH_RK2818MID) += board-midsdk.o
|
||||
obj-$(CONFIG_MACH_RK2818PHONE) += board-phonesdk.o
|
||||
obj-$(CONFIG_MACH_RAHO) += board-raho.o board-raho-rfkill.o
|
||||
obj-$(CONFIG_MACH_RAHO_0928) += board-raho-0928.o board-raho-0928-rfkill.o
|
||||
obj-$(CONFIG_MACH_RK2818INFO) += board-infosdk.o board-infosdk-rfkill.o
|
||||
obj-$(CONFIG_MACH_RK2818INFO_IT50) += board-infoit50.o board-infoit50-rfkill.o
|
||||
obj-$(CONFIG_RK2818_SOC_PM) += rk2818-socpm.o
|
||||
|
||||
162
arch/arm/mach-rk2818/board-raho-0928-rfkill.c
Executable file
162
arch/arm/mach-rk2818/board-raho-0928-rfkill.c
Executable file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (C) 2010 ROCKCHIP, Inc.
|
||||
* Author: roger_chen <cz@rock-chips.com>
|
||||
*
|
||||
* This program is the bluetooth device bcm4329's driver,
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/rfkill.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/slab.h>
|
||||
//#include <asm/gpio.h>
|
||||
//#include <asm/arch/gpio.h>
|
||||
//#include <asm/arch/iomux.h>
|
||||
//#include <asm/arch/gpio.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/wakelock.h>
|
||||
#include <mach/spi_fpga.h>
|
||||
#include <linux/fs.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <mach/gpio.h>
|
||||
|
||||
#if 1
|
||||
#define DBG(x...) printk(KERN_INFO x)
|
||||
#else
|
||||
#define DBG(x...)
|
||||
#endif
|
||||
|
||||
#define RAHO_BT_GPIO_POWER_N FPGA_PIO1_06
|
||||
#define RAHO_BT_GPIO_RESET_N FPGA_PIO1_07
|
||||
#define RAHO_BT_GPIO_WAKE_UP_N RK2818_PIN_PC6
|
||||
|
||||
static struct rfkill *bt_rfk;
|
||||
static const char bt_name[] = "bcm4329";
|
||||
extern int raho_bt_power_state;
|
||||
extern int raho_wifi_power_state;
|
||||
#ifdef CONFIG_BT_HCIBCM4325
|
||||
int bcm4325_sleep(int bSleep)
|
||||
{
|
||||
printk("*************bt enter sleep***************\n");
|
||||
if (bSleep)
|
||||
gpio_set_value(RAHO_BT_GPIO_WAKE_UP_N, GPIO_LOW); //low represent bt device may enter sleep
|
||||
else
|
||||
gpio_set_value(RAHO_BT_GPIO_WAKE_UP_N, GPIO_HIGH); //high represent bt device must be awake
|
||||
}
|
||||
#endif
|
||||
|
||||
static int bcm4329_set_block(void *data, bool blocked)
|
||||
{
|
||||
DBG("%s---blocked :%d\n", __FUNCTION__, blocked);
|
||||
|
||||
if (false == blocked) {
|
||||
gpio_set_value(RAHO_BT_GPIO_POWER_N, GPIO_HIGH); /* bt power on */
|
||||
gpio_set_value(RAHO_BT_GPIO_RESET_N, GPIO_HIGH); /* bt reset deactive*/
|
||||
mdelay(20);
|
||||
pr_info("bt turn on power\n");
|
||||
}
|
||||
else {
|
||||
if (!raho_wifi_power_state) {
|
||||
gpio_set_value(RAHO_BT_GPIO_POWER_N, GPIO_LOW); /* bt power off */
|
||||
mdelay(20);
|
||||
pr_info("bt shut off power\n");
|
||||
}else {
|
||||
pr_info("bt shouldn't shut off power, wifi is using it!\n");
|
||||
}
|
||||
|
||||
gpio_set_value(RAHO_BT_GPIO_RESET_N, GPIO_LOW); /* bt reset active*/
|
||||
mdelay(20);
|
||||
}
|
||||
|
||||
raho_bt_power_state = !blocked;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static const struct rfkill_ops bcm4329_rfk_ops = {
|
||||
.set_block = bcm4329_set_block,
|
||||
};
|
||||
|
||||
static int __init bcm4329_rfkill_probe(struct platform_device *pdev)
|
||||
{
|
||||
int rc = 0;
|
||||
bool default_state = true;
|
||||
|
||||
DBG("Enter::%s,line=%d\n",__FUNCTION__,__LINE__);
|
||||
|
||||
/* default to bluetooth off */
|
||||
bcm4329_set_block(NULL, default_state); /* blocked -> bt off */
|
||||
|
||||
bt_rfk = rfkill_alloc(bt_name,
|
||||
NULL,
|
||||
RFKILL_TYPE_BLUETOOTH,
|
||||
&bcm4329_rfk_ops,
|
||||
NULL);
|
||||
|
||||
if (!bt_rfk)
|
||||
{
|
||||
printk("fail to rfkill_allocate************\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
rfkill_set_states(bt_rfk, default_state, false);
|
||||
|
||||
rc = rfkill_register(bt_rfk);
|
||||
if (rc)
|
||||
rfkill_destroy(bt_rfk);
|
||||
|
||||
printk("rc=0x%x\n", rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static int __devexit bcm4329_rfkill_remove(struct platform_device *pdev)
|
||||
{
|
||||
if (bt_rfk)
|
||||
rfkill_unregister(bt_rfk);
|
||||
bt_rfk = NULL;
|
||||
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
DBG("Enter::%s,line=%d\n",__FUNCTION__,__LINE__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver bcm4329_rfkill_driver = {
|
||||
.probe = bcm4329_rfkill_probe,
|
||||
.remove = __devexit_p(bcm4329_rfkill_remove),
|
||||
.driver = {
|
||||
.name = "raho_rfkill",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* Module initialization
|
||||
*/
|
||||
static int __init bcm4329_mod_init(void)
|
||||
{
|
||||
int ret;
|
||||
DBG("Enter::%s,line=%d\n",__FUNCTION__,__LINE__);
|
||||
ret = platform_driver_register(&bcm4329_rfkill_driver);
|
||||
printk("ret=0x%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void __exit bcm4329_mod_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&bcm4329_rfkill_driver);
|
||||
}
|
||||
|
||||
module_init(bcm4329_mod_init);
|
||||
module_exit(bcm4329_mod_exit);
|
||||
MODULE_DESCRIPTION("bcm4329 Bluetooth driver");
|
||||
MODULE_AUTHOR("roger_chen cz@rock-chips.com");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
2255
arch/arm/mach-rk2818/board-raho-0928.c
Executable file
2255
arch/arm/mach-rk2818/board-raho-0928.c
Executable file
File diff suppressed because it is too large
Load Diff
@@ -674,6 +674,27 @@ static struct wm8994_platform_data wm8994_data = {
|
||||
.bt_call_vol = 0,
|
||||
};// must initialize
|
||||
|
||||
/*****************************************************************************************
|
||||
* rtc
|
||||
*****************************************************************************************/
|
||||
#define RTC_IRQ_PIN RK2818_PIN_PE2
|
||||
|
||||
static int rk2818_rtc_io_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rk2818_rtc_io_deinit(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rk2818_rtc_platform_data rtc_data = {
|
||||
.irq_type = GPIO_HIGH,//irq type
|
||||
.io_init = rk2818_rtc_io_init,
|
||||
.io_deinit = rk2818_rtc_io_deinit,
|
||||
};
|
||||
|
||||
/*****************************************************************************************
|
||||
* i2c devices
|
||||
* author: kfx@rock-chips.com
|
||||
@@ -778,7 +799,8 @@ static struct i2c_board_info __initdata board_i2c1_devices[] = {
|
||||
.type = "rtc-s35392a",
|
||||
.addr = 0x30,
|
||||
.flags = 0,
|
||||
.irq = RK2818_PIN_PE2,
|
||||
.irq = RTC_IRQ_PIN,
|
||||
.platform_data = &rtc_data,
|
||||
},
|
||||
#endif
|
||||
#if defined (CONFIG_FM_QN8006)
|
||||
|
||||
@@ -214,6 +214,13 @@ struct rk2818_spi_platform_data {
|
||||
u16 num_chipselect;
|
||||
};
|
||||
|
||||
/*rtc*/
|
||||
struct rk2818_rtc_platform_data {
|
||||
u8 irq_type;
|
||||
int (*io_init)(void);
|
||||
int (*io_deinit)(void);
|
||||
};
|
||||
|
||||
//ROCKCHIP AD KEY CODE ,for demo board
|
||||
// key ---> EV
|
||||
#define AD2KEY1 114 ///VOLUME_DOWN
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <mach/board.h>
|
||||
#include "rtc-s35392a.h"
|
||||
|
||||
#define RTC_RATE 100 * 1000
|
||||
@@ -766,6 +767,7 @@ static void s35392a_wakeup_irq(int irq, void *dev_id)
|
||||
static int s35392a_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct rk2818_rtc_platform_data *pdata = client->dev.platform_data;
|
||||
int err;
|
||||
unsigned int i;
|
||||
struct s35392a *s35392a;
|
||||
@@ -834,15 +836,28 @@ static int s35392a_probe(struct i2c_client *client,
|
||||
goto exit_dummy;
|
||||
}
|
||||
|
||||
gpio_pull_updown(client->irq,GPIOPullDown);
|
||||
if (pdata && (pdata->irq_type == GPIO_LOW)) {
|
||||
gpio_pull_updown(client->irq,GPIOPullUp);
|
||||
|
||||
client->irq = gpio_to_irq(client->irq);
|
||||
|
||||
if(err = request_irq(client->irq, s35392a_wakeup_irq,IRQF_TRIGGER_HIGH,NULL,s35392a) <0)
|
||||
{
|
||||
printk("unable to request rtc irq\n");
|
||||
goto exit_dummy;
|
||||
}
|
||||
client->irq = gpio_to_irq(client->irq);
|
||||
|
||||
if(err = request_irq(client->irq, s35392a_wakeup_irq,IRQF_TRIGGER_LOW,NULL,s35392a) <0)
|
||||
{
|
||||
printk("unable to request rtc irq\n");
|
||||
goto exit_dummy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gpio_pull_updown(client->irq,GPIOPullDown);
|
||||
|
||||
client->irq = gpio_to_irq(client->irq);
|
||||
|
||||
if(err = request_irq(client->irq, s35392a_wakeup_irq,IRQF_TRIGGER_HIGH,NULL,s35392a) <0)
|
||||
{
|
||||
printk("unable to request rtc irq\n");
|
||||
goto exit_dummy;
|
||||
}
|
||||
}
|
||||
|
||||
INIT_WORK(&s35392a->work, s35392a_work_func);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user