fan_data           54 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data =
fan_data           57 drivers/hwmon/gpio-fan.c 	sysfs_notify(&fan_data->hwmon_dev->kobj, NULL, "fan1_alarm");
fan_data           58 drivers/hwmon/gpio-fan.c 	kobject_uevent(&fan_data->hwmon_dev->kobj, KOBJ_CHANGE);
fan_data           63 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data = dev_id;
fan_data           65 drivers/hwmon/gpio-fan.c 	schedule_work(&fan_data->alarm_work);
fan_data           73 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
fan_data           76 drivers/hwmon/gpio-fan.c 		       gpiod_get_value_cansleep(fan_data->alarm_gpio));
fan_data           81 drivers/hwmon/gpio-fan.c static int fan_alarm_init(struct gpio_fan_data *fan_data)
fan_data           84 drivers/hwmon/gpio-fan.c 	struct device *dev = fan_data->dev;
fan_data           90 drivers/hwmon/gpio-fan.c 	alarm_irq = gpiod_to_irq(fan_data->alarm_gpio);
fan_data           94 drivers/hwmon/gpio-fan.c 	INIT_WORK(&fan_data->alarm_work, fan_alarm_notify);
fan_data           97 drivers/hwmon/gpio-fan.c 				IRQF_SHARED, "GPIO fan alarm", fan_data);
fan_data          105 drivers/hwmon/gpio-fan.c static void __set_fan_ctrl(struct gpio_fan_data *fan_data, int ctrl_val)
fan_data          109 drivers/hwmon/gpio-fan.c 	for (i = 0; i < fan_data->num_gpios; i++)
fan_data          110 drivers/hwmon/gpio-fan.c 		gpiod_set_value_cansleep(fan_data->gpios[i],
fan_data          114 drivers/hwmon/gpio-fan.c static int __get_fan_ctrl(struct gpio_fan_data *fan_data)
fan_data          119 drivers/hwmon/gpio-fan.c 	for (i = 0; i < fan_data->num_gpios; i++) {
fan_data          122 drivers/hwmon/gpio-fan.c 		value = gpiod_get_value_cansleep(fan_data->gpios[i]);
fan_data          129 drivers/hwmon/gpio-fan.c static void set_fan_speed(struct gpio_fan_data *fan_data, int speed_index)
fan_data          131 drivers/hwmon/gpio-fan.c 	if (fan_data->speed_index == speed_index)
fan_data          134 drivers/hwmon/gpio-fan.c 	__set_fan_ctrl(fan_data, fan_data->speed[speed_index].ctrl_val);
fan_data          135 drivers/hwmon/gpio-fan.c 	fan_data->speed_index = speed_index;
fan_data          138 drivers/hwmon/gpio-fan.c static int get_fan_speed_index(struct gpio_fan_data *fan_data)
fan_data          140 drivers/hwmon/gpio-fan.c 	int ctrl_val = __get_fan_ctrl(fan_data);
fan_data          143 drivers/hwmon/gpio-fan.c 	for (i = 0; i < fan_data->num_speed; i++)
fan_data          144 drivers/hwmon/gpio-fan.c 		if (fan_data->speed[i].ctrl_val == ctrl_val)
fan_data          147 drivers/hwmon/gpio-fan.c 	dev_warn(fan_data->dev,
fan_data          153 drivers/hwmon/gpio-fan.c static int rpm_to_speed_index(struct gpio_fan_data *fan_data, unsigned long rpm)
fan_data          155 drivers/hwmon/gpio-fan.c 	struct gpio_fan_speed *speed = fan_data->speed;
fan_data          158 drivers/hwmon/gpio-fan.c 	for (i = 0; i < fan_data->num_speed; i++)
fan_data          162 drivers/hwmon/gpio-fan.c 	return fan_data->num_speed - 1;
fan_data          168 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
fan_data          169 drivers/hwmon/gpio-fan.c 	u8 pwm = fan_data->speed_index * 255 / (fan_data->num_speed - 1);
fan_data          177 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
fan_data          185 drivers/hwmon/gpio-fan.c 	mutex_lock(&fan_data->lock);
fan_data          187 drivers/hwmon/gpio-fan.c 	if (!fan_data->pwm_enable) {
fan_data          192 drivers/hwmon/gpio-fan.c 	speed_index = DIV_ROUND_UP(pwm * (fan_data->num_speed - 1), 255);
fan_data          193 drivers/hwmon/gpio-fan.c 	set_fan_speed(fan_data, speed_index);
fan_data          196 drivers/hwmon/gpio-fan.c 	mutex_unlock(&fan_data->lock);
fan_data          204 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
fan_data          206 drivers/hwmon/gpio-fan.c 	return sprintf(buf, "%d\n", fan_data->pwm_enable);
fan_data          213 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
fan_data          219 drivers/hwmon/gpio-fan.c 	if (fan_data->pwm_enable == val)
fan_data          222 drivers/hwmon/gpio-fan.c 	mutex_lock(&fan_data->lock);
fan_data          224 drivers/hwmon/gpio-fan.c 	fan_data->pwm_enable = val;
fan_data          228 drivers/hwmon/gpio-fan.c 		set_fan_speed(fan_data, fan_data->num_speed - 1);
fan_data          230 drivers/hwmon/gpio-fan.c 	mutex_unlock(&fan_data->lock);
fan_data          244 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
fan_data          246 drivers/hwmon/gpio-fan.c 	return sprintf(buf, "%d\n", fan_data->speed[0].rpm);
fan_data          252 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
fan_data          255 drivers/hwmon/gpio-fan.c 		       fan_data->speed[fan_data->num_speed - 1].rpm);
fan_data          261 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
fan_data          263 drivers/hwmon/gpio-fan.c 	return sprintf(buf, "%d\n", fan_data->speed[fan_data->speed_index].rpm);
fan_data          269 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
fan_data          276 drivers/hwmon/gpio-fan.c 	mutex_lock(&fan_data->lock);
fan_data          278 drivers/hwmon/gpio-fan.c 	if (!fan_data->pwm_enable) {
fan_data          283 drivers/hwmon/gpio-fan.c 	set_fan_speed(fan_data, rpm_to_speed_index(fan_data, rpm));
fan_data          286 drivers/hwmon/gpio-fan.c 	mutex_unlock(&fan_data->lock);
fan_data          335 drivers/hwmon/gpio-fan.c static int fan_ctrl_init(struct gpio_fan_data *fan_data)
fan_data          337 drivers/hwmon/gpio-fan.c 	int num_gpios = fan_data->num_gpios;
fan_data          338 drivers/hwmon/gpio-fan.c 	struct gpio_desc **gpios = fan_data->gpios;
fan_data          354 drivers/hwmon/gpio-fan.c 	fan_data->pwm_enable = true; /* Enable manual fan speed control. */
fan_data          355 drivers/hwmon/gpio-fan.c 	fan_data->speed_index = get_fan_speed_index(fan_data);
fan_data          356 drivers/hwmon/gpio-fan.c 	if (fan_data->speed_index < 0)
fan_data          357 drivers/hwmon/gpio-fan.c 		return fan_data->speed_index;
fan_data          365 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data = cdev->devdata;
fan_data          367 drivers/hwmon/gpio-fan.c 	if (!fan_data)
fan_data          370 drivers/hwmon/gpio-fan.c 	*state = fan_data->num_speed - 1;
fan_data          377 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data = cdev->devdata;
fan_data          379 drivers/hwmon/gpio-fan.c 	if (!fan_data)
fan_data          382 drivers/hwmon/gpio-fan.c 	*state = fan_data->speed_index;
fan_data          389 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data = cdev->devdata;
fan_data          391 drivers/hwmon/gpio-fan.c 	if (!fan_data)
fan_data          394 drivers/hwmon/gpio-fan.c 	set_fan_speed(fan_data, state);
fan_data          407 drivers/hwmon/gpio-fan.c static int gpio_fan_get_of_data(struct gpio_fan_data *fan_data)
fan_data          410 drivers/hwmon/gpio-fan.c 	struct device *dev = fan_data->dev;
fan_data          419 drivers/hwmon/gpio-fan.c 	fan_data->alarm_gpio = devm_gpiod_get_optional(dev, "alarm", GPIOD_IN);
fan_data          420 drivers/hwmon/gpio-fan.c 	if (IS_ERR(fan_data->alarm_gpio))
fan_data          421 drivers/hwmon/gpio-fan.c 		return PTR_ERR(fan_data->alarm_gpio);
fan_data          424 drivers/hwmon/gpio-fan.c 	fan_data->num_gpios = gpiod_count(dev, NULL);
fan_data          425 drivers/hwmon/gpio-fan.c 	if (fan_data->num_gpios <= 0) {
fan_data          426 drivers/hwmon/gpio-fan.c 		if (fan_data->alarm_gpio)
fan_data          432 drivers/hwmon/gpio-fan.c 			     fan_data->num_gpios, sizeof(struct gpio_desc *),
fan_data          436 drivers/hwmon/gpio-fan.c 	for (i = 0; i < fan_data->num_gpios; i++) {
fan_data          441 drivers/hwmon/gpio-fan.c 	fan_data->gpios = gpios;
fan_data          454 drivers/hwmon/gpio-fan.c 	fan_data->num_speed = i / 2;
fan_data          462 drivers/hwmon/gpio-fan.c 			fan_data->num_speed, sizeof(struct gpio_fan_speed),
fan_data          467 drivers/hwmon/gpio-fan.c 	for (i = 0; i < fan_data->num_speed; i++) {
fan_data          477 drivers/hwmon/gpio-fan.c 	fan_data->speed = speed;
fan_data          496 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data;
fan_data          500 drivers/hwmon/gpio-fan.c 	fan_data = devm_kzalloc(dev, sizeof(struct gpio_fan_data),
fan_data          502 drivers/hwmon/gpio-fan.c 	if (!fan_data)
fan_data          505 drivers/hwmon/gpio-fan.c 	fan_data->dev = dev;
fan_data          506 drivers/hwmon/gpio-fan.c 	err = gpio_fan_get_of_data(fan_data);
fan_data          510 drivers/hwmon/gpio-fan.c 	platform_set_drvdata(pdev, fan_data);
fan_data          511 drivers/hwmon/gpio-fan.c 	mutex_init(&fan_data->lock);
fan_data          514 drivers/hwmon/gpio-fan.c 	if (fan_data->gpios && fan_data->num_gpios > 0) {
fan_data          515 drivers/hwmon/gpio-fan.c 		if (!fan_data->speed || fan_data->num_speed <= 1)
fan_data          517 drivers/hwmon/gpio-fan.c 		err = fan_ctrl_init(fan_data);
fan_data          520 drivers/hwmon/gpio-fan.c 		err = devm_add_action_or_reset(dev, gpio_fan_stop, fan_data);
fan_data          526 drivers/hwmon/gpio-fan.c 	fan_data->hwmon_dev =
fan_data          528 drivers/hwmon/gpio-fan.c 						       "gpio_fan", fan_data,
fan_data          530 drivers/hwmon/gpio-fan.c 	if (IS_ERR(fan_data->hwmon_dev))
fan_data          531 drivers/hwmon/gpio-fan.c 		return PTR_ERR(fan_data->hwmon_dev);
fan_data          534 drivers/hwmon/gpio-fan.c 	if (fan_data->alarm_gpio) {
fan_data          535 drivers/hwmon/gpio-fan.c 		err = fan_alarm_init(fan_data);
fan_data          541 drivers/hwmon/gpio-fan.c 	fan_data->cdev = devm_thermal_of_cooling_device_register(dev, np,
fan_data          542 drivers/hwmon/gpio-fan.c 				"gpio-fan", fan_data, &gpio_fan_cool_ops);
fan_data          551 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data = platform_get_drvdata(pdev);
fan_data          553 drivers/hwmon/gpio-fan.c 	if (fan_data->gpios)
fan_data          554 drivers/hwmon/gpio-fan.c 		set_fan_speed(fan_data, 0);
fan_data          560 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
fan_data          562 drivers/hwmon/gpio-fan.c 	if (fan_data->gpios) {
fan_data          563 drivers/hwmon/gpio-fan.c 		fan_data->resume_speed = fan_data->speed_index;
fan_data          564 drivers/hwmon/gpio-fan.c 		set_fan_speed(fan_data, 0);
fan_data          572 drivers/hwmon/gpio-fan.c 	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
fan_data          574 drivers/hwmon/gpio-fan.c 	if (fan_data->gpios)
fan_data          575 drivers/hwmon/gpio-fan.c 		set_fan_speed(fan_data, fan_data->resume_speed);
fan_data           59 drivers/hwmon/pmbus/ucd9000.c 	u8 fan_data[UCD9000_NUM_FAN][I2C_SMBUS_BLOCK_MAX];
fan_data           79 drivers/hwmon/pmbus/ucd9000.c 	if (data->fan_data[fan][3] & 1)
fan_data           83 drivers/hwmon/pmbus/ucd9000.c 	fan_config |= (data->fan_data[fan][3] & 0x06) >> 1;
fan_data          578 drivers/hwmon/pmbus/ucd9000.c 							data->fan_data[i]);