From patchwork Tue Mar 5 10:07:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 10840533 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 91F001669 for ; Wed, 6 Mar 2019 08:09:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EF2E2CAFD for ; Wed, 6 Mar 2019 08:09:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7296C2CC68; Wed, 6 Mar 2019 08:09:57 +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 DAB522CAFD for ; Wed, 6 Mar 2019 08:09:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 84B2D6E099; Wed, 6 Mar 2019 08:09:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from esa4.microchip.iphmx.com (esa4.microchip.iphmx.com [68.232.154.123]) by gabe.freedesktop.org (Postfix) with ESMTPS id 976FA8972C for ; Tue, 5 Mar 2019 10:07:42 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.58,443,1544511600"; d="scan'208";a="27273021" 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; 05 Mar 2019 03:07:41 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.108) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Mar 2019 03:07:40 -0700 Received: from MWHPR11MB1549.namprd11.prod.outlook.com (10.172.54.17) by MWHPR11MB1647.namprd11.prod.outlook.com (10.172.55.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.21; Tue, 5 Mar 2019 10:07:38 +0000 Received: from MWHPR11MB1549.namprd11.prod.outlook.com ([fe80::54fe:95ed:b0cf:55a6]) by MWHPR11MB1549.namprd11.prod.outlook.com ([fe80::54fe:95ed:b0cf:55a6%9]) with mapi id 15.20.1665.020; Tue, 5 Mar 2019 10:07:38 +0000 From: To: , , , , , , , , , Subject: [PATCH v2 1/7] drm: atmel-hlcdc: add config option for clock selection Thread-Topic: [PATCH v2 1/7] drm: atmel-hlcdc: add config option for clock selection Thread-Index: AQHU0ztD+/wMXaZ0tESQW5wKZocGmw== Date: Tue, 5 Mar 2019 10:07:38 +0000 Message-ID: <1551780434-4580-2-git-send-email-claudiu.beznea@microchip.com> References: <1551780434-4580-1-git-send-email-claudiu.beznea@microchip.com> In-Reply-To: <1551780434-4580-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: VI1PR0502CA0011.eurprd05.prod.outlook.com (2603:10a6:803:1::24) 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: f06c76a5-6c0e-4908-fc09-08d6a152658f x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:MWHPR11MB1647; x-ms-traffictypediagnostic: MWHPR11MB1647: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; MWHPR11MB1647; 23:m1Xx5t+3hGCqxGtM8tbA0gPI+HQZ24zrkOX4+3y?= =?iso-8859-1?q?LzglgRE+3rSMIit?= =?iso-8859-1?q?qTAJM7BuwOIemKz/kqIi0JAMk/oTm0KNjB6YglimR2+bIcrB4cxiKI+gZqcu?= =?iso-8859-1?q?fEQKta0XQIuisDQN3yhhve2odIZeEuBpcelszIMf1mg9MBNnFgnUPqwOOq1K?= =?iso-8859-1?q?gzN+M0AKuvjMDIEkUMJBv/aCFGqjcqRT1ZdN2jB3PuCmSDZo94RteIElopQR?= =?iso-8859-1?q?m13FwXpXgR13rLDnSbUuMO9f7f4psijrvQYoZVpttrpChXHMG0NG6ttrFt4u?= =?iso-8859-1?q?S9/oIAKgjleXLGbuSrehsu64jZjIWrpnIWcnSZH/VCwElvI+xp8zWYNCSVOy?= =?iso-8859-1?q?S1AFpfcjlp429D5Kr2AaCzJDqeSJbQCl+iuYRL/0gloSIobnurT6hnbZlu9X?= =?iso-8859-1?q?udwbneYMTviU3mLhhSvBHHDHoXLt3Lbvjdzl4vaC5y0nTeYNokrun0TmrSAG?= =?iso-8859-1?q?vfmgBkXyHf3qzuLT4DEL5Ivj0mxECPHEyooXnKMUtNGcMP6MXIvp4QbA1Af9?= =?iso-8859-1?q?NA7/bSRkg75vWRMmT5fncDQliFbvUg9mpKtbyczmfRRP6N6MsypTTnwb0MWb?= =?iso-8859-1?q?xpTPmo+pMYCGlV4qwp2V1xQ2NJVBy0jLPDI+vnNlNj0x9CrjrW1UdM1YeKDn?= =?iso-8859-1?q?9nFbLOryK5oMRxvDS+oe3JxXyh8ZDXEc66OuaHhYoLeDNqL4Y2ImTW242Yf0?= =?iso-8859-1?q?mFFeQaPlEByJqs8bGcgv4hQHTtD2YV+03SRKN3uIafW2EEzJZPMu5D/hmjas?= =?iso-8859-1?q?aammJCQG+JKIharjcPBPpiuwpa5pmugjVdU5crfptExgnMV1Z8X+04iEQLy6?= =?iso-8859-1?q?pNciguFpt5MW80BpAwT8CA/gRGTpaOuQjLV8HW+/awUhfRxMRynMO53Alj5b?= =?iso-8859-1?q?QVZDiG1Uxd5urqRA/FyTxWBgsRfF15Q3HM/ZyjAUmi9EZMJ5RShZIsoe60oH?= =?iso-8859-1?q?A/0XPluCkUb1XID8sLslLwbymXdA3ylS+sPu7s/mHNYkZduNuhZTCnDZL8ol?= =?iso-8859-1?q?jcql50Y8IHLScYkYEWZmwC6ZUkbgswkiL1Q5jhmxmB7j6h3JPA/vS7ZceNCK?= =?iso-8859-1?q?FhJu6ThGF+/pZnJwzsvZgyiOwPxf19PR+dDMVqEGjyJ5AZyeXY2yGC/f1ddG?= =?iso-8859-1?q?i/XCrCQHJ4KZsxdMtVXcFRfax8dSYnqh9ADakqTLMRF4KFpGHoBUkCsYGLRA?= =?iso-8859-1?q?KedRGkfs9ZDKxVoAIgkwXIyqcm40b3IHwIfKYluGLrOXHZD/tuet1BDUlF06?= =?iso-8859-1?q?3Y7yOs7dDU78o/tRIqM0EQAruEI+9Xpbo1meulqDEgCT0nQ5q3gek7jHZaKV?= =?iso-8859-1?q?upcZgmf6xYgyNZqo24L9DeHx0vrKg+?= x-microsoft-antispam-prvs: x-forefront-prvs: 0967749BC1 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(396003)(39860400002)(346002)(136003)(366004)(199004)(189003)(106356001)(72206003)(3846002)(99286004)(81156014)(52116002)(36756003)(76176011)(14454004)(81166006)(66066001)(8676002)(110136005)(6116002)(105586002)(6486002)(7736002)(5660300002)(8936002)(305945005)(25786009)(102836004)(54906003)(97736004)(316002)(2906002)(7416002)(2501003)(2616005)(186003)(71190400001)(6506007)(386003)(256004)(476003)(68736007)(11346002)(71200400001)(6512007)(2201001)(107886003)(53936002)(446003)(50226002)(486006)(4326008)(86362001)(6436002)(478600001)(14444005)(26005)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR11MB1647; H:MWHPR11MB1549.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: aLMnhcwbijCslvDfdkdmH0KOsBXeX6yBGleXF76uzeJ48MO1EKGTG+dWagXK3rO7wmFGvQnz1gR8GOA7Y59L/JRYO6ucNZhSWYvA6ZK0ZVg9jMqKqi4GlX/UhAc0il81KRbArGg1YMjUppfKFsmT2L3bwPfTRDiMoXbyd2v6cRSh/5A38EMbOxE4UfCaaYmA2jp4V/mXrSxJFISWUFGJKczLQSQN96HMGGL3lC7GjEuXRgZ3gxdbLKwM52sWbaVFNru23BWTEyq95EUDV8olfuYZBPhtrcNQdzQBl2Bw9nktt7rODcp4JHG2RsnOR6r6kegOCs4nUhEsJXCJnmnuNLk2EgTx/s1JmABRGVvdZbcBBcmWomVeR2KmkXoTdUzHEnQBiz4P+ZfHbGNTP8TSj4Q3lCF1E1IeQYfAWgoFS8s= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: f06c76a5-6c0e-4908-fc09-08d6a152658f X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Mar 2019 10:07:38.6652 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1647 X-OriginatorOrg: microchip.com X-Mailman-Approved-At: Wed, 06 Mar 2019 08:09:28 +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=HnDJrc2fWj+kuXChfYNe6+4J490v2101XUkGUY/F7c4=; b=T6zWMFnM4h2itcg9To2uLJsqowOpv0qUJvihx+OOeKHN0Qo9DV3qeO1zMkCcJamRChOnn2vyDg2c8RN2nuvtNZlU2nHRs9pesjtXaSLf2jTiHa9i7oNVPN90vrHxTZXZwdHbHWuvohS00tOViryg9tZcalAffELUc4LLof66B1w= 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..957e6d2fb00f 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; };