Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2044294rwb; Thu, 27 Jul 2023 00:47:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlHy1Z83Mf84M4WTLm8nD2DKfcNmKgTIAwmLevjt99EZseykpeewNuNki2QsI+eZxDz2Ertm X-Received: by 2002:a17:906:5182:b0:99b:bc52:8d2 with SMTP id y2-20020a170906518200b0099bbc5208d2mr1278531ejk.6.1690444079581; Thu, 27 Jul 2023 00:47:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690444079; cv=none; d=google.com; s=arc-20160816; b=wX4MWmhCcXbTZE/PK9QAqwPGxZzNg5fPddIc32KLwpcCdalkQDHW2s2/RJjShoP1bX pnrCtOMkm1EjYiBI5bL0kzcRBbBb4bG4WRqjDKpSIJDld7813TQj/igAMTi6V6CeWO1+ 2GDKty5i1AE35MTuiM8oZGUkrJYiGjzKgM7OIDMC3bxbHe2RDRM+r4Fph7op3giw5h0n 8t9SR/Dyrsh+Z6lOZwQDbnNPtVXSN/mePwDYScPyOLMA+v8M1+9pdp0vsSv2rCD2w+QI 0DE8yWqwHnPYBoP2XD6Wx25daEaskgxgSJvEeKZDpM2lhygG0WTgoXCbfw0iz6saezzb srmg== 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=oJ3iHUocjz5azHHmivuhMASDBNzfIodCAVzG/5NiGO0=; fh=BBfL5XxCJvLW+EmATBL+NIh+K582snQPbHpm3lJrqLA=; b=WjkqB/ytZi5J/TqNY49i/0KCMUCxdlERd452PZDnVkWQ+D0/UyjGy4FKoeLY94LPpn HcBubAy7mGaLC2xQ9/B8zd4Wp0mUpSa3yAJVK7g8pMdLkpf2m6a1FjO7kdg5yX5JTSRY wFHHhrMtBHaQB9kReCloiDnY9qUP6237esGJj1ZipxuJOGe3jFi7CdtGW1hLzsb1WZrO 9PBv3x4OGLWsvfGu+ivbMD/vayqusLy4qxBJkry/uzl6StUBcluKVxM980l2EcG2gKR4 YNK4xgxrXcgWr0TEWf1hBNAARFNwoqN/j6s9IIATrLOmWS/nfhPTjzJ+bBa3xqMl+V/7 ORyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="a33wyL/X"; 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 f2-20020a170906390200b0099bd2075268si613113eje.920.2023.07.27.00.47.35; Thu, 27 Jul 2023 00:47:59 -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="a33wyL/X"; 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 S233183AbjG0Hco (ORCPT + 99 others); Thu, 27 Jul 2023 03:32:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233414AbjG0Hc2 (ORCPT ); Thu, 27 Jul 2023 03:32:28 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 340E530F5 for ; Thu, 27 Jul 2023 00:21:22 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2b9a2033978so9086721fa.0 for ; Thu, 27 Jul 2023 00:21:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690442480; x=1691047280; 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=oJ3iHUocjz5azHHmivuhMASDBNzfIodCAVzG/5NiGO0=; b=a33wyL/XXsX8EsIq2k37ESjsVb8rsTKKbTthD3ks+RXVkNzMmF8ESBKRNgd9IGHvyo IVGh2GunohoE0v75AfTmsajEvPLjscPbNhjOO0da93cM8T2HKlY28BUh6y7hJ/opRoWN pFodiiLIQm1e5qIflabdutKjoOIuZz/Mg4UCTMAsGJ9MK+iLoNFsouO+P7QHkFsOsF+m tn/m0keFLk2VLBWpirol63GFzQyb7oshBv3kfa1c441htlbv7g8XfqHeJne3IbTi+AOs FIKbrugwTLzbyF1nYe6pzmcHE+BhutoktcQfzQJKbCIaFbAjbGo+//Opzp6UYZnJvzN2 3TwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690442480; x=1691047280; 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=oJ3iHUocjz5azHHmivuhMASDBNzfIodCAVzG/5NiGO0=; b=UZbxdprf9SOpW5rAEy9ZlqQdWkINPGFSSCjcb0IiDh92kP0bcuDC2R3mJfUyjeLGyG A0EAIq7J3WMvyrKfkB5vpzgoutUCZMR8e9XMPN1QvFIge1jSZBvip4dZ8vJl33bSpc+q Eqm1uXKknE+u7mCs+41mu/zSAyJMsUuMYEJLS09qKa6C9nMXBMDmmhQeADkNnmti4WZZ WtEmsuhf96AWZrXXe7uItheAd5iQb3aAPMAQbIOk2fKK5fbVIvw1t6y+gMFMNFIAAuDb 0b94NRA0SxAkL4gKDgZSw79QeEx5QCfg5hIS+nqW9RvgiPwLFkZNZda1B/5IOWnFi5gZ q3ug== X-Gm-Message-State: ABy/qLaY6GnXW1c0eu2OS9GpfJxm9Mk4I5UZ7i0KruTpSeQq4ZaZNr9a FrZg5aNwnEApdJCyTu0HGKGW2bXyJzPEaCzHm24= X-Received: by 2002:a50:ed91:0:b0:522:55bf:21af with SMTP id h17-20020a50ed91000000b0052255bf21afmr1117154edr.7.1690441644127; Thu, 27 Jul 2023 00:07:24 -0700 (PDT) Received: from [192.168.1.20] ([178.197.223.104]) by smtp.gmail.com with ESMTPSA id a18-20020aa7d752000000b0051dd16f7e50sm308004eds.44.2023.07.27.00.07.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jul 2023 00:07:23 -0700 (PDT) Message-ID: <2a09e743-7423-65b0-c70d-87ae8105182a@linaro.org> Date: Thu, 27 Jul 2023 09:07:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v3 1/3] input: pm8xxx-vib: refactor to easily support new SPMI vibrator Content-Language: en-US To: Fenglin Wu , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org, agross@kernel.org, andersson@kernel.org, dmitry.baryshkov@linaro.org, Konrad Dybcio , Dmitry Torokhov , linux-input@vger.kernel.org Cc: quic_collinsd@quicinc.com, quic_subbaram@quicinc.com, quic_kamalw@quicinc.com, jestar@qti.qualcomm.com References: <20230725054138.129497-1-quic_fenglinw@quicinc.com> <20230725054138.129497-2-quic_fenglinw@quicinc.com> <5dd56c31-7ca3-dd39-0623-e4fd18ac6f68@linaro.org> <053c9571-d709-2826-fced-a00dd7255b8b@quicinc.com> From: Krzysztof Kozlowski In-Reply-To: <053c9571-d709-2826-fced-a00dd7255b8b@quicinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 25/07/2023 08:16, Fenglin Wu wrote: >>> >>> -static const struct pm8xxx_regs pm8058_regs = { >>> - .drv_addr = 0x4A, >>> - .drv_mask = 0xf8, >>> - .drv_shift = 3, >>> - .drv_en_manual_mask = 0xfc, >>> +static struct reg_field ssbi_vib_regs[VIB_MAX_REG] = { >> >> Change from const to non-const is wrong. How do you support multiple >> devices? No, this is way too fragile now. >> > > The register definition is no longer used as the match data, hw_type is > used. > > The last suggestion was getting the register base address from the DT > and it has to be added into the offset of SPMI vibrator registers > (either in the previous hard-coded format or the later the reg_filed > data structure), so it's not appropriated to make it constant. > > I don't understand this question: "How do you support multiple devices?" > For SSBI vibrator, since all the registers are fixed, and I would assume > that there is no chance to support multiple vibrator devices on the same > SSBI bus. If they are not on the same bus, the regmap device will be > different while the registers definition is the same, and we are still > able to support multiple devices, right? No, you have static memory. One device probes and changes static memory to reg+=base1. Second device probes and changes the same to reg+=base2. > The similar story for SPMI vibrators and it can support multiple devices > if they are located on different SPMI bus, or even if they are on the > same SPMI bus but just having different SID or PID. Sorry, such code cannot go in. These must stay const and you must write driver without any static allocations or singleton-like patterns. Best regards, Krzysztof