Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6124818rwd; Mon, 5 Jun 2023 13:27:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4WNH5aSjmw+mhSFMcVlqzVmmOYrQfS34rzpjZ+puEQ8ndM0sJB/8tr/UQ7XPwplp6oltNs X-Received: by 2002:a05:622a:1055:b0:3f6:aff0:6dfd with SMTP id f21-20020a05622a105500b003f6aff06dfdmr9517478qte.32.1685996867844; Mon, 05 Jun 2023 13:27:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685996867; cv=none; d=google.com; s=arc-20160816; b=OmcBEJmGDHpd8VcMeUfdxOJYep2YDw9etqXkVTzEpSzLKxtOBZ9b90bCjWkQ9NP9vp HYouniaAcMkJJviKC2qk94M9IMDHmx/q2JUleaw7apTa3eWB/EcxTVVO6FBwATjraYu2 D0nfsP7Rr8C2ifwmfZLDlP1t62dt7T0/6ErpOkEvAnUA66FeQJkbggYkV7bHvBZN+vQV 6BK01SWaE4RPy5cJ7EwxXUPpEERNHrxH0INwXA8YEaHHIo2edK4MdnE0m5fZhbP5nPYD J7lhf3JePeEXaCYW0iiyCyAoiUlDETZy4YoVKBbkHfAEohxI4oo5nqjVCgUPFl16Re0z v85Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9DmAqdFCTWcCnSv3cNxtbIKYt0BJjIXyl6B4XL9Pfx4=; b=Avs+Yk05COLG3GULyXVHl8X7mnzgpAp8DmESboX25+7IQ4tNQEvPUQ5yN0rmpgYBqd oowPFHy7/4gjZzlg3sae83IibjIYOn1YGPehlXJuwmUG3Ev3mg1aot7FTCDtGSucg5oX VLuy2d2f5TbLWjBNg8ybqLFh58U5T8yBEeGhznlHNyT8OpYdmVsIsTRvGs+/DDNxbcPi O8kqJVAZQ8WguenuEaV/adSYXKLxtb9DiKvDOPGMIQkUmMeT6A+ixVS13MTK44YRJF8K a2Y6DyW9E/NRFNzN2HcBvngrUPbOBiiWQ7vlhunHli+UkDkgwz4lWHFTXkosHZf/8oZ0 ithg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20221208 header.b="pAuJ/+en"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p19-20020a05622a13d300b003f8704f386esi2512987qtk.652.2023.06.05.13.27.32; Mon, 05 Jun 2023 13:27:47 -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=@googlemail.com header.s=20221208 header.b="pAuJ/+en"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233025AbjFEUUE (ORCPT + 99 others); Mon, 5 Jun 2023 16:20:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233266AbjFEUTs (ORCPT ); Mon, 5 Jun 2023 16:19:48 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18594170C; Mon, 5 Jun 2023 13:18:42 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2b1af9ef7a9so46258891fa.1; Mon, 05 Jun 2023 13:18:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20221208; t=1685996320; x=1688588320; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9DmAqdFCTWcCnSv3cNxtbIKYt0BJjIXyl6B4XL9Pfx4=; b=pAuJ/+en+DXnrhMOQmfLxIW5mtJj9bT2iORrZSmomltq7qrdY4y7ND8wjL+6Nbpoue JmE18818aJ0/b+W0fnoSO68NXR5Ym2tBOgAR1mlL5g3UkHvj8Cn+xcpDTy9KBOm6vEBk jy6EgYeukLRAGRSZb9J+i5cfBNWCwvT0dn/IqWiFUbYiST+nkMxC+IBIlfAr9Z7b1NXM 340Vkmw4j3hgOgdZT40piHPcAqoCpiI91PxJ5R3HWJqSmLrij2msaV21cTDwYpaCMZGI 0XO0HznaoKlIWKUw5GlH32p0gTPyMO4MpCwWlXPxwIB7BrDIBUK8uKtW/kS9wg+9e/cD DeXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685996320; x=1688588320; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9DmAqdFCTWcCnSv3cNxtbIKYt0BJjIXyl6B4XL9Pfx4=; b=BkMKWUbvQXEyqr+vafpFwWP4YLRKEBl5c22eCR/VQjXLOq+01+BHkJCp4zNzyhtV1r 8WqKwOpSenRbLtU6B8PRCwKUNBY3TQ8kuaQrrotFy0HiSqLyBNRsAylW9upSUFioTlME YchvjASabKh3XCEbbhqQgPNhhq/WMIXJaHNB7Mw3g+lxcQDStg/Ml6xub7OBaR/nJgyf pXqOFSjerb+zdkZ49t9WfZ0ux7vAisbNi8B+RkDVYQNLmuSMkHhboq1dZskBjcPNnSxO iETHU9SHPU1aE+haEl/hj8uMKWi4jYkvcHL8iDQheE5HNifCvi32Zy9yCCz49srlS0SW UStA== X-Gm-Message-State: AC+VfDz2dvfxof4dhvuEpFkozPU1HWK/pqvON9P1mNYgF3dd2vOYb9n7 Vvyk24qROCCklzLBzcRF1LOLuBls5n1hmA0z3TE= X-Received: by 2002:a2e:88da:0:b0:2b0:770f:c83c with SMTP id a26-20020a2e88da000000b002b0770fc83cmr214990ljk.4.1685996319762; Mon, 05 Jun 2023 13:18:39 -0700 (PDT) MIME-Version: 1.0 References: <20230515210545.2100161-1-gnstark@sberdevices.ru> <6910550a-b025-0d97-0b39-bc89b235541e@sberdevices.ru> In-Reply-To: From: Martin Blumenstingl Date: Mon, 5 Jun 2023 22:18:28 +0200 Message-ID: Subject: Re: [PATCH v1] meson saradc: fix clock divider mask length To: George Stark Cc: "jic23@kernel.org" , Dmitry Rokosov , "lars@metafoo.de" , "neil.armstrong@linaro.org" , "khilman@baylibre.com" , "jbrunet@baylibre.com" , "andy.shevchenko@gmail.com" , "nuno.sa@analog.com" , "linux-iio@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-amlogic@lists.infradead.org" , "linux-kernel@vger.kernel.org" , kernel , Vyacheslav Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Hi George, On Thu, Jun 1, 2023 at 10:56=E2=80=AFPM George Stark wrote: [...] > Here the test I promised: > Question: what's the real size of clock divder field in SAR_ADC_REG3 regi= ster in saradc in meson8 socs? > The current kernel code says 5 bits > The datasheet says 6 bit > > The parent clock of adc clock is 24Mhz > I can check it here by: > > # cat /sys/kernel/debug/clk/clk_summary > xtal 4 4 1 24000000 = 0 0 50000 Y > c1108680.adc#adc_div 1 1 0 1142858 = 0 0 50000 Y > c1108680.adc#adc_en 1 1 0 1142858 = 0 0 50000 Y > > for divider width 5bit min adc clock is 24Mhz / 32 =3D 750KHZ > for divider width 6bit min adc clock is 24Mhz / 64 =3D 375KHz > > I suppose that the lower adc clock rate the higher measurement time > so I need to get measurement time at both clk freqs and the times differ = so > 6bit divider is really applied > > I performed test at Odroid-C1, kernel 6.2-rc8 > Two kernel patches must be applied: > > the topic starter patch and the helper patch at the end of the letter > In the helper patch I turn on CLOCK_ALLOW_WRITE_DEBUGFS to change clock r= ate from she shell > and use ktime_get_raw_ts64 to measure measurement time > > So the the test itself: > cat /sys/devices/platform/soc/c1100000.cbus/c1108680.adc/iio:device0/in_v= oltage3_raw > [ 1781.226309] =3D=3D=3D=3D freq: 1142858 time 42408000 > > # echo 750000 > /sys/kernel/debug/clk/c1108680.adc#adc_en/clk_rate > # cat /sys/devices/platform/soc/c1100000.cbus/c1108680.adc/iio:device0/in= _voltage3_raw > [ 1790.728656] =3D=3D=3D=3D freq: 750000 time 49173000 > > # echo 375000 > /sys/kernel/debug/clk/c1108680.adc#adc_en/clk_rate > # cat /sys/devices/platform/soc/c1100000.cbus/c1108680.adc/iio:device0/in= _voltage3_raw > [ 1816.955477] =3D=3D=3D=3D freq: 375000 time 68245000 > > # cat /sys/kernel/debug/clk/clk_summary > xtal 4 4 1 24000000 = 0 0 50000 Y > c1108680.adc#adc_div 1 1 0 375000 = 0 0 50000 Y > c1108680.adc#adc_en 1 1 0 375000 = 0 0 50000 Y These results looks excellent - thanks for sharing the test results! Could you please check one last thing: $ grep -i adc /sys/kernel/debug/meson-clk-msr/measure_summary It should confirm that the clock rate is 375kHz (or close to it, SoC internal clock measurement is not 100% precise) Once we have that confirmation: can you please re-send the patch with the description updated so it's clear which SoC generations are affected and by stating that the fix was tested on a Meson8b Odroid-C1 board. Thank you and best regards, Martin