From: sudeep.holla@arm.com (Sudeep Holla)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH 04/13] scpi: Add legacy SCP functions calling legacy_scpi_send_message
Date: Tue, 23 Aug 2016 15:47:02 +0100 [thread overview]
Message-ID: <e31c0b43-a32f-bef9-c341-25783871f74f@arm.com> (raw)
In-Reply-To: <53093fb5-22e2-3c17-3345-50c7e9df7089@baylibre.com>
On 23/08/16 09:19, Neil Armstrong wrote:
> On 08/19/2016 06:22 PM, Sudeep Holla wrote:
>>
>>
>> On 18/08/16 11:10, Neil Armstrong wrote:
>>> In order to support legacy SCP functions from kernel-wide driver, add legacy
>>> functions using the legacy command enums and calling legacy_scpi_send_message.
>>>
>>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>>> ---
>>> drivers/firmware/arm_scpi.c | 118 ++++++++++++++++++++++++++++++++++++++++++++
>>> 1 file changed, 118 insertions(+)
>>>
>>> diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c
>>> index 50b1297..bb9965f 100644
>>> --- a/drivers/firmware/arm_scpi.c
>>> +++ b/drivers/firmware/arm_scpi.c
>>> @@ -578,6 +578,8 @@ scpi_clk_get_range(u16 clk_id, unsigned long *min, unsigned long *max)
>>> return ret;
>>> }
>>>
>>> +/* scpi_clk_get_range not available for legacy */
>>> +
>>> static unsigned long scpi_clk_get_val(u16 clk_id)
>>> {
>>> int ret;
>>> @@ -589,6 +591,18 @@ static unsigned long scpi_clk_get_val(u16 clk_id)
>>> return ret ? ret : le32_to_cpu(clk.rate);
>>> }
>>>
>>> +static unsigned long legacy_scpi_clk_get_val(u16 clk_id)
>>> +{
>>> + int ret;
>>> + struct clk_get_value clk;
>>> + __le16 le_clk_id = cpu_to_le16(clk_id);
>>> +
>>> + ret = legacy_scpi_send_message(LEGACY_SCPI_CMD_GET_CLOCK_VALUE,
>>> + &le_clk_id, sizeof(le_clk_id),
>>> + &clk, sizeof(clk));
>>> + return ret ? ret : le32_to_cpu(clk.rate);
>>> +}
>>> +
>>> static int scpi_clk_set_val(u16 clk_id, unsigned long rate)
>>> {
>>> int stat;
>>> @@ -601,6 +615,19 @@ static int scpi_clk_set_val(u16 clk_id, unsigned long rate)
>>> &stat, sizeof(stat));
>>> }
>>>
>>> +static int legacy_scpi_clk_set_val(u16 clk_id, unsigned long rate)
>>> +{
>>> + int stat;
>>> + struct legacy_clk_set_value clk = {
>>> + .id = cpu_to_le16(clk_id),
>>> + .rate = cpu_to_le32(rate)
>>> + };
>>> +
>>> + return legacy_scpi_send_message(LEGACY_SCPI_CMD_SET_CLOCK_VALUE,
>>> + &clk, sizeof(clk),
>>> + &stat, sizeof(stat));
>>
>> Except this one which has a different structure format, why do we need
>> to define legacy versions of other functions ? Can't we play with
>> function pointer or have a boolean in drvinfo structure and use then in
>> the existing functions as I had shown in one of the earlier emails.
>>
>
> The main problem is that the command indexes deviates starting at
> SCPI_CMD_SET_CSS_PWR_STATE, I'll be pleased to know how to implement it.
>
Yes, I was thinking of some kind of mapping to new index using an array.
--
Regards,
Sudeep
next prev parent reply other threads:[~2016-08-23 14:47 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-18 10:10 [PATCH 00/13] scpi: Add support for legacy SCPI protocol Neil Armstrong
2016-08-18 10:10 ` [PATCH 01/13] scpi: Add vendor_send_message to enable access to vendor commands Neil Armstrong
2016-08-18 15:53 ` Sudeep Holla
2016-08-19 8:00 ` Neil Armstrong
2016-08-19 10:39 ` Sudeep Holla
2016-08-18 10:10 ` [PATCH 02/13] scpi: Add alternative legacy structures and macros Neil Armstrong
2016-08-18 17:16 ` Sudeep Holla
2016-08-23 8:09 ` Neil Armstrong
2016-08-18 10:10 ` [PATCH 03/13] scpi: Add legacy send, prepare and handle remote functions Neil Armstrong
2016-08-19 16:13 ` Sudeep Holla
2016-08-23 8:15 ` Neil Armstrong
2016-08-23 14:42 ` Sudeep Holla
2016-08-18 10:10 ` [PATCH 04/13] scpi: Add legacy SCP functions calling legacy_scpi_send_message Neil Armstrong
2016-08-19 16:22 ` Sudeep Holla
2016-08-23 8:19 ` Neil Armstrong
2016-08-23 14:47 ` Sudeep Holla [this message]
2016-08-18 10:10 ` [PATCH 05/13] scpi: move of_match table before probe functions Neil Armstrong
2016-08-19 16:24 ` Sudeep Holla
2016-08-23 8:20 ` Neil Armstrong
2016-08-18 10:10 ` [PATCH 06/13] scpi: add priv_scpi_ops and fill legacy structure Neil Armstrong
2016-08-19 16:39 ` Sudeep Holla
2016-08-23 8:22 ` Neil Armstrong
2016-08-23 14:50 ` Sudeep Holla
2016-08-18 10:11 ` [PATCH 07/13] scpi: ignore init_versions failure if reported not supported Neil Armstrong
2016-08-19 16:46 ` Sudeep Holla
2016-08-23 8:23 ` Neil Armstrong
2016-08-23 14:54 ` Sudeep Holla
2016-08-23 14:55 ` Neil Armstrong
2016-08-23 15:01 ` Sudeep Holla
2016-08-18 10:11 ` [PATCH 08/13] scpi: add a vendor_msg mechanism in case the mailbox message differs Neil Armstrong
2016-08-19 16:47 ` Sudeep Holla
2016-08-18 10:11 ` [PATCH 09/13] scpi: implement rockchip support via the vendor_msg mechanism Neil Armstrong
2016-08-18 10:11 ` [PATCH 10/13] scpi: grow MAX_DVFS_OPPS to 16 entries Neil Armstrong
2016-08-18 10:11 ` [PATCH 11/13] dt-bindings: Add support for Amlogic GXBB SCPI Interface Neil Armstrong
2016-08-19 13:45 ` Rob Herring
2016-08-18 10:11 ` [PATCH 12/13] ARM64: dts: meson-gxbb: Add SRAM node Neil Armstrong
2016-08-18 10:11 ` [PATCH 13/13] ARM64: dts: meson-gxbb: Add SCPI with cpufreq & sensors Nodes Neil Armstrong
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=e31c0b43-a32f-bef9-c341-25783871f74f@arm.com \
--to=sudeep.holla@arm.com \
--cc=linus-amlogic@lists.infradead.org \
/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).