30 #define VGA_SR_INDEX 0x3c4
31 #define VGA_SR_DATA 0x3c5
75 #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
83 static int cdv_backlight_combination_mode(
struct drm_device *dev)
93 DRM_DEBUG_KMS(
"LVDS Panel PWM value is 0!\n");
100 if (cdv_backlight_combination_mode(dev))
110 if (cdv_backlight_combination_mode(dev)) {
114 pci_read_config_byte(dev->pdev, 0xF4, &lbpc);
117 return (val * 100)/cdv_get_max_backlight(dev);
131 level *= cdv_get_max_backlight(dev);
134 if (cdv_backlight_combination_mode(dev)) {
135 u32 max = cdv_get_max_backlight(dev);
138 lbpc = level * 0xfe / max + 1;
141 pci_write_config_byte(dev->pdev, 0xF4, lbpc);
152 .update_status = cdv_set_brightness,
155 static int cdv_backlight_init(
struct drm_device *dev)
161 props.max_brightness = 100;
165 NULL, (
void *)dev, &cdv_ops, &props);
166 if (IS_ERR(cdv_backlight_device))
167 return PTR_ERR(cdv_backlight_device);
169 cdv_backlight_device->
props.brightness =
170 cdv_get_brightness(cdv_backlight_device);
171 backlight_update_status(cdv_backlight_device);
189 int mcr = (0x10<<24) | (port << 16) | (offset << 8);
192 pci_write_config_dword(pci_root, 0xD0, mcr);
193 pci_read_config_dword(pci_root, 0xD4, &ret_val);
200 int mcr = (0x11<<24) | (port << 16) | (offset << 8) | 0xF0;
202 pci_write_config_dword(pci_root, 0xD4, value);
203 pci_write_config_dword(pci_root, 0xD0, mcr);
207 #define PSB_PM_SSC 0x20
208 #define PSB_PM_SSS 0x30
209 #define PSB_PWRGT_GFX_ON 0x02
210 #define PSB_PWRGT_GFX_OFF 0x01
211 #define PSB_PWRGT_GFX_D0 0x00
212 #define PSB_PWRGT_GFX_D3 0x03
214 static void cdv_init_pm(
struct drm_device *dev)
234 for (i = 0; i < 5; i++) {
240 dev_err(dev->dev,
"GPU: power management timed out.\n");
243 static void cdv_errata(
struct drm_device *dev)
253 CDV_MSG_WRITE32(3, 0x30, 0x08027108);
263 static int cdv_save_display_registers(
struct drm_device *dev)
269 dev_dbg(dev->dev,
"Saving GPU registers.\n");
271 pci_read_config_byte(dev->pdev, 0xF4, ®s->
cdv.saveLBB);
324 pci_write_config_byte(dev->pdev, 0xF4, regs->
cdv.saveLBB);
340 if ((temp & DPLL_SYNCLOCK_ENABLE) == 0) {
388 u32 pwr_cnt, pwr_mask, pwr_sts;
407 static int cdv_power_up(
struct drm_device *dev)
410 u32 pwr_cnt, pwr_mask, pwr_sts;
430 static void cdv_get_core_freq(
struct drm_device *dev)
436 pci_write_config_dword(pci_root, 0xD0, 0xD0050300);
437 pci_read_config_dword(pci_root, 0xD4, &clock);
440 switch (clock & 0x07) {
479 static int cdv_hotplug_event(
struct drm_device *dev)
487 static void cdv_hotplug_enable(
struct drm_device *dev,
bool on)
500 static const char *force_audio_names[] = {
521 for (i = 0; i <
ARRAY_SIZE(force_audio_names); i++)
530 static const char *broadcast_rgb_names[] = {
550 for (i = 0; i <
ARRAY_SIZE(broadcast_rgb_names); i++)
560 static const struct psb_offset cdv_regmap[2] = {
613 static int cdv_chip_setup(
struct drm_device *dev)
618 if (pci_enable_msi(dev->pdev))
619 dev_warn(dev->dev,
"Enabling MSI failed!\n");
620 dev_priv->
regmap = cdv_regmap;
621 cdv_get_core_freq(dev);
624 cdv_hotplug_enable(dev,
false);
631 .name =
"GMA3600/3650",
635 .hdmi_mask = (1 << 0) | (1 << 1),
636 .lvds_mask = (1 << 1),
649 #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
650 .backlight_init = cdv_backlight_init,