From patchwork Sat Sep 23 14:32:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 144000 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp365207vqu; Sat, 23 Sep 2023 13:56:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYPKhNrhoytMC8PwP/c3/jblkbOdT5CyqwP/fAu6Y72cIEAtCz1vLq6m3am5gEy0hIDXw6 X-Received: by 2002:a05:6870:891a:b0:1dc:7e71:d475 with SMTP id i26-20020a056870891a00b001dc7e71d475mr4447797oao.4.1695502562342; Sat, 23 Sep 2023 13:56:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695502562; cv=none; d=google.com; s=arc-20160816; b=D8pR2DQo87v4tcu9Z+nIvPT4Ybf0n7w4YmbJJJ60XQvAgRfFiqAXh2On//dJQTzFql 3qfQ4trmw+2T3Je/Ppf+IYQm7dqMUqFa1tiCGzv1GBPSL53ZjPU07vBL9f9QmDSMGwGT +2jhohorrevKVo0LhQ1ouv0R78AZ+wBb//O69Jxb56Jy4wToo5yfyV7aOvvPVfSRjoO2 dEo+HXBReRI8vwNPy6EB06oWeK8jETr4lzrZj0AymLEHjaeJfuwo+CHLO1mnyQ+NZNKP egyYsBueL50gUFLv9IENDkY/e2DZDL+qqCBcYwKZX/JFvdHdJDDVqSt0gufvMVPO2Av6 2PbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0IUdR0OeXW6TxtcwkJB1zHEdYqKDlZG5c3AuVCS/T2c=; fh=x1hGPnZeYvyedQGDVaFY4F5NZX5OfdEJxyYqoMYIkPY=; b=nIR39UHjJt2N7MQ85Zkh/TPHdL+alMcgQv9veC8HTM+vGLcgrADh/MhMes01Hac0Iw bs/+KtPRfA+rescIsIlGWM8B9gYGgMVmu71Lh0bN1bP7JjxZHBpCt4p38Vz6JCSBaRVc aHCiPsg50D3crFWggIs7hog562CUhoVIaR7DOZ6+9wHbSMRrWyl+3FPWybPwE2n6wx3I 8SynlQZI7ODgdpNOmRcBwgJAnytkH0P6+aBGW8S26wbjIIHAz1M6mxXu/TuRo/qzyGKt UZC1YgFB+dpYEiqoxi+OlqEXUmYEiarT/mHE92VJiKXmti8gM8eRfT8eCXjE/XfThCz1 Thfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=DQcyfLfO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id ea22-20020a056a004c1600b0068a55b8e380si6436605pfb.230.2023.09.23.13.56.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 13:56:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=DQcyfLfO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id B169183BB7F9; Sat, 23 Sep 2023 07:32:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231862AbjIWOck (ORCPT + 29 others); Sat, 23 Sep 2023 10:32:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231824AbjIWOcd (ORCPT ); Sat, 23 Sep 2023 10:32:33 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F4611B0; Sat, 23 Sep 2023 07:32:17 -0700 (PDT) Received: from umang.lan (unknown [IPv6:2001:818:e7d2:8300:2412:6733:7e63:fb46]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 843398622; Sat, 23 Sep 2023 16:30:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1695479432; bh=A2Tam7zedvr2m/CrifrP+X/qYDjpbz6xBpyNyE/5KFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DQcyfLfOsUCE12770SL8OShaCH3PUbDb1frOfOz74sHgYwOmOlvyoQ3o9w41YR0Ok NhuRy/9PKQCkwFNsu+eSkVRaE7NH0cCHfXlmhN8t/L/D6CqcTqapTo7Ho2OCxOWKWD nsyjRqZhM/AIrmgTOwXDLOQ2VdwOStCo0ZyD8q1g= From: Umang Jain To: linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Stefan Wahren , Greg Kroah-Hartman , Florian Fainelli , Adrien Thierry , Dan Carpenter , Dave Stevenson , Kieran Bingham , Laurent Pinchart , Umang Jain Subject: [PATCH v12 6/6] staging: bcm2835-audio: Register bcm2835-audio with vchiq_bus_type Date: Sat, 23 Sep 2023 20:02:00 +0530 Message-Id: <20230923143200.268063-7-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230923143200.268063-1-umang.jain@ideasonboard.com> References: <20230923143200.268063-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Sat, 23 Sep 2023 07:32:50 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777863294601033213 X-GMAIL-MSGID: 1777863294601033213 Similar to how bcm2385-camera device is registered, register the bcm2835-audio with vchiq_bus_type as well. Since we moved away bcm2835-audio from platform driver/device, we have to set the DMA mask explicitly. Set the DMA mask at probe time. Meanwhile at it, change the name and module alias from "bcm2835_audio" to "bcm2835-audio" to be consistent with bcm2835-camera device. This does not brings any functional change as '-' and '_' are interchangeable as per modprobe man pages. Also, drop vchiq_register_child() helper which is no longer needed after this patch. Signed-off-by: Umang Jain --- .../vc04_services/bcm2835-audio/bcm2835.c | 19 ++++++------- .../interface/vchiq_arm/vchiq_arm.c | 28 ++----------------- 2 files changed, 12 insertions(+), 35 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c index f3ad2543d1c0..06bdc7673d4b 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c @@ -1,13 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright 2011 Broadcom Corporation. All rights reserved. */ -#include - #include #include #include #include +#include "../interface/vchiq_arm/vchiq_bus.h" #include "bcm2835.h" static bool enable_hdmi; @@ -269,9 +268,9 @@ static int snd_add_child_devices(struct device *device, u32 numchans) return 0; } -static int snd_bcm2835_alsa_probe(struct platform_device *pdev) +static int snd_bcm2835_alsa_probe(struct vchiq_device *device) { - struct device *dev = &pdev->dev; + struct device *dev = &device->dev; int err; err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); @@ -299,32 +298,32 @@ static int snd_bcm2835_alsa_probe(struct platform_device *pdev) #ifdef CONFIG_PM -static int snd_bcm2835_alsa_suspend(struct platform_device *pdev, +static int snd_bcm2835_alsa_suspend(struct vchiq_device *device, pm_message_t state) { return 0; } -static int snd_bcm2835_alsa_resume(struct platform_device *pdev) +static int snd_bcm2835_alsa_resume(struct vchiq_device *device) { return 0; } #endif -static struct platform_driver bcm2835_alsa_driver = { +static struct vchiq_driver bcm2835_alsa_driver = { .probe = snd_bcm2835_alsa_probe, #ifdef CONFIG_PM .suspend = snd_bcm2835_alsa_suspend, .resume = snd_bcm2835_alsa_resume, #endif .driver = { - .name = "bcm2835_audio", + .name = "bcm2835-audio", }, }; -module_platform_driver(bcm2835_alsa_driver); +module_vchiq_driver(bcm2835_alsa_driver); MODULE_AUTHOR("Dom Cobley"); MODULE_DESCRIPTION("Alsa driver for BCM2835 chip"); MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:bcm2835_audio"); +MODULE_ALIAS("bcm2835-audio"); diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 886025f0a452..eef9c8c06e66 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -67,12 +67,12 @@ int vchiq_susp_log_level = VCHIQ_LOG_ERROR; DEFINE_SPINLOCK(msg_queue_spinlock); struct vchiq_state g_state; -static struct platform_device *bcm2835_audio; /* * The devices implemented in the VCHIQ firmware are not discoverable, * so we need to maintain a list of them in order to register them with * the interface. */ +static struct vchiq_device *bcm2835_audio; static struct vchiq_device *bcm2835_camera; struct vchiq_drvdata { @@ -1776,28 +1776,6 @@ static const struct of_device_id vchiq_of_match[] = { }; MODULE_DEVICE_TABLE(of, vchiq_of_match); -static struct platform_device * -vchiq_register_child(struct platform_device *pdev, const char *name) -{ - struct platform_device_info pdevinfo; - struct platform_device *child; - - memset(&pdevinfo, 0, sizeof(pdevinfo)); - - pdevinfo.parent = &pdev->dev; - pdevinfo.name = name; - pdevinfo.id = PLATFORM_DEVID_NONE; - pdevinfo.dma_mask = DMA_BIT_MASK(32); - - child = platform_device_register_full(&pdevinfo); - if (IS_ERR(child)) { - dev_warn(&pdev->dev, "%s not registered\n", name); - child = NULL; - } - - return child; -} - static int vchiq_probe(struct platform_device *pdev) { struct device_node *fw_node; @@ -1845,7 +1823,7 @@ static int vchiq_probe(struct platform_device *pdev) goto error_exit; } - bcm2835_audio = vchiq_register_child(pdev, "bcm2835_audio"); + bcm2835_audio = vchiq_device_register(&pdev->dev, "bcm2835-audio"); bcm2835_camera = vchiq_device_register(&pdev->dev, "bcm2835-camera"); return 0; @@ -1858,7 +1836,7 @@ static int vchiq_probe(struct platform_device *pdev) static void vchiq_remove(struct platform_device *pdev) { - platform_device_unregister(bcm2835_audio); + vchiq_device_unregister(bcm2835_audio); vchiq_device_unregister(bcm2835_camera); vchiq_debugfs_deinit(); vchiq_deregister_chrdev();