From patchwork Sun Aug 29 13:12:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12464077 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=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 268ACC43216 for ; Sun, 29 Aug 2021 13:14:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 124FD60F5D for ; Sun, 29 Aug 2021 13:14:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235382AbhH2NOE (ORCPT ); Sun, 29 Aug 2021 09:14:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235189AbhH2NOD (ORCPT ); Sun, 29 Aug 2021 09:14:03 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88390C061756 for ; Sun, 29 Aug 2021 06:13:11 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id s10so424614lfr.11 for ; Sun, 29 Aug 2021 06:13:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VaIELk3aejG928b4attVmLHeHooVAXSsVOw7u++6ic8=; b=NBuVmcUEZj+2izFzWo7km7GIur/VKIWIdCygLu4Gtd5j+RVmNsWMrgh04N2TZuSMfU qOCfcwDEjE8ZtdKrslnPtXszndze+62w2XWwb6xGVsH1q3jBWtuTLCb9KuSLNbPPRhlK IbpDOICgqNbLc24No+PMG8DhLUM2mN/elJS0GRGV4rFr6iSEdeGZxaI/ykar8IBYY9uy Mctoi0prxcBGI+UT9DvbqIAUUP2Iz4yWSGuhWEeXcrakwQ1fy45teTG3uj0aqnye2YP6 lXtLTZX24wvaqQuWHyNbc/msMLpxxBuORKzKEUoSATLWOgQ2fAAvsiPWesmAzPXBNpqI WsVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VaIELk3aejG928b4attVmLHeHooVAXSsVOw7u++6ic8=; b=pqQIF+4nQQt1DmncvSk0gG2oyt0SYG5FJT4v5E5h+NCVrvov+U4rFUWjQ4S04wbqGK 8Rex3wVvnKAwoirqh+YkaAp1wnTnzUQyl6/JYJhq5oaU3LezL1ijKgf3DGS+BO1yvb3r 7iYS5BseBW7Hmrv/nK4SF4lHn3YfqZB1kOeg7CeurbrREGUKmWMMj8uIpq+/4N7n1IvS dsEqhEcoNAKhCf8lBlhKxcUAabfbgFHupqqV1uzuEC4qfatsqLTpzmTeTh4+t7zvnrkh UEE2uKC3pyUxH5jodSVb1pzfUTQMRdwgSK5awiAseqBigm0Xug/RD1GBVmGKgharguk9 oP/g== X-Gm-Message-State: AOAM533Gf1o4a+8mMQWcO7x4dP3isSmEeXnY6PwGP/lDocxK4udHApVG b1oU+To8erXp+lbxQR+8EaUAYQ== X-Google-Smtp-Source: ABdhPJxoTTCTULxN0AI0ux6Ox/vGsWyAWulCZNHRsyc3AM9WfbWCnshA9YjeDZK67Cxvk0WaVZLaHA== X-Received: by 2002:a05:6512:6cd:: with SMTP id u13mr13935373lff.184.1630242789821; Sun, 29 Aug 2021 06:13:09 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id x13sm712503lfq.262.2021.08.29.06.13.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Aug 2021 06:13:09 -0700 (PDT) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Ulf Hansson , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , Kalle Valo , "David S. Miller" , Jakub Kicinski , Stanimir Varbanov Cc: linux-arm-msm@vger.kernel.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC v2 00/13] create power sequencing subsystem Date: Sun, 29 Aug 2021 16:12:52 +0300 Message-Id: <20210829131305.534417-1-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This is the second RFC on the proposed power sequencer subsystem. This is a generification of the MMC pwrseq code. The subsystem tries to abstract the idea of complex power-up/power-down/reset of the devices. To ease migration to pwrseq and to provide compatibility with older device trees, while keeping drivers simple, this iteration of RFC introduces pwrseq fallback support: pwrseq driver can register fallback providers. If another device driver requests pwrseq instance and none was declared, the pwrseq fallback code would go through the list of fallback providers and if the match is found, driver would return a crafted pwrseq instance. For now this mechanism is limited to the OF device matching, but it can be extended further to use any combination of device IDs. The primary set of devices that promted me to create this patchset is the Qualcomm BT+WiFi family of chips. They reside on serial+platform or serial + SDIO interfaces (older generations) or on serial+PCIe (newer generations). They require a set of external voltage regulators to be powered on and (some of them) have separate WiFi and Bluetooth enable GPIOs. This patchset being an RFC tries to demonstrate the approach, design and usage of the pwrseq subsystem. Following issues are present in the RFC at this moment but will be fixed later if the overall approach would be viewed as acceptable: - No documentation While the code tries to be self-documenting proper documentation would be required. - Minimal device tree bindings changes There are no proper updates for the DT bindings (thus neither Rob Herring nor devicetree are included in the To/Cc lists). The dt schema changes would be a part of v1. - Lack of proper PCIe integration At this moment support for PCIe is hacked up to be able to test the PCIe part of qca6390. Proper PCIe support would require automatically powering up the devices before the bus scan depending on the proper device structure in the device tree. Changes since RFC v1: - Provider pwrseq fallback support - Implement fallback support in pwrseq_qca. - Mmove susclk handling to pwrseq_qca. - Significantly simplify hci_qca.c changes, by dropping all legacy code. Now hci_qca uses only pwrseq calls to power up/down bluetooth parts of the chip.