1450N/A/*
1450N/A * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
1450N/A */
1450N/A
1450N/A/*
1450N/A * Copyright (c) 2007 Dave Airlie <airlied@linux.ie>
1450N/A * Copyright (c) 2007, 2013, Intel Corporation
1450N/A * Jesse Barnes <jesse.barnes@intel.com>
1450N/A *
1450N/A * Permission is hereby granted, free of charge, to any person obtaining a
1450N/A * copy of this software and associated documentation files (the "Software"),
1450N/A * to deal in the Software without restriction, including without limitation
1450N/A * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1450N/A * and/or sell copies of the Software, and to permit persons to whom the
1450N/A * Software is furnished to do so, subject to the following conditions:
1450N/A *
1450N/A * The above copyright notice and this permission notice (including the next
1450N/A * paragraph) shall be included in all copies or substantial portions of the
1450N/A * Software.
1450N/A *
1450N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1450N/A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1450N/A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1450N/A * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1450N/A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1450N/A * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1450N/A * DEALINGS IN THE SOFTWARE.
1450N/A */
1450N/A
1450N/A#include "drmP.h"
1450N/A#include "intel_drv.h"
1450N/A#include "i915_drv.h"
1450N/A/* OSOL_i915 Begin */
1450N/A#include "drm_sun_i2c.h"
1450N/A#include "drm_edid.h"
1450N/A/* OSOL_i915 End */
1450N/A
1450N/A/**
1450N/A * intel_connector_update_modes - update connector from edid
1450N/A * @connector: DRM connector device to use
1450N/A * @edid: previously read EDID information
1450N/A */
1450N/Aint intel_connector_update_modes(struct drm_connector *connector,
1450N/A struct edid *edid)
1450N/A{
1450N/A int ret;
1450N/A
1450N/A drm_mode_connector_update_edid_property(connector, edid);
1450N/A ret = drm_add_edid_modes(connector, edid);
1450N/A drm_edid_to_eld(connector, edid);
1450N/A
1450N/A return ret;
1450N/A}
1450N/A
1450N/A/**
1450N/A * intel_ddc_get_modes - get modelist from monitor
1450N/A * @connector: DRM connector device to use
1450N/A * @adapter: i2c adapter
1450N/A *
1450N/A * Fetch the EDID information from @connector using the DDC bus.
1450N/A */
1450N/Aint intel_ddc_get_modes(struct drm_connector *connector,
1450N/A struct i2c_adapter *adapter)
1450N/A{
1450N/A struct edid *edid;
1450N/A int ret;
1450N/A
1450N/A edid = drm_get_edid(connector, adapter);
1450N/A if (!edid)
1450N/A return 0;
1450N/A
1450N/A ret = intel_connector_update_modes(connector, edid);
1450N/A kfree(edid, (EDID_LENGTH * (DRM_MAX_EDID_EXT_NUM + 1)));
1450N/A return ret;
1450N/A}
1450N/A
1450N/Astatic const struct drm_prop_enum_list force_audio_names[] = {
1450N/A { HDMI_AUDIO_OFF_DVI, "force-dvi" },
1450N/A { HDMI_AUDIO_OFF, "off" },
1450N/A { HDMI_AUDIO_AUTO, "auto" },
1450N/A { HDMI_AUDIO_ON, "on" },
1450N/A};
1450N/A
1450N/Avoid
1450N/Aintel_attach_force_audio_property(struct drm_connector *connector)
1450N/A{
1450N/A struct drm_device *dev = connector->dev;
1450N/A struct drm_i915_private *dev_priv = dev->dev_private;
1450N/A struct drm_property *prop;
1450N/A
1450N/A prop = dev_priv->force_audio_property;
1450N/A if (prop == NULL) {
1450N/A prop = drm_property_create_enum(dev, 0,
1450N/A "audio",
1450N/A force_audio_names,
1450N/A ARRAY_SIZE(force_audio_names));
1450N/A if (prop == NULL)
1450N/A return;
1450N/A
1450N/A dev_priv->force_audio_property = prop;
1450N/A }
1450N/A drm_object_attach_property(&connector->base, prop, 0);
1450N/A}
1450N/A
1450N/Astatic const struct drm_prop_enum_list broadcast_rgb_names[] = {
1450N/A { INTEL_BROADCAST_RGB_AUTO, "Automatic" },
1450N/A { INTEL_BROADCAST_RGB_FULL, "Full" },
1450N/A { INTEL_BROADCAST_RGB_LIMITED, "Limited 16:235" },
1450N/A};
1450N/A
1450N/Avoid
1450N/Aintel_attach_broadcast_rgb_property(struct drm_connector *connector)
1450N/A{
1450N/A struct drm_device *dev = connector->dev;
1450N/A struct drm_i915_private *dev_priv = dev->dev_private;
1450N/A struct drm_property *prop;
1450N/A
1450N/A prop = dev_priv->broadcast_rgb_property;
1450N/A if (prop == NULL) {
1450N/A prop = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM,
1450N/A "Broadcast RGB",
1450N/A broadcast_rgb_names,
1450N/A ARRAY_SIZE(broadcast_rgb_names));
1450N/A if (prop == NULL)
1450N/A return;
1450N/A
1450N/A dev_priv->broadcast_rgb_property = prop;
1450N/A }
1450N/A
1450N/A drm_object_attach_property(&connector->base, prop, 0);
1450N/A}