[PATCH 02/10] drm: Extract drm_bridge.h

2016-09-02 Thread Archit Taneja


On 8/31/2016 9:39 PM, Daniel Vetter wrote:
> We don't want to burry the bridge structures kerneldoc in drm_crtc.h.
>
> Cc: Archit Taneja 

Reviewed-by: Archit Taneja 

> Signed-off-by: Daniel Vetter 
> ---
>   Documentation/gpu/drm-kms-helpers.rst |   7 ++
>   drivers/gpu/drm/drm_bridge.c  |   5 +-
>   include/drm/drm_bridge.h  | 218 
> ++
>   include/drm/drm_connector.h   |   4 +
>   include/drm/drm_crtc.h| 187 +
>   include/drm/drm_mode_object.h |   1 +
>   include/drm/drm_modes.h   |   4 +
>   7 files changed, 237 insertions(+), 189 deletions(-)
>   create mode 100644 include/drm/drm_bridge.h
>
> diff --git a/Documentation/gpu/drm-kms-helpers.rst 
> b/Documentation/gpu/drm-kms-helpers.rst
> index 59fa3c11efab..48fc5a96bf95 100644
> --- a/Documentation/gpu/drm-kms-helpers.rst
> +++ b/Documentation/gpu/drm-kms-helpers.rst
> @@ -126,6 +126,13 @@ Default bridge callback sequence
>   .. kernel-doc:: drivers/gpu/drm/drm_bridge.c
>  :doc: bridge callbacks
>
> +
> +Bridge Helper Reference
> +-
> +
> +.. kernel-doc:: include/drm/drm_bridge.h
> +   :internal:
> +
>   .. kernel-doc:: drivers/gpu/drm/drm_bridge.c
>  :export:
>
> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> index 484046664d6c..0ee052b7c21a 100644
> --- a/drivers/gpu/drm/drm_bridge.c
> +++ b/drivers/gpu/drm/drm_bridge.c
> @@ -23,10 +23,9 @@
>
>   #include 
>   #include 
> +#include 
>
> -#include 
> -
> -#include "drm/drmP.h"
> +#include 
>
>   /**
>* DOC: overview
> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> new file mode 100644
> index ..530a1d6e8cde
> --- /dev/null
> +++ b/include/drm/drm_bridge.h
> @@ -0,0 +1,218 @@
> +/*
> + * Copyright (c) 2016 Intel Corporation
> + *
> + * Permission to use, copy, modify, distribute, and sell this software and 
> its
> + * documentation for any purpose is hereby granted without fee, provided that
> + * the above copyright notice appear in all copies and that both that 
> copyright
> + * notice and this permission notice appear in supporting documentation, and
> + * that the name of the copyright holders not be used in advertising or
> + * publicity pertaining to distribution of the software without specific,
> + * written prior permission.  The copyright holders make no representations
> + * about the suitability of this software for any purpose.  It is provided 
> "as
> + * is" without express or implied warranty.
> + *
> + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS 
> SOFTWARE,
> + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
> + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
> + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 
> USE,
> + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
> + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 
> PERFORMANCE
> + * OF THIS SOFTWARE.
> + */
> +
> +#ifndef __DRM_BRIDGE_H__
> +#define __DRM_BRIDGE_H__
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +struct drm_bridge;
> +
> +/**
> + * struct drm_bridge_funcs - drm_bridge control functions
> + */
> +struct drm_bridge_funcs {
> + /**
> +  * @attach:
> +  *
> +  * This callback is invoked whenever our bridge is being attached to a
> +  * _encoder.
> +  *
> +  * The attach callback is optional.
> +  *
> +  * RETURNS:
> +  *
> +  * Zero on success, error code on failure.
> +  */
> + int (*attach)(struct drm_bridge *bridge);
> +
> + /**
> +  * @detach:
> +  *
> +  * This callback is invoked whenever our bridge is being detached from a
> +  * _encoder.
> +  *
> +  * The detach callback is optional.
> +  */
> + void (*detach)(struct drm_bridge *bridge);
> +
> + /**
> +  * @mode_fixup:
> +  *
> +  * This callback is used to validate and adjust a mode. The paramater
> +  * mode is the display mode that should be fed to the next element in
> +  * the display chain, either the final _connector or the next
> +  * _bridge. The parameter adjusted_mode is the input mode the bridge
> +  * requires. It can be modified by this callback and does not need to
> +  * match mode.
> +  *
> +  * This is the only hook that allows a bridge to reject a modeset. If
> +  * this function passes all other callbacks must succeed for this
> +  * configuration.
> +  *
> +  * The mode_fixup callback is optional.
> +  *
> +  * NOTE:
> +  *
> +  * This function is called in the check phase of atomic modesets, which
> +  * can be aborted for any reason (including on userspace's request to
> +  * just check whether a configuration would be possible). Drivers MUST
> +  * NOT touch any persistent state 

[PATCH 02/10] drm: Extract drm_bridge.h

2016-08-31 Thread Daniel Vetter
We don't want to burry the bridge structures kerneldoc in drm_crtc.h.

Cc: Archit Taneja 
Signed-off-by: Daniel Vetter 
---
 Documentation/gpu/drm-kms-helpers.rst |   7 ++
 drivers/gpu/drm/drm_bridge.c  |   5 +-
 include/drm/drm_bridge.h  | 218 ++
 include/drm/drm_connector.h   |   4 +
 include/drm/drm_crtc.h| 187 +
 include/drm/drm_mode_object.h |   1 +
 include/drm/drm_modes.h   |   4 +
 7 files changed, 237 insertions(+), 189 deletions(-)
 create mode 100644 include/drm/drm_bridge.h

diff --git a/Documentation/gpu/drm-kms-helpers.rst 
b/Documentation/gpu/drm-kms-helpers.rst
index 59fa3c11efab..48fc5a96bf95 100644
--- a/Documentation/gpu/drm-kms-helpers.rst
+++ b/Documentation/gpu/drm-kms-helpers.rst
@@ -126,6 +126,13 @@ Default bridge callback sequence
 .. kernel-doc:: drivers/gpu/drm/drm_bridge.c
:doc: bridge callbacks

+
+Bridge Helper Reference
+-
+
+.. kernel-doc:: include/drm/drm_bridge.h
+   :internal:
+
 .. kernel-doc:: drivers/gpu/drm/drm_bridge.c
:export:

diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 484046664d6c..0ee052b7c21a 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -23,10 +23,9 @@

 #include 
 #include 
+#include 

-#include 
-
-#include "drm/drmP.h"
+#include 

 /**
  * DOC: overview
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
new file mode 100644
index ..530a1d6e8cde
--- /dev/null
+++ b/include/drm/drm_bridge.h
@@ -0,0 +1,218 @@
+/*
+ * Copyright (c) 2016 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef __DRM_BRIDGE_H__
+#define __DRM_BRIDGE_H__
+
+#include 
+#include 
+#include 
+#include 
+
+struct drm_bridge;
+
+/**
+ * struct drm_bridge_funcs - drm_bridge control functions
+ */
+struct drm_bridge_funcs {
+   /**
+* @attach:
+*
+* This callback is invoked whenever our bridge is being attached to a
+* _encoder.
+*
+* The attach callback is optional.
+*
+* RETURNS:
+*
+* Zero on success, error code on failure.
+*/
+   int (*attach)(struct drm_bridge *bridge);
+
+   /**
+* @detach:
+*
+* This callback is invoked whenever our bridge is being detached from a
+* _encoder.
+*
+* The detach callback is optional.
+*/
+   void (*detach)(struct drm_bridge *bridge);
+
+   /**
+* @mode_fixup:
+*
+* This callback is used to validate and adjust a mode. The paramater
+* mode is the display mode that should be fed to the next element in
+* the display chain, either the final _connector or the next
+* _bridge. The parameter adjusted_mode is the input mode the bridge
+* requires. It can be modified by this callback and does not need to
+* match mode.
+*
+* This is the only hook that allows a bridge to reject a modeset. If
+* this function passes all other callbacks must succeed for this
+* configuration.
+*
+* The mode_fixup callback is optional.
+*
+* NOTE:
+*
+* This function is called in the check phase of atomic modesets, which
+* can be aborted for any reason (including on userspace's request to
+* just check whether a configuration would be possible). Drivers MUST
+* NOT touch any persistent state (hardware or software) or data
+* structures except the passed in @state parameter.
+*
+* RETURNS:
+*
+* True if an acceptable configuration is possible, false if the modeset
+* operation should be rejected.
+*/
+   bool