From patchwork Fri Feb 21 12:07:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_T=C5=AFma?= X-Patchwork-Id: 13985340 Received: from mx.gpxsee.org (mx.gpxsee.org [37.205.14.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7A7F207E1A; Fri, 21 Feb 2025 12:16:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=37.205.14.76 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740140211; cv=none; b=UsixDAkLIPAhQcMp/h3hST0mWVf/rDE+sTwA6VFfFYr/EAdjDfqISYZ+fuo6rvKtqarJeLTvVma0jqEdG98+OQt/+6T8vJnX9mxo8K8hQHhp/ooH9OxdJfAVZT/cmQGbfpGllNwdMZKnTxRVqm4hYD8sxGjykRN0oJ8SibPeeJY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740140211; c=relaxed/simple; bh=/85CvhojaOEITcE5GoUzlhsmmXD+4jgin8lTFeq++TY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fgl1E4dfbCpHswKFoahC8HjTk89MrTzrZ0+GxyHKQRloJtAbsDaaXsj40/tzJL3DWdDJAn6HP+F9fTU1Ek98jlW11wV1HdhUu7Wk4s9G35XmwttMHcWm5FgO07HXEYYGKP2jvM4WPF7dVpB2aoIR/T8OYrwT5a/e+BZoTSJmQ0Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gpxsee.org; spf=pass smtp.mailfrom=gpxsee.org; arc=none smtp.client-ip=37.205.14.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gpxsee.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gpxsee.org Received: from mgb4.digiteq.red (unknown [62.77.71.229]) by mx.gpxsee.org (Postfix) with ESMTPSA id E3592316A2; Fri, 21 Feb 2025 13:07:49 +0100 (CET) From: tumic@gpxsee.org To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Mar?= =?utf-8?q?tin_T=C5=AFma?= Subject: [PATCH 1/2] media: mgb4: Fix CMT registers update logic Date: Fri, 21 Feb 2025 13:07:42 +0100 Message-ID: <20250221120743.1703-2-tumic@gpxsee.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250221120743.1703-1-tumic@gpxsee.org> References: <20250221120743.1703-1-tumic@gpxsee.org> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Martin Tůma The CMT "magic values" registers must be updated while the CMT reset registers are active. Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 driver") Signed-off-by: Martin Tůma --- drivers/media/pci/mgb4/mgb4_cmt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/mgb4/mgb4_cmt.c b/drivers/media/pci/mgb4/mgb4_cmt.c index a25b68403bc6..bee4bdf54d1c 100644 --- a/drivers/media/pci/mgb4/mgb4_cmt.c +++ b/drivers/media/pci/mgb4/mgb4_cmt.c @@ -206,10 +206,11 @@ u32 mgb4_cmt_set_vout_freq(struct mgb4_vout_dev *voutdev, unsigned int freq) mgb4_write_reg(video, regs->config, 0x1 | (config & ~0x3)); + mgb4_mask_reg(video, regs->config, 0x100, 0x100); + for (i = 0; i < ARRAY_SIZE(cmt_addrs_out[0]); i++) mgb4_write_reg(&voutdev->mgbdev->cmt, addr[i], reg_set[i]); - mgb4_mask_reg(video, regs->config, 0x100, 0x100); mgb4_mask_reg(video, regs->config, 0x100, 0x0); mgb4_write_reg(video, regs->config, config & ~0x1); @@ -236,10 +237,11 @@ void mgb4_cmt_set_vin_freq_range(struct mgb4_vin_dev *vindev, mgb4_write_reg(video, regs->config, 0x1 | (config & ~0x3)); + mgb4_mask_reg(video, regs->config, 0x1000, 0x1000); + for (i = 0; i < ARRAY_SIZE(cmt_addrs_in[0]); i++) mgb4_write_reg(&vindev->mgbdev->cmt, addr[i], reg_set[i]); - mgb4_mask_reg(video, regs->config, 0x1000, 0x1000); mgb4_mask_reg(video, regs->config, 0x1000, 0x0); mgb4_write_reg(video, regs->config, config & ~0x1); From patchwork Fri Feb 21 12:07:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_T=C5=AFma?= X-Patchwork-Id: 13985341 Received: from mx.gpxsee.org (mx.gpxsee.org [37.205.14.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E79C1155336; Fri, 21 Feb 2025 12:16:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=37.205.14.76 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740140211; cv=none; b=J5asLmKNj7aGbS+nVsMtnyh//S55Xpq9/lLIIGIH7nNu2qi/GFXVG4grR7FhdtF1tXjEG2MRZ9x5vQxG9rn3TlUrYVUd+fX12V+kpK6fn5YodCZBZKENp6IUPLO/aCyfd8pG0jkAVGLUqzLuMZvDQ/qoIT971k4EtXd+hnWqtC4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740140211; c=relaxed/simple; bh=xmD6NKAGm9Q5uQLNboQykz4kAobFmsUomdqLzIfO8kY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HOTUGQ9eRaDItV/GCCS1Yg4sF6RBOSuJkpCGd9lrik57qTFCiDSFzliuBLz2qRd7ciEuXolhc8OmRKU364s179ulmX9rmSZiW3pCc/J59E9tyQxFGEE7eHhjGRznpY9BgjYfu6XJSWyeUv6VH5SaQi0977PP/TL+jwzFCPwALxY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gpxsee.org; spf=pass smtp.mailfrom=gpxsee.org; arc=none smtp.client-ip=37.205.14.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gpxsee.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gpxsee.org Received: from mgb4.digiteq.red (unknown [62.77.71.229]) by mx.gpxsee.org (Postfix) with ESMTPSA id E7C6A3142D; Fri, 21 Feb 2025 13:07:49 +0100 (CET) From: tumic@gpxsee.org To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Mar?= =?utf-8?q?tin_T=C5=AFma?= Subject: [PATCH 2/2] media: mgb4: Fix switched CMT frequency range "magic values" sets Date: Fri, 21 Feb 2025 13:07:43 +0100 Message-ID: <20250221120743.1703-3-tumic@gpxsee.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250221120743.1703-1-tumic@gpxsee.org> References: <20250221120743.1703-1-tumic@gpxsee.org> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Martin Tůma The reason why this passed unnoticed is that most infotainment systems use frequencies near enough the middle (50MHz) where both sets work. Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 driver") Signed-off-by: Martin Tůma --- drivers/media/pci/mgb4/mgb4_cmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/mgb4/mgb4_cmt.c b/drivers/media/pci/mgb4/mgb4_cmt.c index bee4bdf54d1c..c22ef51436ed 100644 --- a/drivers/media/pci/mgb4/mgb4_cmt.c +++ b/drivers/media/pci/mgb4/mgb4_cmt.c @@ -135,8 +135,8 @@ static const u16 cmt_vals_out[][15] = { }; static const u16 cmt_vals_in[][13] = { - {0x1082, 0x0000, 0x5104, 0x0000, 0x11C7, 0x0000, 0x1041, 0x02BC, 0x7C01, 0xFFE9, 0x9900, 0x9908, 0x8100}, {0x1104, 0x0000, 0x9208, 0x0000, 0x138E, 0x0000, 0x1041, 0x015E, 0x7C01, 0xFFE9, 0x0100, 0x0908, 0x1000}, + {0x1082, 0x0000, 0x5104, 0x0000, 0x11C7, 0x0000, 0x1041, 0x02BC, 0x7C01, 0xFFE9, 0x9900, 0x9908, 0x8100}, }; static const u32 cmt_addrs_out[][15] = {