From patchwork Sat Sep 23 14:31:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 143933 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp242491vqu; Sat, 23 Sep 2023 08:34:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE5U0SWK8W29C+AaEa6msI27jYw001EdXevShTYUM61h3iwFZxIXaxNSs3tfUQy+I94GvDC X-Received: by 2002:a17:902:e552:b0:1c4:16f7:d95b with SMTP id n18-20020a170902e55200b001c416f7d95bmr2010079plf.63.1695483260216; Sat, 23 Sep 2023 08:34:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695483260; cv=none; d=google.com; s=arc-20160816; b=b5tuf4ZoKWuHdz27P9fPvJ6f4zwQ33CORqG8mvmZQEzyw4jU0plK0ttr/vRJEhmlrr PgCIwNxueRuQnoeA3cYnVwiohrBC3FGfOEYYQpLacsAzQ4RFdxr7ORGXkieOIIukcfcZ py4EjufOEf+S6mTf5vWz+/R9oEnByuFxNGNfsyDq30acLgvOTNPqAIyQpvK8khVo0k6p UmdtR6UsDdOqwoeWHLjAqAuR4CTx+PafF/2VEbyfJ2m0BMUzRkSU/skH844hYZX0xLCi 07+cLYn5lZiySFCx4ncT5EX6hC8b/EcMk/BAidxXKBbceqs4ppD62/1Bp3XjouBX+ICX ZlYg== 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=QfMg9999WgQhAtfgf8hzLqstfWiZqGKl0aHBM0xvXK4=; fh=x1hGPnZeYvyedQGDVaFY4F5NZX5OfdEJxyYqoMYIkPY=; b=0GvL+F78cnLUwL6Rp59xmFOrwmpLUv40RkeVSpEeHposezfiddRNu4pLojiB+0slbk kOgHXSmNvpGE6N1RLhd9ICoq14tk9m6yIOSWctRYesQLH7ba3IbUtifjduzYEzCycEAe 27mjAiB+cgDSYbYHJ3EvaXuj90iDlth4Xi0oC5mrbUhQgaiNMGik/3xsoKCwgcX7iaue yITQs03gSw+CC8MiGtlQGBD7OJZzVsHTPXH+MPwV6Vm3+MF50d4jEAzWsUYfaBOzzb7H 7n8iKpUPpdCFFwwspiIhXzOCZX0xagoX/d6uUXz5nbL8M57ZlIZjUbFPQXeerTY9XbxD vntQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=YU6fSHWG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id ja17-20020a170902efd100b001bf2dc67da3si5703515plb.209.2023.09.23.08.34.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 08:34:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=YU6fSHWG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id A970E807CEF7; Sat, 23 Sep 2023 07:32:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231640AbjIWOcP (ORCPT + 29 others); Sat, 23 Sep 2023 10:32:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230336AbjIWOcN (ORCPT ); Sat, 23 Sep 2023 10:32:13 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD5F011D; Sat, 23 Sep 2023 07:32:07 -0700 (PDT) Received: from umang.lan (unknown [IPv6:2001:818:e7d2:8300:2412:6733:7e63:fb46]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C638910FE; Sat, 23 Sep 2023 16:30:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1695479427; bh=97rsLMbhlIPh3+VcgvhrEUZUnrr2n4j9XSww0+luu9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YU6fSHWGOVySECtHQmD007BAdRgpUBygTtN540U9BRwoDq61OCbJhqooIhR2hxgt3 4Fy/6QnJ0f1hdr3qrJz6pLuZNrJu+QXgnrCmt/0Bom5usPWWG3aXNOZ3i3l6Bdwb5w ZQ7D38drhJ9Cyg6gplbQ0JG1RSsEEe0qVd8EawsI= 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 1/6] staging: vc04_services: bcm2835-camera: Explicitly set DMA mask Date: Sat, 23 Sep 2023 20:01:55 +0530 Message-Id: <20230923143200.268063-2-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 pete.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 (pete.vger.email [0.0.0.0]); Sat, 23 Sep 2023 07:32:52 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777843054763498394 X-GMAIL-MSGID: 1777843054763498394 In the following patches, vchiq_arm will be migrated to create and use its own bus and all the vchiq drivers (bcm2835-camera, bcm2835-audio) will be registered to it. Since the platform driver/device model internally sets the DMA mask for its registered devices, we would have to do it ourself when we remove the platform driver/device registration for vchiq devices. This patch explicitly sets the DMA mask to bcm2835-camera so as not to introduce a regression when we move away from platform device/driver model. Signed-off-by: Umang Jain --- .../staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index 346d00df815a..fcad5118f3e8 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c @@ -1852,6 +1852,12 @@ static int bcm2835_mmal_probe(struct platform_device *pdev) unsigned int resolutions[MAX_BCM2835_CAMERAS][2]; int i; + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) { + dev_err(&pdev->dev, "dma_set_mask_and_coherent failed: %d\n", ret); + return ret; + } + ret = vchiq_mmal_init(&instance); if (ret < 0) return ret; From patchwork Sat Sep 23 14:31:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 143955 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp279817vqu; Sat, 23 Sep 2023 10:00:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWQPWN4UrARObgy6rSC4woptepu3xRAqoNpzSw+MRpep4t49oaH9PiKb8XYr3TX0sa/PD9 X-Received: by 2002:a17:90a:aa85:b0:274:8eda:4cbb with SMTP id l5-20020a17090aaa8500b002748eda4cbbmr1782805pjq.45.1695488455912; Sat, 23 Sep 2023 10:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695488455; cv=none; d=google.com; s=arc-20160816; b=eLJpyEtdUH9AqrHIrZVUfnmbzt4fGFOGYeHFM2h4kZXwGB6W/KrAhAeAMuurpvg0Tu cpuTRxwGThdSN2txI3XkbO84kp1BRO0dH0KUvZyI2lgc1zkwsyWQ8RLAzIyYWqHXUmv+ GsM/e35xGto75nMEtAD3kUgZ3HKyaG13UKa8Snyki2E/HWuSesOm0vqzLJl2iFjVmCAM 2TpbWCtGz7vFiUABb5qO7BlhiANGlEYlBbH3CIIZaI4paGgiQVID8xA0Ziq40z2FSR3I IK+K6PMUvirQbsaBrIt1LFo8JmlOGkxg2n8PKADfbo83iAUrVhwQvhN/ti6n2GDBtshq VuHg== 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=SBL5sIpyqjQUGEFs8sBcyi3Rf1Xipk3OgAaxSlPnFCc=; fh=x1hGPnZeYvyedQGDVaFY4F5NZX5OfdEJxyYqoMYIkPY=; b=OaglmAAvJK/ZGxRQ/JlEZTbo5Rq+koJTwqubth+uy5zcbuTc04EaAWp8JFfICIS9/u sCLkPrKf7RZZdvzt2Z5M1Rm5NO36fT2WDztHnYF7p6m5L6MQTPkJHJIAEye+Y/9aCMRB ntJzq7MuwGj2EwRueI//kM72hrQdGely6rkUcU1JWQoq/MAsUNek5s0AmPR4/3Ik82pb 1roRH8eFOxj6fLyh1e0QrCjG8l6oklorOoEgV2fb6eWPfdasTgvpF7xewWJcAVinXb4O gCAs5A+jPk0a3QIGC5rRPuJ35XdcrYQ253xFByJ8t0QYErNxkFENbswSVEoNtMm3FJk/ 5Y+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=OSNX5JHn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id om4-20020a17090b3a8400b0027652885184si9208983pjb.91.2023.09.23.10.00.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 10:00:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=OSNX5JHn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 218A783BB7DE; Sat, 23 Sep 2023 07:32:54 -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 S231801AbjIWOcY (ORCPT + 29 others); Sat, 23 Sep 2023 10:32:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231770AbjIWOcU (ORCPT ); Sat, 23 Sep 2023 10:32:20 -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 037C5192; Sat, 23 Sep 2023 07:32:11 -0700 (PDT) Received: from umang.lan (unknown [IPv6:2001:818:e7d2:8300:2412:6733:7e63:fb46]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B85E811A9; Sat, 23 Sep 2023 16:30:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1695479428; bh=M9/U+rgwmYjuJLbT8lvGfo8PXTj+i0WtoCKKe+50Opo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OSNX5JHnKPiUqqd/foqsemkodLQq1WWlJG8HpCZO/G2ScGsj1ai0mJTXp1HFVkbMX sfB3la8BTkGPjBfxNurZmz4CsjmPkNY7JmKISjtt7ibRhtduWzumPRgxBTcwL4wV5B 4ZTZrpxptCLY8yOVRbNI8hS34fJtGFFFWq7Ns9/0= 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 2/6] staging: vc04_services: bcm2835-audio: Explicitly set DMA mask Date: Sat, 23 Sep 2023 20:01:56 +0530 Message-Id: <20230923143200.268063-3-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:54 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777848503319143536 X-GMAIL-MSGID: 1777848503319143536 In the following patches, vchiq_arm will be migrated to create and use its own bus and all the vchiq drivers (bcm2835-camera, bcm2835-audio) will be registered to it. Since the platform driver/device model internally sets the DMA mask for its registered devices, we would have to do it ourself when we remove the platform driver/device registration for vchiq devices. This patch explicitly sets the DMA mask to bcm2835-audio so as not to introduce a regression when we move away from platform device/driver model. Signed-off-by: Umang Jain --- drivers/staging/vc04_services/bcm2835-audio/bcm2835.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c index 00bc898b0189..f3ad2543d1c0 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c @@ -3,6 +3,7 @@ #include +#include #include #include #include @@ -273,6 +274,12 @@ static int snd_bcm2835_alsa_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int err; + err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); + if (err) { + dev_err(dev, "dma_set_mask_and_coherent failed: %d\n", err); + return err; + } + if (num_channels <= 0 || num_channels > MAX_SUBSTREAMS) { num_channels = MAX_SUBSTREAMS; dev_warn(dev, "Illegal num_channels value, will use %u\n", From patchwork Sat Sep 23 14:31:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 143924 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp213032vqu; Sat, 23 Sep 2023 07:36:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXjTrV2BeDf3Q5Ycal1TOAQIXDFuyA4ld3X6UJ2DavPHz4BMQHndrxen1iGjBB1C7CDmfT X-Received: by 2002:a17:902:e54e:b0:1c3:dbad:52d4 with SMTP id n14-20020a170902e54e00b001c3dbad52d4mr2307386plf.33.1695479809742; Sat, 23 Sep 2023 07:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695479809; cv=none; d=google.com; s=arc-20160816; b=prktAr2iVqDY+3Q+fkZcvzAqcSB5Q2AFiXQbmTAuvF9gHbK8kWZM0t4bIlmf/aUzBm tOjBUiO2Ni3n7rKW9dXaQzVXakSTRSZove+QGq7QI8ke49b6TV7UcFfaVW0p0FwePFT/ /lJm4J5ja5lkLhx1q88MAOWdkv50CfuZzAsDOn3bwBHT6fjiJNBxGBKym2Fn1dbZBEB5 Fvlt7WsMB6QOU7tHYMDSYbIXPDbBk58+56aqhyq5yrCJZOuXDn/YmYDT1q8X3GxqWiy/ 44G7G28ZTjtJOOcSLVljbdwCvoJhh8u84daBMpC+JEmbSxjhqkNdAvtYi3qe5ccqVqDr wgHw== 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=Qxqr9QLAhH+Bwa2cwluRKciKyJKNnMQ50eys1ScornY=; fh=x1hGPnZeYvyedQGDVaFY4F5NZX5OfdEJxyYqoMYIkPY=; b=nK5GEKWRQ1Hpzmfk4Sr2BeJkziPMJSRHXNrC7a9lxpkrbV0G3kNqtMDrWH3FZrNI6w eSCbyozdldasiI8iLluLz7PHIQ/OP9+l0WY1Rd5gsx9sPB1B34TWFzP3LW3AhYIBtDic tWaNQah6sGMeiR0zzg77kDonutTvte6UzsSYSh/Ou7Lh5rJ0zUggfY/Wi4wJEGaUwuMF /JUx12Xt4W+XO46saAoF2HZCvyjJqRud/5Fm+87ZFW2QkdOoIiH5gatBid9dIaPLnnH7 Vge11YXKNBWm2dKBX63RpITzA145kPPVmU3UoG8RjS/1RDj2yx32OB5JraqdUjT9fxyJ 5COA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=GxiiGB1o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id kg14-20020a170903060e00b001b89b1bae72si5756104plb.528.2023.09.23.07.36.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 07:36:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=GxiiGB1o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id B7E788056A0A; Sat, 23 Sep 2023 07:32:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231745AbjIWOcT (ORCPT + 29 others); Sat, 23 Sep 2023 10:32:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231680AbjIWOcQ (ORCPT ); Sat, 23 Sep 2023 10:32:16 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD1FD113; Sat, 23 Sep 2023 07:32:09 -0700 (PDT) Received: from umang.lan (unknown [IPv6:2001:818:e7d2:8300:2412:6733:7e63:fb46]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AC3EF128D; Sat, 23 Sep 2023 16:30:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1695479429; bh=2+THR7127i+SAsSXZ3cjqcejLvD97dI0zDmJEtXP0y8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GxiiGB1oPSZEfs0u6urLuJslqXRrx0EPq578Sdx1PUxRhhUGbxk7eA5M4nNEB8vUg CgDxpRVzVnGVFHqoj/6W/fDMOCfb89lGPHQITFzKO7BB2j98KscEQba2nBb1Tyag6F 3rvcYvjT6Xp4+AqFi1nuFjVprXBWdcE7rcqqj0Y4= 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 3/6] staging: vc04_services: vchiq_arm: Add new bus type and device type Date: Sat, 23 Sep 2023 20:01:57 +0530 Message-Id: <20230923143200.268063-4-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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Sat, 23 Sep 2023 07:32:23 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777839437251921810 X-GMAIL-MSGID: 1777839437251921810 The devices that the vchiq interface registers (bcm2835-audio, bcm2835-camera) are implemented and exposed by the VC04 firmware. The device tree describes the VC04 itself with the resources required to communicate with it through a mailbox interface. However, the vchiq interface registers these devices as platform devices. This also means the specific drivers for these devices are getting registered as platform drivers. This is not correct and a blatant abuse of platform device/driver. Add a new bus type, vchiq_bus_type and device type (struct vchiq_device) which will be used to migrate child devices that the vchiq interfaces creates/registers from the platform device/driver. Signed-off-by: Umang Jain --- drivers/staging/vc04_services/Makefile | 1 + .../interface/vchiq_arm/vchiq_bus.c | 100 ++++++++++++++++++ .../interface/vchiq_arm/vchiq_bus.h | 54 ++++++++++ 3 files changed, 155 insertions(+) create mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c create mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h diff --git a/drivers/staging/vc04_services/Makefile b/drivers/staging/vc04_services/Makefile index 44794bdf6173..e8b897a7b9a6 100644 --- a/drivers/staging/vc04_services/Makefile +++ b/drivers/staging/vc04_services/Makefile @@ -4,6 +4,7 @@ obj-$(CONFIG_BCM2835_VCHIQ) += vchiq.o vchiq-objs := \ interface/vchiq_arm/vchiq_core.o \ interface/vchiq_arm/vchiq_arm.o \ + interface/vchiq_arm/vchiq_bus.o \ interface/vchiq_arm/vchiq_debugfs.o \ interface/vchiq_arm/vchiq_connected.o \ diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c new file mode 100644 index 000000000000..4ac3491efe45 --- /dev/null +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * vchiq_device.c - VCHIQ generic device and bus-type + * + * Copyright (c) 2023 Ideas On Board Oy + */ + +#include +#include +#include +#include +#include + +#include "vchiq_bus.h" + +static int vchiq_bus_type_match(struct device *dev, struct device_driver *drv) +{ + if (dev->bus == &vchiq_bus_type && + strcmp(dev_name(dev), drv->name) == 0) + return true; + + return false; +} + +static int vchiq_bus_uevent(const struct device *dev, struct kobj_uevent_env *env) +{ + const struct vchiq_device *device = container_of_const(dev, struct vchiq_device, dev); + + return add_uevent_var(env, "MODALIAS=%s", dev_name(&device->dev)); +} + +static int vchiq_bus_probe(struct device *dev) +{ + struct vchiq_device *device = to_vchiq_device(dev); + struct vchiq_driver *driver = to_vchiq_driver(dev->driver); + + return driver->probe(device); +} + +struct bus_type vchiq_bus_type = { + .name = "vchiq-bus", + .match = vchiq_bus_type_match, + .uevent = vchiq_bus_uevent, + .probe = vchiq_bus_probe, +}; + +static void vchiq_device_release(struct device *dev) +{ + struct vchiq_device *device = to_vchiq_device(dev); + + kfree(device); +} + +struct vchiq_device * +vchiq_device_register(struct device *parent, const char *name) +{ + struct vchiq_device *device; + int ret; + + device = kzalloc(sizeof(*device), GFP_KERNEL); + if (!device) + return NULL; + + device->dev.init_name = name; + device->dev.parent = parent; + device->dev.bus = &vchiq_bus_type; + device->dev.dma_mask = &device->dev.coherent_dma_mask; + device->dev.release = vchiq_device_release; + + of_dma_configure(&device->dev, parent->of_node, true); + + ret = device_register(&device->dev); + if (ret) { + dev_err(parent, "Cannot register %s: %d\n", name, ret); + put_device(&device->dev); + kfree(device); + return NULL; + } + + return device; +} + +void vchiq_device_unregister(struct vchiq_device *vchiq_dev) +{ + device_unregister(&vchiq_dev->dev); +} + +int vchiq_driver_register(struct vchiq_driver *vchiq_drv) +{ + vchiq_drv->driver.bus = &vchiq_bus_type; + + return driver_register(&vchiq_drv->driver); +} +EXPORT_SYMBOL_GPL(vchiq_driver_register); + +void vchiq_driver_unregister(struct vchiq_driver *vchiq_drv) +{ + driver_unregister(&vchiq_drv->driver); +} +EXPORT_SYMBOL_GPL(vchiq_driver_unregister); diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h new file mode 100644 index 000000000000..7eaaf9a91cda --- /dev/null +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h @@ -0,0 +1,54 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2023 Ideas On Board Oy + */ + +#ifndef _VCHIQ_DEVICE_H +#define _VCHIQ_DEVICE_H + +#include + +struct vchiq_device { + struct device dev; +}; + +struct vchiq_driver { + int (*probe)(struct vchiq_device *device); + void (*remove)(struct vchiq_device *device); + int (*resume)(struct vchiq_device *device); + int (*suspend)(struct vchiq_device *device, + pm_message_t state); + struct device_driver driver; +}; + +static inline struct vchiq_device *to_vchiq_device(struct device *d) +{ + return container_of(d, struct vchiq_device, dev); +} + +static inline struct vchiq_driver *to_vchiq_driver(struct device_driver *d) +{ + return container_of(d, struct vchiq_driver, driver); +} + +extern struct bus_type vchiq_bus_type; + +struct vchiq_device * +vchiq_device_register(struct device *parent, const char *name); +void vchiq_device_unregister(struct vchiq_device *dev); + +int vchiq_driver_register(struct vchiq_driver *vchiq_drv); +void vchiq_driver_unregister(struct vchiq_driver *vchiq_drv); + +/** + * module_vchiq_driver() - Helper macro for registering a vchiq driver + * @__vchiq_driver: vchiq driver struct + * + * Helper macro for vchiq drivers which do not do anything special in + * module init/exit. This eliminates a lot of boilerplate. Each module may only + * use this macro once, and calling it replaces module_init() and module_exit() + */ +#define module_vchiq_driver(__vchiq_driver) \ + module_driver(__vchiq_driver, vchiq_driver_register, vchiq_driver_unregister) + +#endif /* _VCHIQ_DEVICE_H */ From patchwork Sat Sep 23 14:31:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 143942 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp263419vqu; Sat, 23 Sep 2023 09:18:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHOlyTrTJ0e02txVcbhfrmQEo5pPyPgAIJqyKITNogmXQHv1mz+hRP+jS7HKOE8ctmYajZJ X-Received: by 2002:a17:902:c10d:b0:1c0:c4be:62ca with SMTP id 13-20020a170902c10d00b001c0c4be62camr2309940pli.17.1695485922465; Sat, 23 Sep 2023 09:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695485922; cv=none; d=google.com; s=arc-20160816; b=dhfNdETt/aJ0fmAktQoojv5i8XNOnmACsaqtab0Utkg/S+6OS92351/BZI/MEaiNq+ K6mA5N0S7j7gv11tAQw/2YB6PvPFtI1F9BlCD7nTgJQD8Laz3PAYyKgwgz8FDQDa4kl2 ofWfOIj7Bu8UBc+xS8HTuovmyRqf+Nb1VYFhjf2pC6gmd8SwOLcUiKzFOAt5eZwpZU4Y B8xJOeCSXDCT+iU2/u8//U7WrNpfpPB/z+FTtkxMMlKyHd0s8XS7Owsk9QNekpHn82ia 1/5+Mpj0KywBs13lHZ6XFDNSoCtfs+URpRFAs6UkeLe0K59SRPk50vuj44tJa4eAOmki UyVw== 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=fFdSZp/RAv5y+kwIQcxN3x8BkNjNF+sSvrjAIb4DDW8=; fh=x1hGPnZeYvyedQGDVaFY4F5NZX5OfdEJxyYqoMYIkPY=; b=WZ0Wavs0p2PLp58Kpv+WcRHAZDZihUiQZp9cWevZFPQa7SCRZvrOteJdlQCYHTxlzV GxNygM/rXxpG8MGQddVUVNtsTFEPLo2eSxiWufWYSkKvEMC6AsT9zEfAshfC3BdxEqZN QNs493LDKMAX+AOgAwk5PLfM5Na5BqWK4foZl3TZLyjGgjJMXI4ObRb241v/FMlv9Xnk lNcdVJNdwoqq7O9yeLdLvvx0iDg7Xuw31FrG6CE4A32PgnXCjszJcwXgotxKebfIIN/R HlglS78Z0LcRwCtIG1EpxdOsIP4BlsXHmNVMAynw5wgxKGyjJx77Db+wCf4Rr1miK/0G B8tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=i0Uuzwne; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id b17-20020a170903229100b001bdd35033ebsi6520681plh.361.2023.09.23.09.18.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 09:18:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=i0Uuzwne; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id DAD628217048; Sat, 23 Sep 2023 07:32:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231818AbjIWOc1 (ORCPT + 29 others); Sat, 23 Sep 2023 10:32:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231772AbjIWOcU (ORCPT ); Sat, 23 Sep 2023 10:32:20 -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 B1CDD113; Sat, 23 Sep 2023 07:32:12 -0700 (PDT) Received: from umang.lan (unknown [IPv6:2001:818:e7d2:8300:2412:6733:7e63:fb46]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A1D831536; Sat, 23 Sep 2023 16:30:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1695479430; bh=OiS/6vUN9OZ5WEDhF9ICm3EsH9faDTmVyUTUv11Lyjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i0Uuzwneh5WRhM44uyo608ZSSywQ7WhkGMFNG8AIQHznLDIuZXZX2EE/aMykvcqxv MLE0+DaqVQBKGi2FMYaSmUuSwbAK1CgMGIgGeCbBZBzptmBpXoCGumVYDQAy8GTWo/ B5NAriMoauRDbuJdeIfB47H7mfaMnK1s/NCKeTjM= 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 4/6] staging: vc04_services: vchiq_arm: Register vchiq_bus_type Date: Sat, 23 Sep 2023 20:01:58 +0530 Message-Id: <20230923143200.268063-5-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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Sat, 23 Sep 2023 07:32:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777845846525635634 X-GMAIL-MSGID: 1777845846525635634 Register the vchiq_bus_type bus with the vchiq interface. The bcm2835-camera and bcm2835_audio will be registered to this bus type going ahead. Signed-off-by: Umang Jain Reviewed-by: Kieran Bingham --- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 aa2313f3bcab..9388859b9b56 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -33,6 +34,7 @@ #include "vchiq_core.h" #include "vchiq_ioctl.h" #include "vchiq_arm.h" +#include "vchiq_bus.h" #include "vchiq_debugfs.h" #include "vchiq_connected.h" #include "vchiq_pagelist.h" @@ -1870,9 +1872,17 @@ static int __init vchiq_driver_init(void) { int ret; + ret = bus_register(&vchiq_bus_type); + if (ret) { + pr_err("Failed to register %s\n", vchiq_bus_type.name); + return ret; + } + ret = platform_driver_register(&vchiq_driver); - if (ret) + if (ret) { pr_err("Failed to register vchiq driver\n"); + bus_unregister(&vchiq_bus_type); + } return ret; } @@ -1880,6 +1890,7 @@ module_init(vchiq_driver_init); static void __exit vchiq_driver_exit(void) { + bus_unregister(&vchiq_bus_type); platform_driver_unregister(&vchiq_driver); } module_exit(vchiq_driver_exit); From patchwork Sat Sep 23 14:31:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 144001 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp368695vqu; Sat, 23 Sep 2023 14:06:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFNBhLHpyTturslbhhH//Ljaq6MheSpEY8cSry3EAuJlqwGegfgJNhyfAFIGaUKvOBaOYV/ X-Received: by 2002:a05:6808:2382:b0:3a7:2d4c:5d4e with SMTP id bp2-20020a056808238200b003a72d4c5d4emr4523586oib.7.1695503174427; Sat, 23 Sep 2023 14:06:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695503174; cv=none; d=google.com; s=arc-20160816; b=MW/3Nv/RDKUCHmTHBbVXnrXdynrhA3ASaIBZm5t4cl/dLBF4j+vY3DAl11wz20ckIt tJhsX7owl2X/gaidcIK36yA73XjVf5R2/ib+dp/WN0TKCgV7zxYXYPEzl3Ji68wECRaE KOcefUMXi2YlWGMlsWjrRuFxW/DrQ9MKf1EzhvC2tLxFK9Ar+eGDnbAdews2p2a96kUM wiPlDfR8tCgXrFx2pNKkHTfzZAAWbylg1flpwxq3iIovum/ChKz3fgm+NJsp3QElZ0Uq O0NuyqpwAxG0iD5Z4oTDmq8lJat/cTVnizgnNnBFmJnvDKP1OAScaPsBIuAo1XJFhvn0 VmtQ== 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=Uuj3VwwvjSK9yZqOICAGut2xHOWAYLUVNwpUBG7Exn8=; fh=x1hGPnZeYvyedQGDVaFY4F5NZX5OfdEJxyYqoMYIkPY=; b=K+UM1AkHOURn61ZOnJCGFz+22SM9AlyIu4t5mDodszKd8oKNUyyg6EGwXbu611VlQB 7TzksEWftZpwKuok1gyQjxx/WAHUsdSbJGI5ckUPsEd0yFcVD/QXtya8WrEtNBqNZgOr +0sgLpOpsf89falvYMMUqutnZHpwcMK6HKgmGz2CBnnHitlUd5b0EjBuWeDCgyYtKgAL Tlyj4AXkrbo4XF2NZbo2RNm4CmME6sz5V1tzALmWBJXvyv/5sMBn6fe1TKohHjq2eD8C CRpcfiOFYTyhwTN1ZfL7O1bL7ZENS40vrh1/a14b0ckZaJu4v4APKKRSJD8v+FCvNV6G mj+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b="Wm/13YRC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id u15-20020a170902e80f00b001bd949bcd75si7322461plg.575.2023.09.23.14.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 14:06:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b="Wm/13YRC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 2EA968080E37; Sat, 23 Sep 2023 07:32:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231876AbjIWOcf (ORCPT + 29 others); Sat, 23 Sep 2023 10:32:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231772AbjIWOcc (ORCPT ); Sat, 23 Sep 2023 10:32:32 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F37701B2; Sat, 23 Sep 2023 07:32:16 -0700 (PDT) Received: from umang.lan (unknown [IPv6:2001:818:e7d2:8300:2412:6733:7e63:fb46]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 954D831B9; Sat, 23 Sep 2023 16:30:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1695479431; bh=x/pyWDX8yelf+FyDWkZ3SLTfqNu4DBRHODYZ2wiONPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wm/13YRCwq0x2XGphzqOuK0BHCu+qtPu8UrVmMioUc2WFeoC9n93kzjEEXUdK5TJl ByN0X2BAQiikdgCkrHP+Lt629OCf2c+Bmp2cqyDu1MKTM4g6jdS9SLkBI34/a0bfxd W9dxXYbFns4AZqPFNAlUsP0UeD2Wkeu4W+L+LfRY= 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 5/6] staging: bcm2835-camera: Register bcm2835-camera with vchiq_bus_type Date: Sat, 23 Sep 2023 20:01:59 +0530 Message-Id: <20230923143200.268063-6-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 fry.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 (fry.vger.email [0.0.0.0]); Sat, 23 Sep 2023 07:32:59 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777863936521441565 X-GMAIL-MSGID: 1777863936521441565 Register the bcm2835-camera with the vchiq_bus_type instead of using platform driver/device. Since we moved away bcm2835-camera from platform driver/device, we have to set the DMA mask explicitly. Set the DMA mask at probe time. Also the VCHIQ firmware doesn't support device enumeration, hence one has to maintain a list of devices to be registered in the interface. Signed-off-by: Umang Jain --- .../bcm2835-camera/bcm2835-camera.c | 21 ++++++++++--------- .../interface/vchiq_arm/vchiq_arm.c | 11 +++++++--- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index fcad5118f3e8..c873eace1437 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c @@ -11,6 +11,7 @@ * Luke Diamand @ Broadcom */ +#include #include #include #include @@ -24,8 +25,8 @@ #include #include #include -#include +#include "../interface/vchiq_arm/vchiq_bus.h" #include "../vchiq-mmal/mmal-common.h" #include "../vchiq-mmal/mmal-encodings.h" #include "../vchiq-mmal/mmal-vchiq.h" @@ -1841,7 +1842,7 @@ static struct v4l2_format default_v4l2_format = { .fmt.pix.sizeimage = 1024 * 768, }; -static int bcm2835_mmal_probe(struct platform_device *pdev) +static int bcm2835_mmal_probe(struct vchiq_device *device) { int ret; struct bcm2835_mmal_dev *dev; @@ -1852,9 +1853,9 @@ static int bcm2835_mmal_probe(struct platform_device *pdev) unsigned int resolutions[MAX_BCM2835_CAMERAS][2]; int i; - ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + ret = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32)); if (ret) { - dev_err(&pdev->dev, "dma_set_mask_and_coherent failed: %d\n", ret); + dev_err(&device->dev, "dma_set_mask_and_coherent failed: %d\n", ret); return ret; } @@ -1902,7 +1903,7 @@ static int bcm2835_mmal_probe(struct platform_device *pdev) &camera_instance); ret = v4l2_device_register(NULL, &dev->v4l2_dev); if (ret) { - dev_err(&pdev->dev, "%s: could not register V4L2 device: %d\n", + dev_err(&device->dev, "%s: could not register V4L2 device: %d\n", __func__, ret); goto free_dev; } @@ -1982,7 +1983,7 @@ static int bcm2835_mmal_probe(struct platform_device *pdev) return ret; } -static void bcm2835_mmal_remove(struct platform_device *pdev) +static void bcm2835_mmal_remove(struct vchiq_device *device) { int camera; struct vchiq_mmal_instance *instance = gdev[0]->instance; @@ -1994,17 +1995,17 @@ static void bcm2835_mmal_remove(struct platform_device *pdev) vchiq_mmal_finalise(instance); } -static struct platform_driver bcm2835_camera_driver = { +static struct vchiq_driver bcm2835_camera_driver = { .probe = bcm2835_mmal_probe, - .remove_new = bcm2835_mmal_remove, + .remove = bcm2835_mmal_remove, .driver = { .name = "bcm2835-camera", }, }; -module_platform_driver(bcm2835_camera_driver) +module_vchiq_driver(bcm2835_camera_driver) MODULE_DESCRIPTION("Broadcom 2835 MMAL video capture"); MODULE_AUTHOR("Vincent Sanders"); MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:bcm2835-camera"); +MODULE_ALIAS("bcm2835-camera"); 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 9388859b9b56..886025f0a452 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -67,8 +67,13 @@ int vchiq_susp_log_level = VCHIQ_LOG_ERROR; DEFINE_SPINLOCK(msg_queue_spinlock); struct vchiq_state g_state; -static struct platform_device *bcm2835_camera; 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_camera; struct vchiq_drvdata { const unsigned int cache_line_size; @@ -1840,8 +1845,8 @@ static int vchiq_probe(struct platform_device *pdev) goto error_exit; } - bcm2835_camera = vchiq_register_child(pdev, "bcm2835-camera"); bcm2835_audio = vchiq_register_child(pdev, "bcm2835_audio"); + bcm2835_camera = vchiq_device_register(&pdev->dev, "bcm2835-camera"); return 0; @@ -1854,7 +1859,7 @@ static int vchiq_probe(struct platform_device *pdev) static void vchiq_remove(struct platform_device *pdev) { platform_device_unregister(bcm2835_audio); - platform_device_unregister(bcm2835_camera); + vchiq_device_unregister(bcm2835_camera); vchiq_debugfs_deinit(); vchiq_deregister_chrdev(); } 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();