Received: by 10.192.165.156 with SMTP id m28csp942570imm; Wed, 11 Apr 2018 09:38:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx49bnDDDFuxdgI69fpq+h+tZICOvK0DyB+Q7E7vx9KOqRECuQ4YTGOneJ80LgwCo9OHoWcti X-Received: by 2002:a17:902:3265:: with SMTP id y92-v6mr5748367plb.16.1523464681621; Wed, 11 Apr 2018 09:38:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523464681; cv=none; d=google.com; s=arc-20160816; b=WWTMaYoVX1c5+BpwYJiLenIMlgAWX/ZNJ/byAvsHSkj+/Tm2+2VwwA1uXjtWzQzNa+ uo53gNUPZE5EUSsHx7w6ruuxx3r9odc0pnNxR51Mtp8z1/Bb/Uq/fO5VDwe7/TMM9zlZ F5CJUqbGdgHn7P5oJkt/rsZ7Qqsv4QkR12bdYwDKKG57QVn77upSJa0QOEoWdxJkjT30 RWmffylshO48yQI4tmVks9oSekGFZL9nyhIsAuyID8qXmSWQ3B0YzvEZUVUqO8l90MZO lFvwVRQu4Oxwn5jrVR2bjHu6A/gah5jeMZropGzyORIQGJtaRKxiTR092eiKrAB3+poy uUWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=QUeuHMQyoja/aPRpCI8QwWn35DNbcNs25i35zTu++e8=; b=nhHp+POVSX8Nw4Y3ao2/k4Y08+QdXaPJGr5LqhvVqmx3fGJ2p2qoWLnJH/pq2xkthN ByAtpeS98fpG/m8K6boT/8hrobKubPRYEisbrKoCiwluTf8dBhdyuX4b3uE5hJQGSw1x JyEb1fg4J1Ti/VIUuYsLhr1xVo79vdqzn3CoL7DN3BpQLN8xCntPPImftYeF27PBpwAe 5AgTGdI08yVWFxwYwZrrEMLgBBIGSkHYiyHkakB/jy/LHQkH1hPQDvLtNdWz0YPxH3DZ QSjbFwZPctAkmfSd6etnr/EaLKDsn8TkzxgQWeku9AyF4xtwAsYpoZmQjAv9r9GGXVmH THog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=mWi6B3Pc; dkim=pass header.i=@codeaurora.org header.s=default header.b=mWi6B3Pc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y12si1097998pfl.229.2018.04.11.09.37.23; Wed, 11 Apr 2018 09:38:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=mWi6B3Pc; dkim=pass header.i=@codeaurora.org header.s=default header.b=mWi6B3Pc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753978AbeDKQeo (ORCPT + 99 others); Wed, 11 Apr 2018 12:34:44 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:45870 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753090AbeDKQem (ORCPT ); Wed, 11 Apr 2018 12:34:42 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E45C860D81; Wed, 11 Apr 2018 16:34:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523464481; bh=iFR07TtZn80u7Xw6rUqYWpaITZvizmcKXsUhmmUF8pI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mWi6B3PcWVnMREWpAdzo8Vr3aa5OemLFxf+iynD8au8wLGpmSbbcNf1VAsYh0PvAq c5Vof4HM85Pf4phsGJ8Wqafy1CU2+kqPoNVphEArQ0sbD1AAy8OLCH/mBMAuVJ90li /n2uPlFXxM0nCmIuFNE7IqFkViZ23mVYcBO3Ullc= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from localhost (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: ilina@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4E4C2602CB; Wed, 11 Apr 2018 16:34:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523464481; bh=iFR07TtZn80u7Xw6rUqYWpaITZvizmcKXsUhmmUF8pI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mWi6B3PcWVnMREWpAdzo8Vr3aa5OemLFxf+iynD8au8wLGpmSbbcNf1VAsYh0PvAq c5Vof4HM85Pf4phsGJ8Wqafy1CU2+kqPoNVphEArQ0sbD1AAy8OLCH/mBMAuVJ90li /n2uPlFXxM0nCmIuFNE7IqFkViZ23mVYcBO3Ullc= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4E4C2602CB Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ilina@codeaurora.org Date: Wed, 11 Apr 2018 10:34:40 -0600 From: Lina Iyer To: Stephen Boyd Cc: andy.gross@linaro.org, david.brown@linaro.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, rnayak@codeaurora.org, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, dianders@chromium.org Subject: Re: [PATCH v5 04/10] drivers: qcom: rpmh: add RPMH helper functions Message-ID: <20180411163440.GF19682@codeaurora.org> References: <20180405161834.3850-1-ilina@codeaurora.org> <20180405161834.3850-5-ilina@codeaurora.org> <152306410070.94378.2738189478665128271@swboyd.mtv.corp.google.com> <20180409153631.GB19682@codeaurora.org> <152341338838.180276.13886596646409290675@swboyd.mtv.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <152341338838.180276.13886596646409290675@swboyd.mtv.corp.google.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 10 2018 at 20:23 -0600, Stephen Boyd wrote: >Quoting Lina Iyer (2018-04-09 08:36:31) >> On Fri, Apr 06 2018 at 19:21 -0600, Stephen Boyd wrote: >> >Quoting Lina Iyer (2018-04-05 09:18:28) >> >> diff --git a/include/soc/qcom/rpmh.h b/include/soc/qcom/rpmh.h >> >> new file mode 100644 >> >> index 000000000000..95334d4c1ede >> >> --- /dev/null >> >> +++ b/include/soc/qcom/rpmh.h >> >> @@ -0,0 +1,34 @@ >> >> +/* SPDX-License-Identifier: GPL-2.0 */ >> >> +/* >> >> + * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. >> >> + */ >> >> + >> >> +#ifndef __SOC_QCOM_RPMH_H__ >> >> +#define __SOC_QCOM_RPMH_H__ >> >> + >> >> +#include >> >> +#include >> >> + >> >> +struct rpmh_client; >> >> + >> >> +#if IS_ENABLED(CONFIG_QCOM_RPMH) >> >> +int rpmh_write(struct rpmh_client *rc, enum rpmh_state state, >> >> + const struct tcs_cmd *cmd, u32 n); >> >> + >> >> +struct rpmh_client *rpmh_get_client(struct platform_device *pdev); >> >> + >> >> +void rpmh_release(struct rpmh_client *rc); >> > >> >Please get rid of this 'client' layer and fold it into the rpmh driver. >> >Everything that uses the rpmh_client is a child device of the rpmh >> >device so they should be able to just pass in their device pointer as >> >their 'handle' and have the rpmh driver take that, get the parent device >> >pointer, and pull an rpmh_drv structure out of there. The 'common' code >> >can go into the base rpmh driver and get used from there and then we >> >don't have to hop between two files to see how rpmh is used by the >> >consumers. Code complexity goes down this way. >> >> That would be not be a good idea. This layer is not just providing an >> API interface. There is resource buffering, handling of memory for >> requests and downstream quirks and debug going on in this layer. It >> would be unwise to clobber the hardware centric rpmh-rsc layer. If you >> look at the series as a whole, you would understand why this is >> necessary. I plan to build more on top of these patches in the future as >> we add support for system low power modes. The complexity doesn't go >> away, it just thrown in to another file, which is already decently >> sized. >> >> I could try to use the device as a handle, and internally work on >> getting the drv and other information from it, if that helps. But I do >> not want to clobber these two files together. It doesn't help >> maintainability. > >Using the device as a handle is a good start. Let's see how it looks >once that part of the code gets replaced. I still fail to see how buffer >management and requests are any different from poking the hardware, but >OK. Maybe if this was a TCS "library" on top of the rpmh hardware >interface? This is essentially a TCS library. -- Lina