linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukasz Luba <l.luba@partner.samsung.com>
To: Chanwoo Choi <cw00.choi@samsung.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Cc: b.zolnierkie@samsung.com, krzk@kernel.org, robh+dt@kernel.org,
	mark.rutland@arm.com, kyungmin.park@samsung.com,
	m.szyprowski@samsung.com, s.nawrocki@samsung.com,
	myungjoo.ham@samsung.com, kgene@kernel.org,
	willy.mh.wolff.ml@gmail.com
Subject: Re: [PATCH v3 2/4] drivers: devfreq: events: extend events by type of counted data
Date: Thu, 2 May 2019 11:07:43 +0200	[thread overview]
Message-ID: <4cd7b7a3-7458-2166-a784-1a94830f5507@partner.samsung.com> (raw)
In-Reply-To: <be9dfa71-b6fd-ebe3-e8be-a7ea28765225@samsung.com>



On 5/2/19 3:25 AM, Chanwoo Choi wrote:
> Hi Lukasz,
> 
> On 19. 5. 1. 오전 6:19, Lukasz Luba wrote:
>> Hi Chanwoo,
>>
>> On 4/30/19 9:34 AM, Chanwoo Choi wrote:
>>> Hi Lukasz,
>>>
>>> On 19. 4. 19. 오후 10:48, Lukasz Luba wrote:
>>>> This patch adds posibility to choose what type of data should be counted
>>>> by the PPMU counter. Now the type comes from DT where the event has been
>>>> defined. When there is no 'event-data-type' the default value is used,
>>>> which is 'read data in bytes'.
>>>> It is needed when you want to know not only read+write data bytes but
>>>> i.e. only write data in byte, or number of read requests, etc.
>>>>
>>>> Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
>>>> ---
>>>>    drivers/devfreq/event/exynos-ppmu.c | 61 +++++++++++++++++++++++++------------
>>>>    include/linux/devfreq-event.h       |  6 ++++
>>>>    2 files changed, 48 insertions(+), 19 deletions(-)
>>>>
>>>> diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c
>>>> index c61de0b..073bf2c 100644
>>>> --- a/drivers/devfreq/event/exynos-ppmu.c
>>>> +++ b/drivers/devfreq/event/exynos-ppmu.c
>>>> @@ -154,9 +154,9 @@ static int exynos_ppmu_set_event(struct devfreq_event_dev *edev)
>>>>    	if (ret < 0)
>>>>    		return ret;
>>>>    
>>>> -	/* Set the event of Read/Write data count  */
>>>> +	/* Set the event of proper data type monitoring */
>>>>    	ret = regmap_write(info->regmap, PPMU_BEVTxSEL(id),
>>>> -				PPMU_RO_DATA_CNT | PPMU_WO_DATA_CNT);
>>>> +			   edev->desc->data_type);
>>>>    	if (ret < 0)
>>>>    		return ret;
>>>>    
>>>> @@ -368,23 +368,11 @@ static int exynos_ppmu_v2_set_event(struct devfreq_event_dev *edev)
>>>>    	if (ret < 0)
>>>>    		return ret;
>>>>    
>>>> -	/* Set the event of Read/Write data count  */
>>>> -	switch (id) {
>>>> -	case PPMU_PMNCNT0:
>>>> -	case PPMU_PMNCNT1:
>>>> -	case PPMU_PMNCNT2:
>>>> -		ret = regmap_write(info->regmap, PPMU_V2_CH_EVx_TYPE(id),
>>>> -				PPMU_V2_RO_DATA_CNT | PPMU_V2_WO_DATA_CNT);
>>>> -		if (ret < 0)
>>>> -			return ret;
>>>> -		break;
>>>> -	case PPMU_PMNCNT3:
>>>> -		ret = regmap_write(info->regmap, PPMU_V2_CH_EVx_TYPE(id),
>>>> -				PPMU_V2_EVT3_RW_DATA_CNT);
>>>> -		if (ret < 0)
>>>> -			return ret;
>>>> -		break;
>>>> -	}
>>>> +	/* Set the event of proper data type monitoring */
>>>> +	ret = regmap_write(info->regmap, PPMU_V2_CH_EVx_TYPE(id),
>>>> +			   edev->desc->data_type);
>>>> +	if (ret < 0)
>>>> +		return ret;
>>>>    
>>>>    	/* Reset cycle counter/performance counter and enable PPMU */
>>>>    	ret = regmap_read(info->regmap, PPMU_V2_PMNC, &pmnc);
>>>> @@ -508,6 +496,7 @@ static int of_get_devfreq_events(struct device_node *np,
>>>>    	struct device *dev = info->dev;
>>>>    	struct device_node *events_np, *node;
>>>>    	int i, j, count;
>>>> +	int ret;
>>>>    
>>>>    	events_np = of_get_child_by_name(np, "events");
>>>>    	if (!events_np) {
>>>> @@ -544,6 +533,40 @@ static int of_get_devfreq_events(struct device_node *np,
>>>>    		desc[j].driver_data = info;
>>>>    
>>>>    		of_property_read_string(node, "event-name", &desc[j].name);
>>>> +		ret = of_property_read_u32(node, "event-data-type",
>>>> +					   &desc[j].data_type);
>>>> +		if (ret) {
>>>> +			/* Set the event of proper data type counting.
>>>> +			 * Check if the data type has been defined in DT,
>>>> +			 * use default if not.
>>>> +			 */
>>>> +			if (of_device_is_compatible(np,
>>>> +					"samsung,exynos-ppmu-v2")) {
>>>
>>> It is not proper to compare the compatible string again
>>> in the device driver. Instead, you can define the ppmu device type
>>> as following and then use 'struct of_device_id' in order to
>>> identify the device type.
>> I have been thinking about modifying the code in similar fashion as you
>> did. Good to see similar approach. I'll take your changes with a small
>> additional code, which sets the 'info->ppmu_type' before the for
>> loop, as an additional patch. Would it be OK if I add you as an author
>> and add Sign-off-by: Chanwoo Choi <cw00.choi@samsung.com>?
> 
> If you agree, just add the my signed-off-by on second line.
OK

Regards,
Lukasz

  reply	other threads:[~2019-05-02  9:07 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190419134818eucas1p1d121f99f6c018c27254f0af8cab5ea64@eucas1p1.samsung.com>
2019-04-19 13:48 ` [PATCH v3 0/4] Exynos Performance Monitoring Counters enhancements Lukasz Luba
     [not found]   ` <CGME20190419134820eucas1p154e839769af0e1b8bae17ce3efa0ba93@eucas1p1.samsung.com>
2019-04-19 13:48     ` [PATCH v3 1/4] include: dt-bindings: add Performance Monitoring Unit for Exynos Lukasz Luba
2019-04-30  4:56       ` Chanwoo Choi
2019-04-30 20:36         ` Lukasz Luba
2019-04-30 22:33       ` Rob Herring
2019-05-02  9:16         ` Lukasz Luba
     [not found]   ` <CGME20190419134821eucas1p2461a27e28387ff2b87c149f09582d2a0@eucas1p2.samsung.com>
2019-04-19 13:48     ` [PATCH v3 2/4] drivers: devfreq: events: extend events by type of counted data Lukasz Luba
2019-04-30  7:34       ` Chanwoo Choi
2019-04-30 21:19         ` Lukasz Luba
2019-05-02  1:25           ` Chanwoo Choi
2019-05-02  9:07             ` Lukasz Luba [this message]
     [not found]   ` <CGME20190419134822eucas1p29c6eff0f500311749b33c4f556123cf0@eucas1p2.samsung.com>
2019-04-19 13:48     ` [PATCH v3 3/4] Documentation: devicetree: add PPMU events description Lukasz Luba
2019-04-30  6:16       ` Chanwoo Choi
2019-04-30 21:23         ` Lukasz Luba
2019-05-02 10:11         ` Lukasz Luba
2019-04-30 22:36       ` Rob Herring
2019-05-02  8:52         ` Lukasz Luba
2019-05-02 20:24           ` Rob Herring
2019-05-06 10:29             ` Lukasz Luba
2019-05-07  9:05               ` Lukasz Luba
2019-05-07 16:50                 ` Rob Herring
2019-05-08  8:28                   ` Lukasz Luba
     [not found]   ` <CGME20190419134823eucas1p1ff852194b1db655ed2dbce72b5f7f3a6@eucas1p1.samsung.com>
2019-04-19 13:48     ` [PATCH v3 4/4] DT: arm: exynos4412: add event data type which is monitored Lukasz Luba
2019-04-30  6:10       ` Chanwoo Choi
2019-04-30 21:24         ` Lukasz Luba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4cd7b7a3-7458-2166-a784-1a94830f5507@partner.samsung.com \
    --to=l.luba@partner.samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kgene@kernel.org \
    --cc=krzk@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mark.rutland@arm.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=robh+dt@kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=willy.mh.wolff.ml@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).