提交 6f9f4b7a 编写于 作者: C Chris Wilson

drm/i915/opregion: Convert to using native drm_i915_private

Prefer passing struct drm_i915_private to internal interfaces as this
saves us having to dance between drm_device and our native struct. The
savings hare are small (only 70 bytes of unrequired dancing), but
progressive!
Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1464012490-30961-1-git-send-email-chris@chris-wilson.co.ukReviewed-by: NJani Nikula <jani.nikula@linux.intel.com>
上级 11825b0d
...@@ -1310,7 +1310,7 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv) ...@@ -1310,7 +1310,7 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv)
intel_uncore_sanitize(dev_priv); intel_uncore_sanitize(dev_priv);
intel_opregion_setup(dev); intel_opregion_setup(dev_priv);
i915_gem_load_init_fences(dev_priv); i915_gem_load_init_fences(dev_priv);
...@@ -1379,7 +1379,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv) ...@@ -1379,7 +1379,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
if (INTEL_INFO(dev_priv)->num_pipes) { if (INTEL_INFO(dev_priv)->num_pipes) {
/* Must be done after probing outputs */ /* Must be done after probing outputs */
intel_opregion_init(dev); intel_opregion_init(dev_priv);
acpi_video_register(); acpi_video_register();
} }
...@@ -1398,7 +1398,7 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv) ...@@ -1398,7 +1398,7 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)
i915_audio_component_cleanup(dev_priv); i915_audio_component_cleanup(dev_priv);
intel_gpu_ips_teardown(); intel_gpu_ips_teardown();
acpi_video_unregister(); acpi_video_unregister();
intel_opregion_fini(dev_priv->dev); intel_opregion_fini(dev_priv);
i915_teardown_sysfs(dev_priv->dev); i915_teardown_sysfs(dev_priv->dev);
i915_gem_shrinker_cleanup(dev_priv); i915_gem_shrinker_cleanup(dev_priv);
} }
......
...@@ -628,10 +628,10 @@ static int i915_drm_suspend(struct drm_device *dev) ...@@ -628,10 +628,10 @@ static int i915_drm_suspend(struct drm_device *dev)
i915_save_state(dev); i915_save_state(dev);
opregion_target_state = suspend_to_idle(dev_priv) ? PCI_D1 : PCI_D3cold; opregion_target_state = suspend_to_idle(dev_priv) ? PCI_D1 : PCI_D3cold;
intel_opregion_notify_adapter(dev, opregion_target_state); intel_opregion_notify_adapter(dev_priv, opregion_target_state);
intel_uncore_forcewake_reset(dev_priv, false); intel_uncore_forcewake_reset(dev_priv, false);
intel_opregion_fini(dev); intel_opregion_fini(dev_priv);
intel_fbdev_set_suspend(dev, FBINFO_STATE_SUSPENDED, true); intel_fbdev_set_suspend(dev, FBINFO_STATE_SUSPENDED, true);
...@@ -749,7 +749,7 @@ static int i915_drm_resume(struct drm_device *dev) ...@@ -749,7 +749,7 @@ static int i915_drm_resume(struct drm_device *dev)
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
i915_restore_state(dev); i915_restore_state(dev);
intel_opregion_setup(dev); intel_opregion_setup(dev_priv);
intel_init_pch_refclk(dev); intel_init_pch_refclk(dev);
drm_mode_config_reset(dev); drm_mode_config_reset(dev);
...@@ -794,7 +794,7 @@ static int i915_drm_resume(struct drm_device *dev) ...@@ -794,7 +794,7 @@ static int i915_drm_resume(struct drm_device *dev)
/* Config may have changed between suspend and resume */ /* Config may have changed between suspend and resume */
drm_helper_hpd_irq_event(dev); drm_helper_hpd_irq_event(dev);
intel_opregion_init(dev); intel_opregion_init(dev_priv);
intel_fbdev_set_suspend(dev, FBINFO_STATE_RUNNING, false); intel_fbdev_set_suspend(dev, FBINFO_STATE_RUNNING, false);
...@@ -802,7 +802,7 @@ static int i915_drm_resume(struct drm_device *dev) ...@@ -802,7 +802,7 @@ static int i915_drm_resume(struct drm_device *dev)
dev_priv->modeset_restore = MODESET_DONE; dev_priv->modeset_restore = MODESET_DONE;
mutex_unlock(&dev_priv->modeset_restore_lock); mutex_unlock(&dev_priv->modeset_restore_lock);
intel_opregion_notify_adapter(dev, PCI_D0); intel_opregion_notify_adapter(dev_priv, PCI_D0);
drm_kms_helper_poll_enable(dev); drm_kms_helper_poll_enable(dev);
...@@ -1596,14 +1596,14 @@ static int intel_runtime_suspend(struct device *device) ...@@ -1596,14 +1596,14 @@ static int intel_runtime_suspend(struct device *device)
* FIXME: We really should find a document that references the arguments * FIXME: We really should find a document that references the arguments
* used below! * used below!
*/ */
if (IS_BROADWELL(dev)) { if (IS_BROADWELL(dev_priv)) {
/* /*
* On Broadwell, if we use PCI_D1 the PCH DDI ports will stop * On Broadwell, if we use PCI_D1 the PCH DDI ports will stop
* being detected, and the call we do at intel_runtime_resume() * being detected, and the call we do at intel_runtime_resume()
* won't be able to restore them. Since PCI_D3hot matches the * won't be able to restore them. Since PCI_D3hot matches the
* actual specification and appears to be working, use it. * actual specification and appears to be working, use it.
*/ */
intel_opregion_notify_adapter(dev, PCI_D3hot); intel_opregion_notify_adapter(dev_priv, PCI_D3hot);
} else { } else {
/* /*
* current versions of firmware which depend on this opregion * current versions of firmware which depend on this opregion
...@@ -1612,7 +1612,7 @@ static int intel_runtime_suspend(struct device *device) ...@@ -1612,7 +1612,7 @@ static int intel_runtime_suspend(struct device *device)
* to distinguish it from notifications that might be sent via * to distinguish it from notifications that might be sent via
* the suspend path. * the suspend path.
*/ */
intel_opregion_notify_adapter(dev, PCI_D1); intel_opregion_notify_adapter(dev_priv, PCI_D1);
} }
assert_forcewakes_inactive(dev_priv); assert_forcewakes_inactive(dev_priv);
...@@ -1636,7 +1636,7 @@ static int intel_runtime_resume(struct device *device) ...@@ -1636,7 +1636,7 @@ static int intel_runtime_resume(struct device *device)
WARN_ON_ONCE(atomic_read(&dev_priv->pm.wakeref_count)); WARN_ON_ONCE(atomic_read(&dev_priv->pm.wakeref_count));
disable_rpm_wakeref_asserts(dev_priv); disable_rpm_wakeref_asserts(dev_priv);
intel_opregion_notify_adapter(dev, PCI_D0); intel_opregion_notify_adapter(dev_priv, PCI_D0);
dev_priv->pm.suspended = false; dev_priv->pm.suspended = false;
if (intel_uncore_unclaimed_mmio(dev_priv)) if (intel_uncore_unclaimed_mmio(dev_priv))
DRM_DEBUG_DRIVER("Unclaimed access during suspend, bios?\n"); DRM_DEBUG_DRIVER("Unclaimed access during suspend, bios?\n");
......
...@@ -3608,19 +3608,19 @@ bool intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv, ...@@ -3608,19 +3608,19 @@ bool intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv,
/* intel_opregion.c */ /* intel_opregion.c */
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
extern int intel_opregion_setup(struct drm_device *dev); extern int intel_opregion_setup(struct drm_i915_private *dev_priv);
extern void intel_opregion_init(struct drm_device *dev); extern void intel_opregion_init(struct drm_i915_private *dev_priv);
extern void intel_opregion_fini(struct drm_device *dev); extern void intel_opregion_fini(struct drm_i915_private *dev_priv);
extern void intel_opregion_asle_intr(struct drm_i915_private *dev_priv); extern void intel_opregion_asle_intr(struct drm_i915_private *dev_priv);
extern int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, extern int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
bool enable); bool enable);
extern int intel_opregion_notify_adapter(struct drm_device *dev, extern int intel_opregion_notify_adapter(struct drm_i915_private *dev_priv,
pci_power_t state); pci_power_t state);
extern int intel_opregion_get_panel_type(struct drm_device *dev); extern int intel_opregion_get_panel_type(struct drm_i915_private *dev_priv);
#else #else
static inline int intel_opregion_setup(struct drm_device *dev) { return 0; } static inline int intel_opregion_setup(struct drm_i915_private *dev) { return 0; }
static inline void intel_opregion_init(struct drm_device *dev) { return; } static inline void intel_opregion_init(struct drm_i915_private *dev) { }
static inline void intel_opregion_fini(struct drm_device *dev) { return; } static inline void intel_opregion_fini(struct drm_i915_private *dev) { }
static inline void intel_opregion_asle_intr(struct drm_i915_private *dev_priv) static inline void intel_opregion_asle_intr(struct drm_i915_private *dev_priv)
{ {
} }
...@@ -3630,11 +3630,11 @@ intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, bool enable) ...@@ -3630,11 +3630,11 @@ intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, bool enable)
return 0; return 0;
} }
static inline int static inline int
intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state) intel_opregion_notify_adapter(struct drm_i915_private *dev, pci_power_t state)
{ {
return 0; return 0;
} }
static inline int intel_opregion_get_panel_type(struct drm_device *dev) static inline int intel_opregion_get_panel_type(struct drm_i915_private *dev)
{ {
return -ENODEV; return -ENODEV;
} }
......
...@@ -213,7 +213,7 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv, ...@@ -213,7 +213,7 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
dev_priv->vbt.lvds_dither = lvds_options->pixel_dither; dev_priv->vbt.lvds_dither = lvds_options->pixel_dither;
ret = intel_opregion_get_panel_type(dev_priv->dev); ret = intel_opregion_get_panel_type(dev_priv);
if (ret >= 0) { if (ret >= 0) {
WARN_ON(ret > 0xf); WARN_ON(ret > 0xf);
panel_type = ret; panel_type = ret;
......
...@@ -240,10 +240,11 @@ struct opregion_asle_ext { ...@@ -240,10 +240,11 @@ struct opregion_asle_ext {
#define MAX_DSLP 1500 #define MAX_DSLP 1500
static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out) static int swsci(struct drm_i915_private *dev_priv,
u32 function, u32 parm, u32 *parm_out)
{ {
struct drm_i915_private *dev_priv = dev->dev_private;
struct opregion_swsci *swsci = dev_priv->opregion.swsci; struct opregion_swsci *swsci = dev_priv->opregion.swsci;
struct pci_dev *pdev = dev_priv->dev->pdev;
u32 main_function, sub_function, scic; u32 main_function, sub_function, scic;
u16 swsci_val; u16 swsci_val;
u32 dslp; u32 dslp;
...@@ -293,16 +294,16 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out) ...@@ -293,16 +294,16 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
swsci->scic = scic; swsci->scic = scic;
/* Ensure SCI event is selected and event trigger is cleared. */ /* Ensure SCI event is selected and event trigger is cleared. */
pci_read_config_word(dev->pdev, SWSCI, &swsci_val); pci_read_config_word(pdev, SWSCI, &swsci_val);
if (!(swsci_val & SWSCI_SCISEL) || (swsci_val & SWSCI_GSSCIE)) { if (!(swsci_val & SWSCI_SCISEL) || (swsci_val & SWSCI_GSSCIE)) {
swsci_val |= SWSCI_SCISEL; swsci_val |= SWSCI_SCISEL;
swsci_val &= ~SWSCI_GSSCIE; swsci_val &= ~SWSCI_GSSCIE;
pci_write_config_word(dev->pdev, SWSCI, swsci_val); pci_write_config_word(pdev, SWSCI, swsci_val);
} }
/* Use event trigger to tell bios to check the mail. */ /* Use event trigger to tell bios to check the mail. */
swsci_val |= SWSCI_GSSCIE; swsci_val |= SWSCI_GSSCIE;
pci_write_config_word(dev->pdev, SWSCI, swsci_val); pci_write_config_word(pdev, SWSCI, swsci_val);
/* Poll for the result. */ /* Poll for the result. */
#define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0) #define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0)
...@@ -336,13 +337,13 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out) ...@@ -336,13 +337,13 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
bool enable) bool enable)
{ {
struct drm_device *dev = intel_encoder->base.dev; struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
u32 parm = 0; u32 parm = 0;
u32 type = 0; u32 type = 0;
u32 port; u32 port;
/* don't care about old stuff for now */ /* don't care about old stuff for now */
if (!HAS_DDI(dev)) if (!HAS_DDI(dev_priv))
return 0; return 0;
if (intel_encoder->type == INTEL_OUTPUT_DSI) if (intel_encoder->type == INTEL_OUTPUT_DSI)
...@@ -382,7 +383,7 @@ int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, ...@@ -382,7 +383,7 @@ int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
parm |= type << (16 + port * 3); parm |= type << (16 + port * 3);
return swsci(dev, SWSCI_SBCB_DISPLAY_POWER_STATE, parm, NULL); return swsci(dev_priv, SWSCI_SBCB_DISPLAY_POWER_STATE, parm, NULL);
} }
static const struct { static const struct {
...@@ -396,27 +397,28 @@ static const struct { ...@@ -396,27 +397,28 @@ static const struct {
{ PCI_D3cold, 0x04 }, { PCI_D3cold, 0x04 },
}; };
int intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state) int intel_opregion_notify_adapter(struct drm_i915_private *dev_priv,
pci_power_t state)
{ {
int i; int i;
if (!HAS_DDI(dev)) if (!HAS_DDI(dev_priv))
return 0; return 0;
for (i = 0; i < ARRAY_SIZE(power_state_map); i++) { for (i = 0; i < ARRAY_SIZE(power_state_map); i++) {
if (state == power_state_map[i].pci_power_state) if (state == power_state_map[i].pci_power_state)
return swsci(dev, SWSCI_SBCB_ADAPTER_POWER_STATE, return swsci(dev_priv, SWSCI_SBCB_ADAPTER_POWER_STATE,
power_state_map[i].parm, NULL); power_state_map[i].parm, NULL);
} }
return -EINVAL; return -EINVAL;
} }
static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) static u32 asle_set_backlight(struct drm_i915_private *dev_priv, u32 bclp)
{ {
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_connector *connector; struct intel_connector *connector;
struct opregion_asle *asle = dev_priv->opregion.asle; struct opregion_asle *asle = dev_priv->opregion.asle;
struct drm_device *dev = dev_priv->dev;
DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp); DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
...@@ -449,7 +451,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) ...@@ -449,7 +451,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
return 0; return 0;
} }
static u32 asle_set_als_illum(struct drm_device *dev, u32 alsi) static u32 asle_set_als_illum(struct drm_i915_private *dev_priv, u32 alsi)
{ {
/* alsi is the current ALS reading in lux. 0 indicates below sensor /* alsi is the current ALS reading in lux. 0 indicates below sensor
range, 0xffff indicates above sensor range. 1-0xfffe are valid */ range, 0xffff indicates above sensor range. 1-0xfffe are valid */
...@@ -457,13 +459,13 @@ static u32 asle_set_als_illum(struct drm_device *dev, u32 alsi) ...@@ -457,13 +459,13 @@ static u32 asle_set_als_illum(struct drm_device *dev, u32 alsi)
return ASLC_ALS_ILLUM_FAILED; return ASLC_ALS_ILLUM_FAILED;
} }
static u32 asle_set_pwm_freq(struct drm_device *dev, u32 pfmb) static u32 asle_set_pwm_freq(struct drm_i915_private *dev_priv, u32 pfmb)
{ {
DRM_DEBUG_DRIVER("PWM freq is not supported\n"); DRM_DEBUG_DRIVER("PWM freq is not supported\n");
return ASLC_PWM_FREQ_FAILED; return ASLC_PWM_FREQ_FAILED;
} }
static u32 asle_set_pfit(struct drm_device *dev, u32 pfit) static u32 asle_set_pfit(struct drm_i915_private *dev_priv, u32 pfit)
{ {
/* Panel fitting is currently controlled by the X code, so this is a /* Panel fitting is currently controlled by the X code, so this is a
noop until modesetting support works fully */ noop until modesetting support works fully */
...@@ -471,13 +473,13 @@ static u32 asle_set_pfit(struct drm_device *dev, u32 pfit) ...@@ -471,13 +473,13 @@ static u32 asle_set_pfit(struct drm_device *dev, u32 pfit)
return ASLC_PFIT_FAILED; return ASLC_PFIT_FAILED;
} }
static u32 asle_set_supported_rotation_angles(struct drm_device *dev, u32 srot) static u32 asle_set_supported_rotation_angles(struct drm_i915_private *dev_priv, u32 srot)
{ {
DRM_DEBUG_DRIVER("SROT is not supported\n"); DRM_DEBUG_DRIVER("SROT is not supported\n");
return ASLC_ROTATION_ANGLES_FAILED; return ASLC_ROTATION_ANGLES_FAILED;
} }
static u32 asle_set_button_array(struct drm_device *dev, u32 iuer) static u32 asle_set_button_array(struct drm_i915_private *dev_priv, u32 iuer)
{ {
if (!iuer) if (!iuer)
DRM_DEBUG_DRIVER("Button array event is not supported (nothing)\n"); DRM_DEBUG_DRIVER("Button array event is not supported (nothing)\n");
...@@ -495,7 +497,7 @@ static u32 asle_set_button_array(struct drm_device *dev, u32 iuer) ...@@ -495,7 +497,7 @@ static u32 asle_set_button_array(struct drm_device *dev, u32 iuer)
return ASLC_BUTTON_ARRAY_FAILED; return ASLC_BUTTON_ARRAY_FAILED;
} }
static u32 asle_set_convertible(struct drm_device *dev, u32 iuer) static u32 asle_set_convertible(struct drm_i915_private *dev_priv, u32 iuer)
{ {
if (iuer & ASLE_IUER_CONVERTIBLE) if (iuer & ASLE_IUER_CONVERTIBLE)
DRM_DEBUG_DRIVER("Convertible is not supported (clamshell)\n"); DRM_DEBUG_DRIVER("Convertible is not supported (clamshell)\n");
...@@ -505,7 +507,7 @@ static u32 asle_set_convertible(struct drm_device *dev, u32 iuer) ...@@ -505,7 +507,7 @@ static u32 asle_set_convertible(struct drm_device *dev, u32 iuer)
return ASLC_CONVERTIBLE_FAILED; return ASLC_CONVERTIBLE_FAILED;
} }
static u32 asle_set_docking(struct drm_device *dev, u32 iuer) static u32 asle_set_docking(struct drm_i915_private *dev_priv, u32 iuer)
{ {
if (iuer & ASLE_IUER_DOCKING) if (iuer & ASLE_IUER_DOCKING)
DRM_DEBUG_DRIVER("Docking is not supported (docked)\n"); DRM_DEBUG_DRIVER("Docking is not supported (docked)\n");
...@@ -515,7 +517,7 @@ static u32 asle_set_docking(struct drm_device *dev, u32 iuer) ...@@ -515,7 +517,7 @@ static u32 asle_set_docking(struct drm_device *dev, u32 iuer)
return ASLC_DOCKING_FAILED; return ASLC_DOCKING_FAILED;
} }
static u32 asle_isct_state(struct drm_device *dev) static u32 asle_isct_state(struct drm_i915_private *dev_priv)
{ {
DRM_DEBUG_DRIVER("ISCT is not supported\n"); DRM_DEBUG_DRIVER("ISCT is not supported\n");
return ASLC_ISCT_STATE_FAILED; return ASLC_ISCT_STATE_FAILED;
...@@ -527,7 +529,6 @@ static void asle_work(struct work_struct *work) ...@@ -527,7 +529,6 @@ static void asle_work(struct work_struct *work)
container_of(work, struct intel_opregion, asle_work); container_of(work, struct intel_opregion, asle_work);
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
container_of(opregion, struct drm_i915_private, opregion); container_of(opregion, struct drm_i915_private, opregion);
struct drm_device *dev = dev_priv->dev;
struct opregion_asle *asle = dev_priv->opregion.asle; struct opregion_asle *asle = dev_priv->opregion.asle;
u32 aslc_stat = 0; u32 aslc_stat = 0;
u32 aslc_req; u32 aslc_req;
...@@ -544,32 +545,32 @@ static void asle_work(struct work_struct *work) ...@@ -544,32 +545,32 @@ static void asle_work(struct work_struct *work)
} }
if (aslc_req & ASLC_SET_ALS_ILLUM) if (aslc_req & ASLC_SET_ALS_ILLUM)
aslc_stat |= asle_set_als_illum(dev, asle->alsi); aslc_stat |= asle_set_als_illum(dev_priv, asle->alsi);
if (aslc_req & ASLC_SET_BACKLIGHT) if (aslc_req & ASLC_SET_BACKLIGHT)
aslc_stat |= asle_set_backlight(dev, asle->bclp); aslc_stat |= asle_set_backlight(dev_priv, asle->bclp);
if (aslc_req & ASLC_SET_PFIT) if (aslc_req & ASLC_SET_PFIT)
aslc_stat |= asle_set_pfit(dev, asle->pfit); aslc_stat |= asle_set_pfit(dev_priv, asle->pfit);
if (aslc_req & ASLC_SET_PWM_FREQ) if (aslc_req & ASLC_SET_PWM_FREQ)
aslc_stat |= asle_set_pwm_freq(dev, asle->pfmb); aslc_stat |= asle_set_pwm_freq(dev_priv, asle->pfmb);
if (aslc_req & ASLC_SUPPORTED_ROTATION_ANGLES) if (aslc_req & ASLC_SUPPORTED_ROTATION_ANGLES)
aslc_stat |= asle_set_supported_rotation_angles(dev, aslc_stat |= asle_set_supported_rotation_angles(dev_priv,
asle->srot); asle->srot);
if (aslc_req & ASLC_BUTTON_ARRAY) if (aslc_req & ASLC_BUTTON_ARRAY)
aslc_stat |= asle_set_button_array(dev, asle->iuer); aslc_stat |= asle_set_button_array(dev_priv, asle->iuer);
if (aslc_req & ASLC_CONVERTIBLE_INDICATOR) if (aslc_req & ASLC_CONVERTIBLE_INDICATOR)
aslc_stat |= asle_set_convertible(dev, asle->iuer); aslc_stat |= asle_set_convertible(dev_priv, asle->iuer);
if (aslc_req & ASLC_DOCKING_INDICATOR) if (aslc_req & ASLC_DOCKING_INDICATOR)
aslc_stat |= asle_set_docking(dev, asle->iuer); aslc_stat |= asle_set_docking(dev_priv, asle->iuer);
if (aslc_req & ASLC_ISCT_STATE_CHANGE) if (aslc_req & ASLC_ISCT_STATE_CHANGE)
aslc_stat |= asle_isct_state(dev); aslc_stat |= asle_isct_state(dev_priv);
asle->aslc = aslc_stat; asle->aslc = aslc_stat;
} }
...@@ -656,10 +657,10 @@ static void set_did(struct intel_opregion *opregion, int i, u32 val) ...@@ -656,10 +657,10 @@ static void set_did(struct intel_opregion *opregion, int i, u32 val)
} }
} }
static void intel_didl_outputs(struct drm_device *dev) static void intel_didl_outputs(struct drm_i915_private *dev_priv)
{ {
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_opregion *opregion = &dev_priv->opregion; struct intel_opregion *opregion = &dev_priv->opregion;
struct pci_dev *pdev = dev_priv->dev->pdev;
struct drm_connector *connector; struct drm_connector *connector;
acpi_handle handle; acpi_handle handle;
struct acpi_device *acpi_dev, *acpi_cdev, *acpi_video_bus = NULL; struct acpi_device *acpi_dev, *acpi_cdev, *acpi_video_bus = NULL;
...@@ -668,7 +669,7 @@ static void intel_didl_outputs(struct drm_device *dev) ...@@ -668,7 +669,7 @@ static void intel_didl_outputs(struct drm_device *dev)
u32 temp, max_outputs; u32 temp, max_outputs;
int i = 0; int i = 0;
handle = ACPI_HANDLE(&dev->pdev->dev); handle = ACPI_HANDLE(&pdev->dev);
if (!handle || acpi_bus_get_device(handle, &acpi_dev)) if (!handle || acpi_bus_get_device(handle, &acpi_dev))
return; return;
...@@ -723,7 +724,7 @@ static void intel_didl_outputs(struct drm_device *dev) ...@@ -723,7 +724,7 @@ static void intel_didl_outputs(struct drm_device *dev)
blind_set: blind_set:
i = 0; i = 0;
list_for_each_entry(connector, &dev->mode_config.connector_list, head) { list_for_each_entry(connector, &dev_priv->dev->mode_config.connector_list, head) {
int output_type = ACPI_OTHER_OUTPUT; int output_type = ACPI_OTHER_OUTPUT;
if (i >= max_outputs) { if (i >= max_outputs) {
DRM_DEBUG_KMS("More than %u outputs in connector list\n", DRM_DEBUG_KMS("More than %u outputs in connector list\n",
...@@ -759,9 +760,8 @@ static void intel_didl_outputs(struct drm_device *dev) ...@@ -759,9 +760,8 @@ static void intel_didl_outputs(struct drm_device *dev)
goto end; goto end;
} }
static void intel_setup_cadls(struct drm_device *dev) static void intel_setup_cadls(struct drm_i915_private *dev_priv)
{ {
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_opregion *opregion = &dev_priv->opregion; struct intel_opregion *opregion = &dev_priv->opregion;
int i = 0; int i = 0;
u32 disp_id; u32 disp_id;
...@@ -778,17 +778,16 @@ static void intel_setup_cadls(struct drm_device *dev) ...@@ -778,17 +778,16 @@ static void intel_setup_cadls(struct drm_device *dev)
} while (++i < 8 && disp_id != 0); } while (++i < 8 && disp_id != 0);
} }
void intel_opregion_init(struct drm_device *dev) void intel_opregion_init(struct drm_i915_private *dev_priv)
{ {
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_opregion *opregion = &dev_priv->opregion; struct intel_opregion *opregion = &dev_priv->opregion;
if (!opregion->header) if (!opregion->header)
return; return;
if (opregion->acpi) { if (opregion->acpi) {
intel_didl_outputs(dev); intel_didl_outputs(dev_priv);
intel_setup_cadls(dev); intel_setup_cadls(dev_priv);
/* Notify BIOS we are ready to handle ACPI video ext notifs. /* Notify BIOS we are ready to handle ACPI video ext notifs.
* Right now, all the events are handled by the ACPI video module. * Right now, all the events are handled by the ACPI video module.
...@@ -806,9 +805,8 @@ void intel_opregion_init(struct drm_device *dev) ...@@ -806,9 +805,8 @@ void intel_opregion_init(struct drm_device *dev)
} }
} }
void intel_opregion_fini(struct drm_device *dev) void intel_opregion_fini(struct drm_i915_private *dev_priv)
{ {
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_opregion *opregion = &dev_priv->opregion; struct intel_opregion *opregion = &dev_priv->opregion;
if (!opregion->header) if (!opregion->header)
...@@ -840,9 +838,8 @@ void intel_opregion_fini(struct drm_device *dev) ...@@ -840,9 +838,8 @@ void intel_opregion_fini(struct drm_device *dev)
opregion->lid_state = NULL; opregion->lid_state = NULL;
} }
static void swsci_setup(struct drm_device *dev) static void swsci_setup(struct drm_i915_private *dev_priv)
{ {
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_opregion *opregion = &dev_priv->opregion; struct intel_opregion *opregion = &dev_priv->opregion;
bool requested_callbacks = false; bool requested_callbacks = false;
u32 tmp; u32 tmp;
...@@ -852,7 +849,7 @@ static void swsci_setup(struct drm_device *dev) ...@@ -852,7 +849,7 @@ static void swsci_setup(struct drm_device *dev)
opregion->swsci_sbcb_sub_functions = 1; opregion->swsci_sbcb_sub_functions = 1;
/* We use GBDA to ask for supported GBDA calls. */ /* We use GBDA to ask for supported GBDA calls. */
if (swsci(dev, SWSCI_GBDA_SUPPORTED_CALLS, 0, &tmp) == 0) { if (swsci(dev_priv, SWSCI_GBDA_SUPPORTED_CALLS, 0, &tmp) == 0) {
/* make the bits match the sub-function codes */ /* make the bits match the sub-function codes */
tmp <<= 1; tmp <<= 1;
opregion->swsci_gbda_sub_functions |= tmp; opregion->swsci_gbda_sub_functions |= tmp;
...@@ -863,7 +860,7 @@ static void swsci_setup(struct drm_device *dev) ...@@ -863,7 +860,7 @@ static void swsci_setup(struct drm_device *dev)
* must not call interfaces that are not specifically requested by the * must not call interfaces that are not specifically requested by the
* bios. * bios.
*/ */
if (swsci(dev, SWSCI_GBDA_REQUESTED_CALLBACKS, 0, &tmp) == 0) { if (swsci(dev_priv, SWSCI_GBDA_REQUESTED_CALLBACKS, 0, &tmp) == 0) {
/* here, the bits already match sub-function codes */ /* here, the bits already match sub-function codes */
opregion->swsci_sbcb_sub_functions |= tmp; opregion->swsci_sbcb_sub_functions |= tmp;
requested_callbacks = true; requested_callbacks = true;
...@@ -874,7 +871,7 @@ static void swsci_setup(struct drm_device *dev) ...@@ -874,7 +871,7 @@ static void swsci_setup(struct drm_device *dev)
* the callback is _requested_. But we still can't call interfaces that * the callback is _requested_. But we still can't call interfaces that
* are not requested. * are not requested.
*/ */
if (swsci(dev, SWSCI_SBCB_SUPPORTED_CALLBACKS, 0, &tmp) == 0) { if (swsci(dev_priv, SWSCI_SBCB_SUPPORTED_CALLBACKS, 0, &tmp) == 0) {
/* make the bits match the sub-function codes */ /* make the bits match the sub-function codes */
u32 low = tmp & 0x7ff; u32 low = tmp & 0x7ff;
u32 high = tmp & ~0xfff; /* bit 11 is reserved */ u32 high = tmp & ~0xfff; /* bit 11 is reserved */
...@@ -916,10 +913,10 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = { ...@@ -916,10 +913,10 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = {
{ } { }
}; };
int intel_opregion_setup(struct drm_device *dev) int intel_opregion_setup(struct drm_i915_private *dev_priv)
{ {
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_opregion *opregion = &dev_priv->opregion; struct intel_opregion *opregion = &dev_priv->opregion;
struct pci_dev *pdev = dev_priv->dev->pdev;
u32 asls, mboxes; u32 asls, mboxes;
char buf[sizeof(OPREGION_SIGNATURE)]; char buf[sizeof(OPREGION_SIGNATURE)];
int err = 0; int err = 0;
...@@ -931,7 +928,7 @@ int intel_opregion_setup(struct drm_device *dev) ...@@ -931,7 +928,7 @@ int intel_opregion_setup(struct drm_device *dev)
BUILD_BUG_ON(sizeof(struct opregion_asle) != 0x100); BUILD_BUG_ON(sizeof(struct opregion_asle) != 0x100);
BUILD_BUG_ON(sizeof(struct opregion_asle_ext) != 0x400); BUILD_BUG_ON(sizeof(struct opregion_asle_ext) != 0x400);
pci_read_config_dword(dev->pdev, ASLS, &asls); pci_read_config_dword(pdev, ASLS, &asls);
DRM_DEBUG_DRIVER("graphic opregion physical addr: 0x%x\n", asls); DRM_DEBUG_DRIVER("graphic opregion physical addr: 0x%x\n", asls);
if (asls == 0) { if (asls == 0) {
DRM_DEBUG_DRIVER("ACPI OpRegion not supported!\n"); DRM_DEBUG_DRIVER("ACPI OpRegion not supported!\n");
...@@ -963,7 +960,7 @@ int intel_opregion_setup(struct drm_device *dev) ...@@ -963,7 +960,7 @@ int intel_opregion_setup(struct drm_device *dev)
if (mboxes & MBOX_SWSCI) { if (mboxes & MBOX_SWSCI) {
DRM_DEBUG_DRIVER("SWSCI supported\n"); DRM_DEBUG_DRIVER("SWSCI supported\n");
opregion->swsci = base + OPREGION_SWSCI_OFFSET; opregion->swsci = base + OPREGION_SWSCI_OFFSET;
swsci_setup(dev); swsci_setup(dev_priv);
} }
if (mboxes & MBOX_ASLE) { if (mboxes & MBOX_ASLE) {
...@@ -1012,12 +1009,12 @@ int intel_opregion_setup(struct drm_device *dev) ...@@ -1012,12 +1009,12 @@ int intel_opregion_setup(struct drm_device *dev)
} }
int int
intel_opregion_get_panel_type(struct drm_device *dev) intel_opregion_get_panel_type(struct drm_i915_private *dev_priv)
{ {
u32 panel_details; u32 panel_details;
int ret; int ret;
ret = swsci(dev, SWSCI_GBDA_PANEL_DETAILS, 0x0, &panel_details); ret = swsci(dev_priv, SWSCI_GBDA_PANEL_DETAILS, 0x0, &panel_details);
if (ret) { if (ret) {
DRM_DEBUG_KMS("Failed to get panel details from OpRegion (%d)\n", DRM_DEBUG_KMS("Failed to get panel details from OpRegion (%d)\n",
ret); ret);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册