From patchwork Wed Feb 27 16:24:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 10832649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C58321575 for ; Thu, 28 Feb 2019 08:29:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2CE52D516 for ; Thu, 28 Feb 2019 08:29:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4F982D55E; Thu, 28 Feb 2019 08:29:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 46FE12D516 for ; Thu, 28 Feb 2019 08:29:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E0BC36E152; Thu, 28 Feb 2019 08:28:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 428 seconds by postgrey-1.36 at gabe; Wed, 27 Feb 2019 16:31:28 UTC Received: from esa4.microchip.iphmx.com (esa4.microchip.iphmx.com [68.232.154.123]) by gabe.freedesktop.org (Postfix) with ESMTPS id 233C36E0EB for ; Wed, 27 Feb 2019 16:31:28 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.58,420,1544511600"; d="scan'208";a="26973634" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 Feb 2019 09:24:18 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.105) with Microsoft SMTP Server (TLS) id 14.3.352.0; Wed, 27 Feb 2019 09:24:18 -0700 Received: from MWHPR11MB1549.namprd11.prod.outlook.com (10.172.54.17) by MWHPR11MB1806.namprd11.prod.outlook.com (10.175.53.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.21; Wed, 27 Feb 2019 16:24:16 +0000 Received: from MWHPR11MB1549.namprd11.prod.outlook.com ([fe80::54fe:95ed:b0cf:55a6]) by MWHPR11MB1549.namprd11.prod.outlook.com ([fe80::54fe:95ed:b0cf:55a6%8]) with mapi id 15.20.1643.022; Wed, 27 Feb 2019 16:24:16 +0000 From: To: , , , , , , , , , Subject: [PATCH 1/7] drm: atmel-hlcdc: add config option for clock selection Thread-Topic: [PATCH 1/7] drm: atmel-hlcdc: add config option for clock selection Thread-Index: AQHUzrjibzNyakqaO0avPILToqBAJA== Date: Wed, 27 Feb 2019 16:24:16 +0000 Message-ID: <1551284609-14594-2-git-send-email-claudiu.beznea@microchip.com> References: <1551284609-14594-1-git-send-email-claudiu.beznea@microchip.com> In-Reply-To: <1551284609-14594-1-git-send-email-claudiu.beznea@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR08CA0112.eurprd08.prod.outlook.com (2603:10a6:800:d4::14) To MWHPR11MB1549.namprd11.prod.outlook.com (2603:10b6:301:c::17) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 88d2e4a2-3f73-41a9-4abf-08d69cd00495 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:MWHPR11MB1806; x-ms-traffictypediagnostic: MWHPR11MB1806: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; MWHPR11MB1806; 23:05GuIb1lOsGC3wtmuLRFctvyX4T+X2IgpkovrRL?= =?iso-8859-1?q?x1GaA5Wq7F3c0pn?= =?iso-8859-1?q?iKZ9TkM4K8Hvub/wkjPm+1GdeS8+DyG9uguis6GcYy4WiQqtjhSSzWmPDb4J?= =?iso-8859-1?q?VHE+bZVRtGNNkkKg9t/iC3ytkStSk66ThWegZfX10FJWIwA3fw+e5hlnG8RD?= =?iso-8859-1?q?ryJMapQW6Orz4xM9hi+IjZkus/tZ+rnlAMwihE3TL4Z2pUDMLMDs9oNIff6l?= =?iso-8859-1?q?kRLgeOg9awpm0PoVhVaW+6EMt5UK9zr4nNgFGcUADBIl7fO7uoD84XyqH3HX?= =?iso-8859-1?q?hRNMEZnuMRrPNHaJAeyK9NNhUabIKWdGkefCgAVox9glwxjupNeVin0IUmrQ?= =?iso-8859-1?q?753BQ4bFJT4a/B6HaULK5aWxBa1zzM44SSVntiHwvLfX79XF5AEKpPPG7hKQ?= =?iso-8859-1?q?Fdq3SmIkDqyxtCIE7A+Op4qffWmn3T8x3gAuJA2KZJIxVxOVEKjysPVJZkMd?= =?iso-8859-1?q?AQbItDfOvfpe40piMNUDnDSlMTn21mPv3YRz0cZ7Bp5JBetMGouqFkCVSY7V?= =?iso-8859-1?q?QhOVY6BfRtincgGpduRxXkz4WMGQotXU97HqtTAQ4Qf5Cr4d69pTGU56Q1gw?= =?iso-8859-1?q?vSHmWzdOGNnuwowuEzvEsou25e0K/771fvIhMq87mWUzBJ5dmbe2AcmQXw9z?= =?iso-8859-1?q?PAFpq1jjdf/mscrSmuK9BsSX56xObVFhXZFm51pR1OHe4U67C2SQv5uhzR9T?= =?iso-8859-1?q?hyohp7ZsfSadVp+XTuj0U0IOsYu18fP+CDbSV5A1WcsAXmsqc+jfL/HtoIse?= =?iso-8859-1?q?V4chMU5+o3LqkuCAmljr/nMs717IXhABbbcs6+rLQzkHDHNjzK3cPCop96wQ?= =?iso-8859-1?q?mZpwXXYWYRtIoSq/ZmrgSIkvriY/buYFRudKW9iR5SvKCq48WPd09MqESkZc?= =?iso-8859-1?q?SnONwLVhUvZ8qdMOCmv2lMlX4uTqbiCIgZsYLT29QbDsws5PbBy/RNzJn+0B?= =?iso-8859-1?q?+BclhTfCVYD9QpxPL5Dcv00JHHQ3jrfj9k8yxA+qJ7stQDzk5sYAr/1Xn5fl?= =?iso-8859-1?q?gSzht+eATYJlsPGUTE8ymbKP4Tyn+WPiRvXMKSlKXxU5vHgCKuweGXa2sOAQ?= =?iso-8859-1?q?OO89Eq1sDVS9ljrU3F9qmXoWGZRyt+sAZvR/SkvARUdZpOtH+dX8nMzBW95h?= =?iso-8859-1?q?9n+yN/bwB4E8Vb/h6V7DB2skAYz9Q0dCYrNeP4HQB3Yaw676PuMHopt3roKT?= =?iso-8859-1?q?oI1gdfbO2Ryr0UDhpCCsc+MNA9QreNYMKA6OGTzfNBQZqBOLJNBBmnDnYQmi?= =?iso-8859-1?q?BzkgMmmIbScC2aUbknoSlTd85IBkihnF2bPrc6TF18bDURxOw9xbONWCDkLm?= =?iso-8859-1?q?PywYcJh5+KIAzW4bnVIJHG1Wq7YsN1?= x-microsoft-antispam-prvs: x-forefront-prvs: 0961DF5286 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(39860400002)(396003)(366004)(136003)(376002)(189003)(199004)(11346002)(105586002)(25786009)(6436002)(8936002)(36756003)(4326008)(66066001)(6486002)(486006)(476003)(76176011)(50226002)(52116002)(186003)(107886003)(72206003)(99286004)(478600001)(2616005)(7416002)(68736007)(110136005)(14454004)(2201001)(71190400001)(6116002)(6506007)(86362001)(446003)(71200400001)(386003)(97736004)(8676002)(3846002)(53936002)(81156014)(54906003)(14444005)(81166006)(256004)(2501003)(316002)(305945005)(6512007)(7736002)(26005)(102836004)(2906002)(106356001)(5660300002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR11MB1806; H:MWHPR11MB1549.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: ny8Na9bfpLUL+m144LrVYFDXuvOyfAajQ5OVhsx57/BXJLm4ae+28MlNYJmP9z+lTa4/0ytJwazpGCNHKWW1nOYIy6MHXWzODPYT0tVx3tJpf2bzwirvGoOfPHsIP2pEhuh8CFM41r2zvG7O/obbcTQKkzj2anm4msZdK1ukaalT/JrFinlCoy70JtYmbMckXCPQ8FhQ1wwJGYj6vbaRTA/BHh3kr63X/AnslMGniYgvb7Amuhk30yB13q43iIYUfc3DDrxP2cDkXv1J2KJ9yV/UCfc/hwyL8v8ZmP7AkCoiAMEcKgcV2dwZRSYVVkkZRibcDx6zc33dsaHq8D6eExPHP1rpIdWU90clhcIzpOwjatrE+YUumZ/6MqlWH+C3cSf3cO+ROiVwUolEtQ617WRjvinfBwonVI0tGdtYNwU= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 88d2e4a2-3f73-41a9-4abf-08d69cd00495 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Feb 2019 16:24:11.4596 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1806 X-OriginatorOrg: microchip.com X-Mailman-Approved-At: Thu, 28 Feb 2019 08:28:56 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I3zj3M+u0PYc87f+7WVtUTH+GEPyHpJqWczmXI6W7EA=; b=Z893PtHZJvfplerD6rSSCfl22irjO3f1d7QfJwxJYyWEsoa43Kl7YsN+Tt8x0dFwBpHszSR/40nAuSb5JcNtGPet4VBMxXse8THGWnIpA7JbWdvnEFaAFvtNEp+LCkCZXj0PyE0yNZa7NgP+gJeC9P+YnJfSOea0suTnB68KOsE= X-Mailman-Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Claudiu.Beznea@microchip.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Claudiu.Beznea@microchip.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Claudiu Beznea SAM9x60 LCD Controller has no option to select clock source as previous controllers have. To be able to use the same driver even for this LCD controller add a config option to know if controller supports this. Signed-off-by: Claudiu Beznea Reviewed-by: Sam Ravnborg --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 12 +++++++----- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c index 8070a558d7b1..17a7a18f6a07 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c @@ -78,7 +78,8 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c) unsigned long mode_rate; struct videomode vm; unsigned long prate; - unsigned int cfg; + unsigned int mask = ATMEL_HLCDC_CLKDIV_MASK | ATMEL_HLCDC_CLKPOL; + unsigned int cfg = 0; int div; vm.vfront_porch = adj->crtc_vsync_start - adj->crtc_vdisplay; @@ -101,7 +102,10 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c) (adj->crtc_hdisplay - 1) | ((adj->crtc_vdisplay - 1) << 16)); - cfg = ATMEL_HLCDC_CLKSEL; + if (!crtc->dc->desc->fixed_clksrc) { + cfg = ATMEL_HLCDC_CLKSEL; + mask |= ATMEL_HLCDC_CLKSEL; + } prate = 2 * clk_get_rate(crtc->dc->hlcdc->sys_clk); mode_rate = adj->crtc_clock * 1000; @@ -132,9 +136,7 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c) cfg |= ATMEL_HLCDC_CLKDIV(div); - regmap_update_bits(regmap, ATMEL_HLCDC_CFG(0), - ATMEL_HLCDC_CLKSEL | ATMEL_HLCDC_CLKDIV_MASK | - ATMEL_HLCDC_CLKPOL, cfg); + regmap_update_bits(regmap, ATMEL_HLCDC_CFG(0), mask, cfg); cfg = 0; diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h index 70bd540d644e..0155efb9c443 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h @@ -328,6 +328,7 @@ atmel_hlcdc_layer_to_plane(struct atmel_hlcdc_layer *layer) * @max_hpw: maximum horizontal back/front porch width * @conflicting_output_formats: true if RGBXXX output formats conflict with * each other. + * @fixed_clksrc: true if clock source is fixed * @layers: a layer description table describing available layers * @nlayers: layer description table size */ @@ -340,6 +341,7 @@ struct atmel_hlcdc_dc_desc { int max_vpw; int max_hpw; bool conflicting_output_formats; + bool fixed_clksrc; const struct atmel_hlcdc_layer_desc *layers; int nlayers; };