Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1403414ybl; Wed, 29 Jan 2020 22:23:24 -0800 (PST) X-Google-Smtp-Source: APXvYqz/i/c6+rGSlgP9cOHp8KeYmsRIVr28rqZvKL9iGbcycSu2tN9M5vAI2l0M39TKOVJA5+S6 X-Received: by 2002:aca:b70a:: with SMTP id h10mr1979497oif.20.1580365404783; Wed, 29 Jan 2020 22:23:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580365404; cv=none; d=google.com; s=arc-20160816; b=NtGyeL0a7W7dyRZ9l6qmcrvwZutw+wnWreV3U0QPGKoar+qOku9AFk2k5Az7E8KdpU eZE+wbwjjpD5H1vo5xwm0KHEoQpCCridBAxc0p8fI4E4LOoB1O5RDFfh4KI+ttGWX9wo ZEXZitDA+4zRPSb4PGDF3/yNLhf5mfF1yzKzApxURlmG+Ixfttl3CXeOSoHFtismjeFO DIyS1Sg4c2HG4wIukEeFxs2T+khY+lAAMoidSmWZUaGAYXbr159wQRdKyhYmtHQ0wlSt EYY9HQtG7wGlwXECa4XIQqw2pGY45JBOTwKpWe2uEg7ef/jRdpyz7rMyC+ReB8Qh5jkQ 6uXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=KzbZ+kr+9XCJOp/b/Vsd/kZYowcpc33e5PMtcLk/VJQ=; b=uMiwt3yYbkEUq8PmyG7rHQJYtB31qLNeV0XCOjJq3m1jxtLpmZotslE3pgHhvU7QAl XVXknYb7OlnZV3TeP66bKAAhdakPfGOCHy0R1L40noFTmHxKXP1zTeHWfWZoYgXsieH2 XNhDNG/4mzEqoFJ6GkJbsiBFCUt5h5/vGBFlGLoP0SzGmlHi+3x+blnphamgmbZxMi2W 8VLZfgFpgOvoFRd5adJ/06tLfIXnBPrJ1+HFOpMkkE5+y//v15sejpPcsNtlFbiqNbn9 Uj/yfObVw6d5erff5Gf5vPgqR9CANd0aGxZa3SAg+6gvQf7rtKNESN7oORpM1VCsN/Z/ HhMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t26si2286962otq.264.2020.01.29.22.23.12; Wed, 29 Jan 2020 22:23:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726461AbgA3GVA (ORCPT + 99 others); Thu, 30 Jan 2020 01:21:00 -0500 Received: from olimex.com ([184.105.72.32]:54138 "EHLO olimex.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725798AbgA3GVA (ORCPT ); Thu, 30 Jan 2020 01:21:00 -0500 Received: from 94.155.250.134 ([94.155.250.134]) by olimex.com with ESMTPSA (ECDHE-RSA-AES128-GCM-SHA256:TLSv1.2:Kx=ECDH:Au=RSA:Enc=AESGCM(128):Mac=AEAD) (SMTP-AUTH username stefan@olimex.com, mechanism PLAIN) for ; Wed, 29 Jan 2020 22:20:58 -0800 Subject: Re: [PATCH v3 1/1] drm: sun4i: hdmi: Add support for sun4i HDMI encoder audio To: Maxime Ripard , Stefan Mavrodiev Cc: Chen-Yu Tsai , David Airlie , Daniel Vetter , open list , "open list:DRM DRIVERS FOR ALLWINNER A10" , "moderated list:ARM/Allwinner sunXi SoC support" , linux-sunxi@googlegroups.com References: <20200128140642.8404-1-stefan@olimex.com> <20200128140642.8404-2-stefan@olimex.com> <20200129164321.34mornbi3xvx5dys@gilmour.lan> From: Stefan Mavrodiev Message-ID: <64676a4b-e149-146c-81b4-7fd5e792efc5@olimex.com> Date: Thu, 30 Jan 2020 08:20:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200129164321.34mornbi3xvx5dys@gilmour.lan> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 1/29/20 6:43 PM, Maxime Ripard wrote: > Hi, > > On Tue, Jan 28, 2020 at 04:06:42PM +0200, Stefan Mavrodiev wrote: >> diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c >> index 68d4644ac2dc..4cd35c97c503 100644 >> --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c >> +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c >> @@ -23,6 +23,8 @@ >> #include >> #include >> >> +#include >> + >> #include "sun4i_backend.h" >> #include "sun4i_crtc.h" >> #include "sun4i_drv.h" >> @@ -87,6 +89,10 @@ static void sun4i_hdmi_disable(struct drm_encoder *encoder) >> >> DRM_DEBUG_DRIVER("Disabling the HDMI Output\n"); >> >> +#ifdef CONFIG_DRM_SUN4I_HDMI_AUDIO >> + sun4i_hdmi_audio_destroy(hdmi); >> +#endif >> + >> val = readl(hdmi->base + SUN4I_HDMI_VID_CTRL_REG); >> val &= ~SUN4I_HDMI_VID_CTRL_ENABLE; >> writel(val, hdmi->base + SUN4I_HDMI_VID_CTRL_REG); >> @@ -114,6 +120,11 @@ static void sun4i_hdmi_enable(struct drm_encoder *encoder) >> val |= SUN4I_HDMI_VID_CTRL_HDMI_MODE; >> >> writel(val, hdmi->base + SUN4I_HDMI_VID_CTRL_REG); >> + >> +#ifdef CONFIG_DRM_SUN4I_HDMI_AUDIO >> + if (hdmi->hdmi_audio && sun4i_hdmi_audio_create(hdmi)) >> + DRM_ERROR("Couldn't create the HDMI audio adapter\n"); >> +#endif > I really don't think we should be creating / removing the audio card > at enable / disable time. For me it's unnatural to have sound card all the time, even when the HDMI is not plugged-in. I'll follow your suggestion. Besides it's easier for me just to drop this register/unregister mechanism. Best regards, Stefan Mavrodiev > > To fix the drvdata pointer, you just need to use the card pointer in > the unbind, and that's it. > > Maxime