From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurent Pinchart Subject: Re: [PATCH 1/7] drm/rockchip: prepare common code for cdns and rk dpi/dp driver Date: Wed, 3 Jun 2020 02:28:40 +0300 Message-ID: <20200602232840.GP6547@pendragon.ideasonboard.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Emil Velikov Cc: sandor.yu@nxp.com, Andrzej Hajda , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Heiko =?utf-8?Q?St=C3=BCbner?= , Sandy Huang , dkos@cadence.com, ML dri-devel , linux-rockchip , "Linux-Kernel@Vger. Kernel. Org" , LAKML , NXP Linux Team List-Id: linux-rockchip.vger.kernel.org On Tue, Jun 02, 2020 at 02:55:52PM +0100, Emil Velikov wrote: > On Mon, 1 Jun 2020 at 07:29, wrote: > > > > From: Sandor Yu > > > > - Extracted common fields from cdn_dp_device to a new cdns_mhdp_device > > structure which will be used by two separate drivers later on. > > - Moved some datatypes (audio_format, audio_info, vic_pxl_encoding_format, > > video_info) from cdn-dp-core.c to cdn-dp-reg.h. > > - Changed prefixes from cdn_dp to cdns_mhdp > > cdn -> cdns to match the other Cadence's drivers > > dp -> mhdp to distinguish it from a "just a DP" as the IP underneath > > this registers map can be a HDMI (which is internally different, > > but the interface for commands, events is pretty much the same). > > - Modified cdn-dp-core.c to use the new driver structure and new function > > names. > > - writel and readl are replaced by cdns_mhdp_bus_write and > > cdns_mhdp_bus_read. > > > The high-level idea is great - split, refactor and reuse the existing drivers. > > Although looking at the patches themselves - they seems to be doing > multiple things at once. > As indicated by the extensive list in the commit log. > > I would suggest splitting those up a bit, roughly in line of the > itemisation as per the commit message. > > Here is one hand wavy way to chunk this patch: > 1) use put_unalligned* > 2) 'use local variable dev' style of changes (as seem in cdn_dp_clk_enable) > 3) add writel/readl wrappers > 4) hookup struct cdns_mhdp_device, keep dp->mhdp detail internal. > The cdn-dp-reg.h function names/signatures will stay the same. > 5) finalize the helpers - use mhdp directly, rename I second this, otherwise review is very hard. > Examples: > 4) > static int cdn_dp_mailbox_read(struct cdn_dp_device *dp) > { > +" struct cdns_mhdp_device *mhdp = dp->mhdp; > int val, ret; > > - ret = readx_poll_timeout(readl, dp->regs + MAILBOX_EMPTY_ADDR, > + ret = readx_poll_timeout(readl, mhdp->regs_base + MAILBOX_EMPTY_ADDR, > ... > return fancy_readl(dp, MAILBOX0_RD_DATA) & 0xff; > } > > 5) > -static int cdn_dp_mailbox_read(struct cdn_dp_device *dp) > +static int mhdp_mailbox_read(struct cdns_mhdp_device *mhdp) > { > - struct cdns_mhdp_device *mhdp = dp->mhdp; > int val, ret; > ... > - return fancy_readl(dp, MAILBOX0_RD_DATA) & 0xff; > + return cdns_mhdp_bus_read(mhdp, MAILBOX0_RD_DATA) & 0xff; > } -- Regards, Laurent Pinchart From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69BC3C433DF for ; Tue, 2 Jun 2020 23:29:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3ED052072F for ; Tue, 2 Jun 2020 23:29:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="emebvBrY"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="O+jYNNIu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3ED052072F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Xu1aQYbQzS2mXjkNZqREd9GlXVNF3TCnjA4ZvGZnUQE=; b=emebvBrYYSDHEQ fKZXC5NJhdkfxIUw3QNX+i0hzJpoef4Y3MAZipsDSxa90mPeyCx+JmrHhgH1bBw2wwjQ7VNdRLP4B USJS8nxKnCJBx5DsdphvwywQu8RuWFySbqFzuJ+psvmghtJUvw0JF9RsZ8UHwNVB3FzJp1XwuRohL R1IM9+NFODtNPf0dcZ5kJqqmBdoJgpb5bPZtdFyx4IVjffOoi8134/fM2HQVL+/h5XI6SPxDy+rbR LMAEHUTWZ4i9Y6AWXQGXAYbwY67y3Bg43btCvk3MswiyNJRjNNGT0jvHiNtVn75DeSq6wXOdGk9GO rZiN6E3cP3gjNa/K/QaA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jgGLD-0005Y4-Pd; Tue, 02 Jun 2020 23:29:07 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jgGLA-0005Wq-TT; Tue, 02 Jun 2020 23:29:06 +0000 Received: from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B9A4F2A4; Wed, 3 Jun 2020 01:28:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1591140535; bh=lXkvj1T0Wpo9a3y6ncv9G8LcEGUh4n2+D7BDgxV7xmQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=O+jYNNIuc7Edhz9qSOLPWtjOOspHJR6sOJ1VTxt8mWv7PTUD4KHv7Bi52BjyGkW/r SPcKr1108TkGVpYbGcMD7VIXIU62iM61DoNwRVoD/AdEqW+0hQ9RoWYbslQsQwt1yr +GtD4Yiq4fY+j0DmdUIkbriof9U9ZSvbUBZh1Hwg= Date: Wed, 3 Jun 2020 02:28:40 +0300 From: Laurent Pinchart To: Emil Velikov Subject: Re: [PATCH 1/7] drm/rockchip: prepare common code for cdns and rk dpi/dp driver Message-ID: <20200602232840.GP6547@pendragon.ideasonboard.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200602_162905_099555_C216FD5B X-CRM114-Status: GOOD ( 17.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jernej Skrabec , Heiko =?utf-8?Q?St=C3=BCbner?= , Jonas Karlman , sandor.yu@nxp.com, Neil Armstrong , Sandy Huang , ML dri-devel , "Linux-Kernel@Vger. Kernel. Org" , Andrzej Hajda , NXP Linux Team , linux-rockchip , dkos@cadence.com, LAKML Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jun 02, 2020 at 02:55:52PM +0100, Emil Velikov wrote: > On Mon, 1 Jun 2020 at 07:29, wrote: > > > > From: Sandor Yu > > > > - Extracted common fields from cdn_dp_device to a new cdns_mhdp_device > > structure which will be used by two separate drivers later on. > > - Moved some datatypes (audio_format, audio_info, vic_pxl_encoding_format, > > video_info) from cdn-dp-core.c to cdn-dp-reg.h. > > - Changed prefixes from cdn_dp to cdns_mhdp > > cdn -> cdns to match the other Cadence's drivers > > dp -> mhdp to distinguish it from a "just a DP" as the IP underneath > > this registers map can be a HDMI (which is internally different, > > but the interface for commands, events is pretty much the same). > > - Modified cdn-dp-core.c to use the new driver structure and new function > > names. > > - writel and readl are replaced by cdns_mhdp_bus_write and > > cdns_mhdp_bus_read. > > > The high-level idea is great - split, refactor and reuse the existing drivers. > > Although looking at the patches themselves - they seems to be doing > multiple things at once. > As indicated by the extensive list in the commit log. > > I would suggest splitting those up a bit, roughly in line of the > itemisation as per the commit message. > > Here is one hand wavy way to chunk this patch: > 1) use put_unalligned* > 2) 'use local variable dev' style of changes (as seem in cdn_dp_clk_enable) > 3) add writel/readl wrappers > 4) hookup struct cdns_mhdp_device, keep dp->mhdp detail internal. > The cdn-dp-reg.h function names/signatures will stay the same. > 5) finalize the helpers - use mhdp directly, rename I second this, otherwise review is very hard. > Examples: > 4) > static int cdn_dp_mailbox_read(struct cdn_dp_device *dp) > { > +" struct cdns_mhdp_device *mhdp = dp->mhdp; > int val, ret; > > - ret = readx_poll_timeout(readl, dp->regs + MAILBOX_EMPTY_ADDR, > + ret = readx_poll_timeout(readl, mhdp->regs_base + MAILBOX_EMPTY_ADDR, > ... > return fancy_readl(dp, MAILBOX0_RD_DATA) & 0xff; > } > > 5) > -static int cdn_dp_mailbox_read(struct cdn_dp_device *dp) > +static int mhdp_mailbox_read(struct cdns_mhdp_device *mhdp) > { > - struct cdns_mhdp_device *mhdp = dp->mhdp; > int val, ret; > ... > - return fancy_readl(dp, MAILBOX0_RD_DATA) & 0xff; > + return cdns_mhdp_bus_read(mhdp, MAILBOX0_RD_DATA) & 0xff; > } -- Regards, Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62EAAC433DF for ; Tue, 2 Jun 2020 23:29:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 371712072F for ; Tue, 2 Jun 2020 23:29:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="O+jYNNIu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 371712072F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6F09E6E1B4; Tue, 2 Jun 2020 23:28:59 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by gabe.freedesktop.org (Postfix) with ESMTPS id CD79E6E1B4 for ; Tue, 2 Jun 2020 23:28:57 +0000 (UTC) Received: from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B9A4F2A4; Wed, 3 Jun 2020 01:28:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1591140535; bh=lXkvj1T0Wpo9a3y6ncv9G8LcEGUh4n2+D7BDgxV7xmQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=O+jYNNIuc7Edhz9qSOLPWtjOOspHJR6sOJ1VTxt8mWv7PTUD4KHv7Bi52BjyGkW/r SPcKr1108TkGVpYbGcMD7VIXIU62iM61DoNwRVoD/AdEqW+0hQ9RoWYbslQsQwt1yr +GtD4Yiq4fY+j0DmdUIkbriof9U9ZSvbUBZh1Hwg= Date: Wed, 3 Jun 2020 02:28:40 +0300 From: Laurent Pinchart To: Emil Velikov Subject: Re: [PATCH 1/7] drm/rockchip: prepare common code for cdns and rk dpi/dp driver Message-ID: <20200602232840.GP6547@pendragon.ideasonboard.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jernej Skrabec , Jonas Karlman , sandor.yu@nxp.com, Neil Armstrong , Sandy Huang , ML dri-devel , "Linux-Kernel@Vger. Kernel. Org" , Andrzej Hajda , NXP Linux Team , linux-rockchip , dkos@cadence.com, LAKML Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, Jun 02, 2020 at 02:55:52PM +0100, Emil Velikov wrote: > On Mon, 1 Jun 2020 at 07:29, wrote: > > > > From: Sandor Yu > > > > - Extracted common fields from cdn_dp_device to a new cdns_mhdp_device > > structure which will be used by two separate drivers later on. > > - Moved some datatypes (audio_format, audio_info, vic_pxl_encoding_format, > > video_info) from cdn-dp-core.c to cdn-dp-reg.h. > > - Changed prefixes from cdn_dp to cdns_mhdp > > cdn -> cdns to match the other Cadence's drivers > > dp -> mhdp to distinguish it from a "just a DP" as the IP underneath > > this registers map can be a HDMI (which is internally different, > > but the interface for commands, events is pretty much the same). > > - Modified cdn-dp-core.c to use the new driver structure and new function > > names. > > - writel and readl are replaced by cdns_mhdp_bus_write and > > cdns_mhdp_bus_read. > > > The high-level idea is great - split, refactor and reuse the existing drivers. > > Although looking at the patches themselves - they seems to be doing > multiple things at once. > As indicated by the extensive list in the commit log. > > I would suggest splitting those up a bit, roughly in line of the > itemisation as per the commit message. > > Here is one hand wavy way to chunk this patch: > 1) use put_unalligned* > 2) 'use local variable dev' style of changes (as seem in cdn_dp_clk_enable) > 3) add writel/readl wrappers > 4) hookup struct cdns_mhdp_device, keep dp->mhdp detail internal. > The cdn-dp-reg.h function names/signatures will stay the same. > 5) finalize the helpers - use mhdp directly, rename I second this, otherwise review is very hard. > Examples: > 4) > static int cdn_dp_mailbox_read(struct cdn_dp_device *dp) > { > +" struct cdns_mhdp_device *mhdp = dp->mhdp; > int val, ret; > > - ret = readx_poll_timeout(readl, dp->regs + MAILBOX_EMPTY_ADDR, > + ret = readx_poll_timeout(readl, mhdp->regs_base + MAILBOX_EMPTY_ADDR, > ... > return fancy_readl(dp, MAILBOX0_RD_DATA) & 0xff; > } > > 5) > -static int cdn_dp_mailbox_read(struct cdn_dp_device *dp) > +static int mhdp_mailbox_read(struct cdns_mhdp_device *mhdp) > { > - struct cdns_mhdp_device *mhdp = dp->mhdp; > int val, ret; > ... > - return fancy_readl(dp, MAILBOX0_RD_DATA) & 0xff; > + return cdns_mhdp_bus_read(mhdp, MAILBOX0_RD_DATA) & 0xff; > } -- Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel