From patchwork Fri Feb 14 23:17:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Majewski X-Patchwork-Id: 865431 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C2691FDA62; Fri, 14 Feb 2025 23:18:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739575107; cv=none; b=up1/Rv6ppZSxPII+xJbTn/trBdL3ybf85YuTXwhuqoW3p2qMa/XNdOS9f/2FIf8KEotcWu7QPTuWz/DKHIK3D3++fADaRRWyGL1/mIm40+V5yiUFkCHAjLPD4V0p2T1AYtBGEbXiKM1CgzjrdZ+YQglCp08Cwxdo8ofKXVXsnfw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739575107; c=relaxed/simple; bh=Vhn3QGHE1MLEzmoNMXFb1/tc8Q7VKmv1LdtWM8MWBxc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YvRQmtoxP42511TcxZmmCg6kRwGyY3Xg5yPrEMvtEOzyszF+NcX0QEbdmLCsaye8pAjgACRDurHwy86ir+LFj3RYuJEPKedjMG/X9EfAt1wCqxNZ2j3kjmt7HNxZ/PznAMOna3ssgbra2LiF/JkIVD2d67ccjC1BMMdEMoJ8kaE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FTUGZ7tR; arc=none smtp.client-ip=209.85.219.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FTUGZ7tR" Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-6e66cd2704bso409196d6.3; Fri, 14 Feb 2025 15:18:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739575104; x=1740179904; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=icOWIv/es9uutoyRB9kkQJTmmKKERue49bJNnCoF7Oc=; b=FTUGZ7tRLXTW2XDTLE6W7WcUfQDW685zWOygsIDXft/xEOSIjbX5KfOAhkDuNG9q7u repoAWj/DwnZn+BXBJ1d+Q7cftLfF63/yMNxK8JlvmhE6cpGlxWYtXHjH0wqJxduXFKU 5TFAS1yNa7LlLFKetPPakv1mb1p1XPw7siVi0SJuJQt2q3UCYUlZiSI3FasdTansIg7m ol/mUAqDmVJH4L6IYZuqASv9DE9uWGU2NN68txZGj+SicqmNNOAM5NyHK/QCGyrK1rrj BLyh6zVb5iYSrah3xZxl28xltjdmiA7x2mHuuxFf/0kMrCZOOgipFqQITabswxpElf3T sdOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739575104; x=1740179904; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=icOWIv/es9uutoyRB9kkQJTmmKKERue49bJNnCoF7Oc=; b=BHWO2cPZjPXWfubGlXHvrL1Nm5+MeaNrk33mv640IP3iIT5cDO5nODJ25pfKqK88RV oHFVwg7SZ/3M23K/ekT+c5tdcw26H1QDF9aUXdRPFTgyMFxfxwbcG4kAa/uiKUCaXA2R n5H7YwIqaf5zzcXDMMoF89+8dvzBAKu2tLsuCVhD+5V9GMjnuT49OceuVnlJ8NQ/AZjZ hggxQrL/Eb2HA0ixhGffGeLuPLAByPNrlz6ojA5CB+gsZQn5541ckSkdZ7mTXSTm8yeV JjLVr9/FMcTI7m0Vw/OobxQDngq1199IMkuqGKGyC4SeDjGIQ04wvEYkzwXv8NhFglp+ eVXw== X-Forwarded-Encrypted: i=1; AJvYcCWiq1+xNlAJHzfSuefrssWIQLLnLQGYoYmGZpFiyUBj8NDIsHJ66M2U/iK+RundrKt5esKZk4xLX8OZDMw=@vger.kernel.org, AJvYcCXIME3ilP+2SUSB5lryStFRgaiKvuaL91rk6vNdh1C/u4MuXICJVvBBeDZnUqy1+EvzYOzCaWyn8ylSlKo=@vger.kernel.org X-Gm-Message-State: AOJu0YzcwjUe7JhLPiOKuw/CskAwuyYEND685nUFZQwqnehujnCWQuk0 Pt+abMAJsJMcX84Zvp0iOTAV8W6faZ64ZmfP96I6s9Nqgc81+dVq X-Gm-Gg: ASbGncvtVrC1hg0avw8uI7fS7d5/lNWcpa1ruXImWBNyfy6LZQuNG9fKKHy0EsxR92e 0PT85E9rd1vaghpFQhEnEeKAR3NBZ4uUVO4hrYijKjB4hWvb4k0pK0q0qD7huptIiakuETMkRJD 67oj2+WSDDBfj+jUGsxjjBT2Y9ytqa22STh9gMKlzAawkShmpxdy1V5SM51wcjkgMNVY/Etx6d7 +9uCLLpF9a4r0/nA2BJT7HinSi4CridQxmwsmkjYGyMQY94vM432ou4ioie1bhOzRbyehvl1MhW NwmS85OskVP2BBn7Ys30fn7Aztl3dxds/QE3oMQV5sKnQCAqrGDknuEC X-Google-Smtp-Source: AGHT+IHsvQOy3EtPCYjWxJ334ARhTra6bGLz2x2Itznpk7vAmcxyLOAOHevQQxhDLLWS0ommznhlqg== X-Received: by 2002:a05:620a:46a1:b0:7c0:7e8d:e430 with SMTP id af79cd13be357-7c08a9d7c52mr78025385a.8.1739575104315; Fri, 14 Feb 2025 15:18:24 -0800 (PST) Received: from matt-Z87X-UD4H.mynetworksettings.com ([2600:1002:a012:94a2:4db7:5f35:9da:d13a]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7c07c861221sm257829785a.85.2025.02.14.15.18.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2025 15:18:23 -0800 (PST) From: Matthew Majewski To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Hans Verkuil , "Dr. David Alan Gilbert" , Neil Armstrong , "Uwe Kleine-Konig" , Andrzej Pietrasiewicz Cc: devicetree@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Matthew Majewski Subject: [PATCH v2 1/2] media: dt-bindings: Add dt bindings for m2m-deinterlace device Date: Fri, 14 Feb 2025 18:17:58 -0500 Message-Id: <20250214231759.119481-2-mattwmajewski@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250214231759.119481-1-mattwmajewski@gmail.com> References: <20250214231759.119481-1-mattwmajewski@gmail.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Create a new yaml schema file to describe the device tree bindings for generic m2m-deinterlace device. This device is supported on any hardware that provides a MEM_TO_MEM capable dma channel with interleaved trasfer support. Device tree bindings are for providing appropriate dma channel to device. Signed-off-by: Matthew Majewski --- .../bindings/media/m2m-deinterlace.yaml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/m2m-deinterlace.yaml diff --git a/Documentation/devicetree/bindings/media/m2m-deinterlace.yaml b/Documentation/devicetree/bindings/media/m2m-deinterlace.yaml new file mode 100644 index 000000000000..e39599d7d07b --- /dev/null +++ b/Documentation/devicetree/bindings/media/m2m-deinterlace.yaml @@ -0,0 +1,44 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/m2m-deinterlace.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: M2M Deinterlacer + +maintainers: + - Mauro Carvalho Chehab + +description: |- + A generic memory2memory device for deinterlacing video using dmaengine. It can + convert between interlaced buffer formats and can convert interlaced to + progressive using a simple line-doubling algorithm. This device can be used on + any hardware that provides a MEM_TO_MEM capable dma controller that supports + interleaved transfers. + +properties: + compatible: + const: m2m-deinterlace + + dma-names: + items: + - const: rxtx + + dmas: + items: + - description: MEM_TO_MEM capable DMA channel + +required: + - compatible + - dma-names + - dmas + +additionalProperties: false + +examples: + - | + m2m-deinterlace { + compatible = "m2m-deinterlace"; + dma-names = "rxtx"; + dmas = <&edma 20 0>; + }; From patchwork Fri Feb 14 23:17:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Majewski X-Patchwork-Id: 865239 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 350F11FDE24; Fri, 14 Feb 2025 23:18:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739575110; cv=none; b=NyYgx+1cubvvc6oeE+ITYNKimAOahLISCaTydWoVRvCbvJmA6VfAG38B7sGCvTxmqzGqtrfCGRezu2KImF4eYurlgxScePfKADmJgFty9k6q9Sw6OQKl0e8NkicjaQ5I1dHifE+vFiUtEyxGpIPaavBf9doRo4Wk8QkCDMrU/ck= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739575110; c=relaxed/simple; bh=TE3oEgraRsG6/yVyd1qKvYuB31ewWb6CIHQdaS7to1g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kU6KTGt33DUMnwrkXvAmyKVlFXMJCDEjgjf/1WnzngMPTcKsIMJ/Mdr+OSxQo+yuFgX9SUfEz5Aje8gGYTGA7yHiBMr71lIe7zAvw6XNv25T4qvmKT2ya5lUUVPmTlq6rxRDXwFweCFvjCsmw0cJprmb0Ppi40E8hMgtFmSwMMs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hIi5Q3Iu; arc=none smtp.client-ip=209.85.222.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hIi5Q3Iu" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-7c089f89f49so4970785a.2; Fri, 14 Feb 2025 15:18:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739575108; x=1740179908; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NgSQtsSRJfTvvGbkYKS1L//GTl5a7DNUmVZ6Swpvw8k=; b=hIi5Q3IuziAuKZ9B/3cwvjnAOgjED1aN7P2efu7HMpwsTxBO82Sw9hD8nKEclyFDjN 5DTnajTKSoTXuGKaE2HLdvZUBdzSSxNVysM4LE8AZzBVbJ0Le3Zi4kZhOL1zHNp214dP gFxOJcATFXiLvWDdomSYQ84256juuGvLGAchPI0p7A++kYSZ6m6o47/l3gOyWRfHE6HB WGp44t3kKQRAQSI5PFI/rJv/Qk52tCpHJ9XUbCRJkWhZTFSTbND5aaf+V9u4bCWOcqSs lD+KPDkJwM0uAEeqaNQc0+dmD9U0fB3AyBLbvicu1k4GtZEB8AahwIe+7FZuLcxoKa8y w3pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739575108; x=1740179908; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NgSQtsSRJfTvvGbkYKS1L//GTl5a7DNUmVZ6Swpvw8k=; b=iw5ylq0QAvdMBQjbtBjkBRRejkJqIZ9rrrFvxEZmWclZ0W/y+wVazvDebCW51r1t7+ mEM7Kvkqhlm2v/DGhp0U9NFeUG1SpdFduM7XioyW6yedcuaobMb5lddfrRDrz4abVZdd 3Ai8wmaANAYu2f0cwb6yOs4BSBQWUeeE2byL6KJKgAAONRqTFBYYnYps45B9CUn9Cj8Z MERt9cPU19ej2A98xaBW6+ESG9SunnQUj4ZH0X/uqVjL/sm3hhcRGdo4O05MWl+lkByg LAJjl38Yd9uzYr5wQxq4oDKBFgyU/na2/pMkB09hs9OhEJUckbEv9oP8V69/13w5x38t UKzg== X-Forwarded-Encrypted: i=1; AJvYcCUraYUtL/La1hBLtBiJH1qY5+qUChgmWgeAP8zhVVuGu2XsuWTyyoNT/tIaH9YPbujTq/VPDYJHKjMoGiI=@vger.kernel.org, AJvYcCVWBd97ZZsq/vZ6POPRYodDP856sIfTO2M27oURcCRXStTonjmMpqhSj0MwaZFhUxPwv57wTa/YIQzjmuQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxbkM6+OV7ZX2elwgUKEJYrj2MYwweYEPsbwylqcamcI4wZ7NMi yXad6wWjtI7aJn0O6skT/6nN0inqLWqI60koZZpf+FPUQma8eMAJ X-Gm-Gg: ASbGncuqWG/SkB2PEJosyiJDhxqolze7dPPlUTg6mEtXKNldPDq56NQPgOuZ2nIBDbn Bat69WKrf62CK2AO77L34EItCfGWLrQrCdHFerJw9e3+2kQs1RcqXpOraJaY26zLPkwwqun4PlK Ns2vx9QOA9yysOd2OyAZiLDQU/RhbaYymdfFInbXVuRGaxMnKsycFsjmJCzJ4Y1xYw9z542fW29 oMEv6ljB+X2IhD0TYDPV+IIhg1ygl31SiWhHo88H5SsByNWNINGUPKB5oXXpILnzuGWIOHbAJ7+ ovG2q8vvhg89H2JAT7Ty00XhMfv9fDObKdWRI0wcvoH+X5BVg8XWb/Ph X-Google-Smtp-Source: AGHT+IEnA6hPXLEZGg6jZWlbna3sCUjUWGNdicF4gvRZ69+nb1u0v6q0ZeT6O+JCvBCtDhfJdCuVhA== X-Received: by 2002:a05:620a:384d:b0:7c0:831f:c5ac with SMTP id af79cd13be357-7c08a9d4dfdmr55037585a.9.1739575108022; Fri, 14 Feb 2025 15:18:28 -0800 (PST) Received: from matt-Z87X-UD4H.mynetworksettings.com ([2600:1002:a012:94a2:4db7:5f35:9da:d13a]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7c07c861221sm257829785a.85.2025.02.14.15.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2025 15:18:26 -0800 (PST) From: Matthew Majewski To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Hans Verkuil , "Dr. David Alan Gilbert" , Neil Armstrong , "Uwe Kleine-Konig" , Andrzej Pietrasiewicz Cc: devicetree@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Matthew Majewski Subject: [PATCH v2 2/2] media: m2m-deinterlace: add device-tree support Date: Fri, 14 Feb 2025 18:17:59 -0500 Message-Id: <20250214231759.119481-3-mattwmajewski@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250214231759.119481-1-mattwmajewski@gmail.com> References: <20250214231759.119481-1-mattwmajewski@gmail.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add support for loading the m2m-deinterlace driver through the device-tree. Prefer to query the dma device through dma_request_chan(), which will get the dma device information from the device-tree node if present. Otherwise, fall back to the original dma_request_channel() to preserve backwards compatibility. Signed-off-by: Matthew Majewski --- drivers/media/platform/m2m-deinterlace.c | 25 ++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platform/m2m-deinterlace.c index 5188f3189096..ba4e4ee6ad34 100644 --- a/drivers/media/platform/m2m-deinterlace.c +++ b/drivers/media/platform/m2m-deinterlace.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -914,7 +915,6 @@ static int deinterlace_probe(struct platform_device *pdev) { struct deinterlace_dev *pcdev; struct video_device *vfd; - dma_cap_mask_t mask; int ret = 0; pcdev = devm_kzalloc(&pdev->dev, sizeof(*pcdev), GFP_KERNEL); @@ -923,9 +923,16 @@ static int deinterlace_probe(struct platform_device *pdev) spin_lock_init(&pcdev->irqlock); - dma_cap_zero(mask); - dma_cap_set(DMA_INTERLEAVE, mask); - pcdev->dma_chan = dma_request_channel(mask, NULL, pcdev); + if (pdev->dev.of_node) { + pcdev->dma_chan = dma_request_chan(&pdev->dev, "rxtx"); + } else { + dma_cap_mask_t mask; + + dma_cap_zero(mask); + dma_cap_set(DMA_INTERLEAVE, mask); + pcdev->dma_chan = dma_request_channel(mask, NULL, pcdev); + } + if (!pcdev->dma_chan) return -ENODEV; @@ -989,12 +996,18 @@ static void deinterlace_remove(struct platform_device *pdev) dma_release_channel(pcdev->dma_chan); } +static const struct of_device_id deinterlace_dt_match[] = { + { .compatible = "m2m-deinterlace" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, deinterlace_dt_match); + static struct platform_driver deinterlace_pdrv = { .probe = deinterlace_probe, .remove = deinterlace_remove, .driver = { - .name = MEM2MEM_NAME, + .name = MEM2MEM_NAME, + .of_match_table = deinterlace_dt_match, }, }; module_platform_driver(deinterlace_pdrv); -