Received: by 2002:a05:7412:8d06:b0:f9:332d:97f1 with SMTP id bj6csp38965rdb; Mon, 18 Dec 2023 08:19:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLCJ6AyuzfRLBYUkhJYObzDPE7zl/o0LBWL4H4lOc/cyeLl/pREsIbzDUR1UrZEmYhZHlv X-Received: by 2002:a05:622a:138b:b0:425:8b8a:3c91 with SMTP id o11-20020a05622a138b00b004258b8a3c91mr23218830qtk.23.1702916395728; Mon, 18 Dec 2023 08:19:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702916395; cv=none; d=google.com; s=arc-20160816; b=nE/Kl6A8TddmmDjaSfkvrbvrgN2aEgJP+ePOrW6iBMbBxbP2xewdX6HQHxsLwnR5bX QM6BL0obgN/XN+vgB6ZrL2Sb2CjbdNO6nmIXbxS2luwyXjOcfonAgkxf8dJzjNzwEWoE cRqOcJxe9XL5Ym04cJHTJAFx/dSJYKDAcVGHqKQck9++40ytkoc5PNK3jN1kPTEIWcXT 8X0+NyHnzbCGPdojvyXWI9nXj84etlZARxll4dpgSLZNXBEm8iNHIzfghiQgpsaXk3xf dgmiu/jnTt0smINQzQb7kCEFG5K95auEdBbmOn3trhTrgPTvl3mP7n0PDQb5/j6Cv26J 0lGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=F12CUCjaHnRrE58YzlzlEqYhnlj1UTolJRHB/LEk0dg=; fh=V1tS30MR71O8875Vt1aZ1qSdLiMiRBfV7PEKyWISISk=; b=s1+WDwXSfVIbJ0QedrzE6oQcK3miz7Ng1wdjFhWbOTHygQXa+der0+3/jXpMWhFjjX xEev5edy08QmImwHD0VjGaxvXeM29ufIxRe9tPtvH9bNdeS+MGgOu5GGG8XywD7Uh0B1 47KLjvZCUxNeexq08ic1Je/DOuZqocb99ILHVd5BXA+I1XKgKAVux5U5L8ElJbxM+cEc Y8F9s6oE4DooE/iI2WeOZmd6+BOltj4NuG5PvK9GK5tucYTcYqF80D837HFG5egCNcna UOG4vA2R4EUW07igAahwe9/z0fngx1PaRN9qimjDc3DrzbqUUOC0DysHh9+/k7cvsdqV CLaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aWMo8n03; spf=pass (google.com: domain of linux-kernel+bounces-4053-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4053-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h12-20020ac87d4c000000b00425e5682bbasi15545955qtb.48.2023.12.18.08.19.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 08:19:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4053-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aWMo8n03; spf=pass (google.com: domain of linux-kernel+bounces-4053-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4053-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6213A1C24A03 for ; Mon, 18 Dec 2023 16:19:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B1026498A4; Mon, 18 Dec 2023 16:19:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aWMo8n03" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CB58742379; Mon, 18 Dec 2023 16:19:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFBEBC433C7; Mon, 18 Dec 2023 16:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702916383; bh=YVe24+VIIvFgLdvWefXeeEKbQLshLdaWuzwzX/7lIYQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=aWMo8n03zMskv+hccddZyoSa9i0wkcHSE2ZwS55PWUrvP/YUq6NzZuGRpwU1OpscC TUhkh46qs53hsAWTCqd1HmVxgsZFvEWrODz6aO6k5MfSKm4S2/0cShQUpLBywktD3c vhyC6Bl7JzjNZVWhcNpurvumYl8DARRFuDjgPJJ751uWJCBuCcV92cud+OnUI21iLH inAVf2JngFE2xJ01Cc0e+Xy2jkqHgXr9HXG2GbQqXdOgtcRLXltlUg5uFc6y//p51O qascUJ4OzVrqq4WnLKNAuVpMfJmPoSADaUJScHR3Wk2pHZnN3qyHsqS+LMJXCPQ1wB rC+ehPcL5zCLQ== Message-ID: Date: Mon, 18 Dec 2023 17:19:36 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 12/34] media: iris: add video processing unit(VPU) specific register handling Content-Language: en-US To: Dikshita Agarwal , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, stanimir.k.varbanov@gmail.com, quic_vgarodia@quicinc.com, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, mchehab@kernel.org, bryan.odonoghue@linaro.org Cc: linux-arm-msm@vger.kernel.org, quic_abhinavk@quicinc.com References: <1702899149-21321-1-git-send-email-quic_dikshita@quicinc.com> <1702899149-21321-13-git-send-email-quic_dikshita@quicinc.com> From: Krzysztof Kozlowski Autocrypt: addr=krzk@kernel.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARAQABzSVLcnp5c3p0b2Yg S296bG93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6BkRikNOs7VDEa4/HlbaSJo 7FgndGw1kWmkeL6oQh7wBvYll2buKod4qYntmNKEicoHGU+x91Gcan8mCoqhJkbqrL7+nXG2 5Q/GS5M9RFWS+nYyJh+c3OcfKqVcZQNANItt7+ULzdNJuhvTRRdC3g9hmCEuNSr+CLMdnRBY fv0= In-Reply-To: <1702899149-21321-13-git-send-email-quic_dikshita@quicinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 18/12/2023 12:32, Dikshita Agarwal wrote: > Registers are defined differently for different VPUs. > Define ops for VPU specific handling to accommodate > different VPUs. Implement boot sequence of firmware and interrupt > programming. > ... > + > +int write_register(struct iris_core *core, u32 reg, u32 value) > +{ > + void __iomem *base_addr; > + int ret; > + > + ret = check_core_lock(core); > + if (ret) > + return ret; > + > + base_addr = core->reg_base; > + base_addr += reg; > + writel_relaxed(value, base_addr); > + > + /* Make sure value is written into the register */ > + wmb(); Just don't use relaxed method. The same applies to other places like that. > + > + return ret; > +} > + > +int read_register(struct iris_core *core, u32 reg, u32 *value) > +{ > + void __iomem *base_addr; > + > + base_addr = core->reg_base; > + > + *value = readl_relaxed(base_addr + reg); > + > + /* Make sure value is read correctly from the register */ > + rmb(); > + > + return 0; > +} > + > +static const struct compat_handle compat_handle[] = { > + { > + .compat = "qcom,sm8550-iris", > + .init = init_iris3, Uh... > + }, > +}; > + > +int init_vpu(struct iris_core *core) > +{ > + struct device *dev = NULL; > + int i, ret = 0; > + > + dev = core->dev; > + > + for (i = 0; i < ARRAY_SIZE(compat_handle); i++) { > + if (of_device_is_compatible(dev->of_node, compat_handle[i].compat)) { > + ret = compat_handle[i].init(core); This does not look good. Use flags, quirks, type, pointer ops in structures. Just look at existing code in Linux kernel. Do not reimplement driver match data. Best regards, Krzysztof