Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA00DC433FE for ; Fri, 17 Dec 2021 08:24:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233800AbhLQIYs (ORCPT ); Fri, 17 Dec 2021 03:24:48 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:41986 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231287AbhLQIYs (ORCPT ); Fri, 17 Dec 2021 03:24:48 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A460061FCC; Fri, 17 Dec 2021 08:24:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B924C36AE1; Fri, 17 Dec 2021 08:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1639729487; bh=CbaFWW4ZNZTH1DI4qN8igDyU8NcMcrxlUtLugBF1z2Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OwzwgO2/tQcE5OVcqx2S7YU5QuqvLtn5aK9H2iIw5ACZaTLINdbqFwQU1vkQXHo4U j9MCOhlncsTM2ifqf7eAeFjqN1UIiLKfU5pplziMDORm0yB7tGjxygPPpLLRNBsX3v x2jzmYHFxI2iYxCMcoZPx3AUFh9/eQEMksdrkR8Y= Date: Fri, 17 Dec 2021 09:24:43 +0100 From: gregkh To: Tony Huang =?utf-8?B?6buD5oe35Y6a?= Cc: Wells Lu =?utf-8?B?5ZGC6Iqz6aiw?= , Rob Herring , DTML , Linux Kernel Mailing List , Derek Kiernan , Dragan Cvetic , Arnd Bergmann , =?utf-8?B?6buD5oe35Y6a?= Subject: Re: [PATCH v4 2/2] misc: Add iop driver for Sunplus SP7021 Message-ID: References: <3a2820c389444f7db99712f7cd11de30@sphcmbx02.sunplus.com.tw> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3a2820c389444f7db99712f7cd11de30@sphcmbx02.sunplus.com.tw> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 17, 2021 at 08:10:45AM +0000, Tony Huang 黃懷厚 wrote: > Dear Gregkh: > > > > + > > > +static ssize_t sp_iop_state1_show(struct device *dev, struct > > > +device_attribute *attr, char *buf) { > > > + struct sp_iop *iop = dev_get_drvdata(dev); > > > + ssize_t len = 0; > > > + > > > + sp_iop_standby_mode(iop); > > > + mdelay(10); > > > + sp_iop_s1mode(dev, iop); > > > + return len; > > > +} > > > > This function is not showing anything. > > > > The purpose of this function: > SP7021 has three power states:S0, S1 and S3. > S0:Default domain is on. IOP domain is on. AO domain is on. > S1:Default domain is off. IOP domain is on. AO domain is on. > S3:Default domain is off. IOP domain is off. AO domain is on. > System enter S1 mode when read sysfs sp_iop_state1, That is not what sysfs is for, sorry. > I hope to provide users with the ability to enter S1 mode by themselves. > So I cannot use DEVICE_ATTR. I should use file_operations method. No, please use the normal power management callbacks for your driver that all other drivers use in the kernel. There is nothing special about this one driver to warrant a totally new user/kernel api for it. thanks, greg k-h