Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp4877367imm; Tue, 26 Jun 2018 02:00:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcuwrjQZtK81Q/e0ZLnkNHamXz4o1WYTnGzE7uWaMnV4UE4yvW7z2UyT3gAG8P7QU3AbbP1 X-Received: by 2002:a62:db05:: with SMTP id f5-v6mr650515pfg.123.1530003631702; Tue, 26 Jun 2018 02:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530003631; cv=none; d=google.com; s=arc-20160816; b=NurvHzHazPP3kCThknsS1w3T/02Zk7vH6l3FdpIDn+0SCe4BZZaJz66Ch+VQ2mtf9i W7HrtOISlkQY7pyIdlRYdBZAAAynb4NnYJbb6nOhHhmhu94vkbbFpTNCHI22vEPGzEjD uoAf7xF5fsnojC+70twz9VIcJRR3F36unwmbSRqea5OweocZF1R5ln4tC8R9xmR0WLM+ h/Cbs1dVUfsSVPDfiLM5pqDxBjXovAyRD9wk5FtNUeSA4I656rSIUZHAkGMxpu+mfB/y RcgjT1VxM/+brlLft5MFlSzzouU+VsjNBNYDn9rRmX8LXCEoK4w3hb7qmP0lwYZ3kF/u O2CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=y16P2CcV1gEw9RfTDw2lQkquA3y2sxFuGhI8yqXLIQI=; b=cKdOFPisiL+Kndb+SjSBRu7V1W2DLZkNHJW9haBX6Dyw/GQbxacqNQ7VzVKWQ6LyZf JEnV1qaaJiXFlgM/vhRfxVWB3PAptM9yqCBr9Z5G6Sx3X2Bz9aN4s5KwQHn0u6e5CyTU 2zKxNYo9wbTODmIrduynrcZWO0gX2SiAHkXd/1vbxZ7F1a6/b/Zn4R0KQ+tyy/F/80Hg wkoLJpSE+6NfBSfOAPdOG34nRZBSxJYn+XD1IcnY+ah7PWY6kjvd7juORj6mBLGlj8r7 LaUhN/IFdXGtS3qkSlaT7bIV8cEqwR2TE+0JVTWtwAm10oxOwUEMF000sMoanOGGcGKD W61A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b="b7X/zPBF"; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z19-v6si1166330pff.100.2018.06.26.02.00.16; Tue, 26 Jun 2018 02:00:31 -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=@broadcom.com header.s=google header.b="b7X/zPBF"; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933512AbeFZI7c (ORCPT + 99 others); Tue, 26 Jun 2018 04:59:32 -0400 Received: from mail-oi0-f44.google.com ([209.85.218.44]:33164 "EHLO mail-oi0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932210AbeFZI73 (ORCPT ); Tue, 26 Jun 2018 04:59:29 -0400 Received: by mail-oi0-f44.google.com with SMTP id c6-v6so15288322oiy.0 for ; Tue, 26 Jun 2018 01:59:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=y16P2CcV1gEw9RfTDw2lQkquA3y2sxFuGhI8yqXLIQI=; b=b7X/zPBFugpvwWEdl377IRWui/9fl2ZR6rjC/Bfff28aRA2D+yy60ywPRrxUmqlF6P ysMewjtpOL1pESxtQjgiXLD8WxtAAyQdgeEZjMmZN8mE1soH9hc1B7AvSJhtpM88vIDs t80nFZ+Z+UjtdR3yVzDAi783F8fVgGVTMXW38= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=y16P2CcV1gEw9RfTDw2lQkquA3y2sxFuGhI8yqXLIQI=; b=mSzNUMDOJbwUBqJqtQ4lRQgAJMWxD1M+DbsuT7InAvQX3pHHrCgJGM1X/kKPznh8lG C3JUHWI3ltYCN6A6/pKWAirNTNI8F8vdRYQ2XcFuiCdaNu8SWMuJdINN5eWUQewnkV6/ ady+tH8nYOy60C3gGP+nYzKjJY9WOKoX67Q26tQ2Sg6QCqkc4bGPZRDgb04JPd6/dYnT Jjk1cXcvQkEjuRVPjDm+9WBzJ1Li5npose1WVpis5q/og98XSf3EcEsYHDWzUPtnhygx LdHDgRXsaG6N/fqV/77ACozEiZlXtQTrddLwCzPzT5mKV/bCrnOmy0VAmJZ6FMQ2fodb 8l3g== X-Gm-Message-State: APt69E1qWDPvqJ5h7soSUaMxYm5fQRRKAxmtjMt2Ecb8q6aKfCueQP4v h3uK/ChyPgrVv3EKEqjcnH8woOkOc/wVei8NuOADNbcx X-Received: by 2002:aca:d956:: with SMTP id q83-v6mr292305oig.349.1530003568429; Tue, 26 Jun 2018 01:59:28 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:4044:0:0:0:0:0 with HTTP; Tue, 26 Jun 2018 01:59:27 -0700 (PDT) In-Reply-To: <152996983664.143105.1441423217241075965@swboyd.mtv.corp.google.com> References: <152908459103.16708.4012421602830600322@swboyd.mtv.corp.google.com> <152994466823.143105.11787470853817181844@swboyd.mtv.corp.google.com> <914341e7-ca94-054d-6127-522b745006b4@arm.com> <152996983664.143105.1441423217241075965@swboyd.mtv.corp.google.com> From: Srinath Mannam Date: Tue, 26 Jun 2018 14:29:27 +0530 Message-ID: Subject: Re: ACPI support in common clock framework To: Stephen Boyd Cc: Sudeep Holla , "Rafael J. Wysocki" , Andy Shevchenko , "Rafael J. Wysocki" , ACPI Devel Maling List , Michael Turquette , linux-clk , Linux Kernel Mailing List , Mika Westerberg Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rafael, Stephen, Thank you so much for detailed inputs. In our platform, all HW clocks are accessed (enable/disable/set rate) in Linux through common clock framework (drivers/clk/) using clock nodes exported by device tree. To manage our HW clocks operations (enable/disable/set rate) we have driver in common clock framework (clk-iproc-pll.c, clk-sr.c). At present, clock drivers get properties information from device tree framework. Also many devices to access (enable/disable/set rate) its clock source in their driver. it must call clk_get function and clocks phandler in its device tree node. It means, common clock framework is tightly coupled with device tree framework. We want to upgrade our platforms to ACPI support in the place of device tree support. So that we need to have ACPI support in common clock framework, to modify our HW clock drivers. At the same time we also configure few clocks as "fixed-factor-clock". so fixed-factor-clock also need ACPI support. These are all the reasons insists to have ACPI support in common clock framework. Ex: SP805 watch dog used in our platform whose driver is register as AMBA device. In this case both apb_pclk and watch dog clock devices get (clk_get API) through device tree APIs. AMBA framework has ACPI support. so probe function of sp805_wdt driver is called. But failed with clk_get API because common clock does not have ACPI support. I thought a solution to upgrade ACPI support in common clock framework, in the similar way we have ACPI support in normal device drivers using DSDT ACPI tables. DSDT table of all devices including clock devices contain all resource specific information of device and clock device name. Need to implement similar APIs like of_clk* for ACPI purpose also to get clock device in driver software. Ex: of_clk_src_simple_get of_clk_hw_simple_get of_clk_src_onecell_get of_clk_hw_onecell_get of_clk_add_provider of_clk_add_hw_provider of_clk_del_provider of_clk_get_from_provider of_clk_get_parent_count of_clk_get_parent_name of_clk_parent_fill With this approach no dependency on AML to provide clock rate, enable, disable. It is like translating device tree into ACPI. Please provide your inputs. Regards, Srinath. On Tue, Jun 26, 2018 at 5:07 AM, Stephen Boyd wrote: > Quoting Sudeep Holla (2018-06-25 10:15:45) >> >> >> On 25/06/18 17:37, Stephen Boyd wrote: >> > Quoting Rafael J. Wysocki (2018-06-16 08:50:18) >> >> On Fri, Jun 15, 2018 at 7:43 PM, Stephen Boyd wrote: >> >>> >> >>> Is this for clk_enable/disable? What about clk_set_rate() or >> >>> clk_set_phase()? Is ACPI's AML taking care of that? >> >> >> >> That's for clk_enable/disable AFAICS. >> >> >> >> AML doesn't manage device performance states at all. >> > >> > Alright. We may need to add a better way for device drivers to get >> > handles to clk pointers on ACPI firmware so they can change frequencies >> > or phase, etc. >> >> Is there any specific usecase/device needing this in the kernel ? SPI >> slaves ? > > Mark Brown has been pushing x86 folks to use clk framework for audio > drivers in ASoC. I haven't seen other uses besides that really. >