From patchwork Sun Mar 4 14:35:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10257681 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 817F2602B5 for ; Sun, 4 Mar 2018 14:36:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6611628794 for ; Sun, 4 Mar 2018 14:36:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57CE1287FD; Sun, 4 Mar 2018 14:36:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E47C228794 for ; Sun, 4 Mar 2018 14:36:21 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id D02322670A1; Sun, 4 Mar 2018 15:36:19 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E24BD2670E0; Sun, 4 Mar 2018 15:36:17 +0100 (CET) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by alsa0.perex.cz (Postfix) with ESMTP id A016D267063 for ; Sun, 4 Mar 2018 15:36:15 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 03F598D759; Sun, 4 Mar 2018 14:36:15 +0000 (UTC) Received: from shalem.localdomain.com (ovpn-116-72.ams2.redhat.com [10.36.116.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8BEE111DCEE; Sun, 4 Mar 2018 14:36:13 +0000 (UTC) From: Hans de Goede To: Mark Brown , Bard Liao , Oder Chiou , Pierre-Louis Bossart Date: Sun, 4 Mar 2018 15:35:49 +0100 Message-Id: <20180304143610.21125-2-hdegoede@redhat.com> In-Reply-To: <20180304143610.21125-1-hdegoede@redhat.com> References: <20180304143610.21125-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Sun, 04 Mar 2018 14:36:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Sun, 04 Mar 2018 14:36:15 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'hdegoede@redhat.com' RCPT:'' Cc: Hans de Goede , alsa-devel@alsa-project.org, Carlo Caione , Takashi Iwai Subject: [alsa-devel] [PATCH v3 01/22] ASoC: rt5651: Make rt5651_apply_properties() private X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The idea behind exporting rt5651_apply_properties(), was for it to be used on platforms where the platform code may need to add device-properties, rather then relying only on properties set by the firmware. The platform code could then call rt5651_apply_properties() after adding properties to make sure that the codec driver was aware of the new properties. But this is not necessary, as long as we do all property parsing from the codec component-driver's probe function (or later) then the machine driver can attach properties before calling snd_soc_register_card and calling rt5651_apply_properties() for ordering reasons is not necessary. This commit makes rt5651_apply_properties() private and adds 2 comments documenting that all property parsing must be done from the codec component-driver's probe function. Signed-off-by: Hans de Goede --- Changes in v3: -This is a new patch in v3 of this patch-set --- sound/soc/codecs/rt5651.c | 14 ++++++++++++-- sound/soc/codecs/rt5651.h | 2 -- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c index 5ea5233e1b7b..7bff5cda61fd 100644 --- a/sound/soc/codecs/rt5651.c +++ b/sound/soc/codecs/rt5651.c @@ -1666,7 +1666,14 @@ static int rt5651_set_jack(struct snd_soc_component *component, return 0; } -void rt5651_apply_properties(struct snd_soc_component *component) +/* + * Note on some platforms the platform code may need to add device-properties, + * rather then relying only on properties set by the firmware. Therefor the + * property parsing MUST be done from the component driver's probe function, + * rather then from the i2c driver's probe function, so that the platform-code + * can attach extra properties before calling snd_soc_register_card(). + */ +static void rt5651_apply_properties(struct snd_soc_component *component) { if (device_property_read_bool(component->dev, "realtek,in2-differential")) snd_soc_component_update_bits(component, RT5651_IN1_IN2, @@ -1676,7 +1683,6 @@ void rt5651_apply_properties(struct snd_soc_component *component) snd_soc_component_update_bits(component, RT5651_GPIO_CTRL1, RT5651_GP2_PIN_MASK, RT5651_GP2_PIN_DMIC1_SCL); } -EXPORT_SYMBOL_GPL(rt5651_apply_properties); static int rt5651_probe(struct snd_soc_component *component) { @@ -1894,6 +1900,10 @@ static void rt5651_jack_detect_work(struct work_struct *work) snd_soc_jack_report(rt5651->hp_jack, report, SND_JACK_HEADSET); } +/* + * Note this function MUST not look at device-properties, see the comment + * above rt5651_apply_properties(). + */ static int rt5651_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { diff --git a/sound/soc/codecs/rt5651.h b/sound/soc/codecs/rt5651.h index 7d9d5fa09d6f..f3158488fc89 100644 --- a/sound/soc/codecs/rt5651.h +++ b/sound/soc/codecs/rt5651.h @@ -2080,6 +2080,4 @@ struct rt5651_priv { bool hp_mute; }; -void rt5651_apply_properties(struct snd_soc_component *component); - #endif /* __RT5651_H__ */