Commit f4448375 authored by Daniel Vetter's avatar Daniel Vetter Committed by Jani Nikula

drm/i915/gen9: Use dev_priv in csr functions

As all csr firmware related opertion are not using any
any data structures of drm framework level, so better to
use dev_priv instead of dev. it's a new style! :)

Cc: Damien Lespiau <damien.lespiau@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Sunil Kamath <sunil.kamath@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Signed-off-by: default avatarAnimesh Manna <animesh.manna@intel.com>
Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
Tested-by: Daniel Stone <daniels@collabora.com> # SKL
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1446069547-24760-9-git-send-email-imre.deak@intel.com
parent bffbcd93
...@@ -426,7 +426,7 @@ static int i915_load_modeset_init(struct drm_device *dev) ...@@ -426,7 +426,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
intel_power_domains_init_hw(dev_priv); intel_power_domains_init_hw(dev_priv);
intel_csr_ucode_init(dev); intel_csr_ucode_init(dev_priv);
ret = intel_irq_install(dev_priv); ret = intel_irq_install(dev_priv);
if (ret) if (ret)
...@@ -1145,7 +1145,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -1145,7 +1145,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
out_gtt: out_gtt:
i915_global_gtt_cleanup(dev); i915_global_gtt_cleanup(dev);
out_freecsr: out_freecsr:
intel_csr_ucode_fini(dev); intel_csr_ucode_fini(dev_priv);
intel_uncore_fini(dev); intel_uncore_fini(dev);
pci_iounmap(dev->pdev, dev_priv->regs); pci_iounmap(dev->pdev, dev_priv->regs);
put_bridge: put_bridge:
...@@ -1228,7 +1228,7 @@ int i915_driver_unload(struct drm_device *dev) ...@@ -1228,7 +1228,7 @@ int i915_driver_unload(struct drm_device *dev)
intel_fbc_cleanup_cfb(dev_priv); intel_fbc_cleanup_cfb(dev_priv);
i915_gem_cleanup_stolen(dev); i915_gem_cleanup_stolen(dev);
intel_csr_ucode_fini(dev); intel_csr_ucode_fini(dev_priv);
intel_teardown_gmbus(dev); intel_teardown_gmbus(dev);
intel_teardown_mchbar(dev); intel_teardown_mchbar(dev);
......
...@@ -1118,13 +1118,11 @@ static int bxt_resume_prepare(struct drm_i915_private *dev_priv) ...@@ -1118,13 +1118,11 @@ static int bxt_resume_prepare(struct drm_i915_private *dev_priv)
static int skl_resume_prepare(struct drm_i915_private *dev_priv) static int skl_resume_prepare(struct drm_i915_private *dev_priv)
{ {
struct drm_device *dev = dev_priv->dev;
if (dev_priv->csr.dmc_payload) if (dev_priv->csr.dmc_payload)
skl_disable_dc6(dev_priv); skl_disable_dc6(dev_priv);
skl_init_cdclk(dev_priv); skl_init_cdclk(dev_priv);
intel_csr_load_program(dev); intel_csr_load_program(dev_priv);
return 0; return 0;
} }
......
...@@ -200,19 +200,18 @@ static const struct stepping_info *intel_get_stepping_info(struct drm_device *de ...@@ -200,19 +200,18 @@ static const struct stepping_info *intel_get_stepping_info(struct drm_device *de
/** /**
* intel_csr_load_program() - write the firmware from memory to register. * intel_csr_load_program() - write the firmware from memory to register.
* @dev: drm device. * @dev_priv: i915 drm device.
* *
* CSR firmware is read from a .bin file and kept in internal memory one time. * CSR firmware is read from a .bin file and kept in internal memory one time.
* Everytime display comes back from low power state this function is called to * Everytime display comes back from low power state this function is called to
* copy the firmware from internal memory to registers. * copy the firmware from internal memory to registers.
*/ */
void intel_csr_load_program(struct drm_device *dev) void intel_csr_load_program(struct drm_i915_private *dev_priv)
{ {
struct drm_i915_private *dev_priv = dev->dev_private;
u32 *payload = dev_priv->csr.dmc_payload; u32 *payload = dev_priv->csr.dmc_payload;
uint32_t i, fw_size; uint32_t i, fw_size;
if (!IS_GEN9(dev)) { if (!IS_GEN9(dev_priv)) {
DRM_ERROR("No CSR support available for this platform\n"); DRM_ERROR("No CSR support available for this platform\n");
return; return;
} }
...@@ -362,7 +361,7 @@ static void finish_csr_load(const struct firmware *fw, void *context) ...@@ -362,7 +361,7 @@ static void finish_csr_load(const struct firmware *fw, void *context)
memcpy(dmc_payload, &fw->data[readcount], nbytes); memcpy(dmc_payload, &fw->data[readcount], nbytes);
/* load csr program during system boot, as needed for DC states */ /* load csr program during system boot, as needed for DC states */
intel_csr_load_program(dev); intel_csr_load_program(dev_priv);
fw_loaded = true; fw_loaded = true;
out: out:
...@@ -382,21 +381,20 @@ static void finish_csr_load(const struct firmware *fw, void *context) ...@@ -382,21 +381,20 @@ static void finish_csr_load(const struct firmware *fw, void *context)
/** /**
* intel_csr_ucode_init() - initialize the firmware loading. * intel_csr_ucode_init() - initialize the firmware loading.
* @dev: drm device. * @dev_priv: i915 drm device.
* *
* This function is called at the time of loading the display driver to read * This function is called at the time of loading the display driver to read
* firmware from a .bin file and copied into a internal memory. * firmware from a .bin file and copied into a internal memory.
*/ */
void intel_csr_ucode_init(struct drm_device *dev) void intel_csr_ucode_init(struct drm_i915_private *dev_priv)
{ {
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_csr *csr = &dev_priv->csr; struct intel_csr *csr = &dev_priv->csr;
int ret; int ret;
if (!HAS_CSR(dev)) if (!HAS_CSR(dev_priv))
return; return;
if (IS_SKYLAKE(dev)) if (IS_SKYLAKE(dev_priv))
csr->fw_path = I915_CSR_SKL; csr->fw_path = I915_CSR_SKL;
else if (IS_BROXTON(dev_priv)) else if (IS_BROXTON(dev_priv))
csr->fw_path = I915_CSR_BXT; csr->fw_path = I915_CSR_BXT;
...@@ -426,16 +424,14 @@ void intel_csr_ucode_init(struct drm_device *dev) ...@@ -426,16 +424,14 @@ void intel_csr_ucode_init(struct drm_device *dev)
/** /**
* intel_csr_ucode_fini() - unload the CSR firmware. * intel_csr_ucode_fini() - unload the CSR firmware.
* @dev: drm device. * @dev_priv: i915 drm device.
* *
* Firmmware unloading includes freeing the internal momory and reset the * Firmmware unloading includes freeing the internal momory and reset the
* firmware loading status. * firmware loading status.
*/ */
void intel_csr_ucode_fini(struct drm_device *dev) void intel_csr_ucode_fini(struct drm_i915_private *dev_priv)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; if (!HAS_CSR(dev_priv))
if (!HAS_CSR(dev))
return; return;
kfree(dev_priv->csr.dmc_payload); kfree(dev_priv->csr.dmc_payload);
......
...@@ -1220,9 +1220,9 @@ u32 skl_plane_ctl_tiling(uint64_t fb_modifier); ...@@ -1220,9 +1220,9 @@ u32 skl_plane_ctl_tiling(uint64_t fb_modifier);
u32 skl_plane_ctl_rotation(unsigned int rotation); u32 skl_plane_ctl_rotation(unsigned int rotation);
/* intel_csr.c */ /* intel_csr.c */
void intel_csr_ucode_init(struct drm_device *dev); void intel_csr_ucode_init(struct drm_i915_private *);
void intel_csr_load_program(struct drm_device *dev); void intel_csr_load_program(struct drm_i915_private *);
void intel_csr_ucode_fini(struct drm_device *dev); void intel_csr_ucode_fini(struct drm_i915_private *);
/* intel_dp.c */ /* intel_dp.c */
void intel_dp_init(struct drm_device *dev, int output_reg, enum port port); void intel_dp_init(struct drm_device *dev, int output_reg, enum port port);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment