From patchwork Wed Sep 13 19:53:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 139710 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp494445vqi; Thu, 14 Sep 2023 10:06:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFt+Ud3opXxooYS+h87GIIcB5tV2Nszo+oF33ob6dvYDILwTfKoRTYtYUybMFf6l5b5aKpv X-Received: by 2002:a17:90a:c90e:b0:263:f630:228f with SMTP id v14-20020a17090ac90e00b00263f630228fmr6217487pjt.23.1694711190432; Thu, 14 Sep 2023 10:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694711190; cv=none; d=google.com; s=arc-20160816; b=YCPmG9hszky8O2CPtrP7fX/xH93Ccu/LmXd3EfO0JIT9Ti/1eh/G5EjTr+hc3DIg/q SioAb/vWY94NFTap1wP+tiqqM8zFXmNpo2Ft4sCmAkMPtat+5N7ru8pskjgMvifeS/MP n927M+yyAIyn4hoDeapZ4E6xTFUjKXVe8qo47E9xrvRezYYqlLg2w/YJb0mIuBSFx5xf R5o7uxj7omyGrFXyWx5wKnnY2PbhmRekb/z3fM1kR8BFmnrneM8IAqzjteZmT49FCSGj ouukGM8vQAgdf9aLGbdbjXS44P49KimHK+cCDiTuL8LWGMyi9kJUSNQoe0weFp46vwVw kqAA== 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=lNYs6Zb5UqsRyq7vkIQXj2GGsXBH3Zf+i61pzCpMMM8=; fh=x1hGPnZeYvyedQGDVaFY4F5NZX5OfdEJxyYqoMYIkPY=; b=x2yAdrfD7j/eA/yR4tjM9ZCAVnToT6e2cdatZSU5DlrDQ3MRHAg8XKK1xJp9n/vQnu +sH7gOBS544BsH1aEy9g1S9GPtHsWdNkj43Z22i40uYgtEoBNvyblTYlQn98vUz3tZuS g6rGSdtOKvKcGnKc9HbgL597IpR9WkYaHU8RSYfpgS05z3M/sqaoybubmwrS9OVzUiIf Mrg3WyGPsI0Fv4K9IQFTIUVG/pco+SzxpedjMm9OSifg+dGWwMcz9DELSe7oMLHpMVF7 j5kbiAdnwdhvo1grbB58VVE1u8b01WPHKNlOsThl1woeFXbAb2LTEPU/+bDVeUkztJ7z HTzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b="jOp/Z8CQ"; 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 k6-20020a17090a3e8600b0024e37ccb3fesi2037073pjc.68.2023.09.14.10.06.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 10:06:30 -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="jOp/Z8CQ"; 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 C21648273D35; Wed, 13 Sep 2023 12:55:03 -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 S232500AbjIMTyR (ORCPT + 34 others); Wed, 13 Sep 2023 15:54:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229642AbjIMTyQ (ORCPT ); Wed, 13 Sep 2023 15:54:16 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EC589E; Wed, 13 Sep 2023 12:54:12 -0700 (PDT) Received: from umang.jainideasonboard.com (unknown [103.86.18.170]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D44B0BEB; Wed, 13 Sep 2023 21:52:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1694634759; bh=DmUUNImYbpz5vnZeGQzxG7Dgzt4jEOETZVmtEZfWJ9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jOp/Z8CQJ4AsWqJHsqWBZCz1WLnZtTLVmHK+1vZmJ7gQIj+ghWQSJzfAH8v1gQcEX 5RZ9SUF68KYCtW2lE4fbCQleZPDoolBgsyXcx4GqvPkDnaKZMYjaN0/8UhCk/hpJ4R BNvzacrFAhYkI7U1SqT27Zo3Rjdd1kjyWILrrDIE= 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 v11 1/5] staging: vc04_services: vchiq_arm: Add new bus type and device type Date: Thu, 14 Sep 2023 01:23:50 +0530 Message-Id: <20230913195354.835884-2-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230913195354.835884-1-umang.jain@ideasonboard.com> References: <20230913195354.835884-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 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]); Wed, 13 Sep 2023 12:55:03 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776986983405494967 X-GMAIL-MSGID: 1777033481087416278 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_device.c | 111 ++++++++++++++++++ .../interface/vchiq_arm/vchiq_device.h | 54 +++++++++ 3 files changed, 166 insertions(+) create mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c create mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.h diff --git a/drivers/staging/vc04_services/Makefile b/drivers/staging/vc04_services/Makefile index 44794bdf6173..2d071e55e175 100644 --- a/drivers/staging/vc04_services/Makefile +++ b/drivers/staging/vc04_services/Makefile @@ -5,6 +5,7 @@ vchiq-objs := \ interface/vchiq_arm/vchiq_core.o \ interface/vchiq_arm/vchiq_arm.o \ interface/vchiq_arm/vchiq_debugfs.o \ + interface/vchiq_arm/vchiq_device.o \ interface/vchiq_arm/vchiq_connected.o \ ifdef CONFIG_VCHIQ_CDEV diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c new file mode 100644 index 000000000000..aad55c461905 --- /dev/null +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c @@ -0,0 +1,111 @@ +// 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_device.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 1; + + return 0; +} + +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); + int ret; + + ret = driver->probe(device); + if (ret == 0) + return 0; + + return ret; +} + +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) { + dev_err(parent, "Cannot register %s: Insufficient memory\n", + name); + return NULL; + } + + device->dev.init_name = name; + device->dev.parent = parent; + device->dev.bus = &vchiq_bus_type; + device->dev.release = vchiq_device_release; + + of_dma_configure(&device->dev, parent->of_node, true); + ret = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32)); + if (ret) { + dev_err(&device->dev, "32-bit DMA enable failed\n"); + return NULL; + } + + ret = device_register(&device->dev); + if (ret) { + dev_err(parent, "Cannot register %s: %d\n", name, ret); + put_device(&device->dev); + 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_device.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.h new file mode 100644 index 000000000000..7eaaf9a91cda --- /dev/null +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.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 Wed Sep 13 19:53:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 139217 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp46679vqi; Wed, 13 Sep 2023 18:34:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHNuOahBZTQwzdE9M3k2DcHrt706hwJnUxwCwD4lWvd98NYhJECQ7kql5frg+6ueCkVFcKL X-Received: by 2002:a25:aaa1:0:b0:d4e:bbee:6e04 with SMTP id t30-20020a25aaa1000000b00d4ebbee6e04mr4322288ybi.51.1694655270329; Wed, 13 Sep 2023 18:34:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694655270; cv=none; d=google.com; s=arc-20160816; b=zTylzNGKhQOcID2nwEpDXydAmYb8/Y9e0TZ1gqIgpuwnMwY7+i4otrMXygpLQr69MK 6CIpR80Jksq5uS7SM4tRVcqiwZ3yN+HCZjmyO5RwJVkgPr9BnZosoNPfqlUJrYwHz9LR WYGDqrvHFQH1gOYVeIpIsdFlQ7AqwsSLXz0UfD1zSGG6/+t4iDio5iQjAiDvigryOb6z OvB3CZjyLubs0JBaK7NPlGt3zjQJe2+Z879KRhBO3pmfxak8QtvX1ymbgRVRkl6/+316 KhpTIgq9oKLLTQPAXjx7dwTd16x9CoiXKD/WiwfU79omyLfGZZ7vt+AscsV/Y7Q4FUg3 Uz2g== 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=kphXRU5g3JHLpDyqiKrmOedJ4rfUhX0QVxA5v0OuELk=; fh=x1hGPnZeYvyedQGDVaFY4F5NZX5OfdEJxyYqoMYIkPY=; b=sy1Lreqlrqj4tQYKpfgP1WSx/1lYygNUCCSABP4sS5baot/nlIjWGmE37oRukVXI6n o9x9nhwW9XvJ9sviwY6kvjeUakVRiL9xcBvwyGC2lWpNczl3bLzUxofvKwpbqZ6yYDay ZVVOyxUqJTBAecvPD2U02UbF5xg/BO0mg1FW1b4vlPpGquLaKdnkVGPFYkpl1MkQsjJw WAHN6fAZJ/sJtQMkrZ4FA0nkwaY96O47+wCUeTPT8Gwt0ogn7hQriu3qqjhBuxjUJfN3 KzWf/mq1Lh4oH3AEJ2nQovOdrFW+maanP55rVDocw/75/E2ZHmzFXPNdobyf1GzwEoAc ebyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=JVHIo3BT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id az1-20020a056a02004100b005653316de6fsi384420pgb.271.2023.09.13.18.34.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 18:34:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=JVHIo3BT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 91712822C62C; Wed, 13 Sep 2023 12:54:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232524AbjIMTyY (ORCPT + 34 others); Wed, 13 Sep 2023 15:54:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232516AbjIMTyW (ORCPT ); Wed, 13 Sep 2023 15:54:22 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 023B89E; Wed, 13 Sep 2023 12:54:18 -0700 (PDT) Received: from umang.jainideasonboard.com (unknown [103.86.18.170]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C2F8C16B7; Wed, 13 Sep 2023 21:52:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1694634764; bh=LPrKroR5yvaMCi5yUrTeV3TcH+SVi4IliBcGKe/xNZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JVHIo3BT8JJYCSZiTQFHSrCxkmaeFW1ccL9l97hthLz8Vbo+ogKSUdqEockcOz+HG V/DnCy+EbW4VeIb/aE8TZ0U9b3F8dM1ktVWiXmxtxxv50UfEB56NmpNxZgU1hHtYHz ZPH2jWYrvIiTyY20pIvDANgNYl2TuGfPvPRMMiao= 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 v11 2/5] staging: vc04_services: vchiq_arm: Register vchiq_bus_type Date: Thu, 14 Sep 2023 01:23:51 +0530 Message-Id: <20230913195354.835884-3-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230913195354.835884-1-umang.jain@ideasonboard.com> References: <20230913195354.835884-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 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 (howler.vger.email [0.0.0.0]); Wed, 13 Sep 2023 12:54:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776973441494915971 X-GMAIL-MSGID: 1776974844537005425 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 ++++++++++++- .../interface/vchiq_arm/vchiq_device.c | 7 ------- 2 files changed, 12 insertions(+), 8 deletions(-) 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..d993a91de237 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 @@ -34,6 +35,7 @@ #include "vchiq_ioctl.h" #include "vchiq_arm.h" #include "vchiq_debugfs.h" +#include "vchiq_device.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); diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c index aad55c461905..b8c46f39e74a 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c @@ -74,13 +74,6 @@ vchiq_device_register(struct device *parent, const char *name) device->dev.bus = &vchiq_bus_type; device->dev.release = vchiq_device_release; - of_dma_configure(&device->dev, parent->of_node, true); - ret = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32)); - if (ret) { - dev_err(&device->dev, "32-bit DMA enable failed\n"); - return NULL; - } - ret = device_register(&device->dev); if (ret) { dev_err(parent, "Cannot register %s: %d\n", name, ret); From patchwork Wed Sep 13 19:53:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 139132 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:a8d:b0:3f2:4152:657d with SMTP id gr13csp128236vqb; Wed, 13 Sep 2023 15:41:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHK+N2OluTW78NsvusWnWsSQ2tEPLoI0yHyrq625K600yyMS96BCC356qWpaLYyjwnFM5ek X-Received: by 2002:a05:6a00:b87:b0:68b:e710:ee9c with SMTP id g7-20020a056a000b8700b0068be710ee9cmr4577567pfj.19.1694644864795; Wed, 13 Sep 2023 15:41:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694644864; cv=none; d=google.com; s=arc-20160816; b=nQiGAI+sDzd/oLNV/LV3WpADMHWwR7duF9ac7HLSSmPBYM3JLXiKsPs1/2zb+KhS3E aH0xB0Jxs3/hOhR1s6pF9VYqxzSvCgcpbt5hPE0ir6MuD+9OS2dRPoeBoD1yD3tTecxG 3bqHgyxs/AiG/8YCHtu6QLwyPHRSmrLxdBUyBcdpPu7xn8YTlkOXJ/nLnJWY8HmQKcph G8MwOLlwgFUbvlDX6ulqLVbB+WGblflXV33Hy/1TrFVbFPEkcCoqNMeyUb5Lb61l1/hy TCCt4yy1lrVn0rIsWAfV9HT9z1l+vXPs6/Rqof8b0+SaE+WEQXc7WNpWpoSCO+atpqBm AtGw== 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=JbOP1V2rs7StbLGjBpVESX+LpywXb14Z9JE04GVQ7O4=; fh=x1hGPnZeYvyedQGDVaFY4F5NZX5OfdEJxyYqoMYIkPY=; b=Xr2X6UgKHhRXapeLLIzZ1LulR3dEoL2JlmJsVHTdTpGH4yrQXaqzeqnSKfBm0NSczX p1y/x4+oAWn5XkN6onZQ1vISGAg6+U+Bebwc9ww1hAjdOkKpw76kUhrJLZvdXMxPWbzb M9gbxPznKzqsGSlFDe6hdeFD/TRT3b6oDJL+soILkfhNeUzKVPS+2WylW3jE1NqHLpOv jG+IhNy9fGpmEKLqfHein3BGv1JV2uMwjwxFvfuxNn6J1q0zFcb5JZPS7QOg7+7V7igj BuNgQ3cnIETWKQjenTEaX+vQV/JpTQgYWziWBx5UHj92zQOt23+tFCL5hK7QXudJcS5L KVwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=a4FO8FZu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id t18-20020a056a0021d200b0068fea05ecdasi203868pfj.182.2023.09.13.15.41.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 15:41:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=a4FO8FZu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 DE696835A380; Wed, 13 Sep 2023 12:54:42 -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 S229642AbjIMTy3 (ORCPT + 34 others); Wed, 13 Sep 2023 15:54:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232580AbjIMTy1 (ORCPT ); Wed, 13 Sep 2023 15:54:27 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98A361BCC; Wed, 13 Sep 2023 12:54:23 -0700 (PDT) Received: from umang.jainideasonboard.com (unknown [103.86.18.170]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8D533755; Wed, 13 Sep 2023 21:52:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1694634770; bh=bjRAkpStJWZ3WMMqqCEhTrsjzJ8pv1Ax01MVq8FcDao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a4FO8FZuAzx35phrM+lZXl/o/BgYBG5DKnxPxN5ZJWg0J3h6MAG0j5Xu+KXL1k6gU RN93Aq8h3CxtR9QIVH6y5NBr9Tv9vtMByHZksy4U4EPSAsBI6TLP5uCM/fqMalhhRE dzQwurmK2K0P24qL/rBM0I4kfWtJubGjnfbKAWWk= 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 v11 3/5] staging: bcm2835-camera: Register bcm2835-camera with vchiq_bus_type Date: Thu, 14 Sep 2023 01:23:52 +0530 Message-Id: <20230913195354.835884-4-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230913195354.835884-1-umang.jain@ideasonboard.com> References: <20230913195354.835884-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 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]); Wed, 13 Sep 2023 12:54:42 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776963933821896690 X-GMAIL-MSGID: 1776963933821896690 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 | 26 +++++++++++++------ .../interface/vchiq_arm/vchiq_arm.c | 11 +++++--- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index 346d00df815a..52431b834232 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,9 @@ #include #include #include -#include +#include "../interface/vchiq_arm/vchiq_arm.h" +#include "../interface/vchiq_arm/vchiq_device.h" #include "../vchiq-mmal/mmal-common.h" #include "../vchiq-mmal/mmal-encodings.h" #include "../vchiq-mmal/mmal-vchiq.h" @@ -1841,7 +1843,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,6 +1854,14 @@ static int bcm2835_mmal_probe(struct platform_device *pdev) unsigned int resolutions[MAX_BCM2835_CAMERAS][2]; int i; + if (!device->dev.dma_mask) + device->dev.dma_mask = &device->dev.coherent_dma_mask; + ret = dma_set_coherent_mask(&device->dev, DMA_BIT_MASK(32)); + if (ret) { + dev_err(&device->dev, "can't set coherent DMA mask: %d\n", ret); + return ret; + } + ret = vchiq_mmal_init(&instance); if (ret < 0) return ret; @@ -1896,7 +1906,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; } @@ -1976,7 +1986,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; @@ -1988,17 +1998,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 d993a91de237..14bdde610f3a 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 Wed Sep 13 19:53:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 139205 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp41107vqi; Wed, 13 Sep 2023 18:18:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENRyDbll/EzD/Is/ihertkBUYVgRZbXRK+d0QgySOL3L6IeGe0T5wB8MlOA/IQtvBNm1Fc X-Received: by 2002:a17:903:32c4:b0:1bb:c896:1d91 with SMTP id i4-20020a17090332c400b001bbc8961d91mr552204plr.31.1694654305898; Wed, 13 Sep 2023 18:18:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694654305; cv=none; d=google.com; s=arc-20160816; b=g2GVQjG+LunPzg62Orgy/UB254EfLtLTXkpSXl4sb48gjcJy3Ni3QnyhoKuhL7FlqG QESSEC7U2FgjU8uJNzTE+8eE9xEmxhMHyhmA+o32DHWgCgEZUxlHEYHdyDAfg/Fn2MJ4 U7wUTsP00rBidZWLttjb1xDB0HUh745UpmJ/T+B5rJit8O+fEJyXRHLkoXM25eQ6Y6w0 0jPdThfjwdSCbKfGRInIVKjydKTZGCqxvOe1UE4BJf2aGkLIRS0WRd7L87DdhrvZZsdq 6x3LNqw1CNz85q3OJD9zaZ3uEUfKrp5cG65uqOtsNq8/riGHvpxu5bhLgVYtC/qKDEGC yRUg== 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=7W8EWxSIqMYR42PQDw+VQSYJV6yNo216tHjPW0MR56k=; fh=x1hGPnZeYvyedQGDVaFY4F5NZX5OfdEJxyYqoMYIkPY=; b=kAbsLCpZISxiBMMBGI3xoVTwhHmsLWv1XghgzkmJSed/8jIYb4JCxQRuvOGoWSQRMb 0TJ2xn2qRCbdTX2k95zezRnP//O5pKEZmI8UxSUrwPwWfx3JIDkOic+aG6lKpnY459L/ 2bKwZkHbE3MH0ZJqS5k+eZI0qIOKULq8VmqEhGbDJj7dJiPtMCjT2Z5L4SB+xV6g10q0 kwAfqWBrIOyG8D7/YspB4MSVjBUaw2rxyf2AuFFO9FAXvoYxpy25+FFcZJxIue0cQmhr 0WEBXZ5n93FIly53//N2zcHHYseZ92FOS09RLa78VGahdenez6MHnWs4v/1pY+N/TlAo mXWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=bXeYIKXG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id kv13-20020a17090328cd00b001b8a70ee029si486913plb.449.2023.09.13.18.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 18:18:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=bXeYIKXG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 5FC6B822C633; Wed, 13 Sep 2023 12:54:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230146AbjIMTyg (ORCPT + 34 others); Wed, 13 Sep 2023 15:54:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232547AbjIMTyd (ORCPT ); Wed, 13 Sep 2023 15:54: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 1FA211BDA; Wed, 13 Sep 2023 12:54:29 -0700 (PDT) Received: from umang.jainideasonboard.com (unknown [103.86.18.170]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 018F8BEB; Wed, 13 Sep 2023 21:52:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1694634775; bh=G84FC09s3O5Jvu4oDBP/nwA2VJODo/pJYynRAYTItC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bXeYIKXGL7mA3qyTsoGfJqRz9aGmJk1r1cEzBtJ2MyntknhrF1riUCBo5C94Yatua mTpN23aXzIyycOBFZoxXT6CjGSuE8/SdnpdZslcACAcD3mM0ajc7AqIe+ZVFa6fJ5/ JpwjrKp0Tm+DKmRKdvdMhnf3hsxNe8IjM9M/5wDs= 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 v11 4/5] staging: bcm2835-audio: Register bcm2835-audio with vchiq_bus_type Date: Thu, 14 Sep 2023 01:23:53 +0530 Message-Id: <20230913195354.835884-5-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230913195354.835884-1-umang.jain@ideasonboard.com> References: <20230913195354.835884-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 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 (howler.vger.email [0.0.0.0]); Wed, 13 Sep 2023 12:54:41 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776973833735633438 X-GMAIL-MSGID: 1776973833735633438 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. Signed-off-by: Umang Jain --- .../vc04_services/bcm2835-audio/bcm2835.c | 29 ++++++++++++------- .../interface/vchiq_arm/vchiq_arm.c | 6 ++-- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c index 00bc898b0189..7d945703d97f 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c @@ -1,12 +1,13 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright 2011 Broadcom Corporation. All rights reserved. */ -#include - +#include #include #include #include +#include "../interface/vchiq_arm/vchiq_arm.h" +#include "../interface/vchiq_arm/vchiq_device.h" #include "bcm2835.h" static bool enable_hdmi; @@ -268,11 +269,19 @@ 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; + if (!dev->dma_mask) + dev->dma_mask = &dev->coherent_dma_mask; + err = dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); + if (err) { + dev_err(dev, "can't set coherent DMA mask: %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", @@ -292,32 +301,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 14bdde610f3a..2da470740cda 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 { @@ -1845,7 +1845,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 +1858,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(); From patchwork Wed Sep 13 19:53:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 139193 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp32530vqi; Wed, 13 Sep 2023 17:58:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IED7ykezFS5ca3ZHx8bm+nrS1xUQ+1sAJeeoUZUYLBQIG5jJrkPBClcyO6u1ZFNpdI+/H94 X-Received: by 2002:a17:902:778d:b0:1be:f45c:bc38 with SMTP id o13-20020a170902778d00b001bef45cbc38mr4098755pll.2.1694653111736; Wed, 13 Sep 2023 17:58:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694653111; cv=none; d=google.com; s=arc-20160816; b=OUDVByJiRGArffB8h7fbgml8Y74d71ZqITLR6SIuLOowu7nDXEIy4WhVDYBPt7S6qV 2lFS38UJJ8OE3cUn7Pcl4Yu6WZfkupRVBOCA5sgHeRZUlS7l/TbBo4RX8ORK+xJNpYKa TvxtANHbEq6RvkzbwHaIjDF6UvT5D1iOHZC+e385+f/us0QJokUU6sXoZB4vPOwzDExf dCbFSJ5a3ueTSrnDpkia6RDssP2t1BIQhbrEri+KnGacp2VcB3wiyVQEbKZYm1loEat3 3o/rULTi/i4htYvX1ueEkrjwG5/Ttn3hL540HXMo5zHyRgmJes6R1ni4JaYvULcokuAa DBqw== 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=D6PUj9sfdyWZ+D+9KDjuBVudd8d6zNYPioxkQBvCo4g=; fh=x1hGPnZeYvyedQGDVaFY4F5NZX5OfdEJxyYqoMYIkPY=; b=ei3lrMRaCDcDFHaMrXFjbew2zsvBBp55/1Fs2T8CqZxlfaAj1CYzS6eU6xtsY/PtIa 2fnVX0DldmMGw/HEwOJV3Glf2mBb13zPkEftfJP5+eUnegnFgbhrA4njLBjFu6XfO8Az jCqEG4UO5Xl94M/nh+LZ12V0FAMmcRHVwOteTGl+0xvHVji9tG8iYNuhp+b54mYRRr6M jkrzqYh1wT+mcSIBthpirB5prngUbkcLLedc06oeTsKeZbM7wvYeW8rNs88bfUPgtZkX GG/dSuhI0itejc6WCYOC56VT2EgbjZPOZuHHHdGMhLlyFx5x+gE9UNDintxr9I8HMI7t c5sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=QXAk6thM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id u12-20020a17090341cc00b001bbc61fedafsi562155ple.422.2023.09.13.17.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 17:58:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=QXAk6thM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 04B09822C638; Wed, 13 Sep 2023 12:54:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232625AbjIMTyj (ORCPT + 34 others); Wed, 13 Sep 2023 15:54:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232591AbjIMTyh (ORCPT ); Wed, 13 Sep 2023 15:54:37 -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 0657819AD; Wed, 13 Sep 2023 12:54:33 -0700 (PDT) Received: from umang.jainideasonboard.com (unknown [103.86.18.170]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6CB8D755; Wed, 13 Sep 2023 21:52:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1694634779; bh=FCHVNEv/n2Q1J9B1s0VB82C7wBBOUPiKQ1IHpgUhfXs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QXAk6thMUafYWMBT5aM0HeH5o7yc3xG/zrdSiGs/NxhFjunwUG/KrBqVMxaN4wKo7 auGWunZGl1pViUh/GQYj3Kke9ixvqvNJq70tbrrgvSYlPUygzWV8TlrcudEKDe3EyH GvaBzwbiN6Wt6eXBJQVKtt28lUk+VtSkmDPB7bxo= 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 v11 5/5] staging: vc04_services: vchiq_arm: Remove vchiq_register_child() Date: Thu, 14 Sep 2023 01:23:54 +0530 Message-Id: <20230913195354.835884-6-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230913195354.835884-1-umang.jain@ideasonboard.com> References: <20230913195354.835884-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 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 (howler.vger.email [0.0.0.0]); Wed, 13 Sep 2023 12:54:45 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776972581115576545 X-GMAIL-MSGID: 1776972581115576545 vchiq_register_child() is used to registered child devices as platform devices. Now that the child devices are migrated to use the vchiq_bus_type instead, they will be registered to that. Hence, drop vchiq_register_child() as it is no more required. Signed-off-by: Umang Jain Reviewed-by: Kieran Bingham --- .../interface/vchiq_arm/vchiq_arm.c | 22 ------------------- 1 file changed, 22 deletions(-) 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 2da470740cda..5eccf5b277e5 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -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;