Skip to content

Commit

Permalink
Merge pull request #5 from ilpianista/pine64-hacks
Browse files Browse the repository at this point in the history
Fix build with GCC 6
  • Loading branch information
longsleep committed Nov 19, 2016
2 parents 55c9c8c + 5b75db0 commit f1d5b11
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 25 deletions.
4 changes: 2 additions & 2 deletions drivers/clk/clk_factor.c
Expand Up @@ -48,8 +48,8 @@ static void sunxi_clk_fators_disable(struct clk_hw *hw)
if(factor->flags & CLK_IGNORE_DISABLE)
return;

if(config->sdmwidth)
reg = SET_BITS(config->sdmshift, config->sdmwidth, reg, 0);
if(config->sdmwidth)
reg = SET_BITS(config->sdmshift, config->sdmwidth, reg, 0);
if(config->updshift) //update for pll_ddr register
reg = SET_BITS(config->updshift, 1, reg, 1);

Expand Down
12 changes: 6 additions & 6 deletions drivers/pwm/sunxi_pwm_sun50iw1p1.c
Expand Up @@ -246,12 +246,12 @@ int sunxi_pwm_config(struct sunxi_pwm_chip* pchip, int duty_ns, int period_ns)
entire_cycles = 24000000 / freq / pre_scal[pre_scal_id][1];
}

if(period_ns < 5*100*1000)
active_cycles = (duty_ns * entire_cycles + (period_ns/2)) /period_ns;
else if(period_ns >= 5*100*1000 && period_ns < 6553500)
active_cycles = ((duty_ns / 100) * entire_cycles + (period_ns /2 / 100)) / (period_ns/100);
else
active_cycles = ((duty_ns / 10000) * entire_cycles + (period_ns /2 / 10000)) / (period_ns/10000);
if(period_ns < 5*100*1000)
active_cycles = (duty_ns * entire_cycles + (period_ns/2)) /period_ns;
else if(period_ns >= 5*100*1000 && period_ns < 6553500)
active_cycles = ((duty_ns / 100) * entire_cycles + (period_ns /2 / 100)) / (period_ns/100);
else
active_cycles = ((duty_ns / 10000) * entire_cycles + (period_ns /2 / 10000)) / (period_ns/10000);

reg_offset = pchip->config->reg_prescal_offset;
reg_shift = pchip->config->reg_prescal_shift;
Expand Down
28 changes: 14 additions & 14 deletions drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_fce.c
Expand Up @@ -476,16 +476,16 @@ static void auto_ce_model(unsigned int width, unsigned height, unsigned int sumc
else
black_str_lv=black_thr*1/3+ (p_hist_data->hist_mean*black_thr/(64*3));

//generate p
if (hist[lowest_black]>mean)
hist_r[lowest_black] = mean;
else if (hist[lowest_black]>black_str_lv)
hist_r[lowest_black] = hist[lowest_black];
else
hist_r[lowest_black] = black_str_lv;//hist[i];
//generate p
if (hist[lowest_black]>mean)
hist_r[lowest_black] = mean;
else if (hist[lowest_black]>black_str_lv)
hist_r[lowest_black] = hist[lowest_black];
else
hist_r[lowest_black] = black_str_lv;//hist[i];

total_pixel_r = hist_r[lowest_black];
p[lowest_black] = hist_r[lowest_black];
total_pixel_r = hist_r[lowest_black];
p[lowest_black] = hist_r[lowest_black];

//black zone
for (i=lowest_black+1; i<p_hist_data->black_thr0; i++)
Expand All @@ -508,10 +508,10 @@ static void auto_ce_model(unsigned int width, unsigned height, unsigned int sumc
else if (hist[i]>lthr)
hist_r[i] = hist[i];
else
hist_r[i] = lthr;//hist[i];
hist_r[i] = lthr;//hist[i];

total_pixel_r = total_pixel_r + hist_r[i];
p[i] = p[i-1] + hist_r[i];
total_pixel_r = total_pixel_r + hist_r[i];
p[i] = p[i-1] + hist_r[i];
}

if (p_hist_data->white_thr0 >= 256)
Expand Down Expand Up @@ -787,8 +787,8 @@ static void auto_bws_model(unsigned int width, unsigned int height, unsigned int



if (pd_s1==256)
pd_s0=256;
if (pd_s1==256)
pd_s0=256;

tmp = pd_white + ((pd_s2 * (pd_ymax - pd_white) )>>8);
if ( (tmp < 255) && (pd_ymax > pd_white) && (pd_ymax < 255))
Expand Down
1 change: 0 additions & 1 deletion drivers/video/sunxi/disp2/disp/lcd/lt070me05000.c
Expand Up @@ -9,7 +9,6 @@ static void LCD_bl_close(u32 sel);
static void LCD_panel_init(u32 sel);
static void LCD_panel_exit(u32 sel);

static u8 const mipi_dcs_pixel_format[4] = {0x77,0x66,0x66,0x55};
#define panel_reset(val) sunxi_lcd_gpio_set_value(sel, 1, val)
#define power_en(val) sunxi_lcd_gpio_set_value(sel, 0, val)

Expand Down
15 changes: 15 additions & 0 deletions include/linux/compiler-gcc6.h
@@ -0,0 +1,15 @@
#ifndef __LINUX_COMPILER_H
#error "Please don't include <linux/compiler-gcc6.h> directly, include <linux/compiler.h> instead."
#endif

/*
* Force always-inline if the user requests it so via the .config,
* or if gcc is too old:
*/
#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
!defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
// Force gnu89-inline.
#define inline inline __attribute__((always_inline)) __attribute__((__gnu_inline__))
#define __inline__ __inline__ __attribute__((always_inline)) __attribute__((__gnu_inline__))
#define __inline __inline __attribute__((always_inline)) __attribute__((__gnu_inline__))
#endif
4 changes: 2 additions & 2 deletions nand_sunxi/sun50iw1p1/osal/nand_osal_uboot.c
Expand Up @@ -293,8 +293,8 @@ __s32 _change_ndfc_clk_v1(__u32 nand_index, __u32 dclk_src_sel, __u32 dclk)

//sclk0_ratio_m
sclk0_ratio_m = (sclk0_src_t/(sclk0)) - 1;
if( sclk0_src_t%(sclk0) )
sclk0_ratio_m +=1;
if( sclk0_src_t%(sclk0) )
sclk0_ratio_m +=1;

/////////////////////////////// close clock
reg_val = get_wvalue(sclk0_reg_adr);
Expand Down

0 comments on commit f1d5b11

Please sign in to comment.