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