Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp664435ybh; Sat, 3 Aug 2019 07:15:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyiDc24N0uIBdHYrLDVb0wpX9QsOJxs0UvU6w/WiY1Qq8EJLMkZnUu5Cllu779JgH2g885S X-Received: by 2002:a17:90a:346c:: with SMTP id o99mr9230421pjb.20.1564841739210; Sat, 03 Aug 2019 07:15:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564841739; cv=none; d=google.com; s=arc-20160816; b=nbXQwpuNumaCeySq0Jj1g+3UPtwtZXeaLd5wBxWBj9jQ9+1+lkh5uWzv4cKBvQe2UA s0hunJ6i8c2sOYSRrhQ3aWKwLwkO80pz5Iy3eNxD3wlfXhLAHPF3hQM3IU5jq14IA+Oj G2S9AxpkEz14427Phxsp+Y7LGXtYWDaF/ReI7c4wWpVWmAdcOWknEGzlAvQPEAI1dqMh TLiy1/V+jnqQH0PYfSm4CiOMjPmVC7jKO61r1Bb2dOYpDwcXjyKk6qH8lgDL7csfncRC w5HAnQmmhlabWCmK3RCXgwSJ4vKmZNEDUkS34XZOMygjsKlMi0KbYv4XrMv7Eqypej2X YpHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=N8rgZWIZfOw81q7QuM18Tttp0ZdrCfm1/QUNIZC/5bM=; b=UJdSTqeSxTNestclty4Axbzzj+Qhre4nWw+MV8jPerC36FHc77KSQQ0v2jNV1/Sf/8 RZiImgobAFUa47KQt7JddySL2q/XN/WkLe0ITjreWn7UgM9IsZbD0MnQsRtXBPLjo12Z 4HnnaVdNGVp0HxmQ0DHK5romuIaAqbQII2/F5fb6Kbmp7X0OVLice0WOaak/t/leAd9N 0BDhg7hlcLhpY2AFOkaQXMya1oGpCcY5AauGyXceogd4fphNLV1P92fxBrdV59Zx/AjM Mx4nAdE4D8Apt8pEDmISFAJ7yrvbhGO2BPpbMGcj7YXiq7ZHqUoGhdUvPPzHdDS7Yach V/iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=KqUvXDck; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1si8979408pjp.80.2019.08.03.07.15.24; Sat, 03 Aug 2019 07:15:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=KqUvXDck; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404307AbfHBOsC (ORCPT + 99 others); Fri, 2 Aug 2019 10:48:02 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:1740 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731919AbfHBOsC (ORCPT ); Fri, 2 Aug 2019 10:48:02 -0400 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x72EaJNq005392; Fri, 2 Aug 2019 16:47:50 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=STMicroelectronics; bh=N8rgZWIZfOw81q7QuM18Tttp0ZdrCfm1/QUNIZC/5bM=; b=KqUvXDckPZyMTnjcTF4guAysii2fBpfThquE/WOr+K6iec9ZCasTAjCaVoHBc694o/nA IocwSQWQ9NiMwq5QF2oY40wO4jJZ7mbzbLYAWz/44U3O1kyYXaYCRfMWN/+Gnmyhqq3h koYoCPpSZSAcBPN1XfGoiyVTdRSW3RczZnlNDgfimraWV9IbHNMpWHyQ32ETRf7TjLOz Nv011AIcA7qb3HtK6DQ5Dni+YbVRPbP93ZxJsI+XBR/bhohdv0MpgMB5hQVAIKNWFGDT Icw0ZbXBFx2Vh4HxzOnXGWvBS9k1cMl8n4lpWWsZLtx0nZq2v20lut9fEJfjyGBPoTE+ 6A== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2u3vd07vqr-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 02 Aug 2019 16:47:50 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id EA83231; Fri, 2 Aug 2019 14:47:49 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas22.st.com [10.75.90.92]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id D68092C54E2; Fri, 2 Aug 2019 16:47:49 +0200 (CEST) Received: from SAFEX1HUBCAS23.st.com (10.75.90.47) by Safex1hubcas22.st.com (10.75.90.92) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 2 Aug 2019 16:47:49 +0200 Received: from localhost (10.201.23.97) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 2 Aug 2019 16:47:49 +0200 From: =?UTF-8?q?Yannick=20Fertr=C3=A9?= To: Maxime Coquelin , Alexandre Torgue , Rob Herring , Mark Rutland , , , , , Benjamin Gaignard , Yannick Fertre , Philippe Cornu , Fabrice Gasnier Subject: [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode Date: Fri, 2 Aug 2019 16:47:42 +0200 Message-ID: <1564757262-6166-1-git-send-email-yannick.fertre@st.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.201.23.97] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-02_06:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The implementation of functions encoder_enable and encoder_disable make possible to control the pinctrl according to the encoder type. The pinctrl must be activated only if the encoder type is DPI. This helps to move the DPI-related pinctrl configuration from all the panel or bridge to the LTDC dt node. Signed-off-by: Yannick Fertré --- drivers/gpu/drm/stm/ltdc.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 3ab4fbf..1c4fde0 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -1040,6 +1041,36 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = { .destroy = drm_encoder_cleanup, }; +static void ltdc_encoder_disable(struct drm_encoder *encoder) +{ + struct drm_device *ddev = encoder->dev; + + DRM_DEBUG_DRIVER("\n"); + + /* Set to sleep state the pinctrl whatever type of encoder */ + pinctrl_pm_select_sleep_state(ddev->dev); +} + +static void ltdc_encoder_enable(struct drm_encoder *encoder) +{ + struct drm_device *ddev = encoder->dev; + + DRM_DEBUG_DRIVER("\n"); + + /* + * Set to default state the pinctrl only with DPI type. + * Others types like DSI, don't need pinctrl due to + * internal bridge (the signals do not come out of the chipset). + */ + if (encoder->encoder_type == DRM_MODE_ENCODER_DPI) + pinctrl_pm_select_default_state(ddev->dev); +} + +static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = { + .disable = ltdc_encoder_disable, + .enable = ltdc_encoder_enable, +}; + static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge) { struct drm_encoder *encoder; @@ -1055,6 +1086,8 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge) drm_encoder_init(ddev, encoder, <dc_encoder_funcs, DRM_MODE_ENCODER_DPI, NULL); + drm_encoder_helper_add(encoder, <dc_encoder_helper_funcs); + ret = drm_bridge_attach(encoder, bridge, NULL); if (ret) { drm_encoder_cleanup(encoder); @@ -1280,6 +1313,8 @@ int ltdc_load(struct drm_device *ddev) clk_disable_unprepare(ldev->pixel_clk); + pinctrl_pm_select_sleep_state(ddev->dev); + pm_runtime_enable(ddev->dev); return 0; -- 2.7.4