LCOV - code coverage report
Current view: top level - dev/pci/drm/i915 - intel_modes.c (source / functions) Hit Total Coverage
Test: 6.4 Lines: 0 42 0.0 %
Date: 2018-10-19 03:25:38 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2007 Dave Airlie <airlied@linux.ie>
       3             :  * Copyright (c) 2007, 2010 Intel Corporation
       4             :  *   Jesse Barnes <jesse.barnes@intel.com>
       5             :  *
       6             :  * Permission is hereby granted, free of charge, to any person obtaining a
       7             :  * copy of this software and associated documentation files (the "Software"),
       8             :  * to deal in the Software without restriction, including without limitation
       9             :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      10             :  * and/or sell copies of the Software, and to permit persons to whom the
      11             :  * Software is furnished to do so, subject to the following conditions:
      12             :  *
      13             :  * The above copyright notice and this permission notice (including the next
      14             :  * paragraph) shall be included in all copies or substantial portions of the
      15             :  * Software.
      16             :  *
      17             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      18             :  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      19             :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
      20             :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      21             :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      22             :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      23             :  * DEALINGS IN THE SOFTWARE.
      24             :  */
      25             : 
      26             : #ifdef __linux__
      27             : #include <linux/slab.h>
      28             : #include <linux/i2c.h>
      29             : #include <linux/fb.h>
      30             : #endif
      31             : #include <dev/pci/drm/drm_edid.h>
      32             : #include <dev/pci/drm/drmP.h>
      33             : #include "intel_drv.h"
      34             : #include "i915_drv.h"
      35             : 
      36             : /**
      37             :  * intel_connector_update_modes - update connector from edid
      38             :  * @connector: DRM connector device to use
      39             :  * @edid: previously read EDID information
      40             :  */
      41           0 : int intel_connector_update_modes(struct drm_connector *connector,
      42             :                                 struct edid *edid)
      43             : {
      44             :         int ret;
      45             : 
      46           0 :         drm_mode_connector_update_edid_property(connector, edid);
      47           0 :         ret = drm_add_edid_modes(connector, edid);
      48           0 :         drm_edid_to_eld(connector, edid);
      49             : 
      50           0 :         return ret;
      51             : }
      52             : 
      53             : /**
      54             :  * intel_ddc_get_modes - get modelist from monitor
      55             :  * @connector: DRM connector device to use
      56             :  * @adapter: i2c adapter
      57             :  *
      58             :  * Fetch the EDID information from @connector using the DDC bus.
      59             :  */
      60           0 : int intel_ddc_get_modes(struct drm_connector *connector,
      61             :                         struct i2c_adapter *adapter)
      62             : {
      63             :         struct edid *edid;
      64             :         int ret;
      65             : 
      66           0 :         edid = drm_get_edid(connector, adapter);
      67           0 :         if (!edid)
      68           0 :                 return 0;
      69             : 
      70           0 :         ret = intel_connector_update_modes(connector, edid);
      71           0 :         kfree(edid);
      72             : 
      73           0 :         return ret;
      74           0 : }
      75             : 
      76             : static const struct drm_prop_enum_list force_audio_names[] = {
      77             :         { HDMI_AUDIO_OFF_DVI, "force-dvi" },
      78             :         { HDMI_AUDIO_OFF, "off" },
      79             :         { HDMI_AUDIO_AUTO, "auto" },
      80             :         { HDMI_AUDIO_ON, "on" },
      81             : };
      82             : 
      83             : void
      84           0 : intel_attach_force_audio_property(struct drm_connector *connector)
      85             : {
      86           0 :         struct drm_device *dev = connector->dev;
      87           0 :         struct drm_i915_private *dev_priv = dev->dev_private;
      88             :         struct drm_property *prop;
      89             : 
      90           0 :         prop = dev_priv->force_audio_property;
      91           0 :         if (prop == NULL) {
      92           0 :                 prop = drm_property_create_enum(dev, 0,
      93             :                                            "audio",
      94             :                                            force_audio_names,
      95             :                                            ARRAY_SIZE(force_audio_names));
      96           0 :                 if (prop == NULL)
      97           0 :                         return;
      98             : 
      99           0 :                 dev_priv->force_audio_property = prop;
     100           0 :         }
     101           0 :         drm_object_attach_property(&connector->base, prop, 0);
     102           0 : }
     103             : 
     104             : static const struct drm_prop_enum_list broadcast_rgb_names[] = {
     105             :         { INTEL_BROADCAST_RGB_AUTO, "Automatic" },
     106             :         { INTEL_BROADCAST_RGB_FULL, "Full" },
     107             :         { INTEL_BROADCAST_RGB_LIMITED, "Limited 16:235" },
     108             : };
     109             : 
     110             : void
     111           0 : intel_attach_broadcast_rgb_property(struct drm_connector *connector)
     112             : {
     113           0 :         struct drm_device *dev = connector->dev;
     114           0 :         struct drm_i915_private *dev_priv = dev->dev_private;
     115             :         struct drm_property *prop;
     116             : 
     117           0 :         prop = dev_priv->broadcast_rgb_property;
     118           0 :         if (prop == NULL) {
     119           0 :                 prop = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM,
     120             :                                            "Broadcast RGB",
     121             :                                            broadcast_rgb_names,
     122             :                                            ARRAY_SIZE(broadcast_rgb_names));
     123           0 :                 if (prop == NULL)
     124           0 :                         return;
     125             : 
     126           0 :                 dev_priv->broadcast_rgb_property = prop;
     127           0 :         }
     128             : 
     129           0 :         drm_object_attach_property(&connector->base, prop, 0);
     130           0 : }
     131             : 
     132             : void
     133           0 : intel_attach_aspect_ratio_property(struct drm_connector *connector)
     134             : {
     135           0 :         if (!drm_mode_create_aspect_ratio_property(connector->dev))
     136           0 :                 drm_object_attach_property(&connector->base,
     137           0 :                         connector->dev->mode_config.aspect_ratio_property,
     138             :                         DRM_MODE_PICTURE_ASPECT_NONE);
     139           0 : }

Generated by: LCOV version 1.13