@@ -45,7 +45,8 @@ i915-y += intel_bios.o \
intel_modes.o \
intel_overlay.o \
intel_sideband.o \
- intel_sprite.o
+ intel_sprite.o \
+ intel_clrmgr.o
i915-$(CONFIG_ACPI) += intel_acpi.o intel_opregion.o
i915-$(CONFIG_DRM_I915_FBDEV) += intel_fbdev.o
new file mode 100644
@@ -0,0 +1,79 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * ======
+ * Shashank Sharma <shashank.sharma@intel.com>
+ * Uma Shankar <uma.shankar@intel.com>
+ * Shobhit Kumar <shobhit.kumar@intel.com>
+ * Sonika Jindal <sonika.jindal@intel.com>
+ */
+
+#include "i915_drm.h"
+#include "i915_drv.h"
+#include "i915_reg.h"
+#include "intel_clrmgr.h"
+
+struct clrmgr_status *intel_clrmgr_init(struct drm_device *dev)
+{
+ struct clrmgr_status *status;
+
+ /* Todo: extend this framework for other gen devices also */
+ if (!IS_VALLEYVIEW(dev)) {
+ DRM_ERROR("Color manager is supported for VLV for now\n");
+ return NULL;
+ }
+
+ /* Allocate and attach color status tracker */
+ status = kzalloc(sizeof(struct clrmgr_status), GFP_KERNEL);
+ if (!status) {
+ DRM_ERROR("Out of memory, cant init color manager\n");
+ return NULL;
+ }
+ DRM_DEBUG_DRIVER("\n");
+ return status;
+}
+
+void intel_clrmgr_exit(struct drm_device *dev, struct clrmgr_status *status)
+{
+ u32 count = 0;
+ struct clrmgr_regd_prop *cp;
+
+ if (!status)
+ return;
+
+ /* First free the DRM property, then status */
+ while (count < status->no_of_properties) {
+ cp = status->cp[count++];
+
+ /* Destroy DRM property */
+ drm_property_destroy(dev, cp->property);
+
+ /* Release the color property */
+ kfree(status->cp[count]);
+ status->cp[count] = NULL;
+ }
+
+ /* Now free the status itself */
+ kfree(status);
+ DRM_DEBUG_DRIVER("\n");
+}
new file mode 100644
@@ -0,0 +1,83 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * =====
+ * Shashank Sharma <shashank.sharma@intel.com>
+ * Uma Shankar <uma.shankar@intel.com>
+ * Shobhit Kumar <shobhit.kumar@intel.com>
+ * Sonika Jindal <sonika.jindal@intel.com>
+ */
+
+#ifndef _I915_CLR_MNGR_H_
+#define _I915_CLR_MNGR_H_
+
+#include "drmP.h"
+#include "intel_drv.h"
+#include <linux/errno.h>
+
+/* Framework defs */
+#define CLRMGR_PROP_MAX 10
+
+/*
+* clrmgr_regd_propery structure
+* This structure encapsulates drm_property, and some
+* additional values which are required during the runtime
+* after registration, to set a value.
+*/
+struct clrmgr_regd_prop {
+ bool enabled;
+ struct drm_property *property;
+ /*
+ * A void * is first arg, so that the same function ptr can be used
+ * for both crtc_property and plane_property
+ */
+ bool (*set_property)(void *,
+ struct clrmgr_regd_prop *prop, u64 *data);
+};
+
+/* Status of color properties on pipe at any time */
+struct clrmgr_status {
+ u32 no_of_properties;
+ struct clrmgr_regd_prop *cp[CLRMGR_PROP_MAX];
+};
+
+
+/*
+* intel_clrmgr_init:
+* Allocate memory to save color correction
+* properties for that CRTC.
+* input: struct drm_device
+*/
+struct clrmgr_status *intel_clrmgr_init(struct drm_device *dev);
+
+/*
+* intel_clrmgr_exit
+* Free allocated memory for color status
+* Should be called from CRTC/Plane .destroy function
+* input:
+* - drm_device *
+* - status : color status on that CRTC/Plane
+*/
+void intel_clrmgr_exit(struct drm_device *dev, struct clrmgr_status *status);
+
+#endif