Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp209251rdb; Mon, 22 Jan 2024 01:16:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFJ6eVojEw3rIFngWEbSdz5xIWYFoRBo+jySNhgpaaF+VPHLxMR1QPN7ehKmW+P1uHoodhH X-Received: by 2002:a17:902:d546:b0:1d7:450c:be65 with SMTP id z6-20020a170902d54600b001d7450cbe65mr960153plf.91.1705914995851; Mon, 22 Jan 2024 01:16:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705914995; cv=pass; d=google.com; s=arc-20160816; b=SLJ301f/DDG2qnZW+44rfCm1N69eI8uaGH/oRqSNanqT7wOaPwwDknWJgnOo01TNVw t7XpCjIIFQDQMcrkJtIdJKgftJseLorpfyUyZlABlMoskL3vau44NpgJisromk0O5Y17 sUMIyHdzq7680Sq8ZW/97D8v8itNyGPJQxUJMLUpUk6EbbDIMQtXY50J78fjtH/kWq16 ocDG27WVq80EQqsPcvXTnKFxCEdOTZ5oVQFdR8myyetHVJ/xui40o53BJXnb2vVAhn2L 2hsADSXnkS7rlpCZBlATacyKXjHf2TEhpJtFskv11qhdKSdg3mM0X0kEj2P2IrQ0PK4J RkEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LrG9+46KuXtBlxIUOx0DyHU7sjn1FkhruzlXHAOP5As=; fh=IF1Ls7jxa7JCuP5+azubHLctIo3VYRlSBwVNuSrMvUs=; b=zE3Tl7rx+g9ZdPwti0QGAjjw9U6MIQ4EZGA8Sy2/LpeatIKyDRB6rKExiEAxt5kYYR D+RD56AeqCuG44k9JaZBBcb2jWNHXdVYJ+t5vOww+0+FOMqDv/4GdZp8/x2YCl3xuKC9 xuUUhHF9/p6zBuuRzo4k4jVq9JSMRJTNcmfsRRDAqKWkXzrIK88PkMuUuyNeP2hwu3+2 Mtp3SrKUrkZ0kQZimVxZwn1KlDpUhN6tuu83G1j1BqktIk2imdhASQZWbCg4e36H+E9s VkPibhh7gYMJK+JVyEls+KYX15Ttv5iMWteZHT7v9cWYtawgymeROMo/q6BI5IGTtNGu LmsA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=SFDc5YZj; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-32609-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32609-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id jb5-20020a170903258500b001d70b8d77b9si6847407plb.307.2024.01.22.01.16.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 01:16:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32609-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=SFDc5YZj; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-32609-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32609-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E941928938C for ; Mon, 22 Jan 2024 09:15:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A77E539875; Mon, 22 Jan 2024 09:15:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="SFDc5YZj" Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (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 D8DBE3A8C2; Mon, 22 Jan 2024 09:15:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705914925; cv=none; b=IZ6TIMXf5s/Fd7Dm59s1ONc9PGLvgUx7bX91TZ4zR1dxOwkSXhbcYp7zCxjVuZjMTKYArxsF4u7efuySp98PAInqJVjc2ndmc5ce2aDGYGScla3A5vKGxwxFhWboIpIfaargroxvy0os5ffGxGzCiqVuIB6LzFx1QLxY64s6z9Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705914925; c=relaxed/simple; bh=QOMGLQ8Zx+wPiL92sY2/XSGqt6AVHmJbZBY431fESWI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EqOa88ciVXuMQiDUw8DsssDlLT+XVRiJ6aFlmVrgGe5x8dqBJHZQWKqOir1CFtPxqE+zxnbsKG8h9ChOZN7isQlhiSaB5vqBw7Ls5uZoUJ1QAchP9d6PLK5lT9lj1OWmKgA3lGFeCAzmtPWHtrQdmx8YDT5nwceKpsHnvM5lMpA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=SFDc5YZj; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id E828C1C0008; Mon, 22 Jan 2024 09:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1705914914; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LrG9+46KuXtBlxIUOx0DyHU7sjn1FkhruzlXHAOP5As=; b=SFDc5YZjAYVRO1aKvOuFt3JAr6qRfWGKwPgTbdbQ/8JLd8rtm9JbE+BvXMa0rqbH5G+TNI iFBNBhJw6VvJBsBwjBLnZJ4eFrzgxCIWgFYFZgM+5rKAjSv7Qv5be3ayicmtSpg99/LiEE ZArtLOhhmbouLIJYFK9bDQuasJJcksq4VSNVFdU7J1TujI7vjCB+tp7dRrO06BVCGmqhYx ygT/I2wQJmN+ud0cuf3cgD3x0J3Uq3qOKFfzH6kHinnuAwmtZ0wzqwnaRphmMWLC32FRoY euogrM+TTpBI1BpgrfHqLzuyN6j6EmGrcMiUg+m7KKfJ9PUVei+uOHtSipZj0Q== Date: Mon, 22 Jan 2024 10:15:11 +0100 From: Alexandre Belloni To: Jingbao Qiu Cc: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, chao.wei@sophgo.com, unicorn_wang@outlook.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, dlan@gentoo.org Subject: Re: [PATCH v7 2/3] rtc: sophgo: add rtc support for Sophgo CV1800 SoC Message-ID: <2024012209151130867663@mail.local> References: <20240122080631.2880-1-qiujingbao.dlmu@gmail.com> <20240122081722868bdda5@mail.local> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-GND-Sasl: alexandre.belloni@bootlin.com On 22/01/2024 16:34:00+0800, Jingbao Qiu wrote: > On Mon, Jan 22, 2024 at 4:17 PM Alexandre Belloni > wrote: > > > > On 22/01/2024 16:06:30+0800, Jingbao Qiu wrote: > > > Implement the RTC driver for CV1800, which able to provide time alarm > > > and calibrate functionality. > > > > > > Signed-off-by: Jingbao Qiu > > > --- > > > > > > Depends on https://lore.kernel.org/all/IA1PR20MB4953C774D41EDF1EADB6EC18BB6D2@IA1PR20MB4953.namprd20.prod.outlook.com/ > > > > What is the dependency? > > > > Thank you, this driver requires support from the CLK driver. > I will add an explanation in the next version. > > > > > Also, please fix the checkpatch.pl --strict warnings > > I will use the -- strict option for testing. > > > > > > +/** > > > + * cv1800_rtc_32k_coarse_val_calib() - Using an external > > > + * clock to coarse calibrate the crystal oscillator > > > + * @info: the device of calibrated > > > + * > > > + * @return 0 on success, or -1 on fail > > > + * > > > + * This RTC has an independent 32KHz oscillator. However, > > > + * the accuracy of this oscillator is easily affected by > > > + * external environmental interference,resulting in lower > > > + * accuracy than the internal oscillator.Therefore, a 25M > > > + * crystal oscillator is used as a reference source to > > > + * calibrate the RTC and improve its accuracy.Calibration > > > + * is completed through two steps, namely rough calibration > > > + * and fine calibration. > > > + */ > > > +static int cv1800_rtc_32k_coarse_val_calib(struct cv1800_rtc_priv *info) > > > > This is still not working as well as you think it is. You should > > Implement the offset callbacks instead. > > > I'm sorry, I don't quite understand offset callbacks. > Do you mean that this function needs to be executed periodically. I mean implement read_offset and set_offset here: https://elixir.bootlin.com/linux/v6.7/source/include/linux/rtc.h#L67 -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com