#define MEM_FB_BASE (MEM_CAMIPP_BASE - MEM_FB_SIZE)
#define LINUX_SIZE (MEM_FB_BASE - RK29_SDRAM_PHYS)
+#define PREALLOC_WLAN_SEC_NUM 4
+#define PREALLOC_WLAN_BUF_NUM 160
+#define PREALLOC_WLAN_SECTION_HEADER 24
+
+#define WLAN_SECTION_SIZE_0 (PREALLOC_WLAN_BUF_NUM * 128)
+#define WLAN_SECTION_SIZE_1 (PREALLOC_WLAN_BUF_NUM * 128)
+#define WLAN_SECTION_SIZE_2 (PREALLOC_WLAN_BUF_NUM * 512)
+#define WLAN_SECTION_SIZE_3 (PREALLOC_WLAN_BUF_NUM * 1024)
+
+#define WLAN_SKB_BUF_NUM 16
+
+static struct sk_buff *wlan_static_skb[WLAN_SKB_BUF_NUM];
+
+struct wifi_mem_prealloc {
+ void *mem_ptr;
+ unsigned long size;
+};
+
extern struct sys_timer rk29_timer;
-int rk29_nand_io_init(void)
+static int rk29_nand_io_init(void)
{
return 0;
}
return ret;
}
-struct rk29lcd_info rk29_lcd_info = {
+static struct rk29lcd_info rk29_lcd_info = {
.txd_pin = LCD_TXD_PIN,
.clk_pin = LCD_CLK_PIN,
.cs_pin = LCD_CS_PIN,
return ret;
}
-struct rk29fb_info rk29_fb_info = {
+static struct rk29fb_info rk29_fb_info = {
.fb_id = FB_ID,
.disp_on_pin = FB_DISPLAY_ON_PIN,
.disp_on_value = FB_DISPLAY_ON_VALUE,
};
/* rk29 fb resource */
-struct resource rk29_fb_resource[] = {
+static struct resource rk29_fb_resource[] = {
[0] = {
.name = "lcdc reg",
.start = RK29_LCDC_PHYS,
[2] = {
.name = "win1 buf",
.start = MEM_FB_BASE,
- .end = MEM_FB_BASE + MEM_FB_SIZE,
+ .end = MEM_FB_BASE + MEM_FB_SIZE - 1,
.flags = IORESOURCE_MEM,
},
};
},
};
+static struct platform_device rk29_v4l2_output_devce = {
+ .name = "rk29_vout",
+};
/*HANNSTAR_P1003 touch*/
#if defined (CONFIG_HANNSTAR_P1003)
#define TOUCH_RESET_PIN RK29_PIN6_PC3
#define TOUCH_INT_PIN RK29_PIN0_PA2
-int EETI_EGALAX_init_platform_hw(void)
+static int EETI_EGALAX_init_platform_hw(void)
{
if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
gpio_free(TOUCH_RESET_PIN);
}
-struct eeti_egalax_platform_data eeti_egalax_info = {
+static struct eeti_egalax_platform_data eeti_egalax_info = {
.model= 1003,
.init_platform_hw= EETI_EGALAX_init_platform_hw,
#if defined (CONFIG_GS_MMA8452)
#define MMA8452_INT_PIN RK29_PIN0_PA3
-int mma8452_init_platform_hw(void)
+static int mma8452_init_platform_hw(void)
{
if(gpio_request(MMA8452_INT_PIN,NULL) != 0){
}
-struct mma8452_platform_data mma8452_info = {
+static struct mma8452_platform_data mma8452_info = {
.model= 8452,
.swap_xy = 0,
.init_platform_hw= mma8452_init_platform_hw,
};
#endif
+#if defined (CONFIG_BATTERY_BQ27510)
+#define DC_CHECK_PIN RK29_PIN4_PA1
+#define LI_LION_BAT_NUM 2
+static int bq27510_init_dc_check_pin(void){
+ if(gpio_request(DC_CHECK_PIN,"dc_check") != 0){
+ gpio_free(DC_CHECK_PIN);
+ printk("bq27510 init dc check pin request error\n");
+ return -EIO;
+ }
+ gpio_direction_input(DC_CHECK_PIN);
+ return 0;
+}
+
+struct bq27510_platform_data bq27510_info = {
+ .init_dc_check_pin = bq27510_init_dc_check_pin,
+ .dc_check_pin = DC_CHECK_PIN,
+ .bat_num = LI_LION_BAT_NUM,
+};
+#endif
/*****************************************************************************************
.type = "bq27510",
.addr = 0x55,
.flags = 0,
+ .platform_data = &bq27510_info,
},
#endif
#if defined (CONFIG_RTC_HYM8563)
.platform_data = &mma8452_info,
},
#endif
-#if defined (CONFIG_SENSORS_AK8973)
+#if defined (CONFIG_COMPASS_AK8973)
{
.type = "ak8973",
.addr = 0x1d,
.irq = RK29_PIN0_PA4,
},
#endif
-#if defined (CONFIG_SENSORS_AK8975)
+#if defined (CONFIG_COMPASS_AK8975)
{
.type = "ak8975",
.addr = 0x0d,
static int rk29_sensor_io_deinit(int sensor);
static int rk29_sensor_ioctrl(struct device *dev,enum rk29camera_ioctrl_cmd cmd,int on);
-struct rk29camera_platform_data rk29_camera_platform_data = {
+static struct rk29camera_platform_data rk29_camera_platform_data = {
.io_init = rk29_sensor_io_init,
.io_deinit = rk29_sensor_io_deinit,
.sensor_ioctrl = rk29_sensor_ioctrl,
}
} else {
ret = RK29_CAM_EIO_REQUESTFAIL;
- printk("\n%s..%s..ResetPin=%d request failed!\n",__FUNCTION__,dev_name(dev),camera_reset);
+ printk("\n%s..%s..PowerPin=%d request failed!\n",__FUNCTION__,dev_name(dev),camera_reset);
}
} else {
ret = RK29_CAM_EIO_INVALID;
},
};
-struct soc_camera_link rk29_iclink_0 = {
+static struct soc_camera_link rk29_iclink_0 = {
.bus_id = RK29_CAM_PLATFORM_DEV_ID,
.power = rk29_sensor_power,
.powerdown = rk29_sensor_powerdown,
};
/*platform_device : soc-camera need */
-struct platform_device rk29_soc_camera_pdrv_0 = {
+static struct platform_device rk29_soc_camera_pdrv_0 = {
.name = "soc-camera-pdrv",
.id = 0,
.dev = {
},
};
-struct soc_camera_link rk29_iclink_1 = {
+static struct soc_camera_link rk29_iclink_1 = {
.bus_id = RK29_CAM_PLATFORM_DEV_ID,
.power = rk29_sensor_power,
.powerdown = rk29_sensor_powerdown,
};
/*platform_device : soc-camera need */
-struct platform_device rk29_soc_camera_pdrv_1 = {
+static struct platform_device rk29_soc_camera_pdrv_1 = {
.name = "soc-camera-pdrv",
.id = 1,
.dev = {
static u64 rockchip_device_camera_dmamask = 0xffffffffUL;
-struct resource rk29_camera_resource[] = {
+static struct resource rk29_camera_resource[] = {
[0] = {
.start = RK29_VIP_PHYS,
.end = RK29_VIP_PHYS + RK29_VIP_SIZE - 1,
};
/*platform_device : */
-struct platform_device rk29_device_camera = {
+static struct platform_device rk29_device_camera = {
.name = RK29_CAM_DRV_NAME,
.id = RK29_CAM_PLATFORM_DEV_ID, /* This is used to put cameras on this interface */
.num_resources = ARRAY_SIZE(rk29_camera_resource),
#define PWM_MUX_NAME GPIO1B5_PWM0_NAME
#define PWM_MUX_MODE GPIO1L_PWM0
#define PWM_MUX_MODE_GPIO GPIO1L_GPIO1B5
+#define PWM_GPIO RK29_PIN1_PB5
#define PWM_EFFECT_VALUE 1
//#define LCD_DISP_ON_PIN
rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
return ret;
}
+
+static int rk29_backlight_pwm_suspend(void)
+{
+ int ret = 0;
+ rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
+ if (ret = gpio_request(PWM_GPIO, NULL)) {
+ printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
+ return -1;
+ }
+ gpio_direction_output(PWM_GPIO, GPIO_LOW);
+ return ret;
+}
+
+static int rk29_backlight_pwm_resume(void)
+{
+ gpio_free(PWM_GPIO);
+ rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
+ return 0;
+}
+
struct rk29_bl_info rk29_bl_info = {
.pwm_id = PWM_ID,
.bl_ref = PWM_EFFECT_VALUE,
.io_init = rk29_backlight_io_init,
.io_deinit = rk29_backlight_io_deinit,
+ .pwm_suspend = rk29_backlight_pwm_suspend,
+ .pwm_resume = rk29_backlight_pwm_resume,
};
#endif
/*****************************************************************************************
rk29_mux_api_set(GPIO2A2_SDMMC0DETECTN_NAME, GPIO2L_SDMMC0_DETECT_N);
rk29_mux_api_set(GPIO5D5_SDMMC0PWREN_NAME, GPIO5H_GPIO5D5); ///GPIO5H_SDMMC0_PWR_EN); ///GPIO5H_GPIO5D5);
gpio_request(RK29_PIN5_PD5,"sdmmc");
+#if 0
gpio_set_value(RK29_PIN5_PD5,GPIO_HIGH);
mdelay(100);
gpio_set_value(RK29_PIN5_PD5,GPIO_LOW);
+#else
+ gpio_direction_output(RK29_PIN5_PD5,GPIO_LOW);
+#endif
return 0;
}
{
pr_info("%s: %d\n", __func__, on);
if (on){
- gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, on);
+ gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_HIGH);
+ gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, GPIO_HIGH);
mdelay(100);
pr_info("wifi turn on power\n");
}else{
if (!rk29sdk_bt_power_state){
- gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, on);
+ gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_LOW);
mdelay(100);
pr_info("wifi shut off power\n");
}else
{
pr_info("wifi shouldn't shut off power, bt is using it!\n");
}
+ gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, GPIO_LOW);
}
}
EXPORT_SYMBOL(rk29sdk_wifi_set_carddetect);
+static struct wifi_mem_prealloc wifi_mem_array[PREALLOC_WLAN_SEC_NUM] = {
+ {NULL, (WLAN_SECTION_SIZE_0 + PREALLOC_WLAN_SECTION_HEADER)},
+ {NULL, (WLAN_SECTION_SIZE_1 + PREALLOC_WLAN_SECTION_HEADER)},
+ {NULL, (WLAN_SECTION_SIZE_2 + PREALLOC_WLAN_SECTION_HEADER)},
+ {NULL, (WLAN_SECTION_SIZE_3 + PREALLOC_WLAN_SECTION_HEADER)}
+};
+
+static void *rk29sdk_mem_prealloc(int section, unsigned long size)
+{
+ if (section == PREALLOC_WLAN_SEC_NUM)
+ return wlan_static_skb;
+
+ if ((section < 0) || (section > PREALLOC_WLAN_SEC_NUM))
+ return NULL;
+
+ if (wifi_mem_array[section].size < size)
+ return NULL;
+
+ return wifi_mem_array[section].mem_ptr;
+}
+
+int __init rk29sdk_init_wifi_mem(void)
+{
+ int i;
+ int j;
+
+ for (i = 0 ; i < WLAN_SKB_BUF_NUM ; i++) {
+ wlan_static_skb[i] = dev_alloc_skb(
+ ((i < (WLAN_SKB_BUF_NUM / 2)) ? 4096 : 8192));
+
+ if (!wlan_static_skb[i])
+ goto err_skb_alloc;
+ }
+
+ for (i = 0 ; i < PREALLOC_WLAN_SEC_NUM ; i++) {
+ wifi_mem_array[i].mem_ptr =
+ kmalloc(wifi_mem_array[i].size, GFP_KERNEL);
+
+ if (!wifi_mem_array[i].mem_ptr)
+ goto err_mem_alloc;
+ }
+ return 0;
+
+err_mem_alloc:
+ pr_err("Failed to mem_alloc for WLAN\n");
+ for (j = 0 ; j < i ; j++)
+ kfree(wifi_mem_array[j].mem_ptr);
+
+ i = WLAN_SKB_BUF_NUM;
+
+err_skb_alloc:
+ pr_err("Failed to skb_alloc for WLAN\n");
+ for (j = 0 ; j < i ; j++)
+ dev_kfree_skb(wlan_static_skb[j]);
+
+ return -ENOMEM;
+}
+
static struct wifi_platform_data rk29sdk_wifi_control = {
.set_power = rk29sdk_wifi_power,
.set_reset = rk29sdk_wifi_reset,
.set_carddetect = rk29sdk_wifi_set_carddetect,
+ .mem_prealloc = rk29sdk_mem_prealloc,
};
static struct platform_device rk29sdk_wifi_device = {
.name = "bcm4329_wlan",
[1] = {
.name = "gpu_base",
.start = RK29_GPU_PHYS,
- .end = RK29_GPU_PHYS + RK29_GPU_PHYS_SIZE,
+ .end = RK29_GPU_PHYS + RK29_GPU_SIZE,
.flags = IORESOURCE_MEM,
},
[2] = {
.flags = IORESOURCE_MEM,
},
};
-struct platform_device rk29_device_gpu = {
+static struct platform_device rk29_device_gpu = {
.name = "galcore",
.id = 0,
.num_resources = ARRAY_SIZE(resources_gpu),
#ifdef CONFIG_RK29_IPP
&rk29_device_ipp,
#endif
+#ifdef CONFIG_VIDEO_RK29XX_VOUT
+ &rk29_v4l2_output_devce,
+#endif
};
/*****************************************************************************************
* author: cmc@rock-chips.com
*****************************************************************************************/
#define SPI_CHIPSELECT_NUM 2
-struct spi_cs_gpio rk29xx_spi0_cs_gpios[SPI_CHIPSELECT_NUM] = {
+static struct spi_cs_gpio rk29xx_spi0_cs_gpios[SPI_CHIPSELECT_NUM] = {
{
.name = "spi0 cs0",
.cs_gpio = RK29_PIN2_PC1,
- .cs_iomux_name = NULL,
+ .cs_iomux_name = GPIO2C1_SPI0CSN0_NAME,
+ .cs_iomux_mode = GPIO2H_SPI0_CSN0,
},
{
.name = "spi0 cs1",
}
};
-struct spi_cs_gpio rk29xx_spi1_cs_gpios[SPI_CHIPSELECT_NUM] = {
+static struct spi_cs_gpio rk29xx_spi1_cs_gpios[SPI_CHIPSELECT_NUM] = {
{
.name = "spi1 cs0",
.cs_gpio = RK29_PIN2_PC5,
- .cs_iomux_name = NULL,
+ .cs_iomux_name = GPIO2C5_SPI1CSN0_NAME,
+ .cs_iomux_mode = GPIO2H_SPI1_CSN0,
},
{
.name = "spi1 cs1",
static int spi_io_init(struct spi_cs_gpio *cs_gpios, int cs_num)
{
#if 1
- int i,j,ret;
-
- //cs
+ int i;
if (cs_gpios) {
for (i=0; i<cs_num; i++) {
rk29_mux_api_set(cs_gpios[i].cs_iomux_name, cs_gpios[i].cs_iomux_mode);
- ret = gpio_request(cs_gpios[i].cs_gpio, cs_gpios[i].name);
- if (ret) {
- for (j=0;j<i;j++) {
- gpio_free(cs_gpios[j].cs_gpio);
- //rk29_mux_api_mode_resume(cs_gpios[j].cs_iomux_name);
- }
- printk("[fun:%s, line:%d], gpio request err\n", __func__, __LINE__);
- return -1;
- }
- gpio_direction_output(cs_gpios[i].cs_gpio, GPIO_HIGH);
}
}
#endif
static int spi_io_deinit(struct spi_cs_gpio *cs_gpios, int cs_num)
{
-#if 1
- int i;
-
- if (cs_gpios) {
- for (i=0; i<cs_num; i++) {
- gpio_free(cs_gpios[i].cs_gpio);
- //rk29_mux_api_mode_resume(cs_gpios[i].cs_iomux_name);
- }
- }
-#endif
return 0;
}
gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
pm_power_off = rk29_pm_power_off;
-#ifdef CONFIG_WIFI_CONTROL_FUNC
- rk29sdk_wifi_bt_gpio_control_init();
-#endif
-
platform_add_devices(devices, ARRAY_SIZE(devices));
#ifdef CONFIG_I2C0_RK29
i2c_register_board_info(default_i2c0_data.bus_num, board_i2c0_devices,
#endif
spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
+
+#ifdef CONFIG_WIFI_CONTROL_FUNC
+ rk29sdk_wifi_bt_gpio_control_init();
+ rk29sdk_init_wifi_mem();
+#endif
}
static void __init machine_rk29_fixup(struct machine_desc *desc, struct tag *tags,
static void __init machine_rk29_mapio(void)
{
rk29_map_common_io();
+ rk29_setup_early_printk();
rk29_sram_init();
rk29_clock_init();
rk29_iomux_init();