Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp380048rwb; Fri, 4 Aug 2023 14:27:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQDWEg+G2TVOcOAzgtxGCR7rY047Ba/vpsOptidqpMy8FqAqcgE7DVUws/FICT06TF6s0V X-Received: by 2002:a05:6808:1306:b0:39a:bd0e:43d with SMTP id y6-20020a056808130600b0039abd0e043dmr4757022oiv.36.1691184427918; Fri, 04 Aug 2023 14:27:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691184427; cv=none; d=google.com; s=arc-20160816; b=KQ7KaWoCV2/sV8u/6Qg6fVAdRT59yVgrEAYusm+XxZsa+cVlJtMPggLnzcjlst9s8E gU7tEidRc2BfQKmtLDFx43H0fv6X90l3rCCJacuc4LmYLoZOh9B2ljMdZamNKSW1otmC Z+Em0xhnulTZM0gpYEyv033scLtL2nrM5j8PF5MHA8mRQ8NNtwo9NllTSwHB34vLOEg2 V2tBN1pJ41y46iltLHNThRgo1tbNBKZaPCtUV2vjzda5wgwpNL4r1RKFpdkAWS15amPn 0AW1MRNHcv1UuFw8anFENZXRyVYvMTAYHYaB/xyzx+qSsTpIz5PLmbgDnYIThbp/FEqH oQzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=ytf0fYl7y3s90xE10GWsqr8qlrP5SU3wZD0qdEGlqoc=; fh=grOAo0lqkKWoQ9GTv8s/aRkzUgHNIAb9RLKFUDIVSMs=; b=PrxxKzbljK2dN77fGKGgwXTYY49rRhUk3n6HO+2R3ix4eLg3DEt945fBsFCXbAVoll r7xYTZIkJftBFC7WeQ3jfjlKoRmhNthxF1H6RO4j5ubpsxxMnDIy139hGuWbdmHqDppG uw/hEZSSwQwX3cislRPgEX/Lt0A8VS/G8y+szLvj+C+gylim+FN/aJ09OlFVMdNNC5z+ MboJAtjiBRZo4iETOhdKvDIHUkbQxXp6cXSuYWT6iWsyMZ4skWog0MmFw0mZlN2CYZpU d0s8oAnIx5PzrltS+hsG5Bb/ZL9/qT0F4xQeHk6+YUFBXY47clDlFo/OqzvvlsE5xppZ cxxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WMUbMmCH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t15-20020a17090a510f00b0025bdc2a0b15si5606753pjh.135.2023.08.04.14.26.55; Fri, 04 Aug 2023 14:27:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WMUbMmCH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229851AbjHDUvc (ORCPT + 99 others); Fri, 4 Aug 2023 16:51:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbjHDUvb (ORCPT ); Fri, 4 Aug 2023 16:51:31 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A20784C38 for ; Fri, 4 Aug 2023 13:51:25 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fe12820bffso23329325e9.3 for ; Fri, 04 Aug 2023 13:51:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691182284; x=1691787084; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ytf0fYl7y3s90xE10GWsqr8qlrP5SU3wZD0qdEGlqoc=; b=WMUbMmCHym2MWewUEGEymY2vgE0ilbwjsaA1pKhhgapZV6TqtVkRpDzrtMUbIN2dyz kJeFNOM9GvuMSEZU800iXAru7Y07uX1MbrUic1GH/U9E92lP+GZp7dF5YLPJZP/k1crr bgI9xA3hgJu360BLHjUCy38lwhj2r4i3KW+5zNVsfnzyct1j69gMMVrzjDyae/0IZPjK V1iD0ckcPsQfLy90X0mxyrTwCI1CPlAGNNsqkzxFvG/dnRGF8Efq1cMS3e2/0EHL64no qaXYXrXKq5VN8/c91Mzh3dECKNowQCN8tvqn+gZ7tlSw3DoCH8rFbG7WU6jiL0K3r2zN DrVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691182284; x=1691787084; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ytf0fYl7y3s90xE10GWsqr8qlrP5SU3wZD0qdEGlqoc=; b=av2+bJOEzuSOFk9mXl9apXk1+IftZhtgPxor386e4xc2ZyF3CSYEjsdrHfZfxiw5A7 8RkbCMSijNhsrVHJhNiQ7XdxyeMj5ogVcl82XNh2UDH/svPtupytu4uAbEemmi91hFtx mSWgjriEjKUkBXD2VwOLVHiqEsltzUG0Uh5vinH5nCrQhPlTjNhRn3hVI3vZdz/fb3JG yGGzA7Z0VkyHir30Ufsn6AqRnx9/6wrCz475C71QhXcjBtRNnCz8VpWdwWY/hnqtmxO7 J7NBpigLdqZAtVoTRkNLxu7HQWXFWpglxAY/JlCdNUR3K6gs1m6aH7uwCPAdnmE1abNH 0Y9w== X-Gm-Message-State: AOJu0Yz3bEEu8ESMRVFU9UMPghYW9kWKjFg4RmmEsCu8Yk/BdjbNZhke xxEn+HOpQVgJpkIBt0CJkZSUtA== X-Received: by 2002:a5d:4a81:0:b0:317:5b76:826 with SMTP id o1-20020a5d4a81000000b003175b760826mr1826052wrq.0.1691182284080; Fri, 04 Aug 2023 13:51:24 -0700 (PDT) Received: from [192.168.0.162] (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n9-20020a5d4009000000b00317a04131c5sm3355263wrp.57.2023.08.04.13.51.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Aug 2023 13:51:23 -0700 (PDT) Message-ID: Date: Fri, 4 Aug 2023 21:51:22 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 3/6] media: venus: hfi_venus: Support only updating certain bits with presets Content-Language: en-US To: Konrad Dybcio , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Marijn Suijten , Konrad Dybcio , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230731-topic-8280_venus-v1-0-8c8bbe1983a5@linaro.org> <20230731-topic-8280_venus-v1-3-8c8bbe1983a5@linaro.org> From: Bryan O'Donoghue In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/08/2023 21:50, Bryan O'Donoghue wrote: > On 04/08/2023 21:09, Konrad Dybcio wrote: >> On some platforms (like SM8350) we're expected to only touch certain bits >> (such as 0 and 4 corresponding to mask 0x11). Add support for doing so. >> >> Signed-off-by: Konrad Dybcio >> --- >>   drivers/media/platform/qcom/venus/core.h      |  1 + >>   drivers/media/platform/qcom/venus/hfi_venus.c | 15 ++++++++++++--- >>   2 files changed, 13 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/media/platform/qcom/venus/core.h >> b/drivers/media/platform/qcom/venus/core.h >> index d996abd339e1..2999c24392f5 100644 >> --- a/drivers/media/platform/qcom/venus/core.h >> +++ b/drivers/media/platform/qcom/venus/core.h >> @@ -38,6 +38,7 @@ struct freq_tbl { >>   struct reg_val { >>       u32 reg; >>       u32 value; >> +    u32 mask; >>   }; >>   struct bw_tbl { >> diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c >> b/drivers/media/platform/qcom/venus/hfi_venus.c >> index 19fc6575a489..d4bad66f7293 100644 >> --- a/drivers/media/platform/qcom/venus/hfi_venus.c >> +++ b/drivers/media/platform/qcom/venus/hfi_venus.c >> @@ -349,10 +349,19 @@ static void venus_set_registers(struct >> venus_hfi_device *hdev) >>       const struct venus_resources *res = hdev->core->res; >>       const struct reg_val *tbl = res->reg_tbl; >>       unsigned int count = res->reg_tbl_size; >> -    unsigned int i; >> +    unsigned int i, val; > > u32 val; > >> + >> +    for (i = 0; i < count; i++) { >> +        val = tbl[i].value; > > struct reg_val looks like this > > struct reg_val { >         u32 reg; >         u32 value; > }; > > val should be declared a u32 > >> -    for (i = 0; i < count; i++) >> -        writel(tbl[i].value, hdev->core->base + tbl[i].reg); >> +        /* In some cases, we only want to update certain bits */ > > I'll trust this is a legitimate and true statement. > >> +        if (tbl[i].mask) { >> +            val = readl(hdev->core->base + tbl[i].reg); >> +            val = (val & ~tbl[i].mask) | (tbl[i].value & tbl[i].mask); > > feels like something regmap_update_bits() already does though, I prefer > this because there's less code in it. > >> +        } >> + >> +        writel(val, hdev->core->base + tbl[i].reg); >> +    } > > With the val declaration fix > > Reviewed-by: Bryan O'Donoghue Reviewed-by: Bryan O'Donoghue