1.1 --- a/include/minipc.h Mon Feb 22 17:07:55 2016 +0100
1.2 +++ b/include/minipc.h Mon Feb 22 18:01:27 2016 +0100
1.3 @@ -27,5 +27,7 @@
1.4 */
1.5 #define GPIO_LED_EN 92
1.6 #define GPIO_DISP_OFF_N 93
1.7 +#define GPIO_PWM0 94
1.8 +#define GPIO_POWER 97
1.9
1.10 #endif /* __MINIPC_H__ */
2.1 --- a/stage2/board.h Mon Feb 22 17:07:55 2016 +0100
2.2 +++ b/stage2/board.h Mon Feb 22 18:01:27 2016 +0100
2.3 @@ -12,6 +12,7 @@
2.4
2.5 #ifdef CONFIG_CPU_JZ4730
2.6 #include "jz4730.h"
2.7 +#include "jz4730_compat.h"
2.8 #define READ_TIMER __ost_get_count(TIMER_CHAN) /* macro to read the 32 bit timer */
2.9 #define TIMER_CHAN_IRQ IRQ_OST0
2.10 #else
3.1 --- a/stage2/minipc_claa070vc01.h Mon Feb 22 17:07:55 2016 +0100
3.2 +++ b/stage2/minipc_claa070vc01.h Mon Feb 22 18:01:27 2016 +0100
3.3 @@ -2,7 +2,7 @@
3.4 * MiniPC panel-specific definitions
3.5 *
3.6 * Copyright (C) Xiangfu Liu <xiangfu@sharism.cc>
3.7 - * Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
3.8 + * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
3.9 *
3.10 * This program is free software; you can redistribute it and/or
3.11 * modify it under the terms of the GNU General Public License as
3.12 @@ -23,36 +23,39 @@
3.13 #ifndef __MINIPC_CLAA070VC01_H__
3.14 #define __MINIPC_CLAA070VC01_H__
3.15
3.16 -#define __lcd_set_backlight_level(n) \
3.17 -do { \
3.18 - __gpio_as_pwm(); \
3.19 - REG_PWM_DUT(0) = n; \
3.20 - REG_PWM_PER(0) = 7; \
3.21 - REG_PWM_CTR(0) = 0xc1; \
3.22 -} while (0)
3.23 +#include "board.h"
3.24 +#include "minipc.h"
3.25
3.26 -#define __lcd_close_backlight() \
3.27 -do { \
3.28 -__gpio_as_output(GPIO_PWM0);\
3.29 -__gpio_clear_pin(GPIO_PWM0);\
3.30 -} while (0)
3.31 +static inline void __lcd_set_backlight_level(u16 n)
3.32 +{
3.33 + __gpio_as_pwm();
3.34 + REG_PWM_DUT(0) = n;
3.35 + REG_PWM_PER(0) = 7;
3.36 + REG_PWM_CTR(0) = 0xc1;
3.37 +}
3.38 +
3.39 +static inline void __lcd_close_backlight()
3.40 +{
3.41 + __gpio_as_output(GPIO_PWM0);
3.42 + __gpio_clear_pin(GPIO_PWM0);
3.43 +}
3.44
3.45 -#define __lcd_display_pin_init() \
3.46 -do { \
3.47 - __gpio_as_output(GPIO_DISP_OFF_N); \
3.48 - __lcd_set_backlight_level(8); \
3.49 -} while (0)
3.50 +static inline void __lcd_display_pin_init()
3.51 +{
3.52 + __gpio_as_output(GPIO_DISP_OFF_N);
3.53 + __lcd_set_backlight_level(8);
3.54 +}
3.55
3.56 -#define __lcd_display_on() \
3.57 -do { \
3.58 - __gpio_set_pin(GPIO_DISP_OFF_N); \
3.59 - __lcd_set_backlight_level(8); \
3.60 -} while (0)
3.61 +static inline void __lcd_display_on()
3.62 +{
3.63 + __gpio_set_pin(GPIO_DISP_OFF_N);
3.64 + __lcd_set_backlight_level(8);
3.65 +}
3.66
3.67 -#define __lcd_display_off() \
3.68 -do { \
3.69 - __lcd_close_backlight(); \
3.70 - __gpio_clear_pin(GPIO_DISP_OFF_N); \
3.71 -} while (0)
3.72 +static inline void __lcd_display_off()
3.73 +{
3.74 + __lcd_close_backlight();
3.75 + __gpio_clear_pin(GPIO_DISP_OFF_N);
3.76 +}
3.77
3.78 #endif /* __MINIPC_CLAA070VC01_H__ */
4.1 --- a/stage2/nanonote_gpm940b0.h Mon Feb 22 17:07:55 2016 +0100
4.2 +++ b/stage2/nanonote_gpm940b0.h Mon Feb 22 18:01:27 2016 +0100
4.3 @@ -2,7 +2,7 @@
4.4 * Ben NanoNote panel-specific definitions
4.5 *
4.6 * Copyright (C) Xiangfu Liu <xiangfu@sharism.cc>
4.7 - * Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
4.8 + * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
4.9 *
4.10 * This program is free software; you can redistribute it and/or
4.11 * modify it under the terms of the GNU General Public License as
4.12 @@ -23,50 +23,56 @@
4.13 #ifndef __NANONOTE_GPM940B0_H__
4.14 #define __NANONOTE_GPM940B0_H__
4.15
4.16 -#define __spi_write_reg1(reg, val) \
4.17 -do { \
4.18 - unsigned char no; \
4.19 - unsigned short value; \
4.20 - unsigned char a=reg; \
4.21 - unsigned char b=val; \
4.22 - __gpio_set_pin(SPEN); \
4.23 - __gpio_set_pin(SPCK); \
4.24 - __gpio_clear_pin(SPDA); \
4.25 - __gpio_clear_pin(SPEN); \
4.26 - value=((a<<8)|(b&0xFF)); \
4.27 - for(no=0;no<16;no++) \
4.28 - { \
4.29 - __gpio_clear_pin(SPCK); \
4.30 - if((value&0x8000)==0x8000) \
4.31 - __gpio_set_pin(SPDA); \
4.32 - else \
4.33 - __gpio_clear_pin(SPDA); \
4.34 - __gpio_set_pin(SPCK); \
4.35 - value=(value<<1); \
4.36 - } \
4.37 - __gpio_set_pin(SPEN); \
4.38 -} while (0)
4.39 +#include "board.h"
4.40 +#include "nanonote.h"
4.41 +
4.42 +static inline void __spi_write_reg1(u8 reg, u8 val)
4.43 +{
4.44 + u8 no, a=reg, b=val;
4.45 + u16 value;
4.46 +
4.47 + __gpio_set_pin(SPEN);
4.48 + __gpio_set_pin(SPCK);
4.49 + __gpio_clear_pin(SPDA);
4.50 + __gpio_clear_pin(SPEN);
4.51 +
4.52 + value = ((a << 8) | (b & 0xFF));
4.53 +
4.54 + for (no=0; no<16; no++)
4.55 + {
4.56 + __gpio_clear_pin(SPCK);
4.57 +
4.58 + if ((value & 0x8000) == 0x8000)
4.59 + __gpio_set_pin(SPDA);
4.60 + else
4.61 + __gpio_clear_pin(SPDA);
4.62
4.63 -#define __lcd_display_pin_init() \
4.64 -do { \
4.65 - __cpm_start_tcu(); \
4.66 - __gpio_as_output(SPEN); \
4.67 - __gpio_as_output(SPCK); \
4.68 - __gpio_as_output(SPDA); \
4.69 -} while (0)
4.70 + __gpio_set_pin(SPCK);
4.71 + value = (value << 1);
4.72 + }
4.73 + __gpio_set_pin(SPEN);
4.74 +}
4.75 +
4.76 +static inline void __lcd_display_pin_init()
4.77 +{
4.78 + __cpm_start_tcu();
4.79 + __gpio_as_output(SPEN);
4.80 + __gpio_as_output(SPCK);
4.81 + __gpio_as_output(SPDA);
4.82 +}
4.83
4.84 -#define __lcd_display_on() \
4.85 -do { \
4.86 - __spi_write_reg1(0x05, 0x1e); \
4.87 - __spi_write_reg1(0x05, 0x5e); \
4.88 - __spi_write_reg1(0x07, 0x8d); \
4.89 - __spi_write_reg1(0x13, 0x01); \
4.90 - __spi_write_reg1(0x05, 0x5f); \
4.91 -} while (0)
4.92 +static inline void __lcd_display_on()
4.93 +{
4.94 + __spi_write_reg1(0x05, 0x1e);
4.95 + __spi_write_reg1(0x05, 0x5e);
4.96 + __spi_write_reg1(0x07, 0x8d);
4.97 + __spi_write_reg1(0x13, 0x01);
4.98 + __spi_write_reg1(0x05, 0x5f);
4.99 +}
4.100
4.101 -#define __lcd_display_off() \
4.102 -do { \
4.103 - __spi_write_reg1(0x05, 0x5e); \
4.104 -} while (0)
4.105 +static inline void __lcd_display_off()
4.106 +{
4.107 + __spi_write_reg1(0x05, 0x5e);
4.108 +}
4.109
4.110 #endif /* __NANONOTE_GPM940B0_H__ */