Re: [Intel-gfx] [PATCH v3 3/4] drm/connector: Split out orientation quirk detection

2019-07-01 Thread dbasehore .
On Mon, Jun 24, 2019 at 6:24 AM Ville Syrjälä
 wrote:
>
> On Fri, Jun 21, 2019 at 08:41:04PM -0700, Derek Basehore wrote:
> > Not every platform needs quirk detection for panel orientation, so
> > split the drm_connector_init_panel_orientation_property into two
> > functions. One for platforms without the need for quirks, and the
> > other for platforms that need quirks.
> >
> > Signed-off-by: Derek Basehore 
> > ---
> >  drivers/gpu/drm/drm_connector.c | 45 -
> >  drivers/gpu/drm/i915/intel_dp.c |  4 +--
> >  drivers/gpu/drm/i915/vlv_dsi.c  |  5 ++--
> >  include/drm/drm_connector.h |  2 ++
> >  4 files changed, 39 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_connector.c 
> > b/drivers/gpu/drm/drm_connector.c
> > index e17586aaa80f..c4b01adf927a 100644
> > --- a/drivers/gpu/drm/drm_connector.c
> > +++ b/drivers/gpu/drm/drm_connector.c
> > @@ -1894,31 +1894,23 @@ 
> > EXPORT_SYMBOL(drm_connector_set_vrr_capable_property);
> >   * drm_connector_init_panel_orientation_property -
> >   *   initialize the connecters panel_orientation property
> >   * @connector: connector for which to init the panel-orientation property.
> > - * @width: width in pixels of the panel, used for panel quirk detection
> > - * @height: height in pixels of the panel, used for panel quirk detection
> >   *
> >   * This function should only be called for built-in panels, after setting
> >   * connector->display_info.panel_orientation first (if known).
> >   *
> > - * This function will check for platform specific (e.g. DMI based) quirks
> > - * overriding display_info.panel_orientation first, then if 
> > panel_orientation
> > - * is not DRM_MODE_PANEL_ORIENTATION_UNKNOWN it will attach the
> > - * "panel orientation" property to the connector.
> > + * This function will check if the panel_orientation is not
> > + * DRM_MODE_PANEL_ORIENTATION_UNKNOWN. If not, it will attach the "panel
> > + * orientation" property to the connector.
> >   *
> >   * Returns:
> >   * Zero on success, negative errno on failure.
> >   */
> >  int drm_connector_init_panel_orientation_property(
> > - struct drm_connector *connector, int width, int height)
> > + struct drm_connector *connector)
> >  {
> >   struct drm_device *dev = connector->dev;
> >   struct drm_display_info *info = >display_info;
> >   struct drm_property *prop;
> > - int orientation_quirk;
> > -
> > - orientation_quirk = drm_get_panel_orientation_quirk(width, height);
> > - if (orientation_quirk != DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
> > - info->panel_orientation = orientation_quirk;
> >
> >   if (info->panel_orientation == DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
> >   return 0;
> > @@ -1941,6 +1933,35 @@ int drm_connector_init_panel_orientation_property(
> >  }
> >  EXPORT_SYMBOL(drm_connector_init_panel_orientation_property);
> >
> > +/**
> > + * drm_connector_init_panel_orientation_property_quirk -
> > + *   initialize the connecters panel_orientation property with a quirk
> > + *   override
> > + * @connector: connector for which to init the panel-orientation property.
> > + * @width: width in pixels of the panel, used for panel quirk detection
> > + * @height: height in pixels of the panel, used for panel quirk detection
> > + *
> > + * This function will check for platform specific (e.g. DMI based) quirks
> > + * overriding display_info.panel_orientation first, then if 
> > panel_orientation
> > + * is not DRM_MODE_PANEL_ORIENTATION_UNKNOWN it will attach the
> > + * "panel orientation" property to the connector.
> > + *
> > + * Returns:
> > + * Zero on success, negative errno on failure.
> > + */
> > +int drm_connector_init_panel_orientation_property_quirk(
> > + struct drm_connector *connector, int width, int height)
> > +{
> > + int orientation_quirk;
> > +
> > + orientation_quirk = drm_get_panel_orientation_quirk(width, height);
> > + if (orientation_quirk != DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
> > + connector->display_info.panel_orientation = orientation_quirk;
> > +
> > + return drm_connector_init_panel_orientation_property(connector);
> > +}
> > +EXPORT_SYMBOL(drm_connector_init_panel_orientation_property_quirk);
> > +
> >  int drm_connector_set_obj_prop(struct drm_mode_object *obj,
> >   struct drm_property *property,
> >   uint64_t value)
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c 
> > b/drivers/gpu/drm/i915/intel_dp.c
> > index b099a9dc28fd..7d4e61cf5463 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -7282,8 +7282,8 @@ static bool intel_edp_init_connector(struct intel_dp 
> > *intel_dp,
> >   intel_panel_setup_backlight(connector, pipe);
> >
> >   if (fixed_mode)
> > - drm_connector_init_panel_orientation_property(
> > - connector, fixed_mode->hdisplay, 
> > 

Re: [Intel-gfx] [PATCH v3 3/4] drm/connector: Split out orientation quirk detection

2019-06-24 Thread Ville Syrjälä
On Fri, Jun 21, 2019 at 08:41:04PM -0700, Derek Basehore wrote:
> Not every platform needs quirk detection for panel orientation, so
> split the drm_connector_init_panel_orientation_property into two
> functions. One for platforms without the need for quirks, and the
> other for platforms that need quirks.
> 
> Signed-off-by: Derek Basehore 
> ---
>  drivers/gpu/drm/drm_connector.c | 45 -
>  drivers/gpu/drm/i915/intel_dp.c |  4 +--
>  drivers/gpu/drm/i915/vlv_dsi.c  |  5 ++--
>  include/drm/drm_connector.h |  2 ++
>  4 files changed, 39 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index e17586aaa80f..c4b01adf927a 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -1894,31 +1894,23 @@ EXPORT_SYMBOL(drm_connector_set_vrr_capable_property);
>   * drm_connector_init_panel_orientation_property -
>   *   initialize the connecters panel_orientation property
>   * @connector: connector for which to init the panel-orientation property.
> - * @width: width in pixels of the panel, used for panel quirk detection
> - * @height: height in pixels of the panel, used for panel quirk detection
>   *
>   * This function should only be called for built-in panels, after setting
>   * connector->display_info.panel_orientation first (if known).
>   *
> - * This function will check for platform specific (e.g. DMI based) quirks
> - * overriding display_info.panel_orientation first, then if panel_orientation
> - * is not DRM_MODE_PANEL_ORIENTATION_UNKNOWN it will attach the
> - * "panel orientation" property to the connector.
> + * This function will check if the panel_orientation is not
> + * DRM_MODE_PANEL_ORIENTATION_UNKNOWN. If not, it will attach the "panel
> + * orientation" property to the connector.
>   *
>   * Returns:
>   * Zero on success, negative errno on failure.
>   */
>  int drm_connector_init_panel_orientation_property(
> - struct drm_connector *connector, int width, int height)
> + struct drm_connector *connector)
>  {
>   struct drm_device *dev = connector->dev;
>   struct drm_display_info *info = >display_info;
>   struct drm_property *prop;
> - int orientation_quirk;
> -
> - orientation_quirk = drm_get_panel_orientation_quirk(width, height);
> - if (orientation_quirk != DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
> - info->panel_orientation = orientation_quirk;
>  
>   if (info->panel_orientation == DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
>   return 0;
> @@ -1941,6 +1933,35 @@ int drm_connector_init_panel_orientation_property(
>  }
>  EXPORT_SYMBOL(drm_connector_init_panel_orientation_property);
>  
> +/**
> + * drm_connector_init_panel_orientation_property_quirk -
> + *   initialize the connecters panel_orientation property with a quirk
> + *   override
> + * @connector: connector for which to init the panel-orientation property.
> + * @width: width in pixels of the panel, used for panel quirk detection
> + * @height: height in pixels of the panel, used for panel quirk detection
> + *
> + * This function will check for platform specific (e.g. DMI based) quirks
> + * overriding display_info.panel_orientation first, then if panel_orientation
> + * is not DRM_MODE_PANEL_ORIENTATION_UNKNOWN it will attach the
> + * "panel orientation" property to the connector.
> + *
> + * Returns:
> + * Zero on success, negative errno on failure.
> + */
> +int drm_connector_init_panel_orientation_property_quirk(
> + struct drm_connector *connector, int width, int height)
> +{
> + int orientation_quirk;
> +
> + orientation_quirk = drm_get_panel_orientation_quirk(width, height);
> + if (orientation_quirk != DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
> + connector->display_info.panel_orientation = orientation_quirk;
> +
> + return drm_connector_init_panel_orientation_property(connector);
> +}
> +EXPORT_SYMBOL(drm_connector_init_panel_orientation_property_quirk);
> +
>  int drm_connector_set_obj_prop(struct drm_mode_object *obj,
>   struct drm_property *property,
>   uint64_t value)
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index b099a9dc28fd..7d4e61cf5463 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -7282,8 +7282,8 @@ static bool intel_edp_init_connector(struct intel_dp 
> *intel_dp,
>   intel_panel_setup_backlight(connector, pipe);
>  
>   if (fixed_mode)
> - drm_connector_init_panel_orientation_property(
> - connector, fixed_mode->hdisplay, fixed_mode->vdisplay);
> + drm_connector_init_panel_orientation_property_quirk(connector,
> + fixed_mode->hdisplay, fixed_mode->vdisplay);
>  
>   return true;
>  
> diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
> 

Re: [Intel-gfx] [PATCH v3 3/4] drm/connector: Split out orientation quirk detection

2019-06-23 Thread Hans de Goede

Hi,

On 22-06-19 05:41, Derek Basehore wrote:

Not every platform needs quirk detection for panel orientation, so
split the drm_connector_init_panel_orientation_property into two
functions. One for platforms without the need for quirks, and the
other for platforms that need quirks.

Signed-off-by: Derek Basehore 
---
  drivers/gpu/drm/drm_connector.c | 45 -
  drivers/gpu/drm/i915/intel_dp.c |  4 +--
  drivers/gpu/drm/i915/vlv_dsi.c  |  5 ++--
  include/drm/drm_connector.h |  2 ++
  4 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index e17586aaa80f..c4b01adf927a 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -1894,31 +1894,23 @@ EXPORT_SYMBOL(drm_connector_set_vrr_capable_property);
   * drm_connector_init_panel_orientation_property -
   *initialize the connecters panel_orientation property
   * @connector: connector for which to init the panel-orientation property.
- * @width: width in pixels of the panel, used for panel quirk detection
- * @height: height in pixels of the panel, used for panel quirk detection
   *
   * This function should only be called for built-in panels, after setting
   * connector->display_info.panel_orientation first (if known).
   *
- * This function will check for platform specific (e.g. DMI based) quirks
- * overriding display_info.panel_orientation first, then if panel_orientation
- * is not DRM_MODE_PANEL_ORIENTATION_UNKNOWN it will attach the
- * "panel orientation" property to the connector.
+ * This function will check if the panel_orientation is not
+ * DRM_MODE_PANEL_ORIENTATION_UNKNOWN. If not, it will attach the "panel
+ * orientation" property to the connector.
   *
   * Returns:
   * Zero on success, negative errno on failure.
   */
  int drm_connector_init_panel_orientation_property(
-   struct drm_connector *connector, int width, int height)
+   struct drm_connector *connector)
  {
struct drm_device *dev = connector->dev;
struct drm_display_info *info = >display_info;
struct drm_property *prop;
-   int orientation_quirk;
-
-   orientation_quirk = drm_get_panel_orientation_quirk(width, height);
-   if (orientation_quirk != DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
-   info->panel_orientation = orientation_quirk;
  
  	if (info->panel_orientation == DRM_MODE_PANEL_ORIENTATION_UNKNOWN)

return 0;
@@ -1941,6 +1933,35 @@ int drm_connector_init_panel_orientation_property(
  }
  EXPORT_SYMBOL(drm_connector_init_panel_orientation_property);
  
+/**

+ * drm_connector_init_panel_orientation_property_quirk -
+ * initialize the connecters panel_orientation property with a quirk
+ * override
+ * @connector: connector for which to init the panel-orientation property.
+ * @width: width in pixels of the panel, used for panel quirk detection
+ * @height: height in pixels of the panel, used for panel quirk detection
+ *
+ * This function will check for platform specific (e.g. DMI based) quirks
+ * overriding display_info.panel_orientation first, then if panel_orientation
+ * is not DRM_MODE_PANEL_ORIENTATION_UNKNOWN it will attach the
+ * "panel orientation" property to the connector.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_connector_init_panel_orientation_property_quirk(
+   struct drm_connector *connector, int width, int height)
+{
+   int orientation_quirk;
+
+   orientation_quirk = drm_get_panel_orientation_quirk(width, height);
+   if (orientation_quirk != DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
+   connector->display_info.panel_orientation = orientation_quirk;
+
+   return drm_connector_init_panel_orientation_property(connector);
+}
+EXPORT_SYMBOL(drm_connector_init_panel_orientation_property_quirk);
+
  int drm_connector_set_obj_prop(struct drm_mode_object *obj,
struct drm_property *property,
uint64_t value)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index b099a9dc28fd..7d4e61cf5463 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -7282,8 +7282,8 @@ static bool intel_edp_init_connector(struct intel_dp 
*intel_dp,
intel_panel_setup_backlight(connector, pipe);
  
  	if (fixed_mode)

-   drm_connector_init_panel_orientation_property(
-   connector, fixed_mode->hdisplay, fixed_mode->vdisplay);
+   drm_connector_init_panel_orientation_property_quirk(connector,
+   fixed_mode->hdisplay, fixed_mode->vdisplay);
  
  	return true;
  
diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c

index bfe2891eac37..fa9833dbe359 100644
--- a/drivers/gpu/drm/i915/vlv_dsi.c
+++ b/drivers/gpu/drm/i915/vlv_dsi.c
@@ -1650,6 +1650,7 @@ static void