From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58151C2BA19 for ; Tue, 14 Apr 2020 17:19:03 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D4179206A2 for ; Tue, 14 Apr 2020 17:19:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="YYGE0tOI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4179206A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 15ED5852; Tue, 14 Apr 2020 19:18:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 15ED5852 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1586884741; bh=dkXdr0CAevfQVuDxknxcJpGtVqZ+l00Cln1GYX5ybKo=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YYGE0tOI2dtA0DWAU3pjtgoLk/Qi0/VfNeZ0ht8iNbKfTHrrUDjt4FPqdloj7K2/J le8nyA9bkz0MfogVaWROAIW94l2rj0jHl+FtlrG+xFvOgE7NxAkZ86m1+Ws2Om1jkp 3+JEhTiZUvQt2P0mmN62Pz0xzlz4I9ilA/ECanuE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 45309F80126; Tue, 14 Apr 2020 19:18:10 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 67776F8013D; Tue, 14 Apr 2020 19:18:08 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9860EF800F5 for ; Tue, 14 Apr 2020 19:18:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9860EF800F5 IronPort-SDR: YIEG5LnoVu6Y9Ns/EOxd9oRolF4vDZ3/zCQyMaeaDeW8Tn5c4STLPaPpkniZYXbnzw/Tt8mw9I sk+MnhZPAIeA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2020 10:17:54 -0700 IronPort-SDR: wSdXoXBWbtwb3E7Tm0mh49EdJASJhS4vvbnijD6FTeBStrc1NUUNKh844LrZnzhDD7+w5nbfAD Ad73pOsdtXRA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,383,1580803200"; d="scan'208";a="256582475" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga006.jf.intel.com with ESMTP; 14 Apr 2020 10:17:50 -0700 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1jOPC4-000Zo4-PO; Tue, 14 Apr 2020 20:17:52 +0300 Date: Tue, 14 Apr 2020 20:17:52 +0300 From: Andy Shevchenko To: Pierre-Louis Bossart Subject: Re: [RFC PATCH 03/16] ASoC: Intel: sof-pcm512x: use gpiod for LED Message-ID: <20200414171752.GC34613@smile.fi.intel.com> References: <20200409195841.18901-1-pierre-louis.bossart@linux.intel.com> <20200409195841.18901-4-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200409195841.18901-4-pierre-louis.bossart@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Cc: alsa-devel@alsa-project.org, Rob Herring , linux-gpio@vger.kernel.org, tiwai@suse.de, Linus Walleij , Stephen Boyd , Daniel Matuschek , Hui Wang , Matthias Reichl , broonie@kernel.org, Bartosz Golaszewski , Michael Turquette , linux-clk@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Thu, Apr 09, 2020 at 02:58:28PM -0500, Pierre-Louis Bossart wrote: > Remove direct regmap access, use gpios exposed by PCM512x codec > Keep the codec_init function, this will be used in following patches > > The gpios handling is done with an explicit lookup table. We cannot > use ACPI-based mappings since we don't have an ACPI device for the > machine driver, and the gpiochip is created during the probe of the > PCM512x driver. ... > +#include Okay, it's a board code. ... > +static struct gpiod_lookup_table pcm512x_gpios_table = { > + /* .dev_id set during probe */ > + .table = { > + GPIO_LOOKUP("pcm512x-gpio", 3, "PCM512x-GPIO4", GPIO_ACTIVE_HIGH), It says GPIO 4 and here is number 3. Does this 4 come from hardware documentation? > + { }, No comma for terminator entries. > + }, > +}; ... > + gpiod_add_lookup_table(&pcm512x_gpios_table); Where is the counterpart gpiod_remove_lookup_table() call? > + ctx->gpio_4 = devm_gpiod_get(&pdev->dev, "PCM512x-GPIO4", > + GPIOD_OUT_LOW); Can driver work without this GPIO? If so, perhaps devm_gpiod_get_optional(). > + if (IS_ERR(ctx->gpio_4)) { > + dev_err(&pdev->dev, "gpio4 not found\n"); > + ret = PTR_ERR(ctx->gpio_4); > + return ret; > + } -- With Best Regards, Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50A1DC2BA19 for ; Tue, 14 Apr 2020 17:18:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2BB7A20678 for ; Tue, 14 Apr 2020 17:18:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407565AbgDNRSF (ORCPT ); Tue, 14 Apr 2020 13:18:05 -0400 Received: from mga05.intel.com ([192.55.52.43]:5041 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407532AbgDNRSD (ORCPT ); Tue, 14 Apr 2020 13:18:03 -0400 IronPort-SDR: MwOkRpAphWPNBwgGCeRiSXOUH5i0wbRRGNaLxsyI/2l+hm41qbWNFoSQ4xDkYaYs5jh7FjnDjN cfRbGt5Eo9Hw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2020 10:17:54 -0700 IronPort-SDR: wSdXoXBWbtwb3E7Tm0mh49EdJASJhS4vvbnijD6FTeBStrc1NUUNKh844LrZnzhDD7+w5nbfAD Ad73pOsdtXRA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,383,1580803200"; d="scan'208";a="256582475" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga006.jf.intel.com with ESMTP; 14 Apr 2020 10:17:50 -0700 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1jOPC4-000Zo4-PO; Tue, 14 Apr 2020 20:17:52 +0300 Date: Tue, 14 Apr 2020 20:17:52 +0300 From: Andy Shevchenko To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Daniel Matuschek , Matthias Reichl , Hui Wang , linux-gpio@vger.kernel.org, Linus Walleij , Bartosz Golaszewski , linux-clk@vger.kernel.org, Michael Turquette , Stephen Boyd , Rob Herring Subject: Re: [RFC PATCH 03/16] ASoC: Intel: sof-pcm512x: use gpiod for LED Message-ID: <20200414171752.GC34613@smile.fi.intel.com> References: <20200409195841.18901-1-pierre-louis.bossart@linux.intel.com> <20200409195841.18901-4-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200409195841.18901-4-pierre-louis.bossart@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org On Thu, Apr 09, 2020 at 02:58:28PM -0500, Pierre-Louis Bossart wrote: > Remove direct regmap access, use gpios exposed by PCM512x codec > Keep the codec_init function, this will be used in following patches > > The gpios handling is done with an explicit lookup table. We cannot > use ACPI-based mappings since we don't have an ACPI device for the > machine driver, and the gpiochip is created during the probe of the > PCM512x driver. ... > +#include Okay, it's a board code. ... > +static struct gpiod_lookup_table pcm512x_gpios_table = { > + /* .dev_id set during probe */ > + .table = { > + GPIO_LOOKUP("pcm512x-gpio", 3, "PCM512x-GPIO4", GPIO_ACTIVE_HIGH), It says GPIO 4 and here is number 3. Does this 4 come from hardware documentation? > + { }, No comma for terminator entries. > + }, > +}; ... > + gpiod_add_lookup_table(&pcm512x_gpios_table); Where is the counterpart gpiod_remove_lookup_table() call? > + ctx->gpio_4 = devm_gpiod_get(&pdev->dev, "PCM512x-GPIO4", > + GPIOD_OUT_LOW); Can driver work without this GPIO? If so, perhaps devm_gpiod_get_optional(). > + if (IS_ERR(ctx->gpio_4)) { > + dev_err(&pdev->dev, "gpio4 not found\n"); > + ret = PTR_ERR(ctx->gpio_4); > + return ret; > + } -- With Best Regards, Andy Shevchenko