Lemote-2f: Add Platform Specific Support
cover Lemote-2f: Add Platform Specific Support
This patchset add the platform specific support for LynLoong2F(ALLINONE) PC and YeeLoong2F netbook. and also, a cleanup and update for YeeLoong2F is added.
o [loongson] LynLoong2F: Add Platform Specific Support
Add the backlight and suspend support for LynLoong2F.
o [loongson] yeeloong2f: add basic ec operations
[loongson] yeeloong2f: add platform specific support
Add the support for YeeLoong2F's Embedded Controller and cleanup the reset logic with the ec operations. the following yeeloong2f patches need this ec support.
o [loongson] yeeloong2f: add platform specific support
Add the backlight,hwmon,hotkey,thermal,battery,suspend support for YeeLoong2F.
o [loongson] yeeloong2f: add LID open event as the wakeup event
Setup a new wakeup interrupt for YeeLoong2F to allow user wakeup the netbook from suspend mode via opening the netbook.
All of the above updates have been put into this branch:
git://dev.lemote.com/rt4ls.git linux-loongson/dev/for-upstream
Thanks & Best Regards,
Wu Zhangjin
Wu Zhangjin (5):
[loongson] LynLoong2F: Add Platform Specific Support [loongson] yeeloong2f: add basic ec operations
[loongson] yeeloong2f: add LID open event as the wakeup event [loongson] yeeloong2f: cleanup the reset logic with ec_write function [loongson] yeeloong2f: add platform specific support
.../mips/include/asm/mach-loongson/cs5536/cs5536.h | 35 + .../asm/mach-loongson/cs5536/cs5536_mfgpt.h | 5 + arch/mips/include/asm/mach-loongson/loongson.h | 1 + arch/mips/kernel/setup.c | 1 + arch/mips/loongson/Kconfig | 53 + arch/mips/loongson/common/cmdline.c | 10 + arch/mips/loongson/lemote-2f/Makefile | 8 +- arch/mips/loongson/lemote-2f/ec_kb3310b.c | 132 ++ arch/mips/loongson/lemote-2f/ec_kb3310b.h | 197 +++ arch/mips/loongson/lemote-2f/irq.c | 4 +- arch/mips/loongson/lemote-2f/lynloong_pc.c | 609 +++++++++ arch/mips/loongson/lemote-2f/pm.c | 72 + arch/mips/loongson/lemote-2f/reset.c | 21 +- arch/mips/loongson/lemote-2f/yeeloong_laptop.c | 1354 ++++++++++++++++++++ 14 files changed, 2481 insertions(+), 21 deletions(-) create mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.c create mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.h create mode 100644 arch/mips/loongson/lemote-2f/lynloong_pc.c create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop.c
PATCH 1/5 LynLoong2F: Add Platform Specific Support
LynLoong PC is an AllINONE machine made by Lemote, which is basically compatible to FuLoong2F Mini PC, the only difference is that it has a size-fixed screen: 1360x768 with sisfb video driver. and also, it has its own specific suspend support(e.g. suspend/resume the display, the external clocks.).
This patch adds the backlight subdriver and platform specific suspend support for LynLoong(ALLINONE) PC. And also, a kernel command line argument "video=sisfb:1360x768-16@60" is appended for the size-fixed display.
--- .../mips/include/asm/mach-loongson/cs5536/cs5536.h | 35 ++ .../asm/mach-loongson/cs5536/cs5536_mfgpt.h | 5 + arch/mips/loongson/Kconfig | 35 ++ arch/mips/loongson/common/cmdline.c | 10 + arch/mips/loongson/lemote-2f/Makefile | 5 + arch/mips/loongson/lemote-2f/lynloong_pc.c | 609 ++++++++++++++++++++ 6 files changed, 699 insertions(+), 0 deletions(-) create mode 100644 arch/mips/loongson/lemote-2f/lynloong_pc.c
arch/mips/include/asm/mach-loongson/cs5536/cs5536.h +35 -0
@@ -301,5 +301,40 @@ extern void _wrmsr(u32 msr, u32 hi, u32 lo);/* GPIO : I/O SPACE; REG : 32BITS */ #define GPIOL_OUT_VAL 0x00#define GPIOL_OUT_EN 0x04 +#define GPIOL_OUT_AUX1_SEL 0x10 +/* SMB : I/O SPACE, REG : 8BITS WIDTH */ +#define SMB_SDA 0x00 +#define SMB_STS 0x01 +#define SMB_STS_SLVSTP (1 << 7) +#define SMB_STS_SDAST (1 << 6) +#define SMB_STS_BER (1 << 5) +#define SMB_STS_NEGACK (1 << 4) +#define SMB_STS_STASTR (1 << 3) +#define SMB_STS_NMATCH (1 << 2) +#define SMB_STS_MASTER (1 << 1) +#define SMB_STS_XMIT (1 << 0) +#define SMB_CTRL_STS 0x02 +#define SMB_CSTS_TGSTL (1 << 5) +#define SMB_CSTS_TSDA (1 << 4) +#define SMB_CSTS_GCMTCH (1 << 3) +#define SMB_CSTS_MATCH (1 << 2) +#define SMB_CSTS_BB (1 << 1) +#define SMB_CSTS_BUSY (1 << 0) +#define SMB_CTRL1 0x03 +#define SMB_CTRL1_STASTRE (1 << 7) +#define SMB_CTRL1_NMINTE (1 << 6) +#define SMB_CTRL1_GCMEN (1 << 5) +#define SMB_CTRL1_ACK (1 << 4) +#define SMB_CTRL1_RSVD (1 << 3) +#define SMB_CTRL1_INTEN (1 << 2) +#define SMB_CTRL1_STOP (1 << 1) +#define SMB_CTRL1_START (1 << 0) +#define SMB_ADDR 0x04 +#define SMB_ADDR_SAEN (1 << 7) +#define SMB_CONTROLLER_ADDR (0xef << 0) +#define SMB_CTRL2 0x05 +#define SMB_FREQ (0x20 << 1) +#define SMB_ENABLE (0x01 << 0) +#define SMB_CTRL3 0x06#endif /* _CS5536_H */
arch/mips/include/asm/mach-loongson/cs5536/cs5536_mfgpt.h +5 -0
@@ -32,4 +32,9 @@ static inline void __maybe_unused enable_mfgpt0_counter(void)#define MFGPT0_CNT (MFGPT_BASE + 4)#define MFGPT0_SETUP (MFGPT_BASE + 6) +#define MFGPT2_CMP1 (MFGPT_BASE + 0x10) +#define MFGPT2_CMP2 (MFGPT_BASE + 0x12) +#define MFGPT2_CNT (MFGPT_BASE + 0x14) +#define MFGPT2_SETUP (MFGPT_BASE + 0x16) +#endif /*!_CS5536_MFGPT_H */
arch/mips/loongson/Kconfig +35 -0
@@ -78,3 +78,38 @@ config LOONGSON_SUSPEND bool default y depends on CPU_SUPPORTS_CPUFREQ && SUSPEND + +# +# Loongson Platform Specific Drivers +# + +comment "Loongson Platform Specific Drivers" + +menuconfig LOONGSON_PLATFORM_DEVICES + bool "Loongson Platform Specific Drivers" + default y + ---help--- + Say Y here to get to see options for device drivers for various + loongson platforms, including vendor-specific laptop/pc extension drivers. + This option alone does not add any kernel code. + + If you say N, all options in this submenu will be skipped and disabled. + +if LOONGSON_PLATFORM_DEVICES + +config LEMOTE_LYNLOONG2F_PDEV + tristate "Lemote LynLoong(Allinone) Platform Specific Driver" + depends on LEMOTE_MACH2F + select THERMAL + select BACKLIGHT_CLASS_DEVICE + default m + help + LynLoong PC is an AllINONE machine made by Lemote, which is basically + compatible to FuLoong2F Mini PC, the only difference is that it has a + size-fixed screen: 1360x768 with sisfb video driver. and also, it has + its own specific suspend support. + + This driver adds the lynloong specific backlight driver and platform + driver(mainly the suspend support). + +endif # LOONGSON_PLATFORM_DEVICES
arch/mips/loongson/common/cmdline.c +10 -0
@@ -51,4 +51,14 @@ void __init prom_init_cmdline(void)strcat (arcs_cmdline," root=/dev/hda1" );prom_init_machtype (); + +/* append machine specific command line */ +switch (mips_machtype) { +case MACH_LEMOTE_LL2F : +if ((strstr (arcs_cmdline,"video=" )) ==NULL ) +strcat (arcs_cmdline," video=sisfb:1360x768-16@60" ); +break ; +default : +break ; + } }
arch/mips/loongson/lemote-2f/Makefile +5 -0
@@ -9,3 +9,8 @@ obj-y += irq.o reset.o # obj-$(CONFIG_LOONGSON_SUSPEND) += pm.o + +# +# Platform Drivers +# +obj-$(CONFIG_LEMOTE_LYNLOONG2F_PDEV) += lynloong_pc.o
arch/mips/loongson/lemote-2f/lynloong_pc.c new file +609 -0
609 lines not on this page · raw message
Signature · 1 line
1.6.2.1
PATCH 2/5 yeeloong2f: add basic ec operations
In reply to Wu ZhangjinYeeLoong2F has a kb3310b Embedded Controller. This patch add the basic EC operations for future relative drivers or board support.
--- arch/mips/loongson/lemote-2f/Makefile | 2 +- arch/mips/loongson/lemote-2f/ec_kb3310b.c | 132 +++++++++++++++++++++++++++++ arch/mips/loongson/lemote-2f/ec_kb3310b.h | 47 ++++++++++ 3 files changed, 180 insertions(+), 1 deletions(-) create mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.c create mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.h
arch/mips/loongson/lemote-2f/Makefile +1 -1
@@ -2,7 +2,7 @@ # Makefile for lemote loongson2f family machines # -obj-y += irq.o reset.o +obj-y += irq.o reset.o ec_kb3310b.o # # Suspend Support
arch/mips/loongson/lemote-2f/ec_kb3310b.c new file +132 -0
132 lines not on this page · raw message
arch/mips/loongson/lemote-2f/ec_kb3310b.h new file +47 -0
47 lines not on this page · raw message
Signature · 1 line
1.6.2.1
PATCH 3/5 yeeloong2f: add LID open event as the wakeup event
In reply to Wu ZhangjinYeeloong2F netbook has an embedded controller(kb3310b) to manage the LID action. when the LID is closed/opened, a relative SCI interrupt take place, and the relative event is saved to a relative EC register.
This patch make the LID open action can wake up the processor from wait mode if it in the suspend mode.
--- arch/mips/include/asm/mach-loongson/loongson.h | 1 + arch/mips/loongson/lemote-2f/irq.c | 4 +- arch/mips/loongson/lemote-2f/pm.c | 72 ++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletions(-)
arch/mips/include/asm/mach-loongson/loongson.h +1 -0
@@ -41,6 +41,7 @@ extern void __init bonito_irq_init(void);extern void __init set_irq_trigger_mode (void );extern void __init mach_init_irq (void );extern void mach_irq_dispatch (unsigned int pending); +extern int mach_i8259_irq (void );/* We need this in some places... */ #define delay () ({ \
arch/mips/loongson/lemote-2f/irq.c +3 -1
@@ -9,6 +9,7 @@*/ #include <linux/interrupt.h> +#include <linux/module.h> #include <asm/irq_cpu.h> #include <asm/i8259.h>
@@ -30,7 +31,7 @@* The generic i8259_irq() make the kernel hang on booting. Since we cannot * get the irq via the IRR directly, we access the ISR instead. */ -static inline int mach_i8259_irq (void ) +int mach_i8259_irq (void ) {int irq, isr;
@@ -60,6 +61,7 @@ static inline int mach_i8259_irq(void)return irq; } +EXPORT_SYMBOL (mach_i8259_irq);static void i8259_irqdispatch (void ) {
arch/mips/loongson/lemote-2f/pm.c +72 -0
99 lines not on this page · raw message
Signature · 1 line
1.6.2.1
PATCH 4/5 yeeloong2f: cleanup the reset logic with ec_write function
In reply to Wu ZhangjinA commen ec_read/ec_write function is defined in "[loongson] yeeloong2f:
add basic ec operations", So, we can use it here to cleanup the reset logic of yeeloong2f netbook.
--- arch/mips/loongson/lemote-2f/reset.c | 21 ++------------------- 1 files changed, 2 insertions(+), 19 deletions(-)
arch/mips/loongson/lemote-2f/reset.c +2 -19
@@ -20,6 +20,7 @@#include <loongson.h> #include <cs5536/cs5536.h> +#include "ec_kb3310b.h" static void reset_cpu (void ) {
@@ -75,30 +76,12 @@ static void fl2f_shutdown(void)/* reset support for yeeloong2f and mengloong2f notebook */ -/* -* The following registers are determined by the EC index configuration. -* 1. fill the PORT_HIGH as EC register high part. -* 2. fill the PORT_LOW as EC register low part. -* 3. fill the PORT_DATA as EC register write data or get the data from it. -*/ - -#define EC_IO_PORT_HIGH 0x0381 -#define EC_IO_PORT_LOW 0x0382 -#define EC_IO_PORT_DATA 0x0383 -#define REG_RESET_HIGH 0xF4/* reset the machine auto-clear : rd/wr */ -#define REG_RESET_LOW 0xEC -#define BIT_RESET_ON (1 << 0) -void ml2f_reboot (void ) {reset_cpu ();/* sending an reset signal to EC(embedded controller) */ -outb (REG_RESET_HIGH ,EC_IO_PORT_HIGH ); -outb (REG_RESET_LOW ,EC_IO_PORT_LOW ); -mmiowb (); -outb (BIT_RESET_ON ,EC_IO_PORT_DATA ); -mmiowb (); +ec_write (REG_RESET ,BIT_RESET_ON ); }#define yl2f89_reboot ml2f_reboot
Signature · 1 line
1.6.2.1
PATCH 5/5 yeeloong2f: add platform specific support
In reply to Wu ZhangjinThis patch added the following subdrivers: backlight, hotkey, video output, thermal cooling, hwmon and battery.
--- arch/mips/kernel/setup.c | 1 + arch/mips/loongson/Kconfig | 18 + arch/mips/loongson/lemote-2f/Makefile | 1 + arch/mips/loongson/lemote-2f/ec_kb3310b.h | 150 +++ arch/mips/loongson/lemote-2f/yeeloong_laptop.c | 1354 ++++++++++++++++++++++++ 5 files changed, 1524 insertions(+), 0 deletions(-) create mode 100644 arch/mips/loongson/lemote-2f/yeeloong_laptop.c
arch/mips/kernel/setup.c +1 -0
@@ -60,6 +60,7 @@ struct boot_mem_map boot_mem_map;static char command_line[COMMAND_LINE_SIZE ];char arcs_cmdline[COMMAND_LINE_SIZE ] =CONFIG_CMDLINE ; +EXPORT_SYMBOL (arcs_cmdline);/* * mips_io_port_base is the begin of the address space to which x86 style
arch/mips/loongson/Kconfig +18 -0
@@ -112,4 +112,22 @@ config LEMOTE_LYNLOONG2F_PDEV This driver adds the lynloong specific backlight driver and platform driver(mainly the suspend support). +config LEMOTE_YEELOONG2F_PDEV + tristate "Lemote YeeLoong Platform Specific Driver" + depends on LEMOTE_MACH2F + default m + select INPUT_EVDEV + select HWMON + select VIDEO_OUTPUT_CONTROL + select THERMAL + select BACKLIGHT_CLASS_DEVICE + select SYS_SUPPORTS_APM_EMULATION + help + YeeLoong netbook is a mini laptop made by Lemote, which is basically + compatible to FuLoong2F mini PC, but It has an extra Embedded + Controller(kb3310b) for battery, hotkey, backlight, temperature and + fan management. + + This driver adds the YeeLoong Platform Specific support. + endif # LOONGSON_PLATFORM_DEVICES
arch/mips/loongson/lemote-2f/Makefile +1 -0
@@ -14,3 +14,4 @@ obj-$(CONFIG_LOONGSON_SUSPEND) += pm.o # Platform Drivers # obj-$(CONFIG_LEMOTE_LYNLOONG2F_PDEV) += lynloong_pc.o +obj-$(CONFIG_LEMOTE_YEELOONG2F_PDEV) += yeeloong_laptop.o
arch/mips/loongson/lemote-2f/ec_kb3310b.h +150 -0
160 lines not on this page · raw message
arch/mips/loongson/lemote-2f/yeeloong_laptop.c new file +1351 -0
1,351 lines not on this page · raw message
Signature · 7 lines
1.6.2.1 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [PATCH 5/5] [loongson] yeeloong2f: add platform specific support
Sorry, This patch can not be compiled without CONFIG_PM, this patch is needed to fix it:
We need to wrap the source code relative to CONFIG_PM, otherwise, it will fail in compiling.
This patch is needed to "[PATCH 5/5] [loongson] yeeloong2f: add platform specific support".
--- arch/mips/loongson/lemote-2f/yeeloong_laptop.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
(quoted diff) +0 -0
b/arch/mips/loongson/lemote-2f/yeeloong_laptop.c
index ff74f7f..46c3847 100644
arch/mips/loongson/lemote-2f/yeeloong_laptop.c +0 -0
@@ -1025,9 +1025,10 @@ static int yeeloong_hotkey_init(struct device
*dev)
/* update the current status of lid */ yeeloong_lid_update_status(BIT_LID_DETECT_ON);
+#ifdef CONFIG_SUSPEND
/* install the real yeeloong_report_lid_status for pm.c */ yeeloong_report_lid_status = yeeloong_lid_update_status;
-
+#endif
/* install event handler */ yeeloong_install_sci_handler(EVENT_CAMERA, camera_set);
@@ -1039,9 +1040,10 @@ static void yeeloong_hotkey_exit(void)
/* free irq */
remove_irq(SCI_IRQ_NUM, &sci_irqaction);
+#ifdef CONFIG_SUSPEND
/* uninstall the real yeeloong_report_lid_status for pm.c */ yeeloong_report_lid_status = NULL;
-
+#endif
/* uninstall event handler */ yeeloong_uninstall_sci_handler(EVENT_CAMERA, camera_set);
@@ -1083,7 +1085,8 @@ static void get_fixed_battery_info(void)
#define APM_CRITICAL 5
-static void yeeloong_apm_get_power_status(struct apm_power_info *info) +static void __maybe_unused yeeloong_apm_get_power_status(struct apm_power_info
+ *info)
{
unsigned char bat_status;
@@ -1144,8 +1147,9 @@ static int yeeloong_apm_init(void)
/* print fixed information of battery */ get_fixed_battery_info();
+#ifdef APM_EMULATION
apm_get_power_status = yeeloong_apm_get_power_status;
-
+#endif
return 0;
}
Signature · 7 lines
1.6.2.1 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [PATCH 5/5] [loongson] yeeloong2f: add platform specific support
Hello.
Quoted 52 lines · Wu Zhangjin
Sorry, This patch can not be compiled without
CONFIG_PM, this patch is needed to fix it:We need to wrap the source code relative to
CONFIG_PM, otherwise, it will fail in compiling.This patch is needed to "[PATCH 5/5] [loongson] yeeloong2f: add platform specific support".
Signed-off-by Wu Zhangjin <[email protected]>--- arch/mips/loongson/lemote-2f/yeeloong_laptop.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)arch/mips/loongson/lemote-2f/yeeloong_laptop.c +5
-3@@ -1025,9 +1025,10 @@ static int yeeloong_hotkey_init(struct device *dev)/* update the current status of lid */ yeeloong_lid_update_status (BIT_LID_DETECT_ON ); +#ifdef CONFIG_SUSPEND /* install the real yeeloong_report_lid_status for pm.c */ yeeloong_report_lid_status = yeeloong_lid_update_status; - +#endif /* install event handler */ yeeloong_install_sci_handler (EVENT_CAMERA , camera_set);@@ -1039,9 +1040,10 @@ static void yeeloong_hotkey_exit(void)/* free irq */ remove_irq (SCI_IRQ_NUM , &sci_irqaction); +#ifdef CONFIG_SUSPEND /* uninstall the real yeeloong_report_lid_status for pm.c */ yeeloong_report_lid_status =NULL ; - +#endif /* uninstall event handler */ yeeloong_uninstall_sci_handler (EVENT_CAMERA , camera_set);@@ -1083,7 +1085,8 @@ static void get_fixed_battery_info(void)#define APM_CRITICAL 5 -static void yeeloong_apm_get_power_status (struct apm_power_info *info) +static void __maybe_unused yeeloong_apm_get_power_status(struct
apm_power_info
arch/mips/loongson/lemote-2f/yeeloong_laptop.c
Quoted 1 line
arch/mips/loongson/lemote-2f/yeeloong_laptop.c +1
-0+ *info)
Your patch is line-wrapped.
WBR, Sergei
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [PATCH 5/5] [loongson] yeeloong2f: add platform specific support
On Fri, 2009-11-20 at 00:42 +0300, Sergei Shtylyov wrote:
[...]
Quoted 9 lines
Review
Quoted 6 lines
(quoted diff) +1
-1-static void yeeloong_apm_get_power_status(struct apm_power_info *info) +static void __maybe_unused yeeloong_apm_get_power_status(struct
apm_power_info(quoted diff) +1
-0+ *info)Your patch is line-wrapped.
Yes, I found it, thanks! I have merged this one into "[PATCH v1] [loongson] yeeloong2f: add platform specific support".
Best Regards,
Wu Zhangjin
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors