Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp20023263rwd; Wed, 28 Jun 2023 18:39:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Pm2Vg/Kqw/QOMRR5tYQ9MT8mvwi9SMqVrcMhJY2AAv8/rUsCQNMh7Cy3SHO0uRYLK0JNC X-Received: by 2002:a05:6a00:2e9b:b0:64d:5b4b:8429 with SMTP id fd27-20020a056a002e9b00b0064d5b4b8429mr40102655pfb.18.1688002787007; Wed, 28 Jun 2023 18:39:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688002786; cv=none; d=google.com; s=arc-20160816; b=ShSjVkp1XLe4qojILuqXToFntMndVWF7cFUtNOGcoxGF4KJdU7ZqxyDTyObACdQMQ8 rbLt6ecVKybJC9sakFv3eA3GhQbKsssjHFnNn5vet7aMIKl9ewv+yAREq2+/cURCwNLL R11IFGbpCWY3tb9rQtJ4uMQWIo0ZCSbeIiUJNc7M4t33bT+cdU4xOWZJhEaRaEX2Ub5P 7qVrRFMctxcayyqTnLuHTxmDXARcC5u0Sr0r8KDqirJFCsCGan5DFaJniP2grEwLZ36M aQi6pPg+zQ8PanhvgunPZFjLFbKq7c+gBA6cWYXpeC6KO+YxVGOQwsS2yE77h66ZClWW Jpqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=mft5sp3KsdXhVVEMY4E5KaCF0W58e1NHquVSeHvXAso=; fh=ffvXGx6VHbyrB/3Fr1e0Lgp1UT9iTmM8aJA0vvT/1uk=; b=QOn4RvvnA0wTrzHxtYThmHkxlAsZ5xGMdKhN/oVsuGSu1pQ2/T70u/NtHCGD0v2OEJ WHkASD+eC4Rkav62TkSzQPxubHKNTYK2zs5VEK6YCWiABhukby1a+5N/ZwAkCw40aIvn fi3SzGG8w+aJvHeWNrW9C2wazdFIf6EOR7D6sVH9ksw/uZn5cfcAHE0YVjVnW22yIzzn X53g/dBXHIgAAJzek+BsVLb7wR/0g1RR9Iqj2wrj5XSEcQltxPGX0r1yvxf8ZRW299KV ZXPgXCr2J4tCs8PKr7z0KHPmg6X+qtzcsTRdfXH6XEEosRGAuRYYTZtKWqicZ0LKHY17 +Ttw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b185-20020a62cfc2000000b0066a4a09645dsi9497748pfg.254.2023.06.28.18.39.35; Wed, 28 Jun 2023 18:39:46 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231213AbjF2B1V (ORCPT + 99 others); Wed, 28 Jun 2023 21:27:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbjF2B1R (ORCPT ); Wed, 28 Jun 2023 21:27:17 -0400 Received: from mg.richtek.com (mg.richtek.com [220.130.44.152]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1ED721FE7; Wed, 28 Jun 2023 18:27:14 -0700 (PDT) X-MailGates: (flag:4,DYNAMIC,BADHELO,RELAY,NOHOST:PASS)(compute_score:DE LIVER,40,3) Received: from 192.168.10.47 by mg.richtek.com with MailGates ESMTP Server V5.0(12339:0:AUTH_RELAY) (envelope-from ); Thu, 29 Jun 2023 09:27:04 +0800 (CST) Received: from ex3.rt.l (192.168.10.46) by ex4.rt.l (192.168.10.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Thu, 29 Jun 2023 09:27:03 +0800 Received: from linuxcarl2.richtek.com (192.168.10.154) by ex3.rt.l (192.168.10.45) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Thu, 29 Jun 2023 09:27:03 +0800 Date: Thu, 29 Jun 2023 09:27:03 +0800 From: ChiYuan Huang To: Mark Brown CC: , , , , , Subject: Re: [PATCH 2/2] regulator: rt5739: Add DID check and compatible for rt5733 Message-ID: <20230629012703.GA10948@linuxcarl2.richtek.com> References: <1687942037-14652-1-git-send-email-cy_huang@richtek.com> <1687942037-14652-3-git-send-email-cy_huang@richtek.com> <2a8732f4-13fe-476d-9ae7-b970bd82c218@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <2a8732f4-13fe-476d-9ae7-b970bd82c218@sirena.org.uk> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Wed, Jun 28, 2023 at 12:47:50PM +0100, Mark Brown wrote: > On Wed, Jun 28, 2023 at 04:47:17PM +0800, cy_huang@richtek.com wrote: > > > + if (did == RT5733_CHIPDIE_ID) { > > + min_uV = RT5733_VOLT_MINUV; > > + max_uV = RT5733_VOLT_MAXUV; > > + step_uV = RT5733_VOLT_STPUV; > > + } else { > > + min_uV = RT5739_VOLT_MINUV; > > + max_uV = RT5739_VOLT_MAXUV; > > + step_uV = RT5739_VOLT_STPUV; > > + } > > It would be better to write these as switch statements so if any more > variants turn up they can be added more easily. Since the IC difference is only voltage range and step, They can be retrieved from the regulator description. To check DID here may not a good coding. I may rewrite it as below max_uV = desc->min_uV + desc->uV_step * (desc->n_voltages - 1); And put a switch case for DID check in 'init_regulator_desc'. Is it better?