Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1847167ybz; Thu, 30 Apr 2020 06:35:29 -0700 (PDT) X-Google-Smtp-Source: APiQypKfO2B96rmCSuVEBYJRTDuMBYER7NG18Q4cPmK/m2NP25rfKbTfzjB+r1UwhxO4YQ1DQSja X-Received: by 2002:a17:907:20b5:: with SMTP id pw21mr2578098ejb.227.1588253728895; Thu, 30 Apr 2020 06:35:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588253728; cv=none; d=google.com; s=arc-20160816; b=ZiG4WOKA1sL6rmfu0QTlbIT9qO8KKH9qVKW1RmdSk1VxVnPqTI40VTEGf94OmaScqg 5a+BpeK5W/Gv0zMitLtBnFY3Ny6lqGI2F/6McFLEEh2UGyX4o38nnxrS6OTc+jZ4fDfR doMws21+MpVT/5HJbWaNS6HkWD2FVwIt06pUgEg+MDaQHx7R1YV82ohrGQXkNw7kQIU8 iQ3IUJ43x2u53hMsyWDtSMdoEoR/dPP31dO7Wm2Y1PVvTPMQinYMQ5zOYzifIcQ6sbEX IGbNdN5pbkL3qOmSShzrzUzAcQGiLg1g3QL2GLvKztNO+Gmou8eR71OpNQPK/A3odxhk t3VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=x5VLtb8LznZjPxJRF3B8Nj/Wabo6ahzbNSsgCocdo3Y=; b=01WvHpSdhZoUeoPhQsZdOOv3rS4zLF3M3tTg/pwXR5ogeiWECAjQBVjUoo14kzkIZt 4xq/DQaiQHNNU3NFSU/y9qxNy5ImvJpzDZLzErt0wq4kXMgIa4coOCjl4uqawA1e03av kp/L5uJF2PVIvO9iY/q/1t9f54lMNr5Hqcw1Xo6xTEjjoXw9xk3bSqWAonT9oRanIpWP zaI8PS7N3eIYeI3ZscLvAwHBVglJW2APhtARwViMiAfeIQNL92sqOMF7FyjPFVoeV/vR rmw4J5EGY9Y8QGBTXwgLCfAgvpG5FZFCaUPZNVae0FmPFV2SpyI2zRgdluI/2itdiB5l yl4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si5296568edr.444.2020.04.30.06.35.00; Thu, 30 Apr 2020 06:35:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727100AbgD3NdG (ORCPT + 99 others); Thu, 30 Apr 2020 09:33:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727088AbgD3NdG (ORCPT ); Thu, 30 Apr 2020 09:33:06 -0400 X-Greylist: delayed 13628 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 30 Apr 2020 06:33:05 PDT Received: from hillosipuli.retiisi.org.uk (hillosipuli.retiisi.org.uk [IPv6:2a01:4f9:c010:4572::81:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDF39C035494; Thu, 30 Apr 2020 06:33:05 -0700 (PDT) Received: from valkosipuli.localdomain (valkosipuli.retiisi.org.uk [IPv6:2a01:4f9:c010:4572::80:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hillosipuli.retiisi.org.uk (Postfix) with ESMTPS id C2C81634C91; Thu, 30 Apr 2020 16:32:57 +0300 (EEST) Received: from sailus by valkosipuli.localdomain with local (Exim 4.92) (envelope-from ) id 1jU9JB-0000Re-LJ; Thu, 30 Apr 2020 16:32:57 +0300 Date: Thu, 30 Apr 2020 16:32:57 +0300 From: Sakari Ailus To: Marco Felsch Cc: Robert Foss , Andy Shevchenko , Maxime Ripard , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Dongchun Zhu , Fabio Estevam , Tomasz Figa Subject: Re: [PATCH v6 2/3] media: ov8856: Add devicetree support Message-ID: <20200430133257.GM867@valkosipuli.retiisi.org.uk> References: <20200429162437.2025699-1-robert.foss@linaro.org> <20200429162437.2025699-3-robert.foss@linaro.org> <20200430093524.GB2188@pengutronix.de> <20200430094549.GF867@valkosipuli.retiisi.org.uk> <20200430095332.GC2188@pengutronix.de> <20200430095907.GG867@valkosipuli.retiisi.org.uk> <20200430101157.GD2188@pengutronix.de> <20200430102018.GI867@valkosipuli.retiisi.org.uk> <20200430120740.GG2188@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200430120740.GG2188@pengutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 30, 2020 at 02:07:41PM +0200, Marco Felsch wrote: > On 20-04-30 13:20, Sakari Ailus wrote: > > On Thu, Apr 30, 2020 at 12:11:57PM +0200, Marco Felsch wrote: > > > On 20-04-30 12:59, Sakari Ailus wrote: > > > > Hi Marco, > > > > > > > > On Thu, Apr 30, 2020 at 11:53:32AM +0200, Marco Felsch wrote: > > > > > Hi Sakari, > > > > > > > > > > On 20-04-30 12:45, Sakari Ailus wrote: > > > > > > Hi Marco, > > > > > > > > > > > > On Thu, Apr 30, 2020 at 11:35:24AM +0200, Marco Felsch wrote: > > > > > > ... > > > > > > > > > > > - if (mclk != OV8856_MCLK) { > > > > > > > > - dev_err(dev, "external clock %d is not supported", mclk); > > > > > > > > - return -EINVAL; > > > > > > > > + if (!is_acpi_node(fwnode)) { > > > > > > > > + ov8856->xvclk = devm_clk_get(dev, "xvclk"); > > > > > > > > + if (IS_ERR(ov8856->xvclk)) { > > > > > > > > + dev_err(dev, "could not get xvclk clock (%pe)\n", > > > > > > > > + ov8856->xvclk); > > > > > > > > + return PTR_ERR(ov8856->xvclk); > > > > > > > > + } > > > > > > > > + > > > > > > > > + clk_set_rate(ov8856->xvclk, xvclk_rate); > > > > > > > > + xvclk_rate = clk_get_rate(ov8856->xvclk); > > > > > > > > } > > > > > > > > > > > > > > Why do we handle the clock only in DT case? Is there a problem with the > > > > > > > clock handling and ACPI? > > > > > > > > > > > > Not really, it's just that ACPI does not provide an interface to the clocks > > > > > > as such. > > > > > > > > > > But you will get a clk by devm_clk_get()? > > > > > > > > No, because ACPI does not expose one to drivers. Effectively the entire > > > > power sequences are implemented in ACPI, not in the driver. > > > > > > > > > > Ah okay, thanks for the explanation. I'm really not into the ACPI > > > stuff.. So this means the __power_off / power_on should only be done if > > > we are using DT's? > > > > Correct. That's why it bails out early. It could be yet earlier though, > > without doing anything. > > Yes I see. For easier and error less prone handling I would prefer: > > if (is_acpi_node()) > return 0; > > as first instruction for __power_off/on(). > > Also I would refator the ov8856_check_hwcfg() so the common part can be > used by this function and by a ov8856_parse_of() function. But thats > only my opinion. I guess it could be the same function, up to you. -- Sakari Ailus