Lines Matching refs:ptd

97 static int pch_wpt_add_acpi_psv_trip(struct pch_thermal_device *ptd, int trip)
102 adev = ACPI_COMPANION(&ptd->pdev->dev);
109 ptd->trips[trip].type = THERMAL_TRIP_PASSIVE;
110 ptd->trips[trip].temperature = temp;
114 static int pch_wpt_add_acpi_psv_trip(struct pch_thermal_device *ptd, int trip)
122 struct pch_thermal_device *ptd = thermal_zone_device_priv(tzd);
124 *temp = GET_WPT_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP));
163 struct pch_thermal_device *ptd;
169 ptd = devm_kzalloc(&pdev->dev, sizeof(*ptd), GFP_KERNEL);
170 if (!ptd)
173 pci_set_drvdata(pdev, ptd);
174 ptd->pdev = pdev;
188 ptd->hw_base = pci_ioremap_bar(pdev, 0);
189 if (!ptd->hw_base) {
196 if (WPT_TSEL_ETS & readb(ptd->hw_base + WPT_TSEL)) {
197 ptd->bios_enabled = true;
201 tsel = readb(ptd->hw_base + WPT_TSEL);
207 dev_err(&ptd->pdev->dev, "Sensor can't be enabled\n");
212 writeb(tsel|WPT_TSEL_ETS, ptd->hw_base + WPT_TSEL);
213 if (!(WPT_TSEL_ETS & readb(ptd->hw_base + WPT_TSEL))) {
214 dev_err(&ptd->pdev->dev, "Sensor can't be enabled\n");
220 trip_temp = readw(ptd->hw_base + WPT_CTT);
223 ptd->trips[nr_trips].temperature = GET_WPT_TEMP(trip_temp);
224 ptd->trips[nr_trips++].type = THERMAL_TRIP_CRITICAL;
227 trip_temp = readw(ptd->hw_base + WPT_PHL);
230 ptd->trips[nr_trips].temperature = GET_WPT_TEMP(trip_temp);
231 ptd->trips[nr_trips++].type = THERMAL_TRIP_HOT;
234 nr_trips += pch_wpt_add_acpi_psv_trip(ptd, nr_trips);
236 ptd->tzd = thermal_zone_device_register_with_trips(board_names[board_id],
237 ptd->trips, nr_trips,
238 0, ptd, &tzd_ops,
240 if (IS_ERR(ptd->tzd)) {
243 err = PTR_ERR(ptd->tzd);
246 err = thermal_zone_device_enable(ptd->tzd);
253 thermal_zone_device_unregister(ptd->tzd);
255 iounmap(ptd->hw_base);
266 struct pch_thermal_device *ptd = pci_get_drvdata(pdev);
268 thermal_zone_device_unregister(ptd->tzd);
269 iounmap(ptd->hw_base);
277 struct pch_thermal_device *ptd = dev_get_drvdata(device);
283 if (!ptd->bios_enabled) {
284 tsel = readb(ptd->hw_base + WPT_TSEL);
285 writeb(tsel & 0xFE, ptd->hw_base + WPT_TSEL);
294 pch_thr_temp = GET_PCH_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TSPM));
297 pch_cur_temp = GET_PCH_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP));
312 dev_warn(&ptd->pdev->dev, "Wakeup event detected, abort cooling\n");
317 dev_dbg(&ptd->pdev->dev,
322 pch_cur_temp = GET_PCH_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP));
326 dev_warn(&ptd->pdev->dev,
331 dev_info(&ptd->pdev->dev,
335 dev_info(&ptd->pdev->dev,
345 struct pch_thermal_device *ptd = dev_get_drvdata(device);
348 if (ptd->bios_enabled)
351 tsel = readb(ptd->hw_base + WPT_TSEL);
353 writeb(tsel | WPT_TSEL_ETS, ptd->hw_base + WPT_TSEL);