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.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 C8D19C433DF for ; Tue, 2 Jun 2020 13:59:12 +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 9E230207D8 for ; Tue, 2 Jun 2020 13:59:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ze+ivp4c" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E230207D8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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 1F29388697; Tue, 2 Jun 2020 13:59:12 +0000 (UTC) Received: from mail-vs1-xe42.google.com (mail-vs1-xe42.google.com [IPv6:2607:f8b0:4864:20::e42]) by gabe.freedesktop.org (Postfix) with ESMTPS id DC50388697 for ; Tue, 2 Jun 2020 13:59:10 +0000 (UTC) Received: by mail-vs1-xe42.google.com with SMTP id r10so2051610vsa.12 for ; Tue, 02 Jun 2020 06:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9owB6N5YoTr+QgRWYSW+w97CM/a02Li4ocdyLucMnlA=; b=Ze+ivp4cAFxyqk7NhiH/FgnYGbbWWGkjKQQY3TxEitCzQdk7p0Wu76o0FkjuBwXiVH 2Dg5GkZntUYHmh7C7r68i/lLSdsF0OcuA1BfQ15WDPiUYtJHbjCzEhJEJ9F1fW4CSoBa khCoH7AF8Speu+33IkgkUZJNsl734DdLOmVBBUhwR0J5x8OL60XWZn6dVPDktK0uYZyY STfI+k0NDFh4ebSmg1x4NiORk3wVn8f8pbTx/cFFLCIJdycWBKOR9MKgZnroaxd6/GLI VygAjCvqQjJqWXgTeulGShbJMm30zj4FP81VlH6EQDYtPjzDPJbE9QL+kDGi985PaEAa KZEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9owB6N5YoTr+QgRWYSW+w97CM/a02Li4ocdyLucMnlA=; b=nRZWAGsrSd6u14zAm04lsG+qIy2J+cWvCuaWH2t1F2Nfm1J/gtQL/MZC6gvnXldiPO M1TnHjLhA6bNCrHSp6u5zQ5C3Bve4lEehk/jDRBFfGCj34zFYLDk+5Y5hLmzAo2J6uac wADaAi01rJRPZIbs1WDw/MDnVODwwdgyPGjCe3Im/9mtB0pWGYppwe+eDByO+ZaCceME qTW406vVrqW9EBVACzmkIYvs4VlCYR7SnsDdB/F1wO45+K1B2iYPv1hPha74qRna2wxN DKYTOLuvhYOPDOdWhdRjgptmo/V1SzRwZS6tCwSpa8MebvuZ/rZzPNrDZUn+mRrvcs/A aRCQ== X-Gm-Message-State: AOAM533ei4bXcmabGnsugq9B3wwrMFlqD0X2rDCykfgbiGTscmO0xOJl TiYessV2aKp2i3vA3oiyLJEoeKCyy2lRcKlbvyM= X-Google-Smtp-Source: ABdhPJwagcH+IMCLFpcz6CGUl5oYhyGNJls9L62J/M3CQCdOJiJr0Rvnef8YwBvKPwiyJDIDZDjyOZlJdWHq94p6Rm4= X-Received: by 2002:a67:b149:: with SMTP id z9mr17006698vsl.85.1591106349968; Tue, 02 Jun 2020 06:59:09 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Emil Velikov Date: Tue, 2 Jun 2020 14:55:52 +0100 Message-ID: Subject: Re: [PATCH 1/7] drm/rockchip: prepare common code for cdns and rk dpi/dp driver To: sandor.yu@nxp.com 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 , Neil Armstrong , Sandy Huang , ML dri-devel , "Linux-Kernel@Vger. Kernel. Org" , Andrzej Hajda , Laurent Pinchart , linux-rockchip , dkos@cadence.com, LAKML , NXP Linux Team Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" HI Sandor Yu 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 HTH Emil 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; } _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel