Lines Matching +full:pwm +full:- +full:dutycycle +full:- +full:range

36 //build the pwm and tach access device node file name, and mapping pwm/tach number starting from 1.
37 …NUM) snprintf(buffer, sizeof(buffer), "%s%d%s%d", HWMON_DIR "/hwmon",DEV_ID, "/pwm", PWM_NUM+1)
41 //predefine FAN RPM range, must defined at some where for configuration.
54 retval = -1; in pwmtach_directory_check()
58 //Notice: dutycycle_value is one byte (0-255)
72 dutycycle_value = ppwmtach_arg->dutycycle; in SET_PWM_DUTYCYCLE_VALUE()
73 BUILD_PWM_NODE_NAME(DevNodeFileName,ppwmtach_arg->dev_id,ppwmtach_arg->pwmnumber); in SET_PWM_DUTYCYCLE_VALUE()
88 …printf("%s: Error write dutycycle value %d to pwm %d\n",__FUNCTION__,dutycycle_value,ppwmtach_arg- in SET_PWM_DUTYCYCLE_VALUE()
89 retval = -1; in SET_PWM_DUTYCYCLE_VALUE()
102 if(ppwmtach_arg->dutycycle > 100) in SET_PWM_DUTYCYCLE()
104 return -1; in SET_PWM_DUTYCYCLE()
107 dutycycle_value = (ppwmtach_arg->dutycycle*255)/100; in SET_PWM_DUTYCYCLE()
108 ppwmtach_arg->dutycycle = dutycycle_value; in SET_PWM_DUTYCYCLE()
125 BUILD_PWM_NODE_NAME(DevNodeFileName,ppwmtach_arg->dev_id,ppwmtach_arg->pwmnumber); in GET_PWM_DUTYCYCLE()
136 ppwmtach_arg->dutycycle = atoi(duty_num); in GET_PWM_DUTYCYCLE()
137 …printf("%s:dutycycle value %d to pwm %d\n",__FUNCTION__,ppwmtach_arg->dutycycle,ppwmtach_arg->pwmn… in GET_PWM_DUTYCYCLE()
153 BUILD_TACH_NODE_NAME(DevNodeFileName,ppwmtach_arg->dev_id,ppwmtach_arg->tachnumber); in GET_TACH_SPEED()
166 ppwmtach_arg->rpmvalue = atoi(data); in GET_TACH_SPEED()
168 printf("%s:rpm value %d\n",__FUNCTION__,ppwmtach_arg->rpmvalue); in GET_TACH_SPEED()
174 //mapping fan number to pwm number
175 //using information in fan@number reg item, to look up the pwm index
187 BUILD_FAN_REG_NAME(DevNodeFileName,ppwmtach_arg->dev_id,ppwmtach_arg->fannumber); in GET_PWM_NUMBER()
201 retval = -1; in GET_PWM_NUMBER()
205 printf("%s:fan %d, pwm %d, val 0x%X\n",__FUNCTION__,ppwmtach_arg->fannumber,retval,reg_val); in GET_PWM_NUMBER()
209 // printf("%s:rpm value %d\n",__FUNCTION__,ppwmtach_arg->rpmvalue); in GET_PWM_NUMBER()
215 …"%s, Command 0x%X:Dev:%d,Pwm:0x%X,Fan:0x%x,Tach:0x%X\n",__FUNCTION__,command,argp->dev_id,argp->pw… in pwmtach_action()
229 argp->tachnumber = GET_TACH_NUMBER(argp->fannumber); in pwmtach_action()
236 argp->max_rpm = RPM_MAX; in pwmtach_action()
237 argp->min_rpm = RPM_MIN; in pwmtach_action()
240 …argp->pwmnumber = GET_PWM_NUMBER(argp);; //since we don't have the fan to pwm mapping, jus… in pwmtach_action()
241 …argp->counterresvalue = COUNTERRES_DEF; //since driver don't support COUNTERRES, just using defa… in pwmtach_action()
247 retval = -1; in pwmtach_action()
260 if(retval != -1) in get_tach_speed()
273 pwmtach_arg.dutycycle= dutycycle_percentage; in set_pwm_dutycycle()
279 //Notice: dutycycle_value is one byte (0-255)
287 pwmtach_arg.dutycycle= dutycycle_value; in set_pwm_dutycycle_value()
301 if(retval != -1) in get_pwm_dutycycle()
302 *dutycycle_percentage = pwmtach_arg.dutycycle; in get_pwm_dutycycle()
319 indata->dev_id = dev_id; in set_fan_speed()
320 indata->fannumber = fan_number; in set_fan_speed()
321 indata->rpmvalue = rpm_value; in set_fan_speed()
322 indata->counterresvalue = 0; in set_fan_speed()
323 indata->dutycycle = 0; in set_fan_speed()
324 indata->prevdutycycle = 0; in set_fan_speed()
327 if ((rpm_value < indata->min_rpm) || (rpm_value > indata->max_rpm)) in set_fan_speed()
329 printf("Out of range Fan Speed value for fan.\n"); in set_fan_speed()
330 return -1; in set_fan_speed()
334 while (retries--) in set_fan_speed()
340 indata->dutycycle = indata->prevdutycycle; in set_fan_speed()
342 return -1; in set_fan_speed()
346 indata->prevdutycycle = indata->dutycycle; in set_fan_speed()
347 if (indata->rpmvalue > (desiredrpm + 50)) in set_fan_speed()
349 if (indata->dutycycle <= ((indata->counterresvalue*10)/100)) in set_fan_speed()
353 printf("\nSpeed is set to minimum possible speed of %d RPM.\n",indata->rpmvalue); in set_fan_speed()
360 indata->dutycycle -= ((5 * indata->counterresvalue)/100); in set_fan_speed()
363 else if (indata->rpmvalue < (desiredrpm - 50)) in set_fan_speed()
365 if (indata->dutycycle >= indata->counterresvalue) in set_fan_speed()
369 printf("\nSpeed is set to maximum possible speed of %d RPM.\n",indata->rpmvalue); in set_fan_speed()
376 indata->dutycycle += ((5 * indata->counterresvalue)/100); in set_fan_speed()
385 printf("After update: dutycycle=%d, rpmvalue=%d\n", indata->dutycycle, indata->rpmvalue); in set_fan_speed()
387 if(indata->prevdutycycle < indata->dutycycle) in set_fan_speed()
391 indata->dutycycle = indata->prevdutycycle; in set_fan_speed()
402 indata->dutycycle = indata->prevdutycycle; in set_fan_speed()
412 …tf("retry %d : dt=%d, ps=%d, cr=%d\n", retries, indata->dutycycle, indata->prescalervalue, indata- in set_fan_speed()
426 if(retval != -1) in get_fan_speed()