From patchwork Mon Apr 10 19:35:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 97213 Delivered-To: patches@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1503272qgd; Mon, 10 Apr 2017 12:35:18 -0700 (PDT) X-Received: by 10.84.238.198 with SMTP id l6mr16780482pln.95.1491852918168; Mon, 10 Apr 2017 12:35:18 -0700 (PDT) Return-Path: Received: from mail-pf0-x236.google.com (mail-pf0-x236.google.com. [2607:f8b0:400e:c00::236]) by mx.google.com with ESMTPS id p26si14416155pgd.368.2017.04.10.12.35.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Apr 2017 12:35:18 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c00::236 as permitted sender) client-ip=2607:f8b0:400e:c00::236; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c00::236 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-pf0-x236.google.com with SMTP id s16so37822217pfs.0 for ; Mon, 10 Apr 2017 12:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=phvMxALdwJmApUqUxUegxNFgJw7W/pYcN3omlJvoJjY=; b=L2PuSQrcmmDupuIVmkcVqnU/eXfuoHrf8uGLRwS8pNQDjuCVnkSto9HIuwg2+yrYGI DaibPGrKXcIIk/iYGhm31zU07vUjxtSFT4B5qiFXNlEofWsHapyrx5yiA54WAnK5kYwm rsFTvjvROPS7NFrqejSFNGwSidlwTA+IriHks= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=phvMxALdwJmApUqUxUegxNFgJw7W/pYcN3omlJvoJjY=; b=OOc5YE1+A8OqWFqtLVw3tjQBSXADVXgT1+EP4SxCa6/I09w3zEuOL5dPSYd3tkff33 4P3OL9hqe+MFSGrTuq2ToM+BUy/SaulY4mR/d9qxs6c4WxdxSE2T+xrgcJs931Q0mf2M 6Gen71/Ja1ImAbVRR7egF6u8NK2GvFAUpbsVmO5QNtfQ69a3SEKhdi8hpbkGp1z1AhY0 4Wft2CLnG/qE8uzpX+Ah07cv2qODcpHvqPiTENmNOkXpmXBxR0hFGHOTCZZkmoXoSaO7 EAbgcMCLXb1rYUBOsn2R5zGRQRhl5dj47xkRApKy8ZGqo9ehP3UsPM39NdDPnplEr79I nokA== X-Gm-Message-State: AFeK/H1MkdCHa6r4NiXZV1Fi/ZQanFNBpIdEnWDetQFPzWzWsyc6iBNvwiZ/DwrJfFFs9bSzIuo= X-Received: by 10.84.204.8 with SMTP id a8mr69931107ple.4.1491852917807; Mon, 10 Apr 2017 12:35:17 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id g21sm26161036pfb.41.2017.04.10.12.35.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Apr 2017 12:35:16 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Zhangfei Gao , Liam Girdwood , Mark Brown , Jaroslav Kysela , Wei Xu , Rob Herring , Andy Green , Dave Long , Guodong Xu Subject: [PATCH 1/2] ASoC: Improve hi6210-i2s DT bindings Date: Mon, 10 Apr 2017 12:35:11 -0700 Message-Id: <1491852912-18712-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 This patch improves the previously submitted hi6210-i2s DT binding, adding extra details to how the multi-dai index value maps to the potential interfaces. (Currently just index 0 -> the S2 interface, as there is only one supported, but in the future other interfaces may be enabled.) Cc: Zhangfei Gao Cc: Liam Girdwood Cc: Mark Brown Cc: Jaroslav Kysela Cc: Wei Xu Cc: Rob Herring Cc: Andy Green Cc: Dave Long Cc: Guodong Xu Signed-off-by: John Stultz --- Documentation/devicetree/bindings/sound/hisilicon,hi6210-i2s.txt | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.7.4 diff --git a/Documentation/devicetree/bindings/sound/hisilicon,hi6210-i2s.txt b/Documentation/devicetree/bindings/sound/hisilicon,hi6210-i2s.txt index 680bb035..7a29678 100644 --- a/Documentation/devicetree/bindings/sound/hisilicon,hi6210-i2s.txt +++ b/Documentation/devicetree/bindings/sound/hisilicon,hi6210-i2s.txt @@ -17,6 +17,10 @@ Required properties: - dma-names: should be "tx" and "rx" - hisilicon,sysctrl-syscon: phandle to sysctrl syscon - #sound-dai-cells: Should be set to 1 (for multi-dai) + - The dai cell indexes reference the following interfaces: + 0: S2 interface + (Currently that is the only one available, but more may be + supported in the future) Example for the hi6210 i2s controller: @@ -32,3 +36,7 @@ i2s0: i2s@f7118000{ hisilicon,sysctrl-syscon = <&sys_ctrl>; #sound-dai-cells = <1>; }; + +Then when referencing the i2s controller: + sound-dai = <&i2s0 0>; /* index 0 => S2 interface */ + From patchwork Mon Apr 10 19:35:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 97214 Delivered-To: patches@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1503279qgd; Mon, 10 Apr 2017 12:35:19 -0700 (PDT) X-Received: by 10.84.130.99 with SMTP id 90mr70685988plc.94.1491852919705; Mon, 10 Apr 2017 12:35:19 -0700 (PDT) Return-Path: Received: from mail-pg0-x231.google.com (mail-pg0-x231.google.com. [2607:f8b0:400e:c05::231]) by mx.google.com with ESMTPS id d23si14438650plj.139.2017.04.10.12.35.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Apr 2017 12:35:19 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::231 as permitted sender) client-ip=2607:f8b0:400e:c05::231; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::231 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-pg0-x231.google.com with SMTP id g2so109239469pge.3 for ; Mon, 10 Apr 2017 12:35:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/0L2sohrGkXMvTeDuqu0CA8sMshKKkLn5Lid16up08k=; b=hzL5y329eeotaE4zKNCNkPZBixewLxtUK+1ma2yx75x02eKjN101Tw7vJ3H86Vn09U nJ9CmdXgqhlFbYhEoKRaI8R0tcaoWE9RHIZ0T+caNWq6nGMnoWM94Mas8bDWBzK4Xss7 Q8RW6Gt2qeI4kbbwwPAVJxjBooslN54pDTGjU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/0L2sohrGkXMvTeDuqu0CA8sMshKKkLn5Lid16up08k=; b=uBaD1+yuzPSj1JICidFMl3Qw4qM1vDtE5Iu/ZCJEs3s9a96sM0HdrU41QJkRfeQsVY akDxL4+7XY4H0RwD+wz0Qk8owQD6VLiTv0HCO9FoEGWYuNWgUV8ukwHrATuHTufKXzWq TPxdA1W07e+oD6qNloJ7Q5C1n8iG3GzBpMxjXPZH1+ikJLeD3Cv/0hVrCteI222elNC9 nnOG7GzDd1bvWhJ2PCYSOFljrlgDoNdApSgT+n93ivbl+e37cC0BfvsD7lTQpV27bb95 ZsQBCKbPLgAzadGmNeaMeQ2OvpqsHAQR67KioxM/BxZEo513r6iw7Pjpu71Y3IBz5ti8 lpNA== X-Gm-Message-State: AFeK/H0CrLmnkckiOsTNZdMTplO5zOmszQAR6do9OE35N+EA5zLdfth8nX7w111gBEf/25KNZzI= X-Received: by 10.84.254.74 with SMTP id a10mr30483913pln.185.1491852919400; Mon, 10 Apr 2017 12:35:19 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id g21sm26161036pfb.41.2017.04.10.12.35.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Apr 2017 12:35:18 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Zhangfei Gao , Liam Girdwood , Mark Brown , Jaroslav Kysela , Wei Xu , Rob Herring , Andy Green , Dave Long , Guodong Xu Subject: [PATCH 2/2] ASoC: hisilicon: Minor fixups to hi6210 i2s audio driver Date: Mon, 10 Apr 2017 12:35:12 -0700 Message-Id: <1491852912-18712-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491852912-18712-1-git-send-email-john.stultz@linaro.org> References: <1491852912-18712-1-git-send-email-john.stultz@linaro.org> Mark had a few minor fixups he requested to the hi6210 i2s driver, so this patch proves them. This patch adds a few extra error returns in cases that shouldn't happen, some style nits adding breaks to final default cases in switch statements, and tweaks to use devm_ variant of snd_soc_register_component. Cc: Zhangfei Gao Cc: Liam Girdwood Cc: Mark Brown Cc: Jaroslav Kysela Cc: Wei Xu Cc: Rob Herring Cc: Andy Green Cc: Dave Long Cc: Guodong Xu Signed-off-by: John Stultz --- sound/soc/hisilicon/hi6210-i2s.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/sound/soc/hisilicon/hi6210-i2s.c b/sound/soc/hisilicon/hi6210-i2s.c index 45691b70..bdbf982 100644 --- a/sound/soc/hisilicon/hi6210-i2s.c +++ b/sound/soc/hisilicon/hi6210-i2s.c @@ -324,6 +324,7 @@ static int hi6210_i2s_hw_params(struct snd_pcm_substream *substream, default: i2s->bits = 16; dma_data->addr_width = 2; + break; } i2s->rate = params_rate(params); i2s->channels = params_channels(params); @@ -395,6 +396,7 @@ static int hi6210_i2s_hw_params(struct snd_pcm_substream *substream, break; default: WARN_ONCE(1, "Invalid i2s->fmt MASTER_MASK. This shouldn't happen\n"); + return -EINVAL; } switch (i2s->format & SND_SOC_DAIFMT_FORMAT_MASK) { @@ -409,6 +411,7 @@ static int hi6210_i2s_hw_params(struct snd_pcm_substream *substream, break; default: WARN_ONCE(1, "Invalid i2s->fmt FORMAT_MASK. This shouldn't happen\n"); + return -EINVAL; } val = hi6210_read_reg(i2s, HII2S_I2S_CFG); @@ -440,6 +443,7 @@ static int hi6210_i2s_hw_params(struct snd_pcm_substream *substream, val = hi6210_read_reg(i2s, HII2S_I2S_CFG); val &= ~HII2S_I2S_CFG__S2_FRAME_MODE; hi6210_write_reg(i2s, HII2S_I2S_CFG, val); + break; } /* clear loopback, set signed type and word length */ @@ -587,20 +591,14 @@ static int hi6210_i2s_probe(struct platform_device *pdev) if (ret) return ret; - ret = snd_soc_register_component(&pdev->dev, &hi6210_i2s_i2s_comp, + ret = devm_snd_soc_register_component(&pdev->dev, &hi6210_i2s_i2s_comp, &i2s->dai, 1); - if (ret) { - dev_err(&pdev->dev, "Failed to register dai\n"); - return ret; - } - - return 0; + return ret; } static int hi6210_i2s_remove(struct platform_device *pdev) { snd_soc_unregister_component(&pdev->dev); - dev_set_drvdata(&pdev->dev, NULL); return 0; }