/* Get/set the fan speed in open loop mode using pwm1 sysfs file. Speed is given as a relative value from 0 to 255, where 255 is maximum speed. Note that this is done by writing directly to the chip's DAC, it won't change the closed loop speed set by fan1_target. Also note that due to rounding errors it is possible that you don't read back exactly the value you have set.  */
static ssize_t get_pwm(struct device *dev, struct device_attribute *devattr, char *buf)
/* Get/set the fan speed in open loop mode using pwm1 sysfs file. Speed is given as a relative value from 0 to 255, where 255 is maximum speed. Note that this is done by writing directly to the chip's DAC, it won't change the closed loop speed set by fan1_target. Also note that due to rounding errors it is possible that you don't read back exactly the value you have set.  */
static ssize_t get_pwm(struct device *dev, struct device_attribute *devattr, char *buf)
{
	int pwm;
	struct max6650_data *data = max6650_update_device(dev);
	if (data->config & MAX6650_CFG_V12)
		pwm = 255 - (255 * (int)data->dac)/180;
	else
		pwm = 255 - (255 * (int)data->dac)/76;
	if (pwm < 0)
		pwm = 0;
	return sprintf(buf, "%d\n", pwm);
}