Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1328932lqp; Mon, 15 Apr 2024 03:12:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXfgbFPII6N6xKxklzSW90QxzpSpBwBB9hBVZaRjrXaLZ6/tZQFu/w3T/m/foGM8bl8yKyE+VCRLpl251F1N3rzg1XGc/nqj08gNYdskQ== X-Google-Smtp-Source: AGHT+IGmSLlj0QOHZIp8FNVt8A4XCNyavqagHCteX0QGehvsRxqr3TC+VJgXvLYLCytW7u1e1hFw X-Received: by 2002:a05:6a00:989:b0:6ed:7684:4833 with SMTP id u9-20020a056a00098900b006ed76844833mr17646166pfg.0.1713175942743; Mon, 15 Apr 2024 03:12:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713175942; cv=pass; d=google.com; s=arc-20160816; b=a3i6M0aBZqBMe7CT11Cs14kF7mazBPB6KBzSgfMFB343R0R4XRaho7Mr97NZ4xtzG4 vY0Lcnqlly2tVOBfom5kpwV0z5tRyURFW4Ap6AXTyP4N2GH5Jg6/lA/+DuUAiYftWCiQ iETOMGEAj5BbPvyhF8wHtnVy9m+cf5jHvZsbWBdO7+5IpX4t5yF51yRfVY5gh4kqrEH3 dLeJO4Gjx9sHGm4BcQyaOXqPaCmhOJEA9LQjGZWxQhYCgz71Mj1e2BMOxNkX56ccNFyN fxQkdPoyURARsFzlbFYcDvIzBYsJ0qB+RqCK2eF6zKB+Rim5YLq7404PpCCtmj5JX9GG P3aQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=rcWuWwbYDzN/Eba2XHYlH7krkiOlk1hd506TNmQ/SjY=; fh=sAMhAjasKG5a0HOgiDnkzZHp54gZIK8rlFfWhtrgGcU=; b=GbcfGkurs6t7eLW63EPTLlGa427S5dopzSBGAwXKGNYeCCTWEa7DUDqTHZZyhosQmW Oqejkoi9qEVGC814xDjybUv2HaJqM/6SMkecXlZVD9pLSQPNzPBnmsO3p0hZQkZIlzXk luXL4H549CCLMJ8Zeaz5UcaZTFttZwU4zgTwuT6ck128ZrqhvuHk3ftsD8gAySKsGH0F m4bCdHf/rirFxy20O17pk33fMvOseUaPSRsk8iUTK9wo0p0ZLKgNDYR/DLwUyT31pBN8 pP5yH/roj36dHNE6Y4mj0XpHnXX0YfjCGNbHsLNN9I54vR/VPL92IoYpDsmCvdzjs+f2 ETcQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dAoPpl0l; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-144892-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144892-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id x2-20020aa79a42000000b006ed4a972427si7666616pfj.246.2024.04.15.03.12.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 03:12:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144892-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dAoPpl0l; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-144892-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144892-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 19A1BB253E7 for ; Mon, 15 Apr 2024 10:09:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11F9058ABD; Mon, 15 Apr 2024 10:07:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dAoPpl0l" Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (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 28D4457889; Mon, 15 Apr 2024 10:07:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713175673; cv=none; b=SjNveSplHT5tAgZMGZ43msjVSYo7etjM5pVWNOLVYpweWfCUD34MFpHkxveVt+2NSUEGucioASxeRm7+RbogthNuZ2KtNyzcPX6rkuhgO0p5RJszZOVvhP8y0qVNtryV2kY3+TkzNrTxOK2/6lSBLuOtTNyG9i7O9rJPJxfODGU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713175673; c=relaxed/simple; bh=aDbcpQbcbf0YX/mOf1pvgn7kmm9ITS7w0AmOppIc5a0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fVs/Uht15QJ4VBkzkIw5oL2vdZcYghrkm8dzlKn0j9ToIMYSVIoiqcP+Og9WAJF4qrqgMAZTN5sgYgxi+f8io77xCBkJQ+9ErswKL+TwbfHuvG7F58+Mv7t8I+9Q4Cs6PViWKZt/mjFd14wEVR34sExosQJMf8JiHan97hdb4kc= 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=dAoPpl0l; arc=none smtp.client-ip=209.85.167.44 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 Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-516d68d7a8bso2506835e87.1; Mon, 15 Apr 2024 03:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713175669; x=1713780469; 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=rcWuWwbYDzN/Eba2XHYlH7krkiOlk1hd506TNmQ/SjY=; b=dAoPpl0llXV+WXzU2bTUwaPc+5ImPy+u0HMIaDNzss5B5oTxakJ3wKU/hWfo/9HwOw A05bZm9MxU/NsJsa3cmvxpt9WqafAjFolAItKG0BccwILFKWZ7H0OzokyX2iWwDM+/W7 m/+paRM3Tt2psZzHIA0wpFwaKGxDcXHuuEPUiqOVocHkZmsoQVg/aB9Kn8EwENtGAgpu M3J8hpTQ4MG6WrXVU33ot4s0xx71wOMf0nHJOUdT3i1GPKmD+4Q0rxYqTs9FzmD8+mtd 22hSWHe9ElJFY77V7LkmFnljAa67GpfLYom3T/u3ima39cFDAplcZCk9xuHOaTP5JZa9 e33g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713175669; x=1713780469; 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=rcWuWwbYDzN/Eba2XHYlH7krkiOlk1hd506TNmQ/SjY=; b=xCZ45CCMHaI0lQpj2MykPDCMcq0uJVzLTV25aoBuzLtB4fHQT8WP/YROSIb0KzjRZr UgmsGAZ0vWya7L7uCslzcFN9mjU9l1LjjSMemUcIrEnO7F9l4cYuD17MN/Ar6VDnK9Rp 9kUGx1rOZ057CBhvEhlIa0EHhkG4v2b2aQHTusOrANDf6aBCID4JPfccowtq4pwshyBO xAAorpjUA6hK6AF275CtImDbrP5OI0wys9+fsKBxxGp7/fhb2OzU/LBus+0BtVS53obD Ct0IgT34lnjQbc2IFbFzMeZPCeGDnoFVvoS2YDKDtVJOYrwazyvBJwOZlf7qwbSk+yYR yDPQ== X-Forwarded-Encrypted: i=1; AJvYcCXoOJd8Q/Rw7ZwYGShNTFtaOjD4lOHO8MbbgrSjmOTT45iQ9jAxhxqvwtKpfbhclKRT7+23Edjb6zp0uGVH48mZp8VNzo5Ln4QKPFpn71PcP+t2aowKzlfMCuyIfj+TxZnV6oOPu8rLpeQ= X-Gm-Message-State: AOJu0Yz+baEETON1wa4fDgkiYIOfbc1FrPYO3BfAD7X8TJ9ioJyHBjI9 /Tj9zzXzYSmF7q9eclvnD+VPkyXi3Fw4A0GUl3n1P+LBkxcq6VhN X-Received: by 2002:ac2:5f88:0:b0:514:b624:5d36 with SMTP id r8-20020ac25f88000000b00514b6245d36mr2403655lfe.32.1713175669017; Mon, 15 Apr 2024 03:07:49 -0700 (PDT) Received: from localhost.localdomain ([178.70.43.28]) by smtp.gmail.com with ESMTPSA id g11-20020a0565123b8b00b00518f53da2dfsm149571lfv.291.2024.04.15.03.07.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 03:07:48 -0700 (PDT) From: Ivan Bornyakov To: Nas Chung , Jackson Lee , Mauro Carvalho Chehab , Philipp Zabel , Sebastian Fricke Cc: Ivan Bornyakov , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 3/5] media: chips-media: wave5: separate irq setup routine Date: Mon, 15 Apr 2024 13:07:21 +0300 Message-ID: <20240415100726.19911-4-brnkv.i1@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240415100726.19911-1-brnkv.i1@gmail.com> References: <20240415100726.19911-1-brnkv.i1@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Implement a separate setup routine for interrupts to reduce code duplication. Also enable interrupts based on vpu_attr->support_encoders and vpu_attr->support_decoders fields to facilitate support for other Wave5xx IPs, because not all of them are both encoders and decoders. Signed-off-by: Ivan Bornyakov --- .../platform/chips-media/wave5/wave5-hw.c | 53 +++++++++---------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/drivers/media/platform/chips-media/wave5/wave5-hw.c b/drivers/media/platform/chips-media/wave5/wave5-hw.c index 2d82791f575e..cdd0a0948a94 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-hw.c +++ b/drivers/media/platform/chips-media/wave5/wave5-hw.c @@ -299,6 +299,27 @@ static int wave5_send_query(struct vpu_device *vpu_dev, struct vpu_instance *ins return wave5_vpu_firmware_command_queue_error_check(vpu_dev, NULL); } +static void setup_wave5_interrupts(struct vpu_device *vpu_dev) +{ + u32 reg_val = 0; + + if (vpu_dev->attr.support_encoders) { + /* Encoder interrupt */ + reg_val |= BIT(INT_WAVE5_ENC_SET_PARAM); + reg_val |= BIT(INT_WAVE5_ENC_PIC); + reg_val |= BIT(INT_WAVE5_BSBUF_FULL); + } + + if (vpu_dev->attr.support_decoders) { + /* Decoder interrupt */ + reg_val |= BIT(INT_WAVE5_INIT_SEQ); + reg_val |= BIT(INT_WAVE5_DEC_PIC); + reg_val |= BIT(INT_WAVE5_BSBUF_EMPTY); + } + + return vpu_write_reg(vpu_dev, W5_VPU_VINT_ENABLE, reg_val); +} + static int setup_wave5_properties(struct device *dev) { struct vpu_device *vpu_dev = dev_get_drvdata(dev); @@ -340,6 +361,8 @@ static int setup_wave5_properties(struct device *dev) p_attr->support_vcpu_backbone = FIELD_GET(FEATURE_VCPU_BACKBONE, hw_config_def0); p_attr->support_vcore_backbone = FIELD_GET(FEATURE_VCORE_BACKBONE, hw_config_def0); + setup_wave5_interrupts(vpu_dev); + return 0; } @@ -417,16 +440,6 @@ int wave5_vpu_init(struct device *dev, u8 *fw, size_t size) wave5_fio_writel(vpu_dev, W5_BACKBONE_AXI_PARAM, 0); vpu_write_reg(vpu_dev, W5_SEC_AXI_PARAM, 0); - /* Encoder interrupt */ - reg_val = BIT(INT_WAVE5_ENC_SET_PARAM); - reg_val |= BIT(INT_WAVE5_ENC_PIC); - reg_val |= BIT(INT_WAVE5_BSBUF_FULL); - /* Decoder interrupt */ - reg_val |= BIT(INT_WAVE5_INIT_SEQ); - reg_val |= BIT(INT_WAVE5_DEC_PIC); - reg_val |= BIT(INT_WAVE5_BSBUF_EMPTY); - vpu_write_reg(vpu_dev, W5_VPU_VINT_ENABLE, reg_val); - reg_val = vpu_read_reg(vpu_dev, W5_VPU_RET_VPU_CONFIG0); if (FIELD_GET(FEATURE_BACKBONE, reg_val)) { reg_val = ((WAVE5_PROC_AXI_ID << 28) | @@ -1034,16 +1047,6 @@ int wave5_vpu_re_init(struct device *dev, u8 *fw, size_t size) wave5_fio_writel(vpu_dev, W5_BACKBONE_AXI_PARAM, 0); vpu_write_reg(vpu_dev, W5_SEC_AXI_PARAM, 0); - /* Encoder interrupt */ - reg_val = BIT(INT_WAVE5_ENC_SET_PARAM); - reg_val |= BIT(INT_WAVE5_ENC_PIC); - reg_val |= BIT(INT_WAVE5_BSBUF_FULL); - /* Decoder interrupt */ - reg_val |= BIT(INT_WAVE5_INIT_SEQ); - reg_val |= BIT(INT_WAVE5_DEC_PIC); - reg_val |= BIT(INT_WAVE5_BSBUF_EMPTY); - vpu_write_reg(vpu_dev, W5_VPU_VINT_ENABLE, reg_val); - reg_val = vpu_read_reg(vpu_dev, W5_VPU_RET_VPU_CONFIG0); if (FIELD_GET(FEATURE_BACKBONE, reg_val)) { reg_val = ((WAVE5_PROC_AXI_ID << 28) | @@ -1134,15 +1137,7 @@ static int wave5_vpu_sleep_wake(struct device *dev, bool i_sleep_wake, const uin wave5_fio_writel(vpu_dev, W5_BACKBONE_AXI_PARAM, 0); vpu_write_reg(vpu_dev, W5_SEC_AXI_PARAM, 0); - /* Encoder interrupt */ - reg_val = BIT(INT_WAVE5_ENC_SET_PARAM); - reg_val |= BIT(INT_WAVE5_ENC_PIC); - reg_val |= BIT(INT_WAVE5_BSBUF_FULL); - /* Decoder interrupt */ - reg_val |= BIT(INT_WAVE5_INIT_SEQ); - reg_val |= BIT(INT_WAVE5_DEC_PIC); - reg_val |= BIT(INT_WAVE5_BSBUF_EMPTY); - vpu_write_reg(vpu_dev, W5_VPU_VINT_ENABLE, reg_val); + setup_wave5_interrupts(vpu_dev); reg_val = vpu_read_reg(vpu_dev, W5_VPU_RET_VPU_CONFIG0); if (FIELD_GET(FEATURE_BACKBONE, reg_val)) { -- 2.44.0