1 // SPDX-License-Identifier: GPL-2.0-only
2 /**************************************************************************
3 * Copyright (c) 2011, Intel Corporation.
6 **************************************************************************/
9 #include "gma_device.h"
11 void gma_get_core_freq(struct drm_device *dev)
14 struct pci_dev *pdev = to_pci_dev(dev->dev);
15 struct pci_dev *pci_root =
16 pci_get_domain_bus_and_slot(pci_domain_nr(pdev->bus),
18 struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
20 /*pci_write_config_dword(pci_root, 0xD4, 0x00C32004);*/
21 /*pci_write_config_dword(pci_root, 0xD0, 0xE0033000);*/
23 pci_write_config_dword(pci_root, 0xD0, 0xD0050300);
24 pci_read_config_dword(pci_root, 0xD4, &clock);
25 pci_dev_put(pci_root);
27 switch (clock & 0x07) {
29 dev_priv->core_freq = 100;
32 dev_priv->core_freq = 133;
35 dev_priv->core_freq = 150;
38 dev_priv->core_freq = 178;
41 dev_priv->core_freq = 200;
46 dev_priv->core_freq = 266;
49 dev_priv->core_freq = 0;