Merge branch 'drm-next-3.15-wip' of git://people.freedesktop.org/~deathsimple/linux...
authorDave Airlie <airlied@gmail.com>
Sat, 19 Apr 2014 01:16:02 +0000 (11:16 +1000)
committerDave Airlie <airlied@gmail.com>
Sat, 19 Apr 2014 01:16:02 +0000 (11:16 +1000)
Some i2c fixes over DisplayPort.

* 'drm-next-3.15-wip' of git://people.freedesktop.org/~deathsimple/linux:
  drm/radeon: Improve vramlimit module param documentation
  drm/radeon: fix audio pin counts for DCE6+ (v2)
  drm/radeon/dp: switch to the common i2c over aux code
  drm/dp/i2c: Update comments about common i2c over dp assumptions (v3)
  drm/dp/i2c: send bare addresses to properly reset i2c connections (v4)
  drm/radeon/dp: handle zero sized i2c over aux transactions (v2)
  drm/i915: support address only i2c-over-aux transactions
  drm/tegra: dp: Support address-only I2C-over-AUX transactions

1  2 
drivers/gpu/drm/radeon/radeon.h
drivers/gpu/drm/radeon/radeon_display.c
drivers/gpu/drm/radeon/radeon_drv.c

@@@ -739,7 -739,7 +739,7 @@@ union radeon_irq_stat_regs 
        struct cik_irq_stat_regs cik;
  };
  
- #define RADEON_MAX_HPD_PINS 6
+ #define RADEON_MAX_HPD_PINS 7
  #define RADEON_MAX_CRTCS 6
  #define RADEON_MAX_AFMT_BLOCKS 7
  
@@@ -2321,7 -2321,6 +2321,7 @@@ struct radeon_device 
        bool have_disp_power_ref;
  };
  
 +bool radeon_is_px(struct drm_device *dev);
  int radeon_device_init(struct radeon_device *rdev,
                       struct drm_device *ddev,
                       struct pci_dev *pdev,
@@@ -2632,6 -2631,9 +2632,9 @@@ void r100_pll_errata_after_index(struc
  #define ASIC_IS_DCE64(rdev) ((rdev->family == CHIP_OLAND))
  #define ASIC_IS_NODCE(rdev) ((rdev->family == CHIP_HAINAN))
  #define ASIC_IS_DCE8(rdev) ((rdev->family >= CHIP_BONAIRE))
+ #define ASIC_IS_DCE81(rdev) ((rdev->family == CHIP_KAVERI))
+ #define ASIC_IS_DCE82(rdev) ((rdev->family == CHIP_BONAIRE))
+ #define ASIC_IS_DCE83(rdev) ((rdev->family == CHIP_KABINI))
  
  #define ASIC_IS_LOMBOK(rdev) ((rdev->ddev->pdev->device == 0x6849) || \
                              (rdev->ddev->pdev->device == 0x6850) || \
@@@ -759,19 -759,18 +759,18 @@@ int radeon_ddc_get_modes(struct radeon_
  
        if (radeon_connector_encoder_get_dp_bridge_encoder_id(&radeon_connector->base) !=
            ENCODER_OBJECT_ID_NONE) {
-               struct radeon_connector_atom_dig *dig = radeon_connector->con_priv;
-               if (dig->dp_i2c_bus)
+               if (radeon_connector->ddc_bus->has_aux)
                        radeon_connector->edid = drm_get_edid(&radeon_connector->base,
-                                                             &dig->dp_i2c_bus->adapter);
+                                                             &radeon_connector->ddc_bus->aux.ddc);
        } else if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) ||
                   (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) {
                struct radeon_connector_atom_dig *dig = radeon_connector->con_priv;
  
                if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT ||
-                    dig->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) && dig->dp_i2c_bus)
+                    dig->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) &&
+                   radeon_connector->ddc_bus->has_aux)
                        radeon_connector->edid = drm_get_edid(&radeon_connector->base,
-                                                             &dig->dp_i2c_bus->adapter);
+                                                             &radeon_connector->ddc_bus->aux.ddc);
                else if (radeon_connector->ddc_bus && !radeon_connector->edid)
                        radeon_connector->edid = drm_get_edid(&radeon_connector->base,
                                                              &radeon_connector->ddc_bus->adapter);
@@@ -865,7 -864,7 +864,7 @@@ void radeon_compute_pll_avivo(struct ra
        unsigned post_div_min, post_div_max, post_div;
        unsigned ref_div_min, ref_div_max, ref_div;
        unsigned post_div_best, diff_best;
 -      unsigned nom, den, tmp;
 +      unsigned nom, den;
  
        /* determine allowed feedback divider range */
        fb_div_min = pll->min_feedback_div;
        }
        post_div = post_div_best;
  
 +      /* limit reference * post divider to a maximum */
 +      ref_div_max = min(210 / post_div, ref_div_max);
 +
        /* get matching reference and feedback divider */
 -      ref_div = max(den / post_div, 1u);
 -      fb_div = nom;
 +      ref_div = max(DIV_ROUND_CLOSEST(den, post_div), 1u);
 +      fb_div = DIV_ROUND_CLOSEST(nom * ref_div * post_div, den);
  
        /* we're almost done, but reference and feedback
           divider might be to large now */
  
 -      tmp = ref_div;
 +      nom = fb_div;
 +      den = ref_div;
  
          if (fb_div > fb_div_max) {
 -              ref_div = ref_div * fb_div_max / fb_div;
 +              ref_div = DIV_ROUND_CLOSEST(den * fb_div_max, nom);
                fb_div = fb_div_max;
        }
  
        if (ref_div > ref_div_max) {
                ref_div = ref_div_max;
 -              fb_div = nom * ref_div_max / tmp;
 +              fb_div = DIV_ROUND_CLOSEST(nom * ref_div_max, den);
        }
  
        /* reduce the numbers to a simpler ratio once more */
@@@ -115,7 -115,6 +115,7 @@@ extern int radeon_get_crtc_scanoutpos(s
                                      unsigned int flags,
                                      int *vpos, int *hpos, ktime_t *stime,
                                      ktime_t *etime);
 +extern bool radeon_is_px(struct drm_device *dev);
  extern const struct drm_ioctl_desc radeon_ioctls_kms[];
  extern int radeon_max_kms_ioctl;
  int radeon_mmap(struct file *filp, struct vm_area_struct *vma);
@@@ -145,9 -144,11 +145,9 @@@ void radeon_debugfs_cleanup(struct drm_
  #if defined(CONFIG_VGA_SWITCHEROO)
  void radeon_register_atpx_handler(void);
  void radeon_unregister_atpx_handler(void);
 -bool radeon_is_px(void);
  #else
  static inline void radeon_register_atpx_handler(void) {}
  static inline void radeon_unregister_atpx_handler(void) {}
 -static inline bool radeon_is_px(void) { return false; }
  #endif
  
  int radeon_no_wb;
@@@ -185,7 -186,7 +185,7 @@@ module_param_named(dynclks, radeon_dync
  MODULE_PARM_DESC(r4xx_atom, "Enable ATOMBIOS modesetting for R4xx");
  module_param_named(r4xx_atom, radeon_r4xx_atom, int, 0444);
  
- MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing");
+ MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
  module_param_named(vramlimit, radeon_vram_limit, int, 0600);
  
  MODULE_PARM_DESC(agpmode, "AGP Mode (-1 == PCI)");
@@@ -404,7 -405,12 +404,7 @@@ static int radeon_pmops_runtime_suspend
        struct drm_device *drm_dev = pci_get_drvdata(pdev);
        int ret;
  
 -      if (radeon_runtime_pm == 0) {
 -              pm_runtime_forbid(dev);
 -              return -EBUSY;
 -      }
 -
 -      if (radeon_runtime_pm == -1 && !radeon_is_px()) {
 +      if (!radeon_is_px(drm_dev)) {
                pm_runtime_forbid(dev);
                return -EBUSY;
        }
@@@ -428,7 -434,10 +428,7 @@@ static int radeon_pmops_runtime_resume(
        struct drm_device *drm_dev = pci_get_drvdata(pdev);
        int ret;
  
 -      if (radeon_runtime_pm == 0)
 -              return -EINVAL;
 -
 -      if (radeon_runtime_pm == -1 && !radeon_is_px())
 +      if (!radeon_is_px(drm_dev))
                return -EINVAL;
  
        drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
@@@ -453,7 -462,14 +453,7 @@@ static int radeon_pmops_runtime_idle(st
        struct drm_device *drm_dev = pci_get_drvdata(pdev);
        struct drm_crtc *crtc;
  
 -      if (radeon_runtime_pm == 0) {
 -              pm_runtime_forbid(dev);
 -              return -EBUSY;
 -      }
 -
 -      /* are we PX enabled? */
 -      if (radeon_runtime_pm == -1 && !radeon_is_px()) {
 -              DRM_DEBUG_DRIVER("failing to power off - not px\n");
 +      if (!radeon_is_px(drm_dev)) {
                pm_runtime_forbid(dev);
                return -EBUSY;
        }