From patchwork Wed Dec 10 23:42:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 5473001 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3F0B39F443 for ; Wed, 10 Dec 2014 23:41:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A2CF201B9 for ; Wed, 10 Dec 2014 23:41:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D4E752016C for ; Wed, 10 Dec 2014 23:41:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758412AbaLJXlh (ORCPT ); Wed, 10 Dec 2014 18:41:37 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:42190 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758301AbaLJXlh (ORCPT ); Wed, 10 Dec 2014 18:41:37 -0500 Received: from avalon.ideasonboard.com (85-76-134-213-nat.elisa-mobile.fi [85.76.134.213]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id AC6EE20BD4; Thu, 11 Dec 2014 00:38:27 +0100 (CET) From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Cc: linux-sh@vger.kernel.org Subject: [PATCH 04/15] drm: rcar-du: Remove LVDS and HDMI encoders chaining restriction Date: Thu, 11 Dec 2014 01:42:04 +0200 Message-Id: <1418254935-13536-5-git-send-email-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 2.0.4 In-Reply-To: <1418254935-13536-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> References: <1418254935-13536-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The rcar-du driver refuses connecting an LVDS output to an HDMI encoder. There is not technical reason for that restriction, remove it. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 7 ------- drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c index 7c74ecf2ca67..243aba8d4dd2 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c @@ -190,13 +190,6 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu, } if (type == RCAR_DU_ENCODER_HDMI) { - if (renc->lvds) { - dev_err(rcdu->dev, - "Chaining LVDS and HDMI encoders not supported\n"); - ret = -EINVAL; - goto done; - } - ret = rcar_du_hdmienc_init(rcdu, renc, enc_node); if (ret < 0) goto done; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c index 359bc999a9c8..0d774a937e79 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c @@ -21,6 +21,7 @@ #include "rcar_du_drv.h" #include "rcar_du_encoder.h" #include "rcar_du_hdmienc.h" +#include "rcar_du_lvdsenc.h" struct rcar_du_hdmienc { struct rcar_du_encoder *renc; @@ -39,9 +40,15 @@ static void rcar_du_hdmienc_dpms(struct drm_encoder *encoder, int mode) if (hdmienc->dpms == mode) return; + if (mode == DRM_MODE_DPMS_ON && hdmienc->renc->lvds) + rcar_du_lvdsenc_dpms(hdmienc->renc->lvds, encoder->crtc, mode); + if (sfuncs->dpms) sfuncs->dpms(encoder, mode); + if (mode != DRM_MODE_DPMS_ON && hdmienc->renc->lvds) + rcar_du_lvdsenc_dpms(hdmienc->renc->lvds, encoder->crtc, mode); + hdmienc->dpms = mode; } @@ -49,8 +56,16 @@ static bool rcar_du_hdmienc_mode_fixup(struct drm_encoder *encoder, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { + struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder); struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder); + /* The internal LVDS encoder has a clock frequency operating range of + * 30MHz to 150MHz. Clamp the clock accordingly. + */ + if (hdmienc->renc->lvds) + adjusted_mode->clock = clamp(adjusted_mode->clock, + 30000, 150000); + if (sfuncs->mode_fixup == NULL) return true;