From patchwork Tue Sep 19 13:08:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Stevenson X-Patchwork-Id: 44307 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1duIHY-0000tj-Sd; Tue, 19 Sep 2017 13:09:45 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751237AbdISNJn (ORCPT + 1 other); Tue, 19 Sep 2017 09:09:43 -0400 Received: from mx08-00252a01.pphosted.com ([91.207.212.211]:60228 "EHLO mx08-00252a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751053AbdISNJm (ORCPT ); Tue, 19 Sep 2017 09:09:42 -0400 Received: from pps.filterd (m0102629.ppops.net [127.0.0.1]) by mx08-00252a01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v8JD9O9L023987 for ; Tue, 19 Sep 2017 14:09:41 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; h=from : to : cc : subject : date : message-id : in-reply-to : references : in-reply-to : references; s=pp; bh=UJu5yoLLvxtThFwzozMwafoY7zTyc4At3bJYZCA1Xkk=; b=g6vGwLRJhnSPopCBzLXW/h2bi/+J1WxtvnGidFIVN6iDqGifP5nW6a1qdPk+o35D4GLi gIdFRmLPkWCri3ywR0CCpfhk1ifRYIUQ0Tz40QtfLyQJXeAL0ByRfL0FD6wUMZuL0a4J Jk5ZcQtO0XJV5S3sy8U4hDtZ4yrwmTo98tuwCFlsgnrGQRloNHF4Ck3YRxRnF+dJkgua Ucu9ZgBcZk4KKF20xDRXjSdnckJaGUZbb27x2G7rgJL5RELNvLtmPZAb+wcdgFjjdx87 4SukAmjRF6C42/RboJckVYYAS2hoWQ86bM9+JAwIuj3PCoRM46n7qqWsXik++uzoAQ3G cA== Received: from mail-wm0-f72.google.com (mail-wm0-f72.google.com [74.125.82.72]) by mx08-00252a01.pphosted.com with ESMTP id 2d0reg1jgf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Tue, 19 Sep 2017 14:09:41 +0100 Received: by mail-wm0-f72.google.com with SMTP id i131so3879562wma.1 for ; Tue, 19 Sep 2017 06:09:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=UJu5yoLLvxtThFwzozMwafoY7zTyc4At3bJYZCA1Xkk=; b=qHXsz3yU/Dy4h4rehESBzNu7HYC7mNixgOyKipnoswqplafys7oHPZKGGwDLkhC+h8 PELniHe2EuluhDqUKowQ8y2+Dzyk0fjXl5zNIwKl6wpEEJb18exKddWfUUPyWS2MuZ1w CyQv13Jr4Ne1gxXPObaX7lBHm00LA8Im/iRHZ+KHaJa2BmmkRPZVs+Jq2JRtGF+o824p lY4Wp87l/uxiA3kW8OwncM5glf2UD3Y+BTDJUYG8ikOK/56mHpMm/66XdOdzxM8951ji FbBsfJmhvw/8T0L6B3c3dSddMyPln+XC1zkr3swy0oL4JuprORMJshr4Az0eQEwJqeQb AeEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=UJu5yoLLvxtThFwzozMwafoY7zTyc4At3bJYZCA1Xkk=; b=Lz7HkHvIjF8p1sV5CrawZhxrVSbTsIvgixZXczroGs/1bf7wIBKqvS/OY/xTH4y2Oe UMOBuzIoW66ALuAy6czMblK6Ue/u6Gu3ZqeHGhddHR7ZQAZI0PsN7dQEjQEn2Ac+H6co gJwafRNuhwC5nUH4+pD0pDawhb00ZZk6DxOZhDCNh+FmFKwC5vKz9238pfsO9CLo7stm /HYbOuQ/ITHct4zI8RhhbOKLZgMxDFZ6VRY+rcjJe4+3JRw5ot7miqPSHmg7CAPGgrOz S5cq0tl9sByAKsXogX3wf3G7IWWMCk+dg9EcWECLLEto7Ke1CTvi+pWZjPunb2gayb2L U7uQ== X-Gm-Message-State: AHPjjUhJMxPJmYbM22izGifwG55HlrNYHMdJmBdBJOCyG7BlNsNhKm+9 MF3MAqQY46fZw0OFmuTMMUgK89pyAD5U7+HBF8wUVboVgJB0fMZmnyJr8EoVxIeZT7uiIUP8008 UJzX8wejf5Xfw87y0TP1taQ== X-Received: by 10.223.160.170 with SMTP id m39mr1314110wrm.174.1505826580063; Tue, 19 Sep 2017 06:09:40 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCi9Xv6PYwxHue3ijE93G1P7u0Ta6UvpiRmDr579lMSZizjSXEC3IUclY5Wy01iNYGg1vMFNA== X-Received: by 10.223.160.170 with SMTP id m39mr1314093wrm.174.1505826579850; Tue, 19 Sep 2017 06:09:39 -0700 (PDT) Received: from dave-VirtualBox.pitowers.org ([217.33.127.173]) by smtp.googlemail.com with ESMTPSA id a195sm1119170wme.34.2017.09.19.06.09.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Sep 2017 06:09:39 -0700 (PDT) From: Dave Stevenson To: Mats Randgaard , Mauro Carvalho Chehab , Hans Verkuil , Philipp Zabel , linux-media@vger.kernel.org Cc: Dave Stevenson Subject: [PATCH 3/3] [media] tc358743: Add support for 972Mbit/s link freq. Date: Tue, 19 Sep 2017 14:08:53 +0100 Message-Id: <6de475044437c01c14429ac20292e5c29fdd39f9.1505826082.git.dave.stevenson@raspberrypi.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-19_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_notspam policy=outbound_spam score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709190186 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Adds register setups for running the CSI lanes at 972Mbit/s, which allows 1080P50 UYVY down 2 lanes. Signed-off-by: Dave Stevenson --- drivers/media/i2c/tc358743.c | 47 +++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index 7632daf..dcc100e 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -1809,6 +1809,7 @@ static int tc358743_probe_of(struct tc358743_state *state) /* * The CSI bps per lane must be between 62.5 Mbps and 1 Gbps. * The default is 594 Mbps for 4-lane 1080p60 or 2-lane 720p60. + * 972 Mbps allows 1080P50 UYVY over 2-lane. */ bps_pr_lane = 2 * endpoint->link_frequencies[0]; if (bps_pr_lane < 62500000U || bps_pr_lane > 1000000000U) { @@ -1821,23 +1822,41 @@ static int tc358743_probe_of(struct tc358743_state *state) state->pdata.refclk_hz * state->pdata.pll_prd; /* - * FIXME: These timings are from REF_02 for 594 Mbps per lane (297 MHz - * link frequency). In principle it should be possible to calculate + * FIXME: These timings are from REF_02 for 594 or 972 Mbps per lane + * (297 MHz or 495 MHz link frequency). + * In principle it should be possible to calculate * them based on link frequency and resolution. */ - if (bps_pr_lane != 594000000U) + switch (bps_pr_lane) { + default: dev_warn(dev, "untested bps per lane: %u bps\n", bps_pr_lane); - state->pdata.lineinitcnt = 0xe80; - state->pdata.lptxtimecnt = 0x003; - /* tclk-preparecnt: 3, tclk-zerocnt: 20 */ - state->pdata.tclk_headercnt = 0x1403; - state->pdata.tclk_trailcnt = 0x00; - /* ths-preparecnt: 3, ths-zerocnt: 1 */ - state->pdata.ths_headercnt = 0x0103; - state->pdata.twakeup = 0x4882; - state->pdata.tclk_postcnt = 0x008; - state->pdata.ths_trailcnt = 0x2; - state->pdata.hstxvregcnt = 0; + case 594000000U: + state->pdata.lineinitcnt = 0xe80; + state->pdata.lptxtimecnt = 0x003; + /* tclk-preparecnt: 3, tclk-zerocnt: 20 */ + state->pdata.tclk_headercnt = 0x1403; + state->pdata.tclk_trailcnt = 0x00; + /* ths-preparecnt: 3, ths-zerocnt: 1 */ + state->pdata.ths_headercnt = 0x0103; + state->pdata.twakeup = 0x4882; + state->pdata.tclk_postcnt = 0x008; + state->pdata.ths_trailcnt = 0x2; + state->pdata.hstxvregcnt = 0; + break; + case 972000000U: + state->pdata.lineinitcnt = 0xFA0; + state->pdata.lptxtimecnt = 0x007; + /* tclk-preparecnt: 6, tclk-zerocnt: 40 */ + state->pdata.tclk_headercnt = 0x2806; + state->pdata.tclk_trailcnt = 0x00; + /* ths-preparecnt: 3, ths-zerocnt: 1 */ + state->pdata.ths_headercnt = 0x0806; + state->pdata.twakeup = 0x4268; + state->pdata.tclk_postcnt = 0x008; + state->pdata.ths_trailcnt = 0x5; + state->pdata.hstxvregcnt = 0; + break; + } state->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);