• Home
  • Raw
  • Download

Lines Matching refs:fan

116 	struct mlxreg_fan *fan = dev_get_drvdata(dev);  in mlxreg_fan_read()  local
123 tacho = &fan->tacho[channel]; in mlxreg_fan_read()
126 err = regmap_read(fan->regmap, tacho->reg, &regval); in mlxreg_fan_read()
130 *val = MLXREG_FAN_GET_RPM(regval, fan->divider, in mlxreg_fan_read()
131 fan->samples); in mlxreg_fan_read()
135 err = regmap_read(fan->regmap, tacho->reg, &regval); in mlxreg_fan_read()
150 err = regmap_read(fan->regmap, fan->pwm.reg, &regval); in mlxreg_fan_read()
173 struct mlxreg_fan *fan = dev_get_drvdata(dev); in mlxreg_fan_write() local
182 return regmap_write(fan->regmap, fan->pwm.reg, val); in mlxreg_fan_write()
233 HWMON_CHANNEL_INFO(fan,
273 struct mlxreg_fan *fan = cdev->devdata; in mlxreg_fan_get_cur_state() local
277 err = regmap_read(fan->regmap, fan->pwm.reg, &regval); in mlxreg_fan_get_cur_state()
279 dev_err(fan->dev, "Failed to query PWM duty\n"); in mlxreg_fan_get_cur_state()
292 struct mlxreg_fan *fan = cdev->devdata; in mlxreg_fan_set_cur_state() local
316 fan->cooling_levels[i] = state; in mlxreg_fan_set_cur_state()
318 fan->cooling_levels[i] = i; in mlxreg_fan_set_cur_state()
320 err = regmap_read(fan->regmap, fan->pwm.reg, &regval); in mlxreg_fan_set_cur_state()
322 dev_err(fan->dev, "Failed to query PWM duty\n"); in mlxreg_fan_set_cur_state()
337 state = fan->cooling_levels[state]; in mlxreg_fan_set_cur_state()
338 err = regmap_write(fan->regmap, fan->pwm.reg, in mlxreg_fan_set_cur_state()
341 dev_err(fan->dev, "Failed to write PWM duty\n"); in mlxreg_fan_set_cur_state()
353 static int mlxreg_fan_connect_verify(struct mlxreg_fan *fan, in mlxreg_fan_connect_verify() argument
359 err = regmap_read(fan->regmap, data->capability, &regval); in mlxreg_fan_connect_verify()
361 dev_err(fan->dev, "Failed to query capability register 0x%08x\n", in mlxreg_fan_connect_verify()
369 static int mlxreg_fan_speed_divider_get(struct mlxreg_fan *fan, in mlxreg_fan_speed_divider_get() argument
375 err = regmap_read(fan->regmap, data->capability, &regval); in mlxreg_fan_speed_divider_get()
377 dev_err(fan->dev, "Failed to query capability register 0x%08x\n", in mlxreg_fan_speed_divider_get()
389 fan->divider = regval * MLXREG_FAN_TACHO_DIV_MIN; in mlxreg_fan_speed_divider_get()
394 static int mlxreg_fan_config(struct mlxreg_fan *fan, in mlxreg_fan_config() argument
402 fan->samples = MLXREG_FAN_TACHO_SAMPLES_PER_PULSE_DEF; in mlxreg_fan_config()
403 fan->divider = MLXREG_FAN_TACHO_DIV_DEF; in mlxreg_fan_config()
407 dev_err(fan->dev, "too many tacho entries: %s\n", in mlxreg_fan_config()
413 err = mlxreg_fan_connect_verify(fan, data); in mlxreg_fan_config()
422 fan->tacho[tacho_num].reg = data->reg; in mlxreg_fan_config()
423 fan->tacho[tacho_num].mask = data->mask; in mlxreg_fan_config()
424 fan->tacho[tacho_num++].connected = true; in mlxreg_fan_config()
426 if (fan->pwm.connected) { in mlxreg_fan_config()
427 dev_err(fan->dev, "duplicate pwm entry: %s\n", in mlxreg_fan_config()
431 fan->pwm.reg = data->reg; in mlxreg_fan_config()
432 fan->pwm.connected = true; in mlxreg_fan_config()
435 dev_err(fan->dev, "duplicate conf entry: %s\n", in mlxreg_fan_config()
441 dev_err(fan->dev, "invalid conf entry params: %s\n", in mlxreg_fan_config()
446 err = mlxreg_fan_speed_divider_get(fan, data); in mlxreg_fan_config()
451 fan->samples = data->mask; in mlxreg_fan_config()
453 fan->divider = data->bit; in mlxreg_fan_config()
457 dev_err(fan->dev, "invalid label: %s\n", data->label); in mlxreg_fan_config()
464 fan->cooling_levels[i] = MLXREG_FAN_SPEED_MIN_LEVEL; in mlxreg_fan_config()
466 fan->cooling_levels[i] = i; in mlxreg_fan_config()
475 struct mlxreg_fan *fan; in mlxreg_fan_probe() local
485 fan = devm_kzalloc(dev, sizeof(*fan), GFP_KERNEL); in mlxreg_fan_probe()
486 if (!fan) in mlxreg_fan_probe()
489 fan->dev = dev; in mlxreg_fan_probe()
490 fan->regmap = pdata->regmap; in mlxreg_fan_probe()
492 err = mlxreg_fan_config(fan, pdata); in mlxreg_fan_probe()
497 fan, in mlxreg_fan_probe()
506 fan->cdev = devm_thermal_of_cooling_device_register(dev, in mlxreg_fan_probe()
507 NULL, "mlxreg_fan", fan, &mlxreg_fan_cooling_ops); in mlxreg_fan_probe()
508 if (IS_ERR(fan->cdev)) { in mlxreg_fan_probe()
510 return PTR_ERR(fan->cdev); in mlxreg_fan_probe()