From patchwork Fri Jun 8 06:04:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10453809 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5EF5A60318 for ; Fri, 8 Jun 2018 06:05:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D2E5293FF for ; Fri, 8 Jun 2018 06:05:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 415FB29409; Fri, 8 Jun 2018 06:05:08 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7062293FF for ; Fri, 8 Jun 2018 06:05:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750849AbeFHGFG (ORCPT ); Fri, 8 Jun 2018 02:05:06 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:43079 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750823AbeFHGFF (ORCPT ); Fri, 8 Jun 2018 02:05:05 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180608060502euoutp010d84dfee7390046e4450048895692f2c~2Giy7FxxF1858218582euoutp01A; Fri, 8 Jun 2018 06:05:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180608060502euoutp010d84dfee7390046e4450048895692f2c~2Giy7FxxF1858218582euoutp01A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1528437903; bh=Dbry5Moyl7XHwYOishOeeMDZG/y9naN7LpGTepTJ+vM=; h=From:To:Cc:Subject:Date:References:From; b=Byc4J5vyJ/dlyyx+qZoZDvf0Hp5uEleVDkRrpNCDAYaT/FVp4hye2GvbcOKhzHdkK ePwbnIGi45yOIbCVzGMWXmo0Hf5okdndKtcH1ykOj3I7zYiUHdVrCETy8pELxFhehK A7qVwMr9KEp1gbXUwnaOW7kNsZvV3uzxa5RmZa1E= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180608060501eucas1p249a166431565311e73577406a5a043d2~2Gix-phfn0787907879eucas1p2B; Fri, 8 Jun 2018 06:05:01 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 99.7D.05700.D8C1A1B5; Fri, 8 Jun 2018 07:05:01 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180608060501eucas1p18f8382f01e3addf659ff56f260cbb577~2GixRaacc1295312953eucas1p1i; Fri, 8 Jun 2018 06:05:01 +0000 (GMT) X-AuditID: cbfec7f2-1c1ff70000011644-c1-5b1a1c8dd045 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 3B.6E.04183.D8C1A1B5; Fri, 8 Jun 2018 07:05:01 +0100 (BST) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P9Z00MNOQ8C7N20@eusync1.samsung.com>; Fri, 08 Jun 2018 07:05:01 +0100 (BST) From: Andrzej Hajda To: Archit Taneja , Laurent Pinchart Cc: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski Subject: [PATCH v2] drm/bridge/sii8620: simplify hardware reset procedure Date: Fri, 08 Jun 2018 08:04:57 +0200 Message-id: <20180608060457.18357-1-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprFIsWRmVeSWpSXmKPExsWy7djPc7q9MlLRBv+/q1vcWneO1aKp4y2r xcYZ61ktrnx9z2bROXEJu8WM8/uYLNYeucvuwO5xua+XyWN2x0xWj/vdx5k8+rasYvT4vEku gDWKyyYlNSezLLVI3y6BK2Phjk/MBWsFKnpn7GBvYHzA28XIySEhYCJxZOEOdhBbSGAFo8Ta 7iAI+zOjxNTZYTA1T9beYOxi5AKKL2OUOLVhKzuE859RYtuBr0wgVWwCmhJ/N99kA7FFBJIk Tp/7AGYzC1xilPh6WB/EFhbwlPj9bjYLiM0ioCox/+QkVhCbV8BC4uC+92wQ2+QlVm84wAyy QELgLavE4pfN7BAJF4l7v3cyQ9jCEq+Ob4GKy0hcntzNAmHXSzTNvALV3MEocWLxcqip1hKH j19khbiIT2LStulARRxAcV6JjjYhiBIPiVeHmxlBwkICsRJ3L5dNYJRYwMiwilE8tbQ4Nz21 2DAvtVyvODG3uDQvXS85P3cTIzDGTv87/mkH49dLSYcYBTgYlXh4OSwko4VYE8uKK3MPMUpw MCuJ8OaKSUUL8aYkVlalFuXHF5XmpBYfYpTmYFES543TqIsSEkhPLEnNTk0tSC2CyTJxcEo1 MC78xSAa5ZzhELdSXzai3mXPSoYr22ztTD9dW3PbcUbKDI5447UvGbX5t93Nnz+HcXZVj24p Y/xLt1vbO6oLmNXFVacah4g/fZVs+TO459OC+Fv5Xrkbe169D9W6KrR+vd1608j1TL+vzj3k fCcr2Obf2vriuubDL457TzO9IXNNZarsUelwKSWW4oxEQy3mouJEAHYyIOytAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPJMWRmVeSWpSXmKPExsVy+t/xy7q9MlLRBn+buCxurTvHatHU8ZbV YuOM9awWV76+Z7PonLiE3WLG+X1MFmuP3GV3YPe43NfL5DG7Yyarx/3u40wefVtWMXp83iQX wBrFZZOSmpNZllqkb5fAlbFwxyfmgrUCFb0zdrA3MD7g7WLk5JAQMJF4svYGI4gtJLCEUWLm OpMuRi4gu5FJ4kbnL7AEm4CmxN/NN9lAbBGBJImNDw+xgBQxC1xhlOi6d5wFJCEs4Cnx+91s MJtFQFVi/slJrCA2r4CFxMF979kgtslLrN5wgHkCI9cCRoZVjCKppcW56bnFRnrFibnFpXnp esn5uZsYgcGw7djPLTsYu94FH2IU4GBU4uFNsJKMFmJNLCuuzD3EKMHBrCTCm3hJLFqINyWx siq1KD++qDQntfgQozQHi5I473mDyighgfTEktTs1NSC1CKYLBMHp1QD456HT+Nze39VWs7Z VJZ3MWHVtwkfq3iFPnTIvxBQ49ptdthq4mmmtN9O5xpLOq6WfokXspc1mXi1k3vWk4xte6x+ PIvOKfFxiz20aPEWTVVls3+fl/+cFdSi37s3zmax5cPU0PMvN79cFb25eM35NRdUp66bVeuV cyh/ScfmGYKTdyouTv9/ulKJpTgj0VCLuag4EQC5HFwNAgIAAA== X-CMS-MailID: 20180608060501eucas1p18f8382f01e3addf659ff56f260cbb577 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180608060501eucas1p18f8382f01e3addf659ff56f260cbb577 References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is no need to flip reset pin twice. Also delays can be changed to values present in vendor's code. Signed-off-by: Andrzej Hajda Tested-by: Marek Szyprowski Reviewed-by: Maciej Purski --- Hi, This is v2 of forgotten patch, awaiting reviewers, any volunteers. Also "drm/bridge/sii8620: fix loops in EDID fetch logic" waits for reviewers. In this version I have completely removed reset function, and moved its body to sii8620_hw_on. Regards Andrzej --- drivers/gpu/drm/bridge/sil-sii8620.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c b/drivers/gpu/drm/bridge/sil-sii8620.c index 7ab36042a822..d1e780fba4b6 100644 --- a/drivers/gpu/drm/bridge/sil-sii8620.c +++ b/drivers/gpu/drm/bridge/sil-sii8620.c @@ -971,8 +971,17 @@ static int sii8620_hw_on(struct sii8620 *ctx) ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); if (ret) return ret; + usleep_range(10000, 20000); - return clk_prepare_enable(ctx->clk_xtal); + ret = clk_prepare_enable(ctx->clk_xtal); + if (ret) + return ret; + + msleep(100); + gpiod_set_value(ctx->gpio_reset, 0); + msleep(100); + + return 0; } static int sii8620_hw_off(struct sii8620 *ctx) @@ -982,17 +991,6 @@ static int sii8620_hw_off(struct sii8620 *ctx) return regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); } -static void sii8620_hw_reset(struct sii8620 *ctx) -{ - usleep_range(10000, 20000); - gpiod_set_value(ctx->gpio_reset, 0); - usleep_range(5000, 20000); - gpiod_set_value(ctx->gpio_reset, 1); - usleep_range(10000, 20000); - gpiod_set_value(ctx->gpio_reset, 0); - msleep(300); -} - static void sii8620_cbus_reset(struct sii8620 *ctx) { sii8620_write(ctx, REG_PWD_SRST, BIT_PWD_SRST_CBUS_RST @@ -2112,7 +2110,6 @@ static void sii8620_cable_in(struct sii8620 *ctx) dev_err(dev, "Error powering on, %d.\n", ret); return; } - sii8620_hw_reset(ctx); sii8620_read_buf(ctx, REG_VND_IDL, ver, ARRAY_SIZE(ver)); ret = sii8620_clear_error(ctx);