18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright (c)  2010 Intel Corporation
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
58c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
68c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation
78c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicensen
88c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
98c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the next
128c2ecf20Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
138c2ecf20Sopenharmony_ci * Software.
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
168c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
178c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
188c2ecf20Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
198c2ecf20Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
208c2ecf20Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
218c2ecf20Sopenharmony_ci * DEALINGS IN THE SOFTWARE.
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci * Authors:
248c2ecf20Sopenharmony_ci * Thomas Eaton <thomas.g.eaton@intel.com>
258c2ecf20Sopenharmony_ci * Scott Rowe <scott.m.rowe@intel.com>
268c2ecf20Sopenharmony_ci*/
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#include "mdfld_output.h"
298c2ecf20Sopenharmony_ci#include "mdfld_dsi_dpi.h"
308c2ecf20Sopenharmony_ci#include "mdfld_dsi_output.h"
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#include "tc35876x-dsi-lvds.h"
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciint mdfld_get_panel_type(struct drm_device *dev, int pipe)
358c2ecf20Sopenharmony_ci{
368c2ecf20Sopenharmony_ci	struct drm_psb_private *dev_priv = dev->dev_private;
378c2ecf20Sopenharmony_ci	return dev_priv->mdfld_panel_id;
388c2ecf20Sopenharmony_ci}
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_cistatic void mdfld_init_panel(struct drm_device *dev, int mipi_pipe,
418c2ecf20Sopenharmony_ci								int p_type)
428c2ecf20Sopenharmony_ci{
438c2ecf20Sopenharmony_ci	switch (p_type) {
448c2ecf20Sopenharmony_ci	case TPO_VID:
458c2ecf20Sopenharmony_ci		mdfld_dsi_output_init(dev, mipi_pipe, &mdfld_tpo_vid_funcs);
468c2ecf20Sopenharmony_ci		break;
478c2ecf20Sopenharmony_ci	case TC35876X:
488c2ecf20Sopenharmony_ci		tc35876x_init(dev);
498c2ecf20Sopenharmony_ci		mdfld_dsi_output_init(dev, mipi_pipe, &mdfld_tc35876x_funcs);
508c2ecf20Sopenharmony_ci		break;
518c2ecf20Sopenharmony_ci	case TMD_VID:
528c2ecf20Sopenharmony_ci		mdfld_dsi_output_init(dev, mipi_pipe, &mdfld_tmd_vid_funcs);
538c2ecf20Sopenharmony_ci		break;
548c2ecf20Sopenharmony_ci	case HDMI:
558c2ecf20Sopenharmony_ci/*		if (dev_priv->mdfld_hdmi_present)
568c2ecf20Sopenharmony_ci			mdfld_hdmi_init(dev, &dev_priv->mode_dev); */
578c2ecf20Sopenharmony_ci		break;
588c2ecf20Sopenharmony_ci	}
598c2ecf20Sopenharmony_ci}
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ciint mdfld_output_init(struct drm_device *dev)
638c2ecf20Sopenharmony_ci{
648c2ecf20Sopenharmony_ci	struct drm_psb_private *dev_priv = dev->dev_private;
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci	/* FIXME: hardcoded for now */
678c2ecf20Sopenharmony_ci	dev_priv->mdfld_panel_id = TC35876X;
688c2ecf20Sopenharmony_ci	/* MIPI panel 1 */
698c2ecf20Sopenharmony_ci	mdfld_init_panel(dev, 0, dev_priv->mdfld_panel_id);
708c2ecf20Sopenharmony_ci	/* HDMI panel */
718c2ecf20Sopenharmony_ci	mdfld_init_panel(dev, 1, HDMI);
728c2ecf20Sopenharmony_ci	return 0;
738c2ecf20Sopenharmony_ci}
748c2ecf20Sopenharmony_ci
75