tree: git://people.freedesktop.org/~agd5f/linux.git drm-next-4.21-wip head: 6830ffcb15a5bae3f031734b75b11a5f489a52bf commit: 6459eb8ee95150ffbdfcd0c9325945be80f98cf8 [113/125] drm/amd/display: Expand dc to use 16.16 bit backlight smatch warnings: drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_abm.c:86 calculate_16_bit_backlight_from_pwm() warn: should 'bl_pwm << (1 + bl_int_count)' be a 64 bit type? git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git git remote update radeon-alex git checkout 6459eb8ee95150ffbdfcd0c9325945be80f98cf8 vim +86 drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_abm.c aa7397df Amy Zhang 2017-05-12 55 5e7773a2 Anthony Koo 2017-01-23 56 6459eb8e Anthony Koo 2018-10-12 57 static unsigned int calculate_16_bit_backlight_from_pwm(struct dce_abm *abm_dce) 5e7773a2 Anthony Koo 2017-01-23 58 { 5e7773a2 Anthony Koo 2017-01-23 59 uint64_t current_backlight; 5e7773a2 Anthony Koo 2017-01-23 60 uint32_t round_result; 5e7773a2 Anthony Koo 2017-01-23 61 uint32_t pwm_period_cntl, bl_period, bl_int_count; 5e7773a2 Anthony Koo 2017-01-23 62 uint32_t bl_pwm_cntl, bl_pwm, fractional_duty_cycle_en; 5e7773a2 Anthony Koo 2017-01-23 63 uint32_t bl_period_mask, bl_pwm_mask; 5e7773a2 Anthony Koo 2017-01-23 64 5e7773a2 Anthony Koo 2017-01-23 65 pwm_period_cntl = REG_READ(BL_PWM_PERIOD_CNTL); 5e7773a2 Anthony Koo 2017-01-23 66 REG_GET(BL_PWM_PERIOD_CNTL, BL_PWM_PERIOD, &bl_period); 5e7773a2 Anthony Koo 2017-01-23 67 REG_GET(BL_PWM_PERIOD_CNTL, BL_PWM_PERIOD_BITCNT, &bl_int_count); 5e7773a2 Anthony Koo 2017-01-23 68 5e7773a2 Anthony Koo 2017-01-23 69 bl_pwm_cntl = REG_READ(BL_PWM_CNTL); 5e7773a2 Anthony Koo 2017-01-23 70 REG_GET(BL_PWM_CNTL, BL_ACTIVE_INT_FRAC_CNT, (uint32_t *)(&bl_pwm)); 5e7773a2 Anthony Koo 2017-01-23 71 REG_GET(BL_PWM_CNTL, BL_PWM_FRACTIONAL_EN, &fractional_duty_cycle_en); 5e7773a2 Anthony Koo 2017-01-23 72 5e7773a2 Anthony Koo 2017-01-23 73 if (bl_int_count == 0) 5e7773a2 Anthony Koo 2017-01-23 74 bl_int_count = 16; 5e7773a2 Anthony Koo 2017-01-23 75 5e7773a2 Anthony Koo 2017-01-23 76 bl_period_mask = (1 << bl_int_count) - 1; 5e7773a2 Anthony Koo 2017-01-23 77 bl_period &= bl_period_mask; 5e7773a2 Anthony Koo 2017-01-23 78 5e7773a2 Anthony Koo 2017-01-23 79 bl_pwm_mask = bl_period_mask << (16 - bl_int_count); 5e7773a2 Anthony Koo 2017-01-23 80 5e7773a2 Anthony Koo 2017-01-23 81 if (fractional_duty_cycle_en == 0) 5e7773a2 Anthony Koo 2017-01-23 82 bl_pwm &= bl_pwm_mask; 5e7773a2 Anthony Koo 2017-01-23 83 else 5e7773a2 Anthony Koo 2017-01-23 84 bl_pwm &= 0xFFFF; 5e7773a2 Anthony Koo 2017-01-23 85 5e7773a2 Anthony Koo 2017-01-23 @86 current_backlight = bl_pwm << (1 + bl_int_count); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Smatch is not clever enough to know that this doesn't wrap and current_backlight is a u64 so it generates a warning. 5e7773a2 Anthony Koo 2017-01-23 87 5e7773a2 Anthony Koo 2017-01-23 88 if (bl_period == 0) 5e7773a2 Anthony Koo 2017-01-23 89 bl_period = 0xFFFF; 5e7773a2 Anthony Koo 2017-01-23 90 ca709397 Harry Wentland 2017-02-06 91 current_backlight = div_u64(current_backlight, bl_period); 5e7773a2 Anthony Koo 2017-01-23 92 current_backlight = (current_backlight + 1) >> 1; 5e7773a2 Anthony Koo 2017-01-23 93 5e7773a2 Anthony Koo 2017-01-23 94 current_backlight = (uint64_t)(current_backlight) * bl_period; 5e7773a2 Anthony Koo 2017-01-23 95 5e7773a2 Anthony Koo 2017-01-23 96 round_result = (uint32_t)(current_backlight & 0xFFFFFFFF); 5e7773a2 Anthony Koo 2017-01-23 97 5e7773a2 Anthony Koo 2017-01-23 98 round_result = (round_result >> (bl_int_count-1)) & 1; 5e7773a2 Anthony Koo 2017-01-23 99 5e7773a2 Anthony Koo 2017-01-23 100 current_backlight >>= bl_int_count; 5e7773a2 Anthony Koo 2017-01-23 101 current_backlight += round_result; 5e7773a2 Anthony Koo 2017-01-23 102 5e7773a2 Anthony Koo 2017-01-23 103 return (uint32_t)(current_backlight); 5e7773a2 Anthony Koo 2017-01-23 104 } 5e7773a2 Anthony Koo 2017-01-23 105 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel