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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8B2B7C433EF for ; Thu, 14 Jul 2022 11:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:CC:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tLw5utdFJKc4GPL7WoxfVTHMVYp9Tjcepa4p88ZPjck=; b=NoS2NKy4DnHk9r BnPk3SnbnJozJIhl2X6w0fN28o3+fLBgZo6sTGI5TW0x3L04VLP9LQlEaMnOrEvGhDp4vX7EV8MYH 3YlGX+cXSNF5w2fP6Czm+T+nQuJCoGcNIipRZgxCXcPWhl4V9C6IUs1zObbf0eP99ue/QJ/EURfRV 3edEDkP5NrHU0DvTltLp3yPlJeB9E4gdKerTxgYIIhFay4ROgaCauT/YYlD+sAh9B73IO8gNO8t3M sJjocei5zQ+fHYjg9xThSTp6Pm31wzd/+3f1i+EBIBoLLJ6g5r/m9ScZ7TiNT/stzK8R+Z0xV/Whw gVGOhD0gH3tKuLczo5ew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBwsT-00DgNz-M3; Thu, 14 Jul 2022 11:19:29 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBwsP-00DgKT-4f; Thu, 14 Jul 2022 11:19:26 +0000 X-UUID: efa084e92a6346e9b1fbeaeecc71f114-20220714 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.8,REQID:92b5cb22-a721-42fb-bb1d-7c38c462a2c0,OB:0,LO B:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-META: VersionHash:0f94e32,CLOUDID:6c6a4c64-0b3f-4b2c-b3a6-ed5c044366a0,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil ,QS:nil,BEC:nil,COL:0 X-UUID: efa084e92a6346e9b1fbeaeecc71f114-20220714 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1891307780; Thu, 14 Jul 2022 04:19:18 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Thu, 14 Jul 2022 19:19:16 +0800 Received: from mtksdccf07 (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.3 via Frontend Transport; Thu, 14 Jul 2022 19:19:15 +0800 Message-ID: Subject: Re: [PATCH v14 03/10] drm/edid: Add cea_sad helpers for freq/length From: Rex-BC Chen To: AngeloGioacchino Del Regno , , , , , , , , , , CC: , , , , , , , , , , , , Date: Thu, 14 Jul 2022 19:19:10 +0800 In-Reply-To: <67b3a842-66aa-2336-3955-d5aa760cdd4b@collabora.com> References: <20220712111223.13080-1-rex-bc.chen@mediatek.com> <20220712111223.13080-4-rex-bc.chen@mediatek.com> <67b3a842-66aa-2336-3955-d5aa760cdd4b@collabora.com> X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220714_041925_192154_0813A71F X-CRM114-Status: GOOD ( 24.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 2022-07-14 at 13:12 +0200, AngeloGioacchino Del Regno wrote: > Il 12/07/22 13:12, Bo-Chen Chen ha scritto: > > From: Guillaume Ranquet > > > > This patch adds two helper functions that extract the frequency and > > word > > length from a struct cea_sad. > > > > For these helper functions new defines are added that help > > translate the > > 'freq' and 'byte2' fields into real numbers. > > > > Signed-off-by: Markus Schneider-Pargmann > > Signed-off-by: Guillaume Ranquet > > Signed-off-by: Bo-Chen Chen > > --- > > drivers/gpu/drm/drm_edid.c | 73 > > ++++++++++++++++++++++++++++++++++++++ > > include/drm/drm_edid.h | 14 ++++++++ > > 2 files changed, 87 insertions(+) > > > > diff --git a/drivers/gpu/drm/drm_edid.c > > b/drivers/gpu/drm/drm_edid.c > > index bc43e1b32092..79316d7f1fd8 100644 > > --- a/drivers/gpu/drm/drm_edid.c > > +++ b/drivers/gpu/drm/drm_edid.c > > @@ -4916,6 +4916,79 @@ int drm_edid_to_speaker_allocation(const > > struct edid *edid, u8 **sadb) > > } > > EXPORT_SYMBOL(drm_edid_to_speaker_allocation); > > > > +/** > > + * drm_cea_sad_get_sample_rate - Extract the sample rate from > > cea_sad > > + * @sad: Pointer to the cea_sad struct > > + * > > + * Extracts the cea_sad frequency field and returns the sample > > rate in Hz. > > + * > > + * Return: Sample rate in Hz or a negative errno if parsing > > failed. > > + */ > > +int drm_cea_sad_get_sample_rate(const struct cea_sad *sad) > > +{ > > + switch (sad->freq) { > > + case DRM_CEA_SAD_FREQ_32KHZ: > > + return 32000; > > + case DRM_CEA_SAD_FREQ_44KHZ: > > + return 44100; > > + case DRM_CEA_SAD_FREQ_48KHZ: > > + return 48000; > > + case DRM_CEA_SAD_FREQ_88KHZ: > > + return 88200; > > + case DRM_CEA_SAD_FREQ_96KHZ: > > + return 96000; > > + case DRM_CEA_SAD_FREQ_176KHZ: > > + return 176400; > > + case DRM_CEA_SAD_FREQ_192KHZ: > > + return 192000; > > + default: > > + return -EINVAL; > > + } > > +} > > +EXPORT_SYMBOL(drm_cea_sad_get_sample_rate); > > + > > +static bool drm_cea_sad_is_pcm(const struct cea_sad *sad) > > +{ > > + switch (sad->format) { > > + case HDMI_AUDIO_CODING_TYPE_PCM: > > + return true; > > + default: > > + return false; > > + } > > Are you sure that you need this helper? That's used only in one > function... > ...if you really need this one, though, I don't think that using a > switch > is the best option here. > > Unless anyone is against that (please, reason?), I would be for doing > it like: > > return sad->format == HDMI_AUDIO_CODING_TYPE_PCM; > > Everything else looks good to me (and working, too). > > Cheers, > Angelo Hello Angelo, I think you are right, in this case, we don't need this help function. I will merge this function into drm_cea_sad_get_uncompressed_word_length() BRs, Bo-Chen _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel