From patchwork Tue May 22 11:21:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 10418055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3457D6053B for ; Tue, 22 May 2018 11:23:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20CED28BB6 for ; Tue, 22 May 2018 11:23:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 155B128BF4; Tue, 22 May 2018 11:23:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4658128BB6 for ; Tue, 22 May 2018 11:23:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=rmSb9DJ3mTFo1WpbbwGaFoSPMif/D8uPnvSCyFFCSaY=; b=U4wkFpYiPrrQb3kqElmGM/PrLi lHwO0tN0mZ1PERAYo/S5cTAxo7ksb9tiox0iwwS2ay4hUsxemuiJYKPAsNW7YYMlyeDNG0OXS19E5 psB6gIieJe1Bgf1vexzHpkxV4fWwHHgTZ396aFaBhPyKWQaCchTSku++Juaeb0d7oPYD+ud9Q18bR MiAOCgXo0L6nJvdgsx7QLb0amL5G4H87vdWhLOzidNc9Ge98nojo4Tf/dKEhcSra/RV2A9vsjW3v0 Zy4hyLAZiB+C4BX75Wl9tNXIT/sU3uhFBjEMCMhr9bvWfohasfoSwji7OgqSIIl/0Xs5XojBwTAgj 5NGdY6/w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fL5OF-0002U6-2E; Tue, 22 May 2018 11:23:39 +0000 Received: from mout.kundenserver.de ([212.227.126.133]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fL5Nl-0002De-RA; Tue, 22 May 2018 11:23:11 +0000 Received: from localhost.localdomain ([37.4.249.136]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.167]) with ESMTPSA (Nemesis) id 0LlJ1m-1fuh6b1Qfu-00b0Bn; Tue, 22 May 2018 13:22:27 +0200 From: Stefan Wahren To: Rob Herring , Mark Rutland , Jean Delvare , Guenter Roeck , Jonathan Corbet , Eric Anholt Subject: [PATCH RFC V2 3/6] firmware: raspberrypi: Register hwmon driver Date: Tue, 22 May 2018 13:21:49 +0200 Message-Id: <1526988112-4021-4-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526988112-4021-1-git-send-email-stefan.wahren@i2se.com> References: <1526988112-4021-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K1:fMSwKQEm0FqtE+V6H0dPaG/ijcd5SJCKzZWD62lq1y3ka+dUu6Y 4P6DZkfDFRgdhKEVCc+arsgKRLCqle51jcZm4SI/QUNhXuQyf0FaXktJ9Zf/DkTcftHt+il akl5YV/qXp7mK2m3xTDAom5+M/6+bYF/RPKcp6ScPDwSY8GrzNKIrm/cbiWDpIDaMsPbw7u g3xpm0FYz8OXHrkNUst1g== X-UI-Out-Filterresults: notjunk:1; V01:K0:Id4x2yj9Kh8=:+aFp3KFGQC+EMGvw73bO8k q8yJXwFqf4QcGt65m3aNZ57orjFvL9CkeziOtDY2m+5IrpHllxlTuiFVc88eW3c2pBtlqrCCV OSMxUZjUf3JFXxIlCll7cQZyks9Jziuytlp8x0BMYaPS93wSXV18IXXGaoJW1wSzNxf7YgEab aS14EmFnN5mcJoAn5ggdjzrVu2fZYINloZc4mQmU+uNYRoRquhSPWyldauMbuke4rKnhoDxII X/16BLMqD4ST++2Qwytwxaiipau58HLBJVxbQ12Wv0Z4Fwp7SM23YeH8bh4cYZKl0VFzSIpVt BeTIotGRKSKUoS8HjQIw/38kpqQUHQkjWhWHUjVw2MKUO87vSz91xWcInfzjn67cNXtV+Td1m AJtO/6oSbX2wXQb5Jis6J223ndNgHwPg9wCVcdMhwQn+4dxvLf1shJogOsEi1DTkC9HUR63EM q+9aFAXyCr4fylE2k1eCIuS7MIpD0q+an4G8JS2mrEbiz0DOZpNOMd0FydE76Qe6pYgyJwP11 zzRLvi1QArDqmrhENkq2LkNJpn/OtcCG1Djg2URZo4pf975mdCmFPetl11ns/VEwtuS6UEYf6 v7rNcwPQOa7Va7Y6kOMQk0fqVTxLAC2ogF/NeiDKxpP5IcY75FBiHn/VHPmP7KNXZFaf6Geod 176LPGrkaotZgCfxD8kVJBZOSclHbmM+84mXQO7AR03Bh7uDwchcayvf0Jy903Rkbv30= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180522_042310_188155_3A19D197 X-CRM114-Status: GOOD ( 15.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, Florian Fainelli , Scott Branden , linux-doc@vger.kernel.org, Ray Jui , Stefan Wahren , Phil Elwell , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Since the raspberrypi-hwmon driver is tied to the VC4 firmware instead of particular hardware its registration should be in the firmware driver. Signed-off-by: Stefan Wahren --- drivers/firmware/raspberrypi.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c index 6692888f..0602626 100644 --- a/drivers/firmware/raspberrypi.c +++ b/drivers/firmware/raspberrypi.c @@ -21,6 +21,8 @@ #define MBOX_DATA28(msg) ((msg) & ~0xf) #define MBOX_CHAN_PROPERTY 8 +static struct platform_device *rpi_hwmon; + struct rpi_firmware { struct mbox_client cl; struct mbox_chan *chan; /* The property channel. */ @@ -183,6 +185,20 @@ rpi_firmware_print_firmware_revision(struct rpi_firmware *fw) } } +static void +rpi_register_hwmon_driver(struct device *dev, struct rpi_firmware *fw) +{ + u32 packet; + int ret = rpi_firmware_property(fw, RPI_FIRMWARE_GET_THROTTLED, + &packet, sizeof(packet)); + + if (ret) + return; + + rpi_hwmon = platform_device_register_data(dev, "raspberrypi-hwmon", + -1, NULL, 0); +} + static int rpi_firmware_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -209,6 +225,7 @@ static int rpi_firmware_probe(struct platform_device *pdev) platform_set_drvdata(pdev, fw); rpi_firmware_print_firmware_revision(fw); + rpi_register_hwmon_driver(dev, fw); return 0; } @@ -217,6 +234,8 @@ static int rpi_firmware_remove(struct platform_device *pdev) { struct rpi_firmware *fw = platform_get_drvdata(pdev); + platform_device_unregister(rpi_hwmon); + rpi_hwmon = NULL; mbox_free_channel(fw->chan); return 0;