mirror of
https://github.com/torvalds/linux.git
synced 2026-06-11 08:03:05 +02:00
lyx add switch between spim and gpio to fix spi data error when suspend or resume
This commit is contained in:
parent
211e5a1278
commit
620fa29aaa
|
|
@ -970,6 +970,7 @@ CONFIG_SPI_MASTER=y
|
|||
CONFIG_SPIM_RK29=y
|
||||
CONFIG_SPIM0_RK29=y
|
||||
CONFIG_SPIM1_RK29=y
|
||||
CONFIG_LCD_USE_SPIM_CONTROL=y
|
||||
|
||||
#
|
||||
# SPI Protocol Masters
|
||||
|
|
|
|||
1
arch/arm/configs/rk29_phonesdk_defconfig
Executable file → Normal file
1
arch/arm/configs/rk29_phonesdk_defconfig
Executable file → Normal file
|
|
@ -982,6 +982,7 @@ CONFIG_SPI_MASTER=y
|
|||
CONFIG_SPIM_RK29=y
|
||||
CONFIG_SPIM0_RK29=y
|
||||
CONFIG_SPIM1_RK29=y
|
||||
CONFIG_LCD_USE_SPIM_CONTROL=y
|
||||
|
||||
#
|
||||
# SPI Protocol Masters
|
||||
|
|
|
|||
|
|
@ -270,7 +270,13 @@ config SPIM1_RK29
|
|||
bool "RK29 SPI1 master controller"
|
||||
depends on SPIM_RK29
|
||||
help
|
||||
enable SPI1 master controller for RK29
|
||||
enable SPI1 master controller for RK29
|
||||
|
||||
config LCD_USE_SPIM_CONTROL
|
||||
bool "switch gpio to spim with spin lock"
|
||||
depends on SPIM_RK29
|
||||
help
|
||||
switch gpio that used for lcd to spim with spin lock.
|
||||
|
||||
#
|
||||
# There are lots of SPI device types, with sensors and memory
|
||||
|
|
|
|||
|
|
@ -21,9 +21,10 @@
|
|||
#include <linux/clk.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <mach/irqs.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <asm/dma.h>
|
||||
|
||||
#include <linux/preempt.h>
|
||||
#include "rk29_spim.h"
|
||||
#include <linux/spi/spi.h>
|
||||
#include <mach/board.h>
|
||||
|
|
@ -88,6 +89,34 @@ struct chip_data {
|
|||
#define RXBUSY (1<<2)
|
||||
#define TXBUSY (1<<3)
|
||||
|
||||
//
|
||||
#ifdef CONFIG_LCD_USE_SPIM_CONTROL
|
||||
void rk29_lcd_spim_spin_lock(void)
|
||||
{
|
||||
disable_irq(IRQ_SPI0);
|
||||
disable_irq(IRQ_SPI1);
|
||||
preempt_disable();
|
||||
}
|
||||
|
||||
void rk29_lcd_spim_spin_unlock(void)
|
||||
{
|
||||
enable_irq(IRQ_SPI0);
|
||||
enable_irq(IRQ_SPI1);
|
||||
preempt_enable();
|
||||
}
|
||||
#else
|
||||
void rk29_lcd_spim_spin_lock(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void rk29_lcd_spim_spin_unlock(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void spi_dump_regs(struct rk29xx_spi *dws) {
|
||||
DBG("MRST SPI0 registers:\n");
|
||||
DBG("=================================\n");
|
||||
|
|
|
|||
|
|
@ -308,9 +308,12 @@ int lcd_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern void rk29_lcd_spim_spin_lock(void);
|
||||
extern void rk29_lcd_spim_spin_unlock(void);
|
||||
int lcd_standby(u8 enable)
|
||||
{
|
||||
if(gLcd_info)
|
||||
rk29_lcd_spim_spin_lock();
|
||||
if(gLcd_info)
|
||||
gLcd_info->io_init();
|
||||
|
||||
if(enable) {
|
||||
|
|
@ -325,6 +328,7 @@ int lcd_standby(u8 enable)
|
|||
|
||||
if(gLcd_info)
|
||||
gLcd_info->io_deinit();
|
||||
rk29_lcd_spim_spin_unlock();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
7
drivers/video/display/screen/lcd_ls035y8dx02a.c
Normal file → Executable file
7
drivers/video/display/screen/lcd_ls035y8dx02a.c
Normal file → Executable file
|
|
@ -319,10 +319,12 @@ int lcd_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern void rk29_lcd_spim_spin_lock(void);
|
||||
extern void rk29_lcd_spim_spin_unlock(void);
|
||||
int lcd_standby(u8 enable) //***enable =1 means suspend, 0 means resume
|
||||
{
|
||||
|
||||
if(gLcd_info)
|
||||
rk29_lcd_spim_spin_lock();
|
||||
if(gLcd_info)
|
||||
gLcd_info->io_init();
|
||||
printk("lcd standby\n");
|
||||
if(enable) {
|
||||
|
|
@ -339,6 +341,7 @@ int lcd_standby(u8 enable) //***enable =1 means suspend, 0 means resume
|
|||
|
||||
if(gLcd_info)
|
||||
gLcd_info->io_deinit();
|
||||
rk29_lcd_spim_spin_unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#define SWAP_RB 0
|
||||
|
||||
static struct rk29lcd_info *gLcd_info = NULL;
|
||||
|
||||
int init(void);
|
||||
int standby(u8 enable);
|
||||
|
||||
|
|
@ -1571,10 +1572,12 @@ int init(void)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern void rk29_lcd_spim_spin_lock(void);
|
||||
extern void rk29_lcd_spim_spin_unlock(void);
|
||||
int standby(u8 enable) //***enable =1 means suspend, 0 means resume
|
||||
{
|
||||
if(gLcd_info)
|
||||
rk29_lcd_spim_spin_lock();
|
||||
if(gLcd_info)
|
||||
gLcd_info->io_init();
|
||||
|
||||
if(enable) {
|
||||
|
|
@ -1594,6 +1597,8 @@ int standby(u8 enable) //***enable =1 means suspend, 0 means resume
|
|||
if(gLcd_info)
|
||||
gLcd_info->io_deinit();
|
||||
|
||||
rk29_lcd_spim_spin_unlock();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user