Lines Matching refs:d
37 #define ACPI_TO_RAW(v, d) (d->raw_bd->props.max_brightness * v / 100) argument
38 #define RAW_TO_ACPI(v, d) (v * 100 / d->raw_bd->props.max_brightness) argument
44 struct int3406_thermal_data *d = cooling_dev->devdata; in int3406_thermal_get_max_state() local
46 *state = d->upper_limit - d->lower_limit; in int3406_thermal_get_max_state()
54 struct int3406_thermal_data *d = cooling_dev->devdata; in int3406_thermal_set_cur_state() local
57 if (state > d->upper_limit - d->lower_limit) in int3406_thermal_set_cur_state()
60 acpi_level = d->br->levels[d->upper_limit - state]; in int3406_thermal_set_cur_state()
62 raw_level = ACPI_TO_RAW(acpi_level, d); in int3406_thermal_set_cur_state()
64 return backlight_device_set_brightness(d->raw_bd, raw_level); in int3406_thermal_set_cur_state()
71 struct int3406_thermal_data *d = cooling_dev->devdata; in int3406_thermal_get_cur_state() local
75 acpi_level = RAW_TO_ACPI(d->raw_bd->props.brightness, d); in int3406_thermal_get_cur_state()
82 for (index = d->lower_limit; index < d->upper_limit; index++) { in int3406_thermal_get_cur_state()
83 if (acpi_level <= d->br->levels[index]) in int3406_thermal_get_cur_state()
87 *state = d->upper_limit - index; in int3406_thermal_get_cur_state()
108 static void int3406_thermal_get_limit(struct int3406_thermal_data *d) in int3406_thermal_get_limit() argument
113 status = acpi_evaluate_integer(d->handle, "DDDL", NULL, &lower_limit); in int3406_thermal_get_limit()
115 d->lower_limit = int3406_thermal_get_index(d->br->levels, in int3406_thermal_get_limit()
116 d->br->count, lower_limit); in int3406_thermal_get_limit()
118 status = acpi_evaluate_integer(d->handle, "DDPC", NULL, &upper_limit); in int3406_thermal_get_limit()
120 d->upper_limit = int3406_thermal_get_index(d->br->levels, in int3406_thermal_get_limit()
121 d->br->count, upper_limit); in int3406_thermal_get_limit()
124 d->lower_limit = d->lower_limit > 0 ? d->lower_limit : 2; in int3406_thermal_get_limit()
125 d->upper_limit = d->upper_limit > 0 ? d->upper_limit : d->br->count - 1; in int3406_thermal_get_limit()
137 struct int3406_thermal_data *d; in int3406_thermal_probe() local
144 d = devm_kzalloc(&pdev->dev, sizeof(*d), GFP_KERNEL); in int3406_thermal_probe()
145 if (!d) in int3406_thermal_probe()
147 d->handle = ACPI_HANDLE(&pdev->dev); in int3406_thermal_probe()
152 d->raw_bd = bd; in int3406_thermal_probe()
154 ret = acpi_video_get_levels(ACPI_COMPANION(&pdev->dev), &d->br, NULL); in int3406_thermal_probe()
158 int3406_thermal_get_limit(d); in int3406_thermal_probe()
160 d->cooling_dev = thermal_cooling_device_register(acpi_device_bid(adev), in int3406_thermal_probe()
161 d, &video_cooling_ops); in int3406_thermal_probe()
162 if (IS_ERR(d->cooling_dev)) in int3406_thermal_probe()
166 int3406_notify, d); in int3406_thermal_probe()
170 platform_set_drvdata(pdev, d); in int3406_thermal_probe()
175 thermal_cooling_device_unregister(d->cooling_dev); in int3406_thermal_probe()
177 kfree(d->br); in int3406_thermal_probe()
183 struct int3406_thermal_data *d = platform_get_drvdata(pdev); in int3406_thermal_remove() local
185 thermal_cooling_device_unregister(d->cooling_dev); in int3406_thermal_remove()
186 kfree(d->br); in int3406_thermal_remove()