From patchwork Thu Apr 2 18:34:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11471237 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DE6F514DD for ; Thu, 2 Apr 2020 18:39:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BC5FD20719 for ; Thu, 2 Apr 2020 18:39:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387726AbgDBSj7 (ORCPT ); Thu, 2 Apr 2020 14:39:59 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:33417 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727439AbgDBSj7 (ORCPT ); Thu, 2 Apr 2020 14:39:59 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M9ZRc-1jNMXQ41PY-005X3o for ; Thu, 02 Apr 2020 20:39:56 +0200 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id B3258650AA6 for ; Thu, 2 Apr 2020 18:39:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at cetitec.com Received: from mail.cetitecgmbh.com ([127.0.0.1]) by pflvmailgateway.corp.cetitec.com (pflvmailgateway.corp.cetitec.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0-uv8k-Ai-ho for ; Thu, 2 Apr 2020 20:39:56 +0200 (CEST) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 1DCCE64F7EA for ; Thu, 2 Apr 2020 20:39:56 +0200 (CEST) Received: from pflmari.corp.cetitec.com (10.8.5.12) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Apr 2020 20:39:56 +0200 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 81892804FD; Thu, 2 Apr 2020 20:34:00 +0200 (CEST) Date: Thu, 2 Apr 2020 20:34:00 +0200 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v5 1/9] media: adv748x: fix end-of-line terminators in diagnostic statements Message-ID: <2f2460435afa594ef417e70068b125af97ddca39.1585852001.git.alexander.riesen@cetitec.com> Mail-Followup-To: Alex Riesen , Kieran Bingham , Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , Mark Rutland , Kuninori Morimoto , devel@driverdev.osuosl.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.8.5.12] X-ClientProxiedBy: PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) To PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) X-EsetResult: clean, is OK X-EsetId: 37303A290D7F536A6C7266 X-Provags-ID: V03:K1:4ql6TV7KKWRJgAD5jjIU+eHdnNO/G47oomRgMQtXvYMTJOZTzS6 lpE2+1eUM5ULTyX4gGDANT1aq24IOX9UOncQtE6WHRRdgVV9lRFDmnTXDLqs5C7KwN7AD/n 2DYBkfgz37ossgFynAQIeZA7SSJYum20D85DsIjIcGfZcWqAh1LtijdUAzl1vbQgeqnpUj0 hCo6G1N0Uo8o0sWQSdKCQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:6XbgG97zn1g=:XLPQXb5es7obwEF8B5mZAt mw7Snekxq4ba9DdK3VqUdZ2243x2FJfLjoHt6Hodg7OP/5xQx3Lr+NhGYmrTIkj1wxFbkjaqf OXLnCcsu5tlN9M6e+fozVccYDY4ka5aWDaIFktvWWtdA5oQJeU+pB9gqrB4BjxtkXyaaRPFWp W1TnidsEhaAJ54sOJ2EEH2QqJqbwS5QSmjfZteVdq8gMw6CBtcmLs6aDcBLuo0NTwMnv47alV 4FDCSPK43FPgQcwcmt+Uz+2N1rAZoXV4D3jAngHKOrlFxq8lQOclPkZK55fpi5X5lXN/7YWLt Rz59HFWoK1MrbLfUziYMlyeYvu1kG2jNDOo6N5PSFsn4AyK6kfdmKJOsO4O87S+xKNkpZ+YRG W9O8y6XyWqKijFqz6DgIq1fwNfy1Y2/4Hnzi+JolWbqh3moSsiOWonGQDTlqWdL+1pNBBvV4z Xb5Y1mj8zcKhk+jCkHd8k38grk0BcKr+d+tJk2tnr2hIaID/14aUsYKyv4mNR5pOUKuKr6ZUA zqogUAjNeqMEhoV0eEOzJUU4nWSWTl898Jcz1HKShjjuYaRkc6NfFNMuQWisuU7PhTQrYA7jb zChzp/eWxFF//RKT8EQAauo/1+0mCfsMiNJ/8eX6Gr39qjuS+58BTJq0PrqN+RRBy8aV7zVoW YQYo4NpS2OIHCwOrosJPaAJiuGefTwsRJKjlTaucuF+tp2BOKq2dfvjraZf2BClh5/vUfLnY7 jw50Pgnqp8HeH4/bBzjTVzyR9e1KyfWVQa8Gc5i05SubxhRI3R+D4MgxnxVc8XCxJD2lLcKtn sjtMuO3EWdjOz5y9KJ9LTagFRncsItSVgoFeMpeqIIOwBPJO2t/XiMr8t0LtSvi4LulGOcd Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Signed-off-by: Alexander Riesen Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- drivers/media/i2c/adv748x/adv748x-core.c | 24 ++++++++++++------------ drivers/media/i2c/adv748x/adv748x-csi2.c | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c index 23e02ff27b17..c3fb113cef62 100644 --- a/drivers/media/i2c/adv748x/adv748x-core.c +++ b/drivers/media/i2c/adv748x/adv748x-core.c @@ -623,11 +623,11 @@ static int adv748x_parse_dt(struct adv748x_state *state) for_each_endpoint_of_node(state->dev->of_node, ep_np) { of_graph_parse_endpoint(ep_np, &ep); - adv_info(state, "Endpoint %pOF on port %d", ep.local_node, + adv_info(state, "Endpoint %pOF on port %d\n", ep.local_node, ep.port); if (ep.port >= ADV748X_PORT_MAX) { - adv_err(state, "Invalid endpoint %pOF on port %d", + adv_err(state, "Invalid endpoint %pOF on port %d\n", ep.local_node, ep.port); continue; @@ -635,7 +635,7 @@ static int adv748x_parse_dt(struct adv748x_state *state) if (state->endpoints[ep.port]) { adv_err(state, - "Multiple port endpoints are not supported"); + "Multiple port endpoints are not supported\n"); continue; } @@ -702,62 +702,62 @@ static int adv748x_probe(struct i2c_client *client) /* Discover and process ports declared by the Device tree endpoints */ ret = adv748x_parse_dt(state); if (ret) { - adv_err(state, "Failed to parse device tree"); + adv_err(state, "Failed to parse device tree\n"); goto err_free_mutex; } /* Configure IO Regmap region */ ret = adv748x_configure_regmap(state, ADV748X_PAGE_IO); if (ret) { - adv_err(state, "Error configuring IO regmap region"); + adv_err(state, "Error configuring IO regmap region\n"); goto err_cleanup_dt; } ret = adv748x_identify_chip(state); if (ret) { - adv_err(state, "Failed to identify chip"); + adv_err(state, "Failed to identify chip\n"); goto err_cleanup_dt; } /* Configure remaining pages as I2C clients with regmap access */ ret = adv748x_initialise_clients(state); if (ret) { - adv_err(state, "Failed to setup client regmap pages"); + adv_err(state, "Failed to setup client regmap pages\n"); goto err_cleanup_clients; } /* SW reset ADV748X to its default values */ ret = adv748x_reset(state); if (ret) { - adv_err(state, "Failed to reset hardware"); + adv_err(state, "Failed to reset hardware\n"); goto err_cleanup_clients; } /* Initialise HDMI */ ret = adv748x_hdmi_init(&state->hdmi); if (ret) { - adv_err(state, "Failed to probe HDMI"); + adv_err(state, "Failed to probe HDMI\n"); goto err_cleanup_clients; } /* Initialise AFE */ ret = adv748x_afe_init(&state->afe); if (ret) { - adv_err(state, "Failed to probe AFE"); + adv_err(state, "Failed to probe AFE\n"); goto err_cleanup_hdmi; } /* Initialise TXA */ ret = adv748x_csi2_init(state, &state->txa); if (ret) { - adv_err(state, "Failed to probe TXA"); + adv_err(state, "Failed to probe TXA\n"); goto err_cleanup_afe; } /* Initialise TXB */ ret = adv748x_csi2_init(state, &state->txb); if (ret) { - adv_err(state, "Failed to probe TXB"); + adv_err(state, "Failed to probe TXB\n"); goto err_cleanup_txa; } diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c index 2091cda50935..c43ce5d78723 100644 --- a/drivers/media/i2c/adv748x/adv748x-csi2.c +++ b/drivers/media/i2c/adv748x/adv748x-csi2.c @@ -72,7 +72,7 @@ static int adv748x_csi2_registered(struct v4l2_subdev *sd) struct adv748x_state *state = tx->state; int ret; - adv_dbg(state, "Registered %s (%s)", is_txa(tx) ? "TXA":"TXB", + adv_dbg(state, "Registered %s (%s)\n", is_txa(tx) ? "TXA":"TXB", sd->name); /* From patchwork Thu Apr 2 18:34:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11471243 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 90D7214DD for ; Thu, 2 Apr 2020 18:43:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6E5852078B for ; Thu, 2 Apr 2020 18:43:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389103AbgDBSnU (ORCPT ); Thu, 2 Apr 2020 14:43:20 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:57577 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387866AbgDBSnT (ORCPT ); Thu, 2 Apr 2020 14:43:19 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mt6wz-1j5AWS3U5p-00tVjG for ; Thu, 02 Apr 2020 20:43:17 +0200 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id 962B5650A8B for ; Thu, 2 Apr 2020 18:43:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at cetitec.com Received: from mail.cetitecgmbh.com ([127.0.0.1]) by pflvmailgateway.corp.cetitec.com (pflvmailgateway.corp.cetitec.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VhlYTESaXgnC for ; Thu, 2 Apr 2020 20:43:17 +0200 (CEST) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 3A1D164D593 for ; Thu, 2 Apr 2020 20:43:17 +0200 (CEST) Received: from pflmari.corp.cetitec.com (10.8.5.12) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Apr 2020 20:43:17 +0200 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 768EB804FE; Thu, 2 Apr 2020 20:34:03 +0200 (CEST) Date: Thu, 2 Apr 2020 20:34:03 +0200 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v5 2/9] media: adv748x: include everything adv748x.h needs into the file Message-ID: <046f909122e03286faf0a8916f30d56259656e14.1585852001.git.alexander.riesen@cetitec.com> Mail-Followup-To: Alex Riesen , Kieran Bingham , Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , Mark Rutland , Kuninori Morimoto , devel@driverdev.osuosl.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.8.5.12] X-ClientProxiedBy: PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) To PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) X-EsetResult: clean, is OK X-EsetId: 37303A290D7F536A6C7266 X-Provags-ID: V03:K1:4snloNHITPD/ZfEol7FNceZfFL1O+RMDRsKqfGfnxnz8co6fJB6 RVmqr5mLh3CnVwGFzphVBl4k1ClZh7Ot0Hj6pqi2C4JN48b9PL1sz4/O2Iddllw1ItRX6mj D1pQn6KyVOoCiBkInXuj0Gjuym74XluRCt2b/T9tNvKfVvOnsx7suiusFq6GX8cok/ug8ON LEzE+AtttGLNNWOVhfDLw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:PTQF1WLndsQ=:R9d+tZ8m+l97py+LAqAhwJ 7Z8Mi1grTr0EbV3oQGa/wqYT8MjTLn7qH+EdqDgaRei5psw+se6cnAuW+EEzhX7D70gjNuyU1 8LRKJfMOU2gQwU7onTJTWxQolrbG7GhrXUZ4EEuRjXflBUoP7lJV0Gyp5hLePSiWHfKks+4wR f0LS20WRga1u9o9obWY31MnAdZrseBBO/hyoynFUu2aQ0LLs6IqLsA0gWdoxHzgi4rNLUacRV u4H9d66hdkQIYQa+XByHMsyJsrK4Ce8HbyAGbtF8+PlrimDWU27oAPBeEIypuRjYDfnChQUOQ exsPFkP5E2Zmm8LzA88/E1kIRsSAZxsYfNek32d7hDe/gsFB/uIxILOBZybLjy6429OmMQUWn DAT8lS85hxTv9mtAuvT97gMRvmAPhj+lWLnN8uSqM3v14FsAfdAO4kbYL42ij4DC9zSCBUaPc qatDma4de2Xa4lTab7+xpb+BWwJ116H32mEh/NAw/a7U29p308n41Z7d7VHD8HIFJYkneFC3F jbV0lklCvSJ07/9Qi/q+JgOMwZXswAqNhyRJkVk63GXGCCs0csRnH83ExbJcI/X1kYbGezN7n yDwKK3J+9tdKtRcWqm0Yy6QRfSbnFdNPBTLTN0FpKA9KDDCgSAAqvRXrwNBsvSwxdbCmtSXZo G0CdXmKmyCSbGY9SXnVcV5FN2q0P57WA7FemjavXsBInA5QCkQBpF44gF9J9cqr+HGODckM3d OhIDqsB4AmQ4Fnbimg3Pp1Kp/bzsrDRvew4KVonhvH4rJiuvWx05nMK8gRnI7LYPMUP2mk7xA Kq1uHtT0ZoszdeTz84R1zXwqQB2X2kxaV+5agZSQiqaXTbRDavy+2eZvJXoNAbtRiBYvEwV Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org To follow the established practice of not depending on others to pull everything in. While at it, make sure it stays like this. Signed-off-by: Alexander Riesen Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- drivers/media/i2c/adv748x/adv748x-afe.c | 6 ++---- drivers/media/i2c/adv748x/adv748x-core.c | 6 ++---- drivers/media/i2c/adv748x/adv748x-csi2.c | 6 ++---- drivers/media/i2c/adv748x/adv748x-hdmi.c | 6 ++---- drivers/media/i2c/adv748x/adv748x.h | 2 ++ 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/media/i2c/adv748x/adv748x-afe.c b/drivers/media/i2c/adv748x/adv748x-afe.c index dbbb1e4d6363..5a25d1fbe25f 100644 --- a/drivers/media/i2c/adv748x/adv748x-afe.c +++ b/drivers/media/i2c/adv748x/adv748x-afe.c @@ -6,18 +6,16 @@ * Copyright (C) 2017 Renesas Electronics Corp. */ +#include "adv748x.h" + #include #include #include #include -#include -#include #include #include -#include "adv748x.h" - /* ----------------------------------------------------------------------------- * SDP */ diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c index c3fb113cef62..5c59aad319d1 100644 --- a/drivers/media/i2c/adv748x/adv748x-core.c +++ b/drivers/media/i2c/adv748x/adv748x-core.c @@ -10,6 +10,8 @@ * Kieran Bingham */ +#include "adv748x.h" + #include #include #include @@ -20,14 +22,10 @@ #include #include -#include -#include #include #include #include -#include "adv748x.h" - /* ----------------------------------------------------------------------------- * Register manipulation */ diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c index c43ce5d78723..c00d4f347d95 100644 --- a/drivers/media/i2c/adv748x/adv748x-csi2.c +++ b/drivers/media/i2c/adv748x/adv748x-csi2.c @@ -5,15 +5,13 @@ * Copyright (C) 2017 Renesas Electronics Corp. */ +#include "adv748x.h" + #include #include -#include -#include #include -#include "adv748x.h" - static int adv748x_csi2_set_virtual_channel(struct adv748x_csi2 *tx, unsigned int vc) { diff --git a/drivers/media/i2c/adv748x/adv748x-hdmi.c b/drivers/media/i2c/adv748x/adv748x-hdmi.c index c557f8fdf11a..f598acec3b5c 100644 --- a/drivers/media/i2c/adv748x/adv748x-hdmi.c +++ b/drivers/media/i2c/adv748x/adv748x-hdmi.c @@ -5,18 +5,16 @@ * Copyright (C) 2017 Renesas Electronics Corp. */ +#include "adv748x.h" + #include #include -#include -#include #include #include #include -#include "adv748x.h" - /* ----------------------------------------------------------------------------- * HDMI and CP */ diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h index fccb388ce179..09aab4138c3f 100644 --- a/drivers/media/i2c/adv748x/adv748x.h +++ b/drivers/media/i2c/adv748x/adv748x.h @@ -19,6 +19,8 @@ */ #include +#include +#include #ifndef _ADV748X_H_ #define _ADV748X_H_ From patchwork Thu Apr 2 18:34:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11471247 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DAA561668 for ; Thu, 2 Apr 2020 18:46:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B8D2720719 for ; Thu, 2 Apr 2020 18:46:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389297AbgDBSqm (ORCPT ); Thu, 2 Apr 2020 14:46:42 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:55835 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389065AbgDBSqm (ORCPT ); Thu, 2 Apr 2020 14:46:42 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MOzjW-1jhEyq0shQ-00PNq4 for ; Thu, 02 Apr 2020 20:46:40 +0200 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id ED7B8650ABA for ; Thu, 2 Apr 2020 18:46:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at cetitec.com Received: from mail.cetitecgmbh.com ([127.0.0.1]) by pflvmailgateway.corp.cetitec.com (pflvmailgateway.corp.cetitec.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xZSLPxJ2yIEM for ; Thu, 2 Apr 2020 20:46:39 +0200 (CEST) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 8D55F650429 for ; Thu, 2 Apr 2020 20:46:39 +0200 (CEST) Received: from pflmari.corp.cetitec.com (10.8.5.12) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Apr 2020 20:46:39 +0200 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id A260880500; Thu, 2 Apr 2020 20:34:25 +0200 (CEST) Date: Thu, 2 Apr 2020 20:34:25 +0200 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v5 3/9] media: adv748x: reduce amount of code for bitwise modifications of device registers Message-ID: <72873dc73d3b9a1d46673978326dd5f4f0096a17.1585852001.git.alexander.riesen@cetitec.com> Mail-Followup-To: Alex Riesen , Kieran Bingham , Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , Mark Rutland , Kuninori Morimoto , devel@driverdev.osuosl.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.8.5.12] X-ClientProxiedBy: PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) To PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) X-EsetResult: clean, is OK X-EsetId: 37303A290D7F536A6C7266 X-Provags-ID: V03:K1:zo3AvXxdUSW4IDOjQHVLMJWq0ZYIk2R4gjmQwiAlOBSD026RS5V HT5jF/QcMUIq84XE76+4FM5jgOXM9gFTGiN+MZJ/4H2ltEEmqNHwLV0T+CusSXLHzUBGUOC 5B7ALELdu3AjFzMCDcXWnbzf1i9X5oBnH3Y5cSeWrDodOu/nbVfSi09O80GlqCD6lI5F2PV Tq5DRJ9L9sw186j+TeqXw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:V4ypD2SAwdg=:JUrdKi4jV/lOEabWpR5CXz heeJ1ov8/nz/v3yBBAX5rG++eI6Fs0ChfQ6egb6w0XFh1TK46rzBjVLsDL+84ZqRxV/Xp0pPg 8ZlzcbyS2rqLDjNLR4coWVONmySKu4Y5eNQMOTaUKyZZexBfJrUbuP1JMcHBx75+FqZuX+Mgu NvFlu9TXDtSmKESvG4HXwx+PADo33DmZZOqFPWoM2mqTU6cj/8dPUwzQM6wNiHJO3DFuXtG+r HY/GGzxJ3uCWEMbmyMM4zS+M02fYLop3DTkKGdCiAzNbt6kLVZR38CT8dnzF7BAJ7j3pFmdXx YSSPWBdQh6lmJWdI5b/qWXbMa72tgD1XyM2R2bF+QkAe5karNvIuswWqQjUGp2JOM8Q0t6NGa yj89KwsYLqr6tmOsFzOoxaSTgVkrvzaiYIyGaUc/mN2tFZ12UzwUgyGvtUkLvajlOH9QLvzXs 0prLjakTXp0Mnucu4j8kwOK8VkCwe/ULAysuYYwPgFf6PSS/Ns5P2zYaD4xpcZd6BoWWi21EJ 0AU5f32/6nn7kg+KQakKOEr3u8p++uUhzk3n/zYoWClzkIzNCMsoXntTPPRmF9/dmdk+YS2vL hFTkeBzO9V4c4v+1Xh7th068I20WTUaNNliz5bGx2vkWOyr2W3JzASSnOurzEJzQQ5cg+Zk+y O2qY4mr3o3vrMfMKPo7PoVmyGC2XCgqChOgPQITAqh77vBn0/SdbXe1h7xUGRciLIZ+koj5Qp VZGopbbCNfaeFO4/c8yDVtbSFnbvK/QmY41fAQZftbk7CT62uMXEQKN8qx5xH3JhvrdnYEceK mBCX5Kzy/oIrSW09CGBO+n4iomToTKV729wS+60LfaJ/Cdm5voCf8dDeUGtu8hdkIAfc8ZZ Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The regmap provides a convenient utility for this. The hdmi_* and dpll_* register modification macros added for symmetry with the existing operations (io_*, sdp_*). Signed-off-by: Alexander Riesen Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- v3: remove _update name in favor of existing _clrset --- drivers/media/i2c/adv748x/adv748x-core.c | 6 ++++++ drivers/media/i2c/adv748x/adv748x.h | 14 +++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c index 5c59aad319d1..8580e6624276 100644 --- a/drivers/media/i2c/adv748x/adv748x-core.c +++ b/drivers/media/i2c/adv748x/adv748x-core.c @@ -133,6 +133,12 @@ static int adv748x_write_check(struct adv748x_state *state, u8 page, u8 reg, return *error; } +int adv748x_update_bits(struct adv748x_state *state, u8 page, u8 reg, u8 mask, + u8 value) +{ + return regmap_update_bits(state->regmap[page], reg, mask, value); +} + /* adv748x_write_block(): Write raw data with a maximum of I2C_SMBUS_BLOCK_MAX * size to one or more registers. * diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h index 09aab4138c3f..0a9d78c2870b 100644 --- a/drivers/media/i2c/adv748x/adv748x.h +++ b/drivers/media/i2c/adv748x/adv748x.h @@ -393,25 +393,33 @@ int adv748x_write(struct adv748x_state *state, u8 page, u8 reg, u8 value); int adv748x_write_block(struct adv748x_state *state, int client_page, unsigned int init_reg, const void *val, size_t val_len); +int adv748x_update_bits(struct adv748x_state *state, u8 page, u8 reg, + u8 mask, u8 value); #define io_read(s, r) adv748x_read(s, ADV748X_PAGE_IO, r) #define io_write(s, r, v) adv748x_write(s, ADV748X_PAGE_IO, r, v) -#define io_clrset(s, r, m, v) io_write(s, r, (io_read(s, r) & ~(m)) | (v)) +#define io_clrset(s, r, m, v) adv748x_update_bits(s, ADV748X_PAGE_IO, r, m, v) #define hdmi_read(s, r) adv748x_read(s, ADV748X_PAGE_HDMI, r) #define hdmi_read16(s, r, m) (((hdmi_read(s, r) << 8) | hdmi_read(s, (r)+1)) & (m)) #define hdmi_write(s, r, v) adv748x_write(s, ADV748X_PAGE_HDMI, r, v) +#define hdmi_clrset(s, r, m, v) \ + adv748x_update_bits(s, ADV748X_PAGE_HDMI, r, m, v) + +#define dpll_read(s, r) adv748x_read(s, ADV748X_PAGE_DPLL, r) +#define dpll_clrset(s, r, m, v) \ + adv748x_update_bits(s, ADV748X_PAGE_DPLL, r, m, v) #define repeater_read(s, r) adv748x_read(s, ADV748X_PAGE_REPEATER, r) #define repeater_write(s, r, v) adv748x_write(s, ADV748X_PAGE_REPEATER, r, v) #define sdp_read(s, r) adv748x_read(s, ADV748X_PAGE_SDP, r) #define sdp_write(s, r, v) adv748x_write(s, ADV748X_PAGE_SDP, r, v) -#define sdp_clrset(s, r, m, v) sdp_write(s, r, (sdp_read(s, r) & ~(m)) | (v)) +#define sdp_clrset(s, r, m, v) adv748x_update_bits(s, ADV748X_PAGE_SDP, r, m, v) #define cp_read(s, r) adv748x_read(s, ADV748X_PAGE_CP, r) #define cp_write(s, r, v) adv748x_write(s, ADV748X_PAGE_CP, r, v) -#define cp_clrset(s, r, m, v) cp_write(s, r, (cp_read(s, r) & ~(m)) | (v)) +#define cp_clrset(s, r, m, v) adv748x_update_bits(s, ADV748X_PAGE_CP, r, m, v) #define tx_read(t, r) adv748x_read(t->state, t->page, r) #define tx_write(t, r, v) adv748x_write(t->state, t->page, r, v) From patchwork Thu Apr 2 18:34:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11471263 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 97AAD1668 for ; Thu, 2 Apr 2020 18:50:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 75BDA2078B for ; Thu, 2 Apr 2020 18:50:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388875AbgDBSuE (ORCPT ); Thu, 2 Apr 2020 14:50:04 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:39787 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388778AbgDBSuD (ORCPT ); Thu, 2 Apr 2020 14:50:03 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MWzXd-1jrNLf0Zar-00XO7Q for ; Thu, 02 Apr 2020 20:50:02 +0200 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id E23F765052F for ; Thu, 2 Apr 2020 18:50:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at cetitec.com Received: from mail.cetitecgmbh.com ([127.0.0.1]) by pflvmailgateway.corp.cetitec.com (pflvmailgateway.corp.cetitec.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Oy5Mv_havtAp for ; Thu, 2 Apr 2020 20:50:01 +0200 (CEST) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 893E464F5F7 for ; Thu, 2 Apr 2020 20:50:01 +0200 (CEST) Received: from pflmari.corp.cetitec.com (10.8.5.12) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Apr 2020 20:50:01 +0200 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id E554580501; Thu, 2 Apr 2020 20:34:27 +0200 (CEST) Date: Thu, 2 Apr 2020 20:34:27 +0200 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v5 4/9] media: adv748x: add definitions for audio output related registers Message-ID: <26573ecdb48aa816f802b9d8bbe5f74157248021.1585852001.git.alexander.riesen@cetitec.com> Mail-Followup-To: Alex Riesen , Kieran Bingham , Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , Mark Rutland , Kuninori Morimoto , devel@driverdev.osuosl.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.8.5.12] X-ClientProxiedBy: PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) To PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) X-EsetResult: clean, is OK X-EsetId: 37303A290D7F536A6C7266 X-Provags-ID: V03:K1:tDdN0WEQ8YKtkDQGjf8SgFvm0Hm+Z60tnKJSOf2hwArYDJ+JS8I s9eZMoA8kbJDTW2USxm4+liJThWYcWbxbO5dGtmLMhuK8EfQzZ+NUiDxOjmJAYa65oAsIJv GOE/PhLME1F4fP0uDEw86YrpOPgP1oHfDWsIzoY8DQM13418P76hQ9UA3/aZrrSfrgMCNmG wRqNcbBZfdGBiuL2ibXJg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:X1c981AOioU=:sE7gGYM3+z5hu4h1Xma3J3 2wTjLFriFnWjc/2sD8eWuA5NqgvtcdC5S6O2N4yQi+MLzAI2a8RHu2CpsfpvKJxSBsjVRXPJ8 +qPX3/yh659Sn3eGP9e+8VsRpC7Zty+vbY9+T1AxFvhB0CLernqOlXjx/6/5Y/2UbnxaNA6B1 7SUMvKuO2xurp37bmXaZiuxbL6/Uv6iP+rMcRk8i60dL47Dnpv1yygIwXBc/VvBbuLlzZ9Al0 zKV4kLzvmJh6Gh5HLoIQJHUp3k5bdMWpvVPy7rWVCesHzqVEjeHLtqDp8ecbujD9gM8t2aA7I MZRhhUyd6AmOlJ3wiuF7/cXJBtEW9jdTUdGCAZCILKtayavxDbjAlXqoByDKO/aDiOSYhj5Xn 9WOYK1WB30u1Unqv0c1QiMT1sWcpA0hskXkyciv8s687sRIgsHDr/eQHnPpISgoUGF9tPDsHo QhIf//R9MkXLnG9HxpK5vOQWmUr/vrAlCtWlUKOEjcxNIu4QCLejRKT6O7laTgJsEbV8bTVlH HjdBPdyyipBE4ceE7SQbNnUVsn02yJtYX3bBQKp0vDicxllG5GSYbNHj5ssXwv4N2gnoGliQP yawMKb4ezJF217TfiEzGwcFge8f9OzDKsRyfmMURF5G+TCeBpmS1m02ThIYMaTadDta1Y3Hux KJ0oujgeCYw9W8wkTMlLwANX5pN5z+ixSEQyl2W4PVV2VOBEDA2XCInKYeMWY6iqOLKXMgktx TsVEhGYbiAtwMbAU7AEgpJC2MEpkjcSs94McCGY/ex1VH9LCQvrdDUVFAKbyqIPIpVBTgCQU9 0o6Vz4lkZ/zbiFsu/R1j51y4Cat3ZJDAV4y3LV7Dwpmj3NLCrIRZjF7mWI//HsEPHfVlYd3 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Signed-off-by: Alexander Riesen Reviewed-by: Kieran Bingham --- drivers/media/i2c/adv748x/adv748x.h | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h index 0a9d78c2870b..1a1ea70086c6 100644 --- a/drivers/media/i2c/adv748x/adv748x.h +++ b/drivers/media/i2c/adv748x/adv748x.h @@ -226,6 +226,11 @@ struct adv748x_state { #define ADV748X_IO_VID_STD 0x05 +#define ADV748X_IO_PAD_CONTROLS 0x0e +#define ADV748X_IO_PAD_CONTROLS_TRI_AUD BIT(5) +#define ADV748X_IO_PAD_CONTROLS_PDN_AUD BIT(1) +#define ADV748X_IO_PAD_CONTROLS1 0x1d + #define ADV748X_IO_10 0x10 /* io_reg_10 */ #define ADV748X_IO_10_CSI4_EN BIT(7) #define ADV748X_IO_10_CSI1_EN BIT(6) @@ -248,7 +253,21 @@ struct adv748x_state { #define ADV748X_IO_REG_FF 0xff #define ADV748X_IO_REG_FF_MAIN_RESET 0xff +/* DPLL Map */ +#define ADV748X_DPLL_MCLK_FS 0xb5 +#define ADV748X_DPLL_MCLK_FS_N_MASK GENMASK(2, 0) + /* HDMI RX Map */ +#define ADV748X_HDMI_I2S 0x03 /* I2S mode and width */ +#define ADV748X_HDMI_I2SBITWIDTH_MASK GENMASK(4, 0) +#define ADV748X_HDMI_I2SOUTMODE_SHIFT 5 +#define ADV748X_HDMI_I2SOUTMODE_MASK \ + GENMASK(6, ADV748X_HDMI_I2SOUTMODE_SHIFT) +#define ADV748X_I2SOUTMODE_I2S 0 +#define ADV748X_I2SOUTMODE_RIGHT_J 1 +#define ADV748X_I2SOUTMODE_LEFT_J 2 +#define ADV748X_I2SOUTMODE_SPDIF 3 + #define ADV748X_HDMI_LW1 0x07 /* line width_1 */ #define ADV748X_HDMI_LW1_VERT_FILTER BIT(7) #define ADV748X_HDMI_LW1_DE_REGEN BIT(5) @@ -260,6 +279,16 @@ struct adv748x_state { #define ADV748X_HDMI_F1H1 0x0b /* field1 height_1 */ #define ADV748X_HDMI_F1H1_INTERLACED BIT(5) +#define ADV748X_HDMI_MUTE_CTRL 0x1a +#define ADV748X_HDMI_MUTE_CTRL_MUTE_AUDIO BIT(4) +#define ADV748X_HDMI_MUTE_CTRL_WAIT_UNMUTE_MASK GENMASK(3, 1) +#define ADV748X_HDMI_MUTE_CTRL_NOT_AUTO_UNMUTE BIT(0) + +#define ADV748X_HDMI_AUDIO_MUTE_SPEED 0x0f +#define ADV748X_HDMI_AUDIO_MUTE_SPEED_MASK GENMASK(4, 0) +#define ADV748X_MAN_AUDIO_DL_BYPASS BIT(7) +#define ADV748X_AUDIO_DELAY_LINE_BYPASS BIT(6) + #define ADV748X_HDMI_HFRONT_PORCH 0x20 /* hsync_front_porch_1 */ #define ADV748X_HDMI_HFRONT_PORCH_MASK 0x1fff @@ -281,6 +310,9 @@ struct adv748x_state { #define ADV748X_HDMI_TMDS_1 0x51 /* hdmi_reg_51 */ #define ADV748X_HDMI_TMDS_2 0x52 /* hdmi_reg_52 */ +#define ADV748X_HDMI_REG_6D 0x6d /* hdmi_reg_6d */ +#define ADV748X_I2S_TDM_MODE_ENABLE BIT(7) + /* HDMI RX Repeater Map */ #define ADV748X_REPEATER_EDID_SZ 0x70 /* primary_edid_size */ #define ADV748X_REPEATER_EDID_SZ_SHIFT 4 From patchwork Thu Apr 2 18:34:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11471273 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5F27E92C for ; Thu, 2 Apr 2020 18:53:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A61220719 for ; Thu, 2 Apr 2020 18:53:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387726AbgDBSxn (ORCPT ); Thu, 2 Apr 2020 14:53:43 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:46351 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732214AbgDBSxm (ORCPT ); Thu, 2 Apr 2020 14:53:42 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mq2Wi-1ixcNK0ebS-00n94E for ; Thu, 02 Apr 2020 20:53:40 +0200 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id E1C5F650735 for ; Thu, 2 Apr 2020 18:53:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at cetitec.com Received: from mail.cetitecgmbh.com ([127.0.0.1]) by pflvmailgateway.corp.cetitec.com (pflvmailgateway.corp.cetitec.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zJU47-FpzgiE for ; Thu, 2 Apr 2020 20:53:39 +0200 (CEST) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 3BFC064D894 for ; Thu, 2 Apr 2020 20:53:39 +0200 (CEST) Received: from pflmari.corp.cetitec.com (10.8.5.12) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Apr 2020 20:53:39 +0200 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 2D0E680502; Thu, 2 Apr 2020 20:34:38 +0200 (CEST) Date: Thu, 2 Apr 2020 20:34:38 +0200 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , , linux-clk Subject: [PATCH v5 5/9] media: adv748x: add support for HDMI audio Message-ID: <74e0e3041732bf6151196445dab30dd08ea890cb.1585852001.git.alexander.riesen@cetitec.com> Mail-Followup-To: Alex Riesen , Kieran Bingham , Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , Mark Rutland , Kuninori Morimoto , devel@driverdev.osuosl.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-clk References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.8.5.12] X-ClientProxiedBy: PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) To PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) X-EsetResult: clean, is OK X-EsetId: 37303A290D7F536A6C7266 X-Provags-ID: V03:K1:v7PMPcH+1OXGVU6364UBRTgl3kUZm0ILVn2qETDDrJV09P2oZAe 6mwboI2B1eq89XAjHgPQeeLWlJESO87u1nUpxn/7fANZmJoT3jUr0dKuJI6TSouKrK0sFQO LWW59KO5Hp4wWO8+Zo5stuy6OF3nI/Fl6S8PFhnyL+NYt1snu/UWxwm+jP1tQmQE4X/kW86 dos6ttsiaZxDnqC+mvorw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:AGPOziXWW9Q=:Z8YAeKZpC3KvgE0P4luNu2 DIonrY5oB2TL464BwrgQkShsobX7JfuXT9MXH/rBuTDHtL0mv4nNnGZqTSrAzWeJHl0lC1JyW mXKtOAI3UhFN8Rqwsm7uKog1xRDDP8X7VpWqZp0w6KmVnlR8MI4/4PXYpLKo6sNF21AUVpHgH 1nCrkwQH+Q2zmfYHEAde5SvQPOf4OvW/axwH0yqieixtELMVi1a3Oq69B+CnqmwtnO/DGbiaz rO/nMsi5BUzPE9OCZf8pWbWa7gPCjBA5vYZaLTzIblhcGtpkS9DHhJLx4+ylCqprdlflgTHFl C+Wi6qHWyQfEFGMZQxVBvfHQZJEW6AgwZq4V5ps71Gjcxm9RCumIOT8qiRORQCyDOTv7zai9v Vq164OMWW4VhUkjxI31YV9gfXhn31uVunzMq1iPVvcz17xyf12HwRj1P4rWZXS3lZoSUxGfhE zi9ueHvFNiIJSZIw4WJz9Io7PoIcdjs2pMOUxwCA84k5uJ+dKxg2iOFOb/CdffvisuCmvsDBf Eok57H25NLm2wEls19ZjdgzLYn91Rq4BWmauVPizFMb4Dlwewe+x1qZncDcXMNxEe+piRrIfW nRt7cWL0FUrVledb8xV7+3GG2QhQDVmHZfps/sRkWnyvc2vHtD1F2Awu48GypHlAVPNKGSgcF XtjA7oRelKwNh+UFDD23mGObnVuuahRaWOUCyXRPGtbSeI9pmZayZ0fu7oj3upNqVOkjfDUrS xvurWtpn8+0OTEN0qAgI86BjK8nfw+LAnYvQpBjRHy8LH6Dlu4YThdBUPi4RAfOhfyc/7FjtH 0xZgaQk5HpoFEodRV1OZZhg+7WLXiB0/PoPZIv97jFLQG4NW2oDvA7Q+GqJg/5WTL0cX4pb Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org This adds an implemention of SoC DAI driver which provides access to the I2S port of the device. Signed-off-by: Alexander Riesen --- v3: fix clock registration in case of multiple adv748x devices Suggested-by: Geert Uytterhoeven v4: use clk_hw instead of clk Suggested-by: Stephen Boyd v4: use const for capture snd_soc_pcm_stream instance Suggested-by: Stephen Boyd --- drivers/media/i2c/adv748x/Makefile | 3 +- drivers/media/i2c/adv748x/adv748x-core.c | 9 +- drivers/media/i2c/adv748x/adv748x-dai.c | 261 +++++++++++++++++++++++ drivers/media/i2c/adv748x/adv748x.h | 17 +- 4 files changed, 287 insertions(+), 3 deletions(-) create mode 100644 drivers/media/i2c/adv748x/adv748x-dai.c diff --git a/drivers/media/i2c/adv748x/Makefile b/drivers/media/i2c/adv748x/Makefile index 93844f14cb10..6e7a302ef199 100644 --- a/drivers/media/i2c/adv748x/Makefile +++ b/drivers/media/i2c/adv748x/Makefile @@ -3,6 +3,7 @@ adv748x-objs := \ adv748x-afe.o \ adv748x-core.o \ adv748x-csi2.o \ - adv748x-hdmi.o + adv748x-hdmi.o \ + adv748x-dai.o obj-$(CONFIG_VIDEO_ADV748X) += adv748x.o diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c index 8580e6624276..3513ca138e53 100644 --- a/drivers/media/i2c/adv748x/adv748x-core.c +++ b/drivers/media/i2c/adv748x/adv748x-core.c @@ -765,8 +765,14 @@ static int adv748x_probe(struct i2c_client *client) goto err_cleanup_txa; } + ret = adv748x_dai_init(&state->dai); + if (ret) { + adv_err(state, "Failed to probe DAI\n"); + goto err_cleanup_txb; + } return 0; - +err_cleanup_txb: + adv748x_csi2_cleanup(&state->txb); err_cleanup_txa: adv748x_csi2_cleanup(&state->txa); err_cleanup_afe: @@ -787,6 +793,7 @@ static int adv748x_remove(struct i2c_client *client) { struct adv748x_state *state = i2c_get_clientdata(client); + adv748x_dai_cleanup(&state->dai); adv748x_afe_cleanup(&state->afe); adv748x_hdmi_cleanup(&state->hdmi); diff --git a/drivers/media/i2c/adv748x/adv748x-dai.c b/drivers/media/i2c/adv748x/adv748x-dai.c new file mode 100644 index 000000000000..c9191f8f1ca8 --- /dev/null +++ b/drivers/media/i2c/adv748x/adv748x-dai.c @@ -0,0 +1,261 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Driver for Analog Devices ADV748X HDMI receiver with AFE + * The implementation of DAI. + */ + +#include "adv748x.h" + +#include +#include +#include + +#define state_of(soc_dai) \ + adv748x_dai_to_state(container_of((soc_dai)->driver, \ + struct adv748x_dai, drv)) +#define mclk_of(state) ((state)->dai.mclk_hw->clk) + +static const char ADV748X_DAI_NAME[] = "adv748x-i2s"; + +static int set_audio_pads_state(struct adv748x_state *state, int on) +{ + return io_clrset(state, ADV748X_IO_PAD_CONTROLS, + ADV748X_IO_PAD_CONTROLS_TRI_AUD | + ADV748X_IO_PAD_CONTROLS_PDN_AUD, + on ? 0 : 0xff); +} + +static int set_dpll_mclk_fs(struct adv748x_state *state, int fs) +{ + return dpll_clrset(state, ADV748X_DPLL_MCLK_FS, + ADV748X_DPLL_MCLK_FS_N_MASK, (fs / 128) - 1); +} + +static int set_i2s_format(struct adv748x_state *state, uint outmode, + uint bitwidth) +{ + return hdmi_clrset(state, ADV748X_HDMI_I2S, + ADV748X_HDMI_I2SBITWIDTH_MASK | + ADV748X_HDMI_I2SOUTMODE_MASK, + (outmode << ADV748X_HDMI_I2SOUTMODE_SHIFT) | + bitwidth); +} + +static int set_i2s_tdm_mode(struct adv748x_state *state, int is_tdm) +{ + int ret; + + ret = hdmi_clrset(state, ADV748X_HDMI_AUDIO_MUTE_SPEED, + ADV748X_MAN_AUDIO_DL_BYPASS | + ADV748X_AUDIO_DELAY_LINE_BYPASS, + is_tdm ? 0xff : 0); + if (ret < 0) + return ret; + ret = hdmi_clrset(state, ADV748X_HDMI_REG_6D, + ADV748X_I2S_TDM_MODE_ENABLE, + is_tdm ? 0xff : 0); + return ret; +} + +static int set_audio_mute(struct adv748x_state *state, int enable) +{ + return hdmi_clrset(state, ADV748X_HDMI_MUTE_CTRL, + ADV748X_HDMI_MUTE_CTRL_MUTE_AUDIO, + enable ? 0xff : 0); +} + +static int adv748x_dai_set_sysclk(struct snd_soc_dai *dai, + int clk_id, unsigned int freq, int dir) +{ + struct adv748x_state *state = state_of(dai); + + /* currently supporting only one fixed rate clock */ + if (clk_id != 0 || freq != clk_get_rate(mclk_of(state))) { + dev_err(dai->dev, "invalid clock (%d) or frequency (%u, dir %d)\n", + clk_id, freq, dir); + return -EINVAL; + } + state->dai.freq = freq; + return 0; +} + +static int adv748x_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) +{ + struct adv748x_state *state = state_of(dai); + int ret = 0; + + if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBM_CFM) { + dev_err(dai->dev, "only I2S master clock mode supported\n"); + ret = -EINVAL; + goto done; + } + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { + case SND_SOC_DAI_FORMAT_I2S: + state->dai.tdm = 0; + state->dai.fmt = ADV748X_I2SOUTMODE_I2S; + break; + case SND_SOC_DAI_FORMAT_RIGHT_J: + state->dai.tdm = 1; + state->dai.fmt = ADV748X_I2SOUTMODE_RIGHT_J; + break; + case SND_SOC_DAI_FORMAT_LEFT_J: + state->dai.tdm = 1; + state->dai.fmt = ADV748X_I2SOUTMODE_LEFT_J; + break; + default: + dev_err(dai->dev, "only i2s, left_j and right_j supported\n"); + ret = -EINVAL; + goto done; + } + if ((fmt & SND_SOC_DAIFMT_INV_MASK) != SND_SOC_DAIFMT_NB_NF) { + dev_err(dai->dev, "only normal bit clock + frame supported\n"); + ret = -EINVAL; + } +done: + return ret; +} + +static int adv748x_dai_startup(struct snd_pcm_substream *sub, struct snd_soc_dai *dai) +{ + struct adv748x_state *state = state_of(dai); + + if (sub->stream != SNDRV_PCM_STREAM_CAPTURE) + return -EINVAL; + return set_audio_pads_state(state, 1); +} + +static int adv748x_dai_hw_params(struct snd_pcm_substream *sub, + struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) +{ + int ret; + struct adv748x_state *state = state_of(dai); + uint fs = state->dai.freq / params_rate(params); + + dev_dbg(dai->dev, "dai %s substream %s rate=%u (fs=%u), channels=%u sample width=%u(%u)\n", + dai->name, sub->name, + params_rate(params), fs, + params_channels(params), + params_width(params), + params_physical_width(params)); + switch (fs) { + case 128: + case 256: + case 384: + case 512: + case 640: + case 768: + break; + default: + ret = -EINVAL; + dev_err(dai->dev, "invalid clock frequency (%u) or rate (%u)\n", + state->dai.freq, params_rate(params)); + goto done; + } + ret = set_dpll_mclk_fs(state, fs); + if (ret) + goto done; + ret = set_i2s_tdm_mode(state, state->dai.tdm); + if (ret) + goto done; + ret = set_i2s_format(state, state->dai.fmt, params_width(params)); +done: + return ret; +} + +static int adv748x_dai_mute_stream(struct snd_soc_dai *dai, int mute, int dir) +{ + struct adv748x_state *state = state_of(dai); + + return set_audio_mute(state, mute); +} + +static void adv748x_dai_shutdown(struct snd_pcm_substream *sub, struct snd_soc_dai *dai) +{ + struct adv748x_state *state = state_of(dai); + + set_audio_pads_state(state, 0); +} + +static const struct snd_soc_dai_ops adv748x_dai_ops = { + .set_sysclk = adv748x_dai_set_sysclk, + .set_fmt = adv748x_dai_set_fmt, + .startup = adv748x_dai_startup, + .hw_params = adv748x_dai_hw_params, + .mute_stream = adv748x_dai_mute_stream, + .shutdown = adv748x_dai_shutdown, +}; + +static int adv748x_of_xlate_dai_name(struct snd_soc_component *component, + struct of_phandle_args *args, + const char **dai_name) +{ + if (dai_name) + *dai_name = ADV748X_DAI_NAME; + return 0; +} + +static const struct snd_soc_component_driver adv748x_codec = { + .of_xlate_dai_name = adv748x_of_xlate_dai_name, +}; + +int adv748x_dai_init(struct adv748x_dai *dai) +{ + int ret; + struct adv748x_state *state = adv748x_dai_to_state(dai); + + dai->mclk_name = kasprintf(GFP_KERNEL, "%s.%s-i2s-mclk", + state->dev->driver->name, + dev_name(state->dev)); + if (!dai->mclk_name) { + ret = -ENOMEM; + adv_err(state, "No memory for MCLK\n"); + goto fail; + } + dai->mclk_hw = clk_hw_register_fixed_rate(state->dev, dai->mclk_name, + NULL, 0, 12288000); + if (IS_ERR(dai->mclk_hw)) { + ret = PTR_ERR(dai->mclk_hw); + adv_err(state, "Failed to register MCLK (%d)\n", ret); + goto fail; + } + ret = of_clk_add_hw_provider(state->dev->of_node, of_clk_hw_simple_get, + dai->mclk_hw->clk); + if (ret < 0) { + adv_err(state, "Failed to add MCLK provider (%d)\n", ret); + goto unreg_mclk; + } + dai->drv.name = ADV748X_DAI_NAME; + dai->drv.ops = &adv748x_dai_ops; + dai->drv.capture = (const struct snd_soc_pcm_stream){ + .stream_name = "Capture", + .channels_min = 8, + .channels_max = 8, + .rates = SNDRV_PCM_RATE_48000, + .formats = SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_U24_LE, + }; + + ret = devm_snd_soc_register_component(state->dev, &adv748x_codec, + &dai->drv, 1); + if (ret < 0) { + adv_err(state, "Failed to register the codec (%d)\n", ret); + goto cleanup_mclk; + } + return 0; + +cleanup_mclk: + of_clk_del_provider(state->dev->of_node); +unreg_mclk: + clk_hw_unregister_fixed_rate(dai->mclk_hw); +fail: + return ret; +} + +void adv748x_dai_cleanup(struct adv748x_dai *dai) +{ + struct adv748x_state *state = adv748x_dai_to_state(dai); + + of_clk_del_provider(state->dev->of_node); + clk_hw_unregister_fixed_rate(dai->mclk_hw); + kfree(dai->mclk_name); +} diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h index 1a1ea70086c6..454f97ff7b54 100644 --- a/drivers/media/i2c/adv748x/adv748x.h +++ b/drivers/media/i2c/adv748x/adv748x.h @@ -19,6 +19,7 @@ */ #include +#include #include #include @@ -63,7 +64,8 @@ enum adv748x_ports { ADV748X_PORT_TTL = 9, ADV748X_PORT_TXA = 10, ADV748X_PORT_TXB = 11, - ADV748X_PORT_MAX = 12, + ADV748X_PORT_I2S = 12, + ADV748X_PORT_MAX = 13, }; enum adv748x_csi2_pads { @@ -166,6 +168,13 @@ struct adv748x_afe { container_of(ctrl->handler, struct adv748x_afe, ctrl_hdl) #define adv748x_sd_to_afe(sd) container_of(sd, struct adv748x_afe, sd) +struct adv748x_dai { + struct snd_soc_dai_driver drv; + struct clk_hw *mclk_hw; + char *mclk_name; + unsigned int freq, fmt, tdm; +}; + /** * struct adv748x_state - State of ADV748X * @dev: (OF) device @@ -182,6 +191,7 @@ struct adv748x_afe { * @afe: state of AFE receiver context * @txa: state of TXA transmitter context * @txb: state of TXB transmitter context + * @mclk: MCLK clock of the I2S port */ struct adv748x_state { struct device *dev; @@ -197,10 +207,12 @@ struct adv748x_state { struct adv748x_afe afe; struct adv748x_csi2 txa; struct adv748x_csi2 txb; + struct adv748x_dai dai; }; #define adv748x_hdmi_to_state(h) container_of(h, struct adv748x_state, hdmi) #define adv748x_afe_to_state(a) container_of(a, struct adv748x_state, afe) +#define adv748x_dai_to_state(p) container_of(p, struct adv748x_state, dai) #define adv_err(a, fmt, arg...) dev_err(a->dev, fmt, ##arg) #define adv_info(a, fmt, arg...) dev_info(a->dev, fmt, ##arg) @@ -484,4 +496,7 @@ int adv748x_csi2_set_pixelrate(struct v4l2_subdev *sd, s64 rate); int adv748x_hdmi_init(struct adv748x_hdmi *hdmi); void adv748x_hdmi_cleanup(struct adv748x_hdmi *hdmi); +int adv748x_dai_init(struct adv748x_dai *); +void adv748x_dai_cleanup(struct adv748x_dai *); + #endif /* _ADV748X_H_ */ From patchwork Thu Apr 2 18:34:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11471285 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96B511668 for ; Thu, 2 Apr 2020 18:57:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E40E2077D for ; Thu, 2 Apr 2020 18:57:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389760AbgDBS5C (ORCPT ); Thu, 2 Apr 2020 14:57:02 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:47619 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388658AbgDBS5C (ORCPT ); Thu, 2 Apr 2020 14:57:02 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MiJhW-1inkba3Nx8-00fNwI for ; Thu, 02 Apr 2020 20:57:00 +0200 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id 9160565073A for ; Thu, 2 Apr 2020 18:57:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at cetitec.com Received: from mail.cetitecgmbh.com ([127.0.0.1]) by pflvmailgateway.corp.cetitec.com (pflvmailgateway.corp.cetitec.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xJbFNJGyRqpT for ; Thu, 2 Apr 2020 20:57:00 +0200 (CEST) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 4A70964CC0A for ; Thu, 2 Apr 2020 20:57:00 +0200 (CEST) Received: from pflmari.corp.cetitec.com (10.8.5.12) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Apr 2020 20:57:00 +0200 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id E692280503; Thu, 2 Apr 2020 20:34:48 +0200 (CEST) Date: Thu, 2 Apr 2020 20:34:48 +0200 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v5 6/9] media: adv748x: prepare/enable mclk when the audio is used Message-ID: Mail-Followup-To: Alex Riesen , Kieran Bingham , Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , Mark Rutland , Kuninori Morimoto , devel@driverdev.osuosl.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.8.5.12] X-ClientProxiedBy: PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) To PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) X-EsetResult: clean, is OK X-EsetId: 37303A290D7F536A6C7266 X-Provags-ID: V03:K1:4PU0m/o31r4CCYgmjy9OqrYagieW5Zki74WFejvSjJHyVfACXNo LWx0EFLX7axqCgXm6XMulr6g+iKQB2jfOssnsHR3E7us0qJSpIcWCkOfiruN9xgm5u5o+Bi B2eKNuVWJrmxmPdyvicPloElUFqGpUXNURX/E8ZJ91s35qHla2r7ff8WgjBEQf05VJmcIfv MgZiaiMU3a/KeXzZ5ACxw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:28fZMYzHigo=:UAoHbeDBzoWDEamrt53vVc EeisHEp9VyFVpENXhyEC+WOQh+nlYum8Q57WWlTqiqms6dj1IZrwNLaJ/yMkD4fYocxET4b+V NOwIXzit8Fc2SGiofKcInyqsXYeT7bdZddAXCJVCn66SCvNql0Z8fI4eQTr1k5qZLm4HvIcd3 L4MPpbczKVOehcMsLj8z085gPqttHlUXQq7j3HtMOPKkMjNoRS+9Vc4jmm/Dm+c4P3FtKCMJK 3S0Dh2eabCxkCDIeEWKd41F7PovkFYrapDcPJuO3oMMWWQGOTAhs6JG1/Xa1ykRhP2Iyy771t DXShXesaT6wZK2rdR6zyUIsgaDYUYt4UocjyVJEhsgs/wVgcGVB8T5aLXmwz80uU1Zhc2PP6L /dBm7rQWVOk7yh0LBnjWKqKHjaA60eUPf1aKzDunen1ShfZhW4ZNow79CYmyNoECLbpJZf/8y 0htHgBjx7GndYFo3pX/uwqVISsGbtK+nJ7ttYIKpSpdwKccsVt9z5zz8uICZCKjb6dYhP3f1q L4v3+HbJ5bezecSsLtTerZGdDKS8CJYmESWFrGPfDPXlb5Y7Zxit2mo6Ia2s6HJH9e5hgCAwJ MQJkWPmxQrbo2KhOaqZrvU5yD+A4iXpeHQ3XzkIacLPrshxm/E8AQEqrs9w2wGxxsIeoUHLmJ 6osW/NCOgTOvJsfzAppxIr2tjA2GTKI1ZLtASl1f6UeLqusohgu0X6ZzfjMA1+oqermXKhaa+ Sl7p8DnItKRI/7dyeySu+5j77pR+tiGEZRJkjr2v1GYLA2y78GW+R8IPEkB6mopPE9fL5qWmu /ojNPc3ORLvOqzgesJoOyaUbauEQD8DFs4bhKs30YcGPws31ajeD1SXYi1t8NDEwx3w6nMk Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org As there is nothing else (the consumers are supposed to do that) which enables the clock, do it in the driver. Signed-off-by: Alexander Riesen Reviewed-by: Kieran Bingham --- v3: added --- drivers/media/i2c/adv748x/adv748x-dai.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/adv748x/adv748x-dai.c b/drivers/media/i2c/adv748x/adv748x-dai.c index c9191f8f1ca8..185f78023e91 100644 --- a/drivers/media/i2c/adv748x/adv748x-dai.c +++ b/drivers/media/i2c/adv748x/adv748x-dai.c @@ -117,11 +117,22 @@ static int adv748x_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) static int adv748x_dai_startup(struct snd_pcm_substream *sub, struct snd_soc_dai *dai) { + int ret; struct adv748x_state *state = state_of(dai); if (sub->stream != SNDRV_PCM_STREAM_CAPTURE) return -EINVAL; - return set_audio_pads_state(state, 1); + ret = set_audio_pads_state(state, 1); + if (ret) + goto fail; + ret = clk_prepare_enable(mclk_of(state)); + if (ret) + goto fail_pwdn; + return 0; +fail_pwdn: + set_audio_pads_state(state, 0); +fail: + return ret; } static int adv748x_dai_hw_params(struct snd_pcm_substream *sub, @@ -174,6 +185,7 @@ static void adv748x_dai_shutdown(struct snd_pcm_substream *sub, struct snd_soc_d { struct adv748x_state *state = state_of(dai); + clk_disable_unprepare(mclk_of(state)); set_audio_pads_state(state, 0); } From patchwork Thu Apr 2 18:34:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11471289 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 78F30159A for ; Thu, 2 Apr 2020 19:00:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 608DD20737 for ; Thu, 2 Apr 2020 19:00:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389103AbgDBTAY (ORCPT ); Thu, 2 Apr 2020 15:00:24 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:37227 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388843AbgDBTAX (ORCPT ); Thu, 2 Apr 2020 15:00:23 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MplHR-1izY792f4n-00qAQs for ; Thu, 02 Apr 2020 21:00:22 +0200 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id 68483650882 for ; Thu, 2 Apr 2020 19:00:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at cetitec.com Received: from mail.cetitecgmbh.com ([127.0.0.1]) by pflvmailgateway.corp.cetitec.com (pflvmailgateway.corp.cetitec.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dZJOwrLsFPkF for ; Thu, 2 Apr 2020 21:00:22 +0200 (CEST) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 150EA64FB53 for ; Thu, 2 Apr 2020 21:00:22 +0200 (CEST) Received: from pflmari.corp.cetitec.com (10.8.5.12) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Apr 2020 21:00:22 +0200 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 2CFF680504; Thu, 2 Apr 2020 20:34:59 +0200 (CEST) Date: Thu, 2 Apr 2020 20:34:59 +0200 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v5 7/9] media: adv748x: only activate DAI if it is described in device tree Message-ID: Mail-Followup-To: Alex Riesen , Kieran Bingham , Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , Mark Rutland , Kuninori Morimoto , devel@driverdev.osuosl.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.8.5.12] X-ClientProxiedBy: PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) To PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) X-EsetResult: clean, is OK X-EsetId: 37303A290D7F536A6C7266 X-Provags-ID: V03:K1:n9tquJEofo91gDY2vOY3TlXfZZQXAPgJmmUwH3GaKShbI/Xidna 59FH9fwmyuMeI7YEE/uCaSoLuGQKgNcsSk+fwv1NdUg1+qzQeflzVX+HLPYKlTzMfwa8mKR 6RTNLpbMcnYaBaXb8ALX+k/EBhty0U+EnMSKFLeQnKAtB1ubzlDIVjHoMKa/gJ5Al9gweVC CJn/Al38bO701yXNPHuKA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Md7hZo6/tZg=:u2rKc5PColQNeKhcm/apXK UzrVib2Qj7HTVfbxYMZgQWlIWr+vHn1I7rSehpDoPEnjgRyYa3Bf4im6IGP4GtivQmCbhYPLf rAXvWhvpaT4m2/S+u6QeoI0+ZdZhQleZF+RxP5YljSuv+0RcacA1BV1TtIH4K15JMDWbyI6XU 0rJCqH1Q52iW4EJCug/1hUJS27iE7g0vQa82zn61iTSaGXqJQO7hGj5IW+vV7UGjKbysBDIfd rOv2KYYf5uEV7F1eeNW6kYgEDVa3/JoRl/qwSlaBzAVw3/YYFHehtJPgYlDjou5SQ0CyOT7NL vU5jrQJ3WibcqTualnL8wMQmTJ/0LfreqMsY2UuCCEZ8QTrBv+J9mCCyeCKGLPIWNIF6M8oMp x+VPub/RxzIFYGj7TGhhZ/p/te2G2AKwhCiL+CSqKaM2Rab/tP/NypnCXGMSX/fhhiJtpLaBM mek/arqzuDBeoMfpaXP9bJwpR4uZ0nr/e2sQpakOCPX0HOK6ITtb+3Rpgqi0YMc+kWj268KSd BwjZiCrajhnCK1QYRpQ2Z8aXDmzRqHcQt/+YNnX+xfFb/5H64ro7k/rveMVkIiuk7nq2IKKtV GD7LW+L5DtuaJdbUF4j4RiMy5wU6t+5hjWd3sAZ4gg+6wveRLoYPAxkK+jFb3Ztn2t2Rk44/d +8PRFk2j+SsdaG1OFHnIH+a0O+sLfh0+pGoqB9a9kZ92XPgo9Cz7AMqq9rwnf35/5PrUIE04B +1frSQn0CG24z9drfAdCOFaGjn31DO/cEki3oqjmdBl8wXSXCelaSHeMMv8FMfDWT34741os3 pzdJTLsqLP0oPQvnA4p7CLw4PcrBT58UgUILM+7h+PDU35CD070w0X5U0W1PVNSJ+5zQ0Se Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org To avoid setting it up even if the hardware is not actually connected to anything physically. Besides, the bindings explicitly notes that port definitions are "optional if they are not connected to anything at the hardware level". Signed-off-by: Alexander Riesen Reviewed-by: Kieran Bingham --- drivers/media/i2c/adv748x/adv748x-dai.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/i2c/adv748x/adv748x-dai.c b/drivers/media/i2c/adv748x/adv748x-dai.c index 185f78023e91..f9cc47fa9ad1 100644 --- a/drivers/media/i2c/adv748x/adv748x-dai.c +++ b/drivers/media/i2c/adv748x/adv748x-dai.c @@ -216,6 +216,11 @@ int adv748x_dai_init(struct adv748x_dai *dai) int ret; struct adv748x_state *state = adv748x_dai_to_state(dai); + if (!state->endpoints[ADV748X_PORT_I2S]) { + adv_info(state, "no I2S port, DAI disabled\n"); + ret = 0; + goto fail; + } dai->mclk_name = kasprintf(GFP_KERNEL, "%s.%s-i2s-mclk", state->dev->driver->name, dev_name(state->dev)); From patchwork Thu Apr 2 18:35:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11471333 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 32F901392 for ; Thu, 2 Apr 2020 19:11:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1024D20719 for ; Thu, 2 Apr 2020 19:11:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733052AbgDBTLZ (ORCPT ); Thu, 2 Apr 2020 15:11:25 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:59631 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731689AbgDBTLZ (ORCPT ); Thu, 2 Apr 2020 15:11:25 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MD9nd-1jT7nu2MBl-009C5V for ; Thu, 02 Apr 2020 21:11:23 +0200 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id 26F67650ABB for ; Thu, 2 Apr 2020 19:11:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at cetitec.com Received: from mail.cetitecgmbh.com ([127.0.0.1]) by pflvmailgateway.corp.cetitec.com (pflvmailgateway.corp.cetitec.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JH0pEXOcYfj2 for ; Thu, 2 Apr 2020 21:11:22 +0200 (CEST) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id AEAD464E5AD for ; Thu, 2 Apr 2020 21:11:22 +0200 (CEST) Received: from pflmari.corp.cetitec.com (10.8.5.12) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Apr 2020 21:11:21 +0200 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 34C0C80505; Thu, 2 Apr 2020 20:35:06 +0200 (CEST) Date: Thu, 2 Apr 2020 20:35:06 +0200 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v5 8/9] dt-bindings: adv748x: add information about serial audio interface (I2S/TDM) Message-ID: <337b689519806178458ab77385c8ac6f510cb0da.1585852001.git.alexander.riesen@cetitec.com> Mail-Followup-To: Alex Riesen , Kieran Bingham , Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , Mark Rutland , Kuninori Morimoto , devel@driverdev.osuosl.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.8.5.12] X-ClientProxiedBy: PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) To PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) X-EsetResult: clean, is OK X-EsetId: 37303A290D7F536A6C7266 X-Provags-ID: V03:K1:0d0psf6QeVlnZT6chhMY7b2lvihdMbNLjGNYRn18aBNhga1Pc6p jwD1dG9BCviM8XUGIsqKpnj+bmtxpX5+iqd0X/3jz2FQPYnq5KSAb0hPREr+R6KAkix6fXW dVy2/5klA/ZZGA42+FKAb0VlZWOb17iU+l45qvTfrxzv9KVdthrXZAvw7sbmSEjIrEe8rJy fPYnJqFJijCC73S2FpX1g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:TuqlgnlB1Uk=:KUCZqU6ca22DUsaMQoP2Az z32pooYCgT2HOkhyQqpMbujyN3yIRaI/BMDFhU4FZYMirB1eIi9dSzUgnzTafrbEnEhb5BrJ7 a3MUCbWNUdEJWcZQJRPRusoSqR8Ycd/JSocuQsbFXJM0xlMidZpdGN7WWgZXsjH1Ws5grkXMp piGg10LYdIrZxsjZYRtwhK2mJU4ja6OhLtz2BfwowL01P5DNFKBck2zYLazYdfY7HJ7qpG8iE i8c36w2P+jvZrOHMQuDEFkxuCC0gUCisHfe0xPeIeqAaNXFSoW7WlGxpGGSe+fug+DsWb5Fvy 8G6UY4SXvXZBRXaBa7qx5ymTGXdenPGu8YCHlv7fhGUcROG7cmt/Ez3KkINkCam6IldhTJz7u tmfZzMiFduEOqZxZcG78cpQ+ntjIs+Xcp647YeV4M0SMz5RcpaAl+WgBhzqmXporgFSZZJSiv m7l+HmL+SDyYwXESioKl9zh1M+SPAsUu1ndf7r5bun/AdewHx1KBWQWKOq2TB9ZH00JgNPDr5 csCVHLVumugNKE52qTiD0lEo8BNmHrGJIy7JVZAOJEVbuQ0Z9NdF+cbrup5rPN9N50A5V2QTo rkYIRTAhZuqCM/PMijXULYMdwBrlZLdqQEyaPN5lztYyU+L9NdMEIyFMiWlhOmN7mXsfwo+CI syI5pywadpA/iWWWG+5Y5QNtritpyPU0AVKKQTmh6BeaTn56TgEk2872mkczFDWglH0U79PZw hdS7f+ssaj9WLHadyh02aTrbuA0/oCelfNnO2Mablv9l8DN8T9RPXDDDd78pXqoaqx4miB71d 2HI8S6c8ciP4BLelKahzkNYLl2Cnj0uqVu2Zxp8zZyyW4hT9XQFW4Li7M/EVNkvhOKW3lsl Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org As the driver has some support for the audio interface of the device, the bindings file should mention it. Signed-off-by: Alexander Riesen Reviewed-by: Rob Herring Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- v3: remove optionality off MCLK clock cell to ensure the description matches the hardware no matter if the line is connected. Suggested-by: Geert Uytterhoeven --- .../devicetree/bindings/media/i2c/adv748x.txt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/media/i2c/adv748x.txt b/Documentation/devicetree/bindings/media/i2c/adv748x.txt index 4f91686e54a6..50a753189b81 100644 --- a/Documentation/devicetree/bindings/media/i2c/adv748x.txt +++ b/Documentation/devicetree/bindings/media/i2c/adv748x.txt @@ -2,7 +2,9 @@ The ADV7481 and ADV7482 are multi format video decoders with an integrated HDMI receiver. They can output CSI-2 on two independent outputs TXA and TXB -from three input sources HDMI, analog and TTL. +from three input sources HDMI, analog and TTL. There is also support for an +I2S-compatible interface connected to the audio processor of the HDMI decoder. +The interface has TDM capability (8 slots, 32 bits, left or right justified). Required Properties: @@ -16,6 +18,8 @@ Required Properties: slave device on the I2C bus. The main address is mandatory, others are optional and remain at default values if not specified. + - #clock-cells: must be <0> + Optional Properties: - interrupt-names: Should specify the interrupts as "intrq1", "intrq2" and/or @@ -47,6 +51,7 @@ are numbered as follows. TTL sink 9 TXA source 10 TXB source 11 + I2S source 12 The digital output port nodes, when present, shall contain at least one endpoint. Each of those endpoints shall contain the data-lanes property as @@ -72,6 +77,7 @@ Example: #address-cells = <1>; #size-cells = <0>; + #clock-cells = <0>; interrupt-parent = <&gpio6>; interrupt-names = "intrq1", "intrq2"; @@ -113,4 +119,12 @@ Example: remote-endpoint = <&csi20_in>; }; }; + + port@c { + reg = <12>; + + adv7482_i2s: endpoint { + remote-endpoint = <&i2s_in>; + }; + }; }; From patchwork Thu Apr 2 18:35:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11471359 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 37CBB14B4 for ; Thu, 2 Apr 2020 19:21:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 162E420737 for ; Thu, 2 Apr 2020 19:21:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732995AbgDBTVU (ORCPT ); Thu, 2 Apr 2020 15:21:20 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:49827 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732625AbgDBTVU (ORCPT ); Thu, 2 Apr 2020 15:21:20 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N2mWA-1jCYSX0oCy-0138ry for ; Thu, 02 Apr 2020 21:21:17 +0200 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id D238B6505D2 for ; Thu, 2 Apr 2020 19:21:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at cetitec.com Received: from mail.cetitecgmbh.com ([127.0.0.1]) by pflvmailgateway.corp.cetitec.com (pflvmailgateway.corp.cetitec.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HeYHjFtF1JMU for ; Thu, 2 Apr 2020 21:21:16 +0200 (CEST) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 3BE6C64CA02 for ; Thu, 2 Apr 2020 21:21:16 +0200 (CEST) Received: from pflmari.corp.cetitec.com (10.8.5.12) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Apr 2020 21:21:09 +0200 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 4482E80506; Thu, 2 Apr 2020 20:35:13 +0200 (CEST) Date: Thu, 2 Apr 2020 20:35:13 +0200 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v5 9/9] arm64: dts: renesas: salvator: add a connection from adv748x codec (HDMI input) to the R-Car SoC Message-ID: <90f2c14fcbe5d06eefdaeadbe8a6efc8c91523f3.1585852001.git.alexander.riesen@cetitec.com> Mail-Followup-To: Alex Riesen , Kieran Bingham , Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , Mark Rutland , Kuninori Morimoto , devel@driverdev.osuosl.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.8.5.12] X-ClientProxiedBy: PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) To PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) X-EsetResult: clean, is OK X-EsetId: 37303A290D7F536A6C7266 X-Provags-ID: V03:K1:JCVjPHQelMQrkcQbWZyU1HdhkBxwWku7+4tcHoFvdH0qq7/B35C JlFePrgzOQwhFzeEuEkQATI70R7Nuzv2rlE4OWZDmHUDRGZD9YsSK/fEP7tAqrhJ5hCgKh8 SfJdKNtaLRhqbZQZzYemQkn6aPi9N4MN5CSR2W0wkt5PHU1mOM2EzR4aMGf03ZR1sIC5+2J hTIFY/+zmpq8K/0k2dvJw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:254Q1oJgJGo=:oI+6jz1vXCEMiBxOiO4QKL cxG+hKiBUCVarLZym7a2HYj5ZBBp94dsBkppgpkA+/PmQug5/gv62sYfF1ErRtSrtSebRkKqJ n0miZmebEOTbmR2wb6d0UoM1ZIQH6DkwcYvoNSmiqmBofnJMbpJrQyVmp5r/2i9b7rJRQaBcA SyrT+8tdRypbadknRqOE1uGQ46neiEGG7FIDuXJ+2vsY6FsOGXmOyuHKBM4hYJaeY9JMOSSv8 1OFVJgYY0F3koajvEkFoFlV/EETr6Xt/xeyVSewcA3YzMTNryUZoQRZoh/TjiRoKYykxaSyjJ 2b7jIjUYWs1TjmxtZoiPw6aRCkC32FC+VjfATjR8kIIBkbIFdpPNl+R6oeLBxQ4agawmy2qyT fK6jCDAq/7/MQbxcWRxwYA6aGZkEBFvejPZizhgdqdBWNDBwK5C76AvDbFPjZWX9ApxHpYdGd EdVqAE4i8tsQvTMxbBXkOba9Ww9C4xpBGlV+jN4lx+vKUjxGLMNpV3UXoZiP50VNGgyq3DFlA hG+zevNxR1SRSvGWiy6KKooBCW95T++snYbuE9vw9NuueJkAvruN7MoAR7pdsgnYCWe5nQY2V pSLKy2NF3CXEGtA0//wFh2UAf3ivd7Rq6Aqmt8vciDHq9FPgXozPm8fc6RnK2Y4d6PKlBUQTv iohbxiHwm+0fLY/9g369czvmJBL+bdPWTTZg+EAqdXstbLhxgZD/c1XD7vo5jcBXBRhULKCDV tM1FLHZq/IJCUtzylnoW/noYk3fl8DCCkJiYQMiOpSSNsMJNwm3mz3GWAbQ2xVXlLlM7CZVAK h0TrBecuMwNtCLX0AUrlLKKyltzn6rpwDqDnb5CTMq846pFgqvzucgNQgONTuImt3IqMZQ+ Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org As all known variants of the Salvator board have the HDMI decoder chip (the ADV7482) connected to the SSI4 on R-Car SoC, the ADV7482 endpoint and the connection definitions are placed in the common board file. For the same reason, the CLK_C clock line and I2C configuration (similar to the ak4613, on the same interface) are added into the common file. Signed-off-by: Alexander Riesen Reviewed-by: Kieran Bingham --- v5: Add dummy ssi4 node to the rcar sound card in r8a77961, as the devices (Salvator-X 2nd version with R-Car M3 W+) also reference salvator-common.dtsi. Suggested-by: Geert Uytterhoeven v2: Also add ssi4_ctrl pin group in the sound pins. The pins are responsible for SCK4 (sample clock) WS4 and (word boundary input), and are required for SSI audio input over I2S. The adv748x shall provide its own implementation of the output clock (MCLK), connected to the audio_clk_c line of the R-Car SoC. If the frequency of the ADV748x MCLK were fixed, the clock implementation were not necessary, but it does not seem so: the MCLK depends on the value in a speed multiplier register and the input sample rate (48kHz). Remove audio clock C from the clocks of adv7482. The clocks property of the video-receiver node lists the input clocks of the device, which is quite the opposite from the original intention: the adv7482 on Salvator X boards is a provide of the MCLK clock for I2S audio output. Remove old definition of &sound_card.dais and reduce size of changes in the Salvator-X specific device tree source. Declare video-receiver a clock producer, as the adv748x driver implements the master clock used I2S audio output. Suggested-by: Geert Uytterhoeven v2: The driver provides only MCLK clock, not the SCLK and LRCLK, which are part of the I2S protocol. Suggested-by: Laurent Pinchart --- .../boot/dts/renesas/r8a77950-salvator-x.dts | 3 +- arch/arm64/boot/dts/renesas/r8a77961.dtsi | 1 + .../boot/dts/renesas/salvator-common.dtsi | 47 +++++++++++++++++-- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/arch/arm64/boot/dts/renesas/r8a77950-salvator-x.dts b/arch/arm64/boot/dts/renesas/r8a77950-salvator-x.dts index 2438825c9b22..e16c146808b6 100644 --- a/arch/arm64/boot/dts/renesas/r8a77950-salvator-x.dts +++ b/arch/arm64/boot/dts/renesas/r8a77950-salvator-x.dts @@ -146,7 +146,8 @@ &sata { &sound_card { dais = <&rsnd_port0 /* ak4613 */ &rsnd_port1 /* HDMI0 */ - &rsnd_port2>; /* HDMI1 */ + &rsnd_port2 /* HDMI1 */ + &rsnd_port3>; /* adv7482 hdmi-in */ }; &usb2_phy2 { diff --git a/arch/arm64/boot/dts/renesas/r8a77961.dtsi b/arch/arm64/boot/dts/renesas/r8a77961.dtsi index be3824bda632..b79907beaf31 100644 --- a/arch/arm64/boot/dts/renesas/r8a77961.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a77961.dtsi @@ -861,6 +861,7 @@ rcar_sound,src { rcar_sound,ssi { ssi0: ssi-0 { }; ssi1: ssi-1 { }; + ssi4: ssi-4 { }; }; }; diff --git a/arch/arm64/boot/dts/renesas/salvator-common.dtsi b/arch/arm64/boot/dts/renesas/salvator-common.dtsi index 98bbcafc8c0d..ead7f8d7a929 100644 --- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi +++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi @@ -460,7 +460,7 @@ pca9654: gpio@20 { #gpio-cells = <2>; }; - video-receiver@70 { + adv7482_hdmi_in: video-receiver@70 { compatible = "adi,adv7482"; reg = <0x70 0x71 0x72 0x73 0x74 0x75 0x60 0x61 0x62 0x63 0x64 0x65>; @@ -469,6 +469,7 @@ video-receiver@70 { #address-cells = <1>; #size-cells = <0>; + #clock-cells = <0>; /* the MCLK for I2S output */ interrupt-parent = <&gpio6>; interrupt-names = "intrq1", "intrq2"; @@ -510,6 +511,15 @@ adv7482_txb: endpoint { remote-endpoint = <&csi20_in>; }; }; + + port@c { + reg = <12>; + + adv7482_i2s: endpoint { + remote-endpoint = <&rsnd_endpoint3>; + system-clock-direction-out; + }; + }; }; csa_vdd: adc@7c { @@ -684,7 +694,8 @@ sdhi3_pins_uhs: sd3_uhs { }; sound_pins: sound { - groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a"; + groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a", + "ssi4_data", "ssi4_ctrl"; function = "ssi"; }; @@ -733,8 +744,8 @@ &rcar_sound { pinctrl-0 = <&sound_pins &sound_clk_pins>; pinctrl-names = "default"; - /* Single DAI */ - #sound-dai-cells = <0>; + /* multi DAI */ + #sound-dai-cells = <1>; /* audio_clkout0/1/2/3 */ #clock-cells = <1>; @@ -758,8 +769,19 @@ &rcar_sound { <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>, <&cpg CPG_MOD 1019>, <&cpg CPG_MOD 1018>, <&audio_clk_a>, <&cs2000>, - <&audio_clk_c>, + <&adv7482_hdmi_in>, <&cpg CPG_CORE CPG_AUDIO_CLK_I>; + clock-names = "ssi-all", + "ssi.9", "ssi.8", "ssi.7", "ssi.6", + "ssi.5", "ssi.4", "ssi.3", "ssi.2", + "ssi.1", "ssi.0", + "src.9", "src.8", "src.7", "src.6", + "src.5", "src.4", "src.3", "src.2", + "src.1", "src.0", + "mix.1", "mix.0", + "ctu.1", "ctu.0", + "dvc.0", "dvc.1", + "clk_a", "clk_b", "clk_c", "clk_i"; ports { #address-cells = <1>; @@ -777,6 +799,21 @@ rsnd_endpoint0: endpoint { capture = <&ssi1 &src1 &dvc1>; }; }; + rsnd_port3: port@3 { + reg = <3>; + rsnd_endpoint3: endpoint { + remote-endpoint = <&adv7482_i2s>; + + dai-tdm-slot-num = <8>; + dai-tdm-slot-width = <32>; + dai-format = "left_j"; + mclk-fs = <256>; + bitclock-master = <&adv7482_i2s>; + frame-master = <&adv7482_i2s>; + + capture = <&ssi4>; + }; + }; }; };