···11+/**************************************************************************22+ * Copyright (c) 2011, Intel Corporation.33+ * All Rights Reserved.44+ *55+ * This program is free software; you can redistribute it and/or modify it66+ * under the terms and conditions of the GNU General Public License,77+ * version 2, as published by the Free Software Foundation.88+ *99+ * This program is distributed in the hope it will be useful, but WITHOUT1010+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1111+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1212+ * more details.1313+ *1414+ **************************************************************************/1515+1616+#include <drm/drmP.h>1717+#include "psb_drv.h"1818+1919+void gma_get_core_freq(struct drm_device *dev)2020+{2121+ uint32_t clock;2222+ struct pci_dev *pci_root = pci_get_bus_and_slot(0, 0);2323+ struct drm_psb_private *dev_priv = dev->dev_private;2424+2525+ /*pci_write_config_dword(pci_root, 0xD4, 0x00C32004);*/2626+ /*pci_write_config_dword(pci_root, 0xD0, 0xE0033000);*/2727+2828+ pci_write_config_dword(pci_root, 0xD0, 0xD0050300);2929+ pci_read_config_dword(pci_root, 0xD4, &clock);3030+ pci_dev_put(pci_root);3131+3232+ switch (clock & 0x07) {3333+ case 0:3434+ dev_priv->core_freq = 100;3535+ break;3636+ case 1:3737+ dev_priv->core_freq = 133;3838+ break;3939+ case 2:4040+ dev_priv->core_freq = 150;4141+ break;4242+ case 3:4343+ dev_priv->core_freq = 178;4444+ break;4545+ case 4:4646+ dev_priv->core_freq = 200;4747+ break;4848+ case 5:4949+ case 6:5050+ case 7:5151+ dev_priv->core_freq = 266;5252+ break;5353+ default:5454+ dev_priv->core_freq = 0;5555+ }5656+}
+21
drivers/gpu/drm/gma500/gma_device.h
···11+/**************************************************************************22+ * Copyright (c) 2011, Intel Corporation.33+ * All Rights Reserved.44+ *55+ * This program is free software; you can redistribute it and/or modify it66+ * under the terms and conditions of the GNU General Public License,77+ * version 2, as published by the Free Software Foundation.88+ *99+ * This program is distributed in the hope it will be useful, but WITHOUT1010+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1111+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1212+ * more details.1313+ *1414+ **************************************************************************/1515+1616+#ifndef _GMA_DEVICE_H1717+#define _GMA_DEVICE_H1818+1919+extern void gma_get_core_freq(struct drm_device *dev);2020+2121+#endif