* [PATCH] drm/i915: remove confusing GPIO vs PCH_GPIO @ 2018-07-06 4:58 Lucas De Marchi 2018-07-06 5:31 ` ✗ Fi.CI.BAT: failure for " Patchwork 2018-07-06 8:24 ` [PATCH] " Jani Nikula 0 siblings, 2 replies; 3+ messages in thread From: Lucas De Marchi @ 2018-07-06 4:58 UTC (permalink / raw) To: intel-gfx; +Cc: Rodrigo Vivi Instead of defining all registers twice, define just a PCH_GPIO_BASE that has the same address as PCH_GPIO_A and use that to calculate all the others. This also brings VLV and !HAS_GMCH_DISPLAY in line, doing the same thing. Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> --- As discussed on https://patchwork.freedesktop.org/patch/225388/. drivers/gpu/drm/i915/gvt/handlers.c | 2 +- drivers/gpu/drm/i915/i915_reg.h | 37 +++++++++++++++-------------- drivers/gpu/drm/i915/intel_i2c.c | 15 ++++++------ 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c index e39492aaff6c..e25a74fe753b 100644 --- a/drivers/gpu/drm/i915/gvt/handlers.c +++ b/drivers/gpu/drm/i915/gvt/handlers.c @@ -2084,7 +2084,7 @@ static int init_generic_mmio_info(struct intel_gvt *gvt) MMIO_F(PCH_GMBUS0, 4 * 4, 0, 0, 0, D_ALL, gmbus_mmio_read, gmbus_mmio_write); - MMIO_F(PCH_GPIOA, 6 * 4, F_UNALIGN, 0, 0, D_ALL, NULL, NULL); + MMIO_F(_MMIO(PCH_GPIO_BASE), 6 * 4, F_UNALIGN, 0, 0, D_ALL, NULL, NULL); MMIO_F(_MMIO(0xe4f00), 0x28, 0, 0, 0, D_ALL, NULL, NULL); MMIO_F(_MMIO(_PCH_DPB_AUX_CH_CTL), 6 * 4, 0, 0, 0, D_PRE_SKL, NULL, diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index dc953ee7e3b3..11503ed60832 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -3045,18 +3045,6 @@ enum i915_power_well_id { /* * GPIO regs */ -#define GPIOA _MMIO(0x5010) -#define GPIOB _MMIO(0x5014) -#define GPIOC _MMIO(0x5018) -#define GPIOD _MMIO(0x501c) -#define GPIOE _MMIO(0x5020) -#define GPIOF _MMIO(0x5024) -#define GPIOG _MMIO(0x5028) -#define GPIOH _MMIO(0x502c) -#define GPIOJ _MMIO(0x5034) -#define GPIOK _MMIO(0x5038) -#define GPIOL _MMIO(0x503C) -#define GPIOM _MMIO(0x5040) # define GPIO_CLOCK_DIR_MASK (1 << 0) # define GPIO_CLOCK_DIR_IN (0 << 1) # define GPIO_CLOCK_DIR_OUT (1 << 1) @@ -7625,12 +7613,25 @@ enum { #define ICP_TC_HPD_LONG_DETECT(tc_port) (2 << (tc_port) * 4) #define ICP_TC_HPD_SHORT_DETECT(tc_port) (1 << (tc_port) * 4) -#define PCH_GPIOA _MMIO(0xc5010) -#define PCH_GPIOB _MMIO(0xc5014) -#define PCH_GPIOC _MMIO(0xc5018) -#define PCH_GPIOD _MMIO(0xc501c) -#define PCH_GPIOE _MMIO(0xc5020) -#define PCH_GPIOF _MMIO(0xc5024) +#define GPIO_OFFSET 0x5010u +#define PCH_GPIO_BASE (0xc0000u + GPIO_OFFSET) +#define VLV_GPIO_BASE (VLV_DISPLAY_BASE + GPIO_OFFSET) + +enum i915_gpio { + GPIOA = 0, + GPIOB, + GPIOC, + GPIOD, + GPIOE, + GPIOF, + GPIOG, + GPIOH, + __GPIOI_UNUSED, + GPIOJ, + GPIOK, + GPIOL, + GPIOM, +}; #define PCH_GMBUS0 _MMIO(0xc5100) #define PCH_GMBUS1 _MMIO(0xc5104) diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index 97606c1be70d..bb1040275d4b 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c @@ -37,7 +37,7 @@ struct gmbus_pin { const char *name; - i915_reg_t reg; + enum i915_gpio gpio; }; /* Map gmbus pin pairs to names and registers. */ @@ -121,8 +121,7 @@ bool intel_gmbus_is_valid_pin(struct drm_i915_private *dev_priv, else size = ARRAY_SIZE(gmbus_pins); - return pin < size && - i915_mmio_reg_valid(get_gmbus_pin(dev_priv, pin)->reg); + return pin < size && get_gmbus_pin(dev_priv, pin)->name; } /* Intel GPIO access functions */ @@ -293,7 +292,7 @@ intel_gpio_setup(struct intel_gmbus *bus, unsigned int pin) algo = &bus->bit_algo; bus->gpio_reg = _MMIO(dev_priv->gpio_mmio_base + - i915_mmio_reg_offset(get_gmbus_pin(dev_priv, pin)->reg)); + 4 * get_gmbus_pin(dev_priv, pin)->gpio); bus->adapter.algo_data = algo; algo->setsda = set_data; algo->setscl = set_clock; @@ -775,11 +774,11 @@ int intel_setup_gmbus(struct drm_i915_private *dev_priv) return 0; if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) - dev_priv->gpio_mmio_base = VLV_DISPLAY_BASE; + dev_priv->gpio_mmio_base = VLV_GPIO_BASE; else if (!HAS_GMCH_DISPLAY(dev_priv)) - dev_priv->gpio_mmio_base = - i915_mmio_reg_offset(PCH_GPIOA) - - i915_mmio_reg_offset(GPIOA); + dev_priv->gpio_mmio_base = PCH_GPIO_BASE; + else + dev_priv->gpio_mmio_base = GPIO_OFFSET; mutex_init(&dev_priv->gmbus_mutex); init_waitqueue_head(&dev_priv->gmbus_wait_queue); -- 2.17.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 3+ messages in thread
* ✗ Fi.CI.BAT: failure for drm/i915: remove confusing GPIO vs PCH_GPIO 2018-07-06 4:58 [PATCH] drm/i915: remove confusing GPIO vs PCH_GPIO Lucas De Marchi @ 2018-07-06 5:31 ` Patchwork 2018-07-06 8:24 ` [PATCH] " Jani Nikula 1 sibling, 0 replies; 3+ messages in thread From: Patchwork @ 2018-07-06 5:31 UTC (permalink / raw) To: Lucas De Marchi; +Cc: intel-gfx == Series Details == Series: drm/i915: remove confusing GPIO vs PCH_GPIO URL : https://patchwork.freedesktop.org/series/46049/ State : failure == Summary == = CI Bug Log - changes from CI_DRM_4440 -> Patchwork_9559 = == Summary - FAILURE == Serious unknown changes coming with Patchwork_9559 absolutely need to be verified manually. If you think the reported changes have nothing to do with the changes introduced in Patchwork_9559, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI. External URL: https://patchwork.freedesktop.org/api/1.0/series/46049/revisions/1/mbox/ == Possible new issues == Here are the unknown changes that may have been introduced in Patchwork_9559: === IGT changes === ==== Possible regressions ==== igt@drv_module_reload@basic-no-display: fi-glk-j4005: PASS -> DMESG-WARN +2 igt@drv_module_reload@basic-reload: fi-bxt-dsi: PASS -> DMESG-WARN +2 fi-glk-dsi: PASS -> DMESG-WARN +2 igt@drv_module_reload@basic-reload-inject: fi-bxt-j4205: PASS -> DMESG-WARN +2 igt@kms_chamelium@common-hpd-after-suspend: fi-skl-6700k2: PASS -> DMESG-WARN +1 igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b: fi-elk-e7500: PASS -> DMESG-WARN == Known issues == Here are the changes found in Patchwork_9559 that come from known issues: === IGT changes === ==== Issues hit ==== igt@gem_exec_suspend@basic-s4-devices: fi-kbl-7500u: PASS -> DMESG-WARN (fdo#105128) igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b: fi-snb-2520m: PASS -> INCOMPLETE (fdo#103713) fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713 fdo#105128 https://bugs.freedesktop.org/show_bug.cgi?id=105128 == Participating hosts (47 -> 42) == Missing (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u == Build changes == * Linux: CI_DRM_4440 -> Patchwork_9559 CI_DRM_4440: 62d9530fc4a1966c8403db01459cd247804ea6fc @ git://anongit.freedesktop.org/gfx-ci/linux IGT_4539: 8b3cc74c6911e9b2835fe6e160f84bae463a70ef @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools Patchwork_9559: abdf6ee7a8588507d02e805b78c69ba6bd15a5a4 @ git://anongit.freedesktop.org/gfx-ci/linux == Linux commits == abdf6ee7a858 drm/i915: remove confusing GPIO vs PCH_GPIO == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9559/issues.html _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/i915: remove confusing GPIO vs PCH_GPIO 2018-07-06 4:58 [PATCH] drm/i915: remove confusing GPIO vs PCH_GPIO Lucas De Marchi 2018-07-06 5:31 ` ✗ Fi.CI.BAT: failure for " Patchwork @ 2018-07-06 8:24 ` Jani Nikula 1 sibling, 0 replies; 3+ messages in thread From: Jani Nikula @ 2018-07-06 8:24 UTC (permalink / raw) To: Lucas De Marchi, intel-gfx; +Cc: Rodrigo Vivi On Thu, 05 Jul 2018, Lucas De Marchi <lucas.demarchi@intel.com> wrote: > Instead of defining all registers twice, define just a PCH_GPIO_BASE > that has the same address as PCH_GPIO_A and use that to calculate all > the others. This also brings VLV and !HAS_GMCH_DISPLAY in line, doing > the same thing. > > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> > --- > > As discussed on https://patchwork.freedesktop.org/patch/225388/. > > drivers/gpu/drm/i915/gvt/handlers.c | 2 +- > drivers/gpu/drm/i915/i915_reg.h | 37 +++++++++++++++-------------- > drivers/gpu/drm/i915/intel_i2c.c | 15 ++++++------ > 3 files changed, 27 insertions(+), 27 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c > index e39492aaff6c..e25a74fe753b 100644 > --- a/drivers/gpu/drm/i915/gvt/handlers.c > +++ b/drivers/gpu/drm/i915/gvt/handlers.c > @@ -2084,7 +2084,7 @@ static int init_generic_mmio_info(struct intel_gvt *gvt) > > MMIO_F(PCH_GMBUS0, 4 * 4, 0, 0, 0, D_ALL, gmbus_mmio_read, > gmbus_mmio_write); > - MMIO_F(PCH_GPIOA, 6 * 4, F_UNALIGN, 0, 0, D_ALL, NULL, NULL); > + MMIO_F(_MMIO(PCH_GPIO_BASE), 6 * 4, F_UNALIGN, 0, 0, D_ALL, NULL, NULL); > MMIO_F(_MMIO(0xe4f00), 0x28, 0, 0, 0, D_ALL, NULL, NULL); > > MMIO_F(_MMIO(_PCH_DPB_AUX_CH_CTL), 6 * 4, 0, 0, 0, D_PRE_SKL, NULL, > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h > index dc953ee7e3b3..11503ed60832 100644 > --- a/drivers/gpu/drm/i915/i915_reg.h > +++ b/drivers/gpu/drm/i915/i915_reg.h > @@ -3045,18 +3045,6 @@ enum i915_power_well_id { > /* > * GPIO regs > */ > -#define GPIOA _MMIO(0x5010) > -#define GPIOB _MMIO(0x5014) > -#define GPIOC _MMIO(0x5018) > -#define GPIOD _MMIO(0x501c) > -#define GPIOE _MMIO(0x5020) > -#define GPIOF _MMIO(0x5024) > -#define GPIOG _MMIO(0x5028) > -#define GPIOH _MMIO(0x502c) > -#define GPIOJ _MMIO(0x5034) > -#define GPIOK _MMIO(0x5038) > -#define GPIOL _MMIO(0x503C) > -#define GPIOM _MMIO(0x5040) > # define GPIO_CLOCK_DIR_MASK (1 << 0) > # define GPIO_CLOCK_DIR_IN (0 << 1) > # define GPIO_CLOCK_DIR_OUT (1 << 1) > @@ -7625,12 +7613,25 @@ enum { > #define ICP_TC_HPD_LONG_DETECT(tc_port) (2 << (tc_port) * 4) > #define ICP_TC_HPD_SHORT_DETECT(tc_port) (1 << (tc_port) * 4) > > -#define PCH_GPIOA _MMIO(0xc5010) > -#define PCH_GPIOB _MMIO(0xc5014) > -#define PCH_GPIOC _MMIO(0xc5018) > -#define PCH_GPIOD _MMIO(0xc501c) > -#define PCH_GPIOE _MMIO(0xc5020) > -#define PCH_GPIOF _MMIO(0xc5024) > +#define GPIO_OFFSET 0x5010u > +#define PCH_GPIO_BASE (0xc0000u + GPIO_OFFSET) > +#define VLV_GPIO_BASE (VLV_DISPLAY_BASE + GPIO_OFFSET) > + > +enum i915_gpio { > + GPIOA = 0, > + GPIOB, > + GPIOC, > + GPIOD, > + GPIOE, > + GPIOF, > + GPIOG, > + GPIOH, > + __GPIOI_UNUSED, > + GPIOJ, > + GPIOK, > + GPIOL, > + GPIOM, > +}; Is this the right place for the enum? The file is about registers, i915_gpio becomes a GPIO identifier not unline pipe, transcoder, or port. Please add a macro to access the registers, indexed using i915_gpio, in terms of dev_priv->gpio_mmio_base. Something like: #define GPIO(gpio) _MMIO(dev_priv->gpio_mmio_base + GPIO_OFFSET + 4 * (gpio)) Please use that in code instead of spreading register offset arithmetics outside of this file. Please note that there are other registers that use gpio_mmio_base defined in this file, and they will be broken by the change of adding GPIO_OFFSET directly into gpio_mmio_base! I don't care which way you do it, but take it into account. Overall I like the idea. BR, Jani. > > #define PCH_GMBUS0 _MMIO(0xc5100) > #define PCH_GMBUS1 _MMIO(0xc5104) > diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c > index 97606c1be70d..bb1040275d4b 100644 > --- a/drivers/gpu/drm/i915/intel_i2c.c > +++ b/drivers/gpu/drm/i915/intel_i2c.c > @@ -37,7 +37,7 @@ > > struct gmbus_pin { > const char *name; > - i915_reg_t reg; > + enum i915_gpio gpio; > }; > > /* Map gmbus pin pairs to names and registers. */ > @@ -121,8 +121,7 @@ bool intel_gmbus_is_valid_pin(struct drm_i915_private *dev_priv, > else > size = ARRAY_SIZE(gmbus_pins); > > - return pin < size && > - i915_mmio_reg_valid(get_gmbus_pin(dev_priv, pin)->reg); > + return pin < size && get_gmbus_pin(dev_priv, pin)->name; > } > > /* Intel GPIO access functions */ > @@ -293,7 +292,7 @@ intel_gpio_setup(struct intel_gmbus *bus, unsigned int pin) > algo = &bus->bit_algo; > > bus->gpio_reg = _MMIO(dev_priv->gpio_mmio_base + > - i915_mmio_reg_offset(get_gmbus_pin(dev_priv, pin)->reg)); > + 4 * get_gmbus_pin(dev_priv, pin)->gpio); > bus->adapter.algo_data = algo; > algo->setsda = set_data; > algo->setscl = set_clock; > @@ -775,11 +774,11 @@ int intel_setup_gmbus(struct drm_i915_private *dev_priv) > return 0; > > if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) > - dev_priv->gpio_mmio_base = VLV_DISPLAY_BASE; > + dev_priv->gpio_mmio_base = VLV_GPIO_BASE; > else if (!HAS_GMCH_DISPLAY(dev_priv)) > - dev_priv->gpio_mmio_base = > - i915_mmio_reg_offset(PCH_GPIOA) - > - i915_mmio_reg_offset(GPIOA); > + dev_priv->gpio_mmio_base = PCH_GPIO_BASE; > + else > + dev_priv->gpio_mmio_base = GPIO_OFFSET; > > mutex_init(&dev_priv->gmbus_mutex); > init_waitqueue_head(&dev_priv->gmbus_wait_queue); -- Jani Nikula, Intel Open Source Graphics Center _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-06 8:24 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-07-06 4:58 [PATCH] drm/i915: remove confusing GPIO vs PCH_GPIO Lucas De Marchi 2018-07-06 5:31 ` ✗ Fi.CI.BAT: failure for " Patchwork 2018-07-06 8:24 ` [PATCH] " Jani Nikula
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).