From patchwork Fri Mar 20 16:11:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11449769 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 0ADD76CA for ; Fri, 20 Mar 2020 16:17:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DDDC920724 for ; Fri, 20 Mar 2020 16:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727148AbgCTQRZ (ORCPT ); Fri, 20 Mar 2020 12:17:25 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:39465 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726935AbgCTQRZ (ORCPT ); Fri, 20 Mar 2020 12:17:25 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N2mS2-1jOyNC3IRo-013350 for ; Fri, 20 Mar 2020 17:17:22 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id 9440064FA81 for ; Fri, 20 Mar 2020 16:17: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 s6FGqP_ixXsI for ; Fri, 20 Mar 2020 17:17:22 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 31EE064F8FB for ; Fri, 20 Mar 2020 17:17:22 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.8.5.41) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 20 Mar 2020 17:17:22 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 0F67C804FD; Fri, 20 Mar 2020 17:11:42 +0100 (CET) Date: Fri, 20 Mar 2020 17:11:42 +0100 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v3 01/11] media: adv748x: fix end-of-line terminators in diagnostic statements 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.41] 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: 37303A290D7F536A6D7662 X-Provags-ID: V03:K1:Ywxajj3nfNV5QSyw0jIFmjLVJEp92D5NnhhhSeCCxKt9pv2l9Cn eK0gRfsEAyEj2VCCPROWKywYuOvVPIzRTnE/D27Trlctptb5dcyCuMl8cZKr7EB1QTmyvjd 4ilxnAC47gDLNj/mn4qrOSoLpJ1mH7C4oZ1utO0RqE1irDwLgOScXLw1ebWPie5esaU8hN7 3Y9N9jY8sopY29Vo0SHgQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:nT3heB0CeT8=:ylF2Ct9TdgSdlKNmSHweve mSPh54rt0XlNTLsXrgp4ME8pjaOZdLw2QLCZ6XAzktVXW3DzvEheHKNuXMhp04wafb+TjEYmN GxemHBgxOEjOVT3upIc1UTnPyGwmLE7FWhhK+A+XNYGFRxrzAnAeCy7pKjGH58mgASE+1Ex1X m+kDUkSPfNGyM4vk3xSi2gBr+rN9DZTJoe8LaeD9jT6MEh/YINbBdxQreOvdr9+ZIs6gUhU0b H256FHg7phTSvm/PV0JK/ob5Xkys+/T6Stz9n3RITwWAwReoEPW3JBWsCNsz6zw5ks/pdaaIs oaXS+2CTuCcj3onhTaKLOgp8qp7cISXqhLKl+Nb9vMigUbdVW3OqJZyoMN1hHGb5Z8OdTOncs JfbGhZDZDcKX9RWyH4rBN8/6cyccPKldLjacGCMSqFm+goBQ8TfzDPEv4otvfU1Y805VDDZbr ITEroO3PAAaa8iAGc+zj3K4gSIeVp55B4HdSqfVv0qpR5R2ixZ4ueWP30z1OIhZbwkCYDsd+G D/dwSnt0/01q5YdABNXmkWerR5JUH2K0Oo8EW09zg7Uq3fq3MwP06Rq6nP+5g2vMx2+zmapsj GPjWyZGxTqrjtOGfjKtMWwSw5wQ4b8z6WpVy7gx+4/q79wVTvfABlkXOt23wh5j0rZT520XxE 3f2pZqfsq0Aone7u9I05kOBo+4DxhShGewW5PByzyTZTqU3r4ZW5CeWnDocV3xZpZY+19K4LR nFYaFqunSzesFJg7joX0wxfXEMEQCp3eJQgv0lgLhMIT8wqnKpN3j5BIsNO7+5D0ZnC+fx1sz D/iN212gvSPUh9n/39KAGhI28PRLkN42AQx/3OxQvNVM9Zat6+/wORu6TMAS1xIw80Vik3x Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Signed-off-by: Alexander Riesen Reviewed-by: Laurent Pinchart --- 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 Fri Mar 20 16:11:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11449789 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 EA95F1874 for ; Fri, 20 Mar 2020 16:20:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C9BA720789 for ; Fri, 20 Mar 2020 16:20:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727794AbgCTQUq (ORCPT ); Fri, 20 Mar 2020 12:20:46 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:55317 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727754AbgCTQUq (ORCPT ); Fri, 20 Mar 2020 12:20:46 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MSLhm-1ir19A1Lbc-00Sc09 for ; Fri, 20 Mar 2020 17:20:44 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id 22DB565035C for ; Fri, 20 Mar 2020 16:20:44 +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 fvP-lA9BqBYH for ; Fri, 20 Mar 2020 17:20:43 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id B84BC64EB78 for ; Fri, 20 Mar 2020 17:20:43 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.8.5.41) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 20 Mar 2020 17:20:43 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 44952804FE; Fri, 20 Mar 2020 17:11:43 +0100 (CET) Date: Fri, 20 Mar 2020 17:11:43 +0100 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v3 02/11] media: adv748x: include everything adv748x.h needs into the file 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.41] 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: 37303A290D7F536A6D7662 X-Provags-ID: V03:K1:PFsRZCYxo7sJ/FnzdkERh7hb2cJEyD5IALKVuRFn4VsuAqwSUS1 LwveC74+4PrzDIovqqnbS+K8QG5lHWysA/0/4fkC+fO1T4Fjwc9+J6nWPCna7gGdNmzP7Ks v5zL3Zbvi6uuYxvK4FiSEa6kSw9bWFu6RBMSMui4KoS8l5s5NPsIjelOAIKau8WwlyjwTff z0YjXkMCD03ftQnfTDkMg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:cHk9QeZ1R3I=:f5+bLuNk9to6Kyy/2ZiD4/ +HTyY0LBnnKpkf2lOfgFk4fott0cD4OpMtmoSHz3r+SCkNQ6GwrnDdrQEb5e6DeiPpLhUf1GO U0iQ4kCXCaZ5wHYAYAIk5/GmcQ9zf/h7a6lZtFZa09qk8nDzGhKXRkr9OTPIKzbs5EQ6Zj74f Mv8B0oYVhK7VoaMrhnKfsW1IgrgLIRHuSByP4f9uiQutbmWPv9G5yPgwuzf+OXut0pkN3lI5e XUVkKsczfdxN2FzYQVEb1Me5Bk3yATpeuvDIcMJM5ut7HN7OlwZiB81P0dKa+yWV+/hokeOPE SWzjit4G4IknO11lJiot00gBaEfCpvAVOlvqfn25V1aHT0GnveYKCG98AmoeepOiK7fx5ed1D 0PM3/rKEq//NX+n/lxBpeVPriA2Yk1qi453cydSOHpQZwuqGBpxdblQ15KkpjqYeSN1UWcwKu ClTG0bsOpOzEyr0hl6uMhWCgBA1OX/+lUe3Kp2OritXEpnlGB6V0GGi4v1JR5CKiuHFH98/RW t2cJxgus8CZxR0dteowWBtlacNFj9kTnfOhzy89MDUCLtbNfcfJcNmPrsvck0PLpWAUj0/j76 sjeEqQlqHsNxGpwwXf7T4Kj0qzxIiVtnQpChDDztpjW80n7vh3tPKQkYvJGgnBn2WDWa3w0Q5 bKxRLu/PJtWkFKcDmqOSCS1sLxCDeJszg2i9fb5VgTO2PamUpQLpmYViuNO5MEHk/dkFR4H// czznQ+dU+bw5QQtYDFNS6kc7UozbLSh6zlK//EfXpj9kG4yzlpZ2Xr4PpzQr1K89CYsN1hWnd 1VMyUdzYcb3TRVOyOGM9t5svm4WhD6P24Kd8PSSaw4+a2HCuY222xAX64s9gpznRdPC0s0E Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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 --- 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 Fri Mar 20 16:11:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11449801 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 9BC961864 for ; Fri, 20 Mar 2020 16:24:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B4DC20739 for ; Fri, 20 Mar 2020 16:24:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727457AbgCTQYM (ORCPT ); Fri, 20 Mar 2020 12:24:12 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:52771 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726983AbgCTQYM (ORCPT ); Fri, 20 Mar 2020 12:24:12 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MVvGt-1io0113eBp-00RsLc for ; Fri, 20 Mar 2020 17:24:10 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id A5240650374 for ; Fri, 20 Mar 2020 16:24:10 +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 iDywV2UNy74p for ; Fri, 20 Mar 2020 17:24:10 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 48B7264CEE2 for ; Fri, 20 Mar 2020 17:24:10 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.8.5.41) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 20 Mar 2020 17:24:10 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 2255B80500; Fri, 20 Mar 2020 17:11:46 +0100 (CET) Date: Fri, 20 Mar 2020 17:11:46 +0100 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v3 03/11] media: adv748x: reduce amount of code for bitwise modifications of device registers Message-ID: <88950969b1d16ff5fcd1b3458356c4cf5a9e6cff.1584720678.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.41] 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: 37303A290D7F536A6D7662 X-Provags-ID: V03:K1:LxFPcbuLqsRvpDdNxSa1jziYj7+PKy9v2tgWJGjkFh6RCF+d0n0 sGIedEokKHKzsTZ6idnCxSkkI5SzdZQZAOsyj4CbCj5AESuh1zMXcD+dUsu8DeSg4B9UiWE Yt2I2TrUHBvb0LtCZLsvh0qdQRkebkivjwHrHoBoRoTQY+In/zjwF4sYkoHV8LtThA/o6Rg EbHv856Po7oPsJVmI4RSQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:KRz75mnzqNk=:VcLaQjraZ0P+K6hbX7Z3Rg p98hyOZTK2kN9s6Hp1GPjZkpLf45Nc5wQy0EKqTf/lP5utUULCQT9j+azhjZqcIPNpuxbP0pE xJPKjk6+21iW5CCMyMPn0f6uFXP8MiLUcPNbtVqza9fkpufXn6zQzGnA1w/dOZunLUbVQ8TPF 5+O+nSXsQ64g3zEDmiP9BOBG0lEkf9gHF8zo9lSU8dvS3WJgYVdbwyXtZcaU8hKUgRbGd70ps hHHuxoVy6y3Eg7vXrLOmTFZTLVp62kk3Wjq4/2K6ya5siDWKJkJOF63NYZMbQv3d/atQB+T6Y AEfOZ8TEQqvSUqj9gqrQ+XMgImjOM/ca/YqFy8uBHFjNncacGFSFEaUgBFo61LF0XqOsufAOH KUmwF3jJMGtHST/N7kMIDFIRz6E85JiHjINqgjNABD47n0RzeWFRwLmU2VyntFw97pwJz4MFc vaVRyJqPmgpOhuM0HIoopDMzHk13QKZliLqab7lvXzaDAkz+HGk8dL0MXZO2LK4FNpKFhlZ95 MJbWIloSZz42wvd7eL5Ycv4L340wR5Fg29ZkAPkGePNNAUnXBP8H0i5oG1s2KRMAPU02AFcR3 Q90hJktmwMiLyXT2qUwVLaY7rWQ59OH86EwZj5N1rySrqwZY8ijLffRI8JlsOc8CK/LGuF+JE +oYk/ENuCxTmLjC+W/Sh5XwPTmhhdkg1IT+b0fOUR8uRSM4B1EhfT/AATLxrsSR9t5gwXMRY5 7cNPyeDxYzMAm9NhapNLodcXtozLaoefiy6JMZ7Jw/T0KXtXCz1V0nip/WBn1IkixYD72Bjel d9bEb4yP355kkKA77ZorSAsh1C7eAoVuWzn6RsRb+i9Lj53hM2l1coCe+124IaFEd5TXSRL Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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 --- 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 Fri Mar 20 16:11:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11449805 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 2AFDF6CA for ; Fri, 20 Mar 2020 16:27:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0A20520753 for ; Fri, 20 Mar 2020 16:27:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727464AbgCTQ1e (ORCPT ); Fri, 20 Mar 2020 12:27:34 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:34675 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727468AbgCTQ1d (ORCPT ); Fri, 20 Mar 2020 12:27:33 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MsYzD-1jZjj62QQd-00u4Tj for ; Fri, 20 Mar 2020 17:27:31 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id 5BE92650374 for ; Fri, 20 Mar 2020 16:27:31 +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 sijfwJVzFqMY for ; Fri, 20 Mar 2020 17:27:31 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 0BB6464DA5D for ; Fri, 20 Mar 2020 17:27:31 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.8.5.41) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 20 Mar 2020 17:27:30 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id E8DB480501; Fri, 20 Mar 2020 17:11:47 +0100 (CET) Date: Fri, 20 Mar 2020 17:11:47 +0100 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v3 04/11] media: adv748x: add definitions for audio output related registers 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.41] 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: 37303A290D7F536A6D7660 X-Provags-ID: V03:K1:+6HhWMiVKhZS2wyiH0duQ0lRHoezEZbG4/O9w8OBiUhXWusvxc4 LXNMeY5YvYwcf3hzQWurmJMoT2SNn15TDu49734d0vtNgg0CxZZBd5c0SEoRadvPrM++l97 WHEPQALIfvROME3bUxBwx9ssrk8FyfksLsvKfhnq/oyp/SAPRfYzSbqBeewHTJgXa9Ig27H g0/nYfoPLt4orvg+BY1Og== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:AH4GuKW+8pk=:doIXkdaVPtp8dKMJYW+obg VM5LKKJ3akj9WG2e2sAbd+7vCqtI4PJQJktFgIX0l6miQUc9D8IZxMfkp9fNfhABNRCyN7ohN 8WkPuCijPwAy2cWstb495dMyOj5dQukzQu+8EPa2n0dJS8TChPsIiQKtC3IvpAs6OU1KbYqPM V5E+Y55LAi+++tL/fwZmr1zlK/1cePxeyYDlfHVb+PT6WB1Eo79ZQw6XowBJxs2LBNNXT9cLi KrigEL8F8gG1E8rOzB7TmeDyL+4NhcyvsT3zmm4jTjrtVPSIzXPTB/0q4GK9Z163lAS9PxVk6 9eYX6LtNbssV3F6CSPVBkDQV3AHnFDql4kM6gBVB28Qo7Ic3k05Fnb6smonmxm9gQYdl6KWSr ymt+VP9DnwGChdVn9Fd9Us5z24Ki1XoYLrquWer2Il4oq4N8++hlR37VnqQufcX2SfKuLRlJ8 70JQYGQ7WQDC72bqOkzVScaWe1O2DhQAZ9ZX8R/aQXs5j+mgMtIWraFDDRlNmviTOjpWCNKey uWXJRW4uXWj6LGTwbl3NvJHj7f99/4nbFR5Zn3I1bYFwjI5DZzA2/lHzjU1wYQNLfc9FDHQ6I kJIWpJ3wUrvJ/GYOeGFJMcs/BH31stl0ZHzFDs3H48khIquvT8tO9WEnoKcjKhZzmaLOkQjwA fGE4qtDLbIA7Cr/RhYGyrDqg4YGcXgRCzJisOI07sH8nQflEp+kH5yDtVOnKMlg3CN1dECukL vuvRSgVeGcorxY+EtTaJ74QG7ZInHTZfHeYLD1P91IyyOxeDKjAl29nrG594ohc3jY7aHc6Lc FOpCvne+LofHo2rDe2O9VMxJBvlWdFKeU6/gWubypzOO82QzjNOQuG7aRMziWLZmXSXWHd5 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Signed-off-by: Alexander Riesen --- 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 Fri Mar 20 16:12: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: 11449817 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 1E1C013B1 for ; Fri, 20 Mar 2020 16:31:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E88FA20777 for ; Fri, 20 Mar 2020 16:31:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727532AbgCTQbL (ORCPT ); Fri, 20 Mar 2020 12:31:11 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:36799 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727523AbgCTQbK (ORCPT ); Fri, 20 Mar 2020 12:31:10 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MeTwa-1jnHmy44hg-00aTZG for ; Fri, 20 Mar 2020 17:31:08 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id BC39264FD18 for ; Fri, 20 Mar 2020 16:31:08 +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 gcJIsFv06gXW for ; Fri, 20 Mar 2020 17:31:08 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 1CBF064DB89 for ; Fri, 20 Mar 2020 17:31:08 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.8.5.41) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 20 Mar 2020 17:31:07 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id D50EA80502; Fri, 20 Mar 2020 17:12:00 +0100 (CET) Date: Fri, 20 Mar 2020 17:12:00 +0100 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 v3 05/11] media: adv748x: add support for HDMI audio Message-ID: <82828e89ccf4173de4e5e52dcecacc4d5168315c.1584720678.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.41] 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: 37303A290D7F536A6D7660 X-Provags-ID: V03:K1:IXlHbIahXtA8esoCG26ZEKQWIIyFFIPWPovGW00dA03GClml4aZ EEKbufQSuUn2FMs7xQtKZN1hcEVgzl7qFiC7T4mJLrMhG1PH2YJYiajBuiEdJazWK+AHPLY 5ehsbG1ETDGlz52wsso+iZ+No1O3qVXx1xAiv0ykBm/LEnaLEvM8VLYe74MWFlEKTzbhH/R mlMN9ZRphWSVDiGmU3hjA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:EXgaC4TEbgc=:s0eg9ozdFhxpyw3szu3x/k XE68pFdte1/qv6d+lByDG4DfGxU1OmxPEaSLVASrWPqkdOfA7QlH20AO0RtFVmvKeuUQ4AYNl 3NQ9pv8v4gCKPa+6Oh9r8wn+ndMs1KSDybPxwRqc8XeA55umL1opHaJaH4JmDcgnwf1/2/n2M CgVzGTqiVaX2LtpZ76AWPyX5sNz4cKMvJSGzUleZKlS6jf/U2jimZb21K+7qaKCPMVld6ZDwV iZHP/9if2enLqrl07fP8lULnjpXvjUB/Srg+qaCI6vCeB4eG2oNJWjoEX5yNTmqumyHQN5nhH GX6bmenpj8rl9whgrBrAmqYsE0fuVKaNgB9hUCJ/SuO9eKqMZ+GzI2Hztgy8wkMUW0N0ANJzk kLBOPIivC+PzQ/ZQ0arwOzlesflH+Czfhp/KAnUvBJdFExT19mMixMcVFZFp+ANycBxRKt+Nu /odTDFFrNr0epsD/dEn3sAfDyd8/kjVqnK+I1pRynxC3oz3ssPg2MTFMvfLgNgcWHX+JLCfuP 4kv6lDl6/vO4+1jKA4RvsX8yJ2Ak2snzG/vZWsgOcUaPljNMIdGvqClLSenUPgcYgzdpH/Mf7 1bFPtRh02debA6vZYVQ6j4Utq2GwXAzNtOM5TvhNrKpy/OSE0g4OADfkwS2jhkz1FeF9cgRA/ 6icQ29pMMNiZ9PN2PK6eUWJ2XKi/o9UbDivhjNCxVThNngJP/grIIH5mKpd2W5F42b8ObKb7B X9sQxaXegJKhWcbJt6p/1NKBQ2laPR6Giq+XFeQn3zrW/+4ASiLNKfQsiv3NPjCXZCb6hWIk6 o3VtRxdV9HE5xeojtF2gKnPTIHAwUjYp0x4lhqXzRM7uyomZUP0F1CrRjZJ4bpl37bsg1FYty mUXCak5z11RJGmbio/+ZcaYmRuEbRGOd064qWsvMp17oTN6/aBQ6d484Yi8ndN0QpsZ0r1xeJ dAlnXYDvGEQ== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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 --- drivers/media/i2c/adv748x/Makefile | 3 +- drivers/media/i2c/adv748x/adv748x-core.c | 9 +- drivers/media/i2c/adv748x/adv748x-dai.c | 265 +++++++++++++++++++++++ drivers/media/i2c/adv748x/adv748x.h | 17 +- 4 files changed, 291 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..6fce7d000423 --- /dev/null +++ b/drivers/media/i2c/adv748x/adv748x-dai.c @@ -0,0 +1,265 @@ +// 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)) + +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(state->dai.mclk)) { + 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 = clk_register_fixed_rate(state->dev, + dai->mclk_name, + NULL /* parent_name */, + 0 /* flags */, + 12288000 /* rate */); + if (IS_ERR_OR_NULL(dai->mclk)) { + ret = PTR_ERR(dai->mclk); + adv_err(state, "Failed to register MCLK (%d)\n", ret); + goto fail; + } + ret = of_clk_add_provider(state->dev->of_node, of_clk_src_simple_get, + dai->mclk); + 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 = (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_unregister_fixed_rate(dai->mclk); +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_unregister_fixed_rate(dai->mclk); + kfree(dai->mclk_name); +} + diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h index 1a1ea70086c6..b0735de0ced5 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 *mclk; + 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 Fri Mar 20 16:12:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11449831 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 E900A6CA for ; Fri, 20 Mar 2020 16:34:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D1A8820777 for ; Fri, 20 Mar 2020 16:34:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727593AbgCTQec (ORCPT ); Fri, 20 Mar 2020 12:34:32 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:56999 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727530AbgCTQeb (ORCPT ); Fri, 20 Mar 2020 12:34:31 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MtwpW-1jXpvO096q-00uJSB for ; Fri, 20 Mar 2020 17:34:30 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id CE83B65007A for ; Fri, 20 Mar 2020 16:34:29 +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 pMtqCE5am2R4 for ; Fri, 20 Mar 2020 17:34:29 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 85FE564EFDB for ; Fri, 20 Mar 2020 17:34:29 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.8.5.41) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 20 Mar 2020 17:34:29 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 2CE8680503; Fri, 20 Mar 2020 17:12:02 +0100 (CET) Date: Fri, 20 Mar 2020 17:12:02 +0100 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v3 06/11] media: adv748x: prepare/enable mclk when the audio is used Message-ID: <7ed1287d00da70de13627480b1601bfd2c6e570a.1584720678.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.41] 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: 37303A290D7F536A6D7660 X-Provags-ID: V03:K1:XFrmLvXQSG1UYe8P7iA3AHrA2zoM8iATkahHR5SCaKJIBwnVua1 rG/ezHslFUVuillnIQ9PBE4jh+8CDInL4eSOvQ1qp9t/DwF4G+R7c+uRyvDSjib0h35o9ei sZD7SS6iMXLM3EpopnmoQLY9/G5+YUdZzNaUdTYb9aaMW/gdDwSWJvaDf4UD0/h73wH0xmE XaW9pJ2yBkKPmQw62RMDw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:sATbBTK90wc=:/RjROyNKVDP457LuOmFeZ9 piRytjjHI6nMF1gO8WpWqlHiKE4fq1ZSMjWA0dn6o5rzE2KpY3Cq3kFuvA0DqrUlI1rf3hBhn EPmHZTDu450ke0akXzJMVlQZ8EwICZtIiWdK1+u3Gb7CJCcavxihvmzgvr0tn5DW8d8zguK/2 OqmELDNbF/VmYbedWNSGRpRNV/nE7d0mKlDyoouGDSPbXYeJVEZNTrQq7nSB60A4zeUCwO8Kn 3J48SVRAYU8Jv6gfK7ZHsiPGjE7DRhCBu9bAt8VGOiXxKtwogeVpw3+trNCLxFxXOWCg4zm6c d2UpOeXyKEfZx3RyR1EhrEa7j5NN2JjO9sG3rMJ4pejOzJgaAov9BGERWqwPBF8tC8dg0cW7Y eSvjzsv0MO1+AEOeEpq4qRMcSRQ1RJUyYUQ9jaqfsLmfWr8DWklf9qRR8FYKVxWuLlvinQU+0 ar3sHyNK3yxQ56sCBbZzBMQ7vm/Rn7E5fD0d97J4WBVewGI/7YDneqQihkfkQ0E2HbZq1gJwb n26isYR0zZUuBBHuoFW/5GRp2fZt4BygRw1id9YuxVPhDl+enphw6+M1rCqHii8B/g1LOYxGK 8LgILMJYY88mmPmGLVieGHHw8XWOWl8AJho6k2p/Zyg5Yy0lVYbXUr5CiJ68AsCqvwxYUFNC/ 83p+Sp/rpYwbugMWfD/gnxU9VDK7bpSi6mN1tZuGNFP361UGdDSf5zsxhm50Q9RcTGfQ6Ol54 AATK+1E4yuqyNneBqdM5Y+RomOHFBwCvkXbJRLrObikQ2+VjHc7QTuXVpSMksqZOzyJ/EEl5V 5QxwYXRbskVpyaAqGMLLXW+xlYpci6HMY+MbI5/Loljww6QYNBRFzjT6Dw8aO4vDe3mQP7s Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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 --- 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 6fce7d000423..1c673efd4745 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(state->dai.mclk); + 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(state->dai.mclk); set_audio_pads_state(state, 0); } From patchwork Fri Mar 20 16:12:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11449835 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 2C6B86CA for ; Fri, 20 Mar 2020 16:37:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 133E720709 for ; Fri, 20 Mar 2020 16:37:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727304AbgCTQhx (ORCPT ); Fri, 20 Mar 2020 12:37:53 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:39257 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727232AbgCTQhx (ORCPT ); Fri, 20 Mar 2020 12:37:53 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N8EdM-1jJTTT0ooC-014FSU for ; Fri, 20 Mar 2020 17:37:51 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id 092B2650123 for ; Fri, 20 Mar 2020 16:37:51 +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 yVOAfblJ85ax for ; Fri, 20 Mar 2020 17:37:50 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id B86DB64E037 for ; Fri, 20 Mar 2020 17:37:50 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.8.5.41) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 20 Mar 2020 17:37:50 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 9E6F480504; Fri, 20 Mar 2020 17:12:02 +0100 (CET) Date: Fri, 20 Mar 2020 17:12:02 +0100 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v3 07/11] 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.41] 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: 37303A290D7F536A6D7660 X-Provags-ID: V03:K1:I5/UP3m5BVE2jvBJ86xA2lDGKIEfUNn+9o7ijdKiHgOtrWI8iOf k/ymkfUla8TXjIjazdAqx6ftB5+W+JHgo5VE/pQj4aO1xIUgvsmPhJBGPuMVNq17AFS+uso y15kRKJFy181i37/qLxtqoUiDqnRSMySAjqbrM8abLlpThmGhTG/boYcq7pPg/TVPxE57aD iKFVvqB//wuht54Ai/e8g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:N3/kXdtCK0E=:48zZHfXsXFO67c2q31P/+L OoAN36dGk5AtkQZ737opkKvxnw3U0QQeoE/3fQCcpLb4ud/TwKjAyVN1kTlepSdii0mF7o+Sr pyOXptl1GobIbQKtu4AX+wDp5saAk9kF+h3dyVQ8vchx7s81V5x9ZNQbxJSBWQyDPhAMb9mhe t+taTsJ7kfOp7WzomTwWjZCpHMUo1MutLEJYs6EQs8bvbL28SGA2b+3JwBz6Ebro/tEFZeFIs qpeMwiv1nk2gvXtuM4d6oqa71nibsKcOcaKhtw6IRkyDv1SN6AMEa+MFvvKtbH+tXCeX54MjR v9nkfFfe6+Qm42WVFIW252H/FlyqUDpy8L6uqSR2pTeazBmf6fE34ff2SdQ1cZseOcHICJWLY BB7Ax72UZtNI65rrFWOZ21m78MI/ho8YNOOZQeCCtri5Gkoo/Bzzg4c+uljLrRUy0A/kxH7Bt YQiFnzVnbIJK6XzBxLPwcd6fL8GbcLG5NIjOWLDNW/8/gI6yZ20SSB4aQTymAchKjQgAr+/Z+ lWhX16RewSJS5edUysWk8qVvYAeDwiv38lD1IY9PQgyQmtRbILgL+xHyx794h/Yfg71rEIPYn dsAslTqMcj14E47PurcrDmPxNnctKTuWQNETCyjEOJjSZb5drk5VpPv/kvCrvKW5B+SlYVRW4 RVcquqPz9MUJOuhYyualVcnAfsqsoZBSiUrGVHnQfBc+kPGovSxfl48zOAkttgHY6yVq63UCQ 3/MZ2zr3qZCFxeeAKs9LJ/RS582/Mpj9cvWM670e5ompInYL3scOrbsMyhTewmmirVJIbsUA8 aD1em5ETLcFzMAoCyxnP5koLkn7skZld3nhE4Rl7UOiZ9AMQaIJ+J8T0D75Xml/rGf+QErJ Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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 --- 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 1c673efd4745..f22566094568 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 Fri Mar 20 16:12:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11449839 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 A76A513B1 for ; Fri, 20 Mar 2020 16:41:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 86A1D20709 for ; Fri, 20 Mar 2020 16:41:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727550AbgCTQlO (ORCPT ); Fri, 20 Mar 2020 12:41:14 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:39993 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726935AbgCTQlO (ORCPT ); Fri, 20 Mar 2020 12:41:14 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M3UhQ-1jFsfi3aIk-000g5u for ; Fri, 20 Mar 2020 17:41:12 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id A270F64E339 for ; Fri, 20 Mar 2020 16:41:12 +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 TQxaAPHktGrO for ; Fri, 20 Mar 2020 17:41:12 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 4728264DBD9 for ; Fri, 20 Mar 2020 17:41:12 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.8.5.41) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 20 Mar 2020 17:41:12 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 33D6A80505; Fri, 20 Mar 2020 17:12:04 +0100 (CET) Date: Fri, 20 Mar 2020 17:12:04 +0100 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v3 08/11] dt-bindings: adv748x: add information about serial audio interface (I2S/TDM) Message-ID: <5e7da04cd003778cf525eac96d8bacdf4a245a13.1584720678.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.41] 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: 37303A290D7F536A6D7660 X-Provags-ID: V03:K1:HKVgQes/b86XuOKUVep06S4Y6/ZIDQi9Pl7B/vLYwi6VkNvQfZE ril+01pF5kAPOikfib7R975fciyZ4CCe/lOeRzZ+TY3MeSlSOjONY4hkmk3NhqJc0BgW6vp WEvfxmKU0Mi1aXlv4ljn2etUglmHrMmtkw4jUSQfxE1ZCyC2A7vtUfehcXlhnw/wVNKKbTp CfL1LJWiR/p3iHannrhdg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:4fIq7OhkGT8=:vaNYXfn3lptKJhUnotVWn/ mPQGe2bAnUBfjwcvomWVe4XHsIjZutJseSxQb08hyN6fi1wW6nDdevcVM6jINnKOm3UyjUE0b og5FEGg8EHDDfktT2UdlxeOkGMzViKVEcMwJybqd/uX/8f+NCWkt0+8BH5jo1/PrSH5nsGcxM Jigiv6wUehfOKanKRmX5lkP1X/lt4z6ltW4NfeubU7YeiZvVAz+YGCiARSzjlqGRTe6KFWlDw O0z6yvTvO7M3HwEOvasyI5UfGScPbXh1dPQ3T5HNVf0tyD0UGLdj5OFa/a9TJfrvkxkVW+ItR fFn13IQiMgw+tQmXJIzT54ERHajvRMmhCBV32/XKFilf+YRzJ4UVxNuI6b+JEatCYtfx9w84q mT7Ovs706llXyIfcC6Qzc2MZkYqcCQKm9h7ylZIE1PmpYMCjR/YJgV7/7j3oHfM+pyX9hYUkC zrUE/Bg24TccfVl5KbR4aU493Xt6OwfwW2Uk3dWPg1wQFXs12wmYn2h3FlF42h/2zOQ/88gY6 SOkK7Y7Fte2rdSQGwXDHCKOzDL0zDpcfy4YhJ1uOSQ/l2sQqL6Lvjxrevo6ge9KBt2p+PnxCq AdKX1aR8a11S43UodMh9s27q3kvADyTZ4m6FQUyyQc7NV8yqyBoS9hZ9n61oJdogaTLvYFoRN 3l6pUm7BwvIISaxKidxXaTzxYxZuffE37w1283kcITCKcdcZbzZqTl68/dO2H4A0RFGMPUrHA pA0z8ku05Z6ezDELGBpIf53aViJO6KMPnOSvsKw0W5Iu07mkWY+u8QWApDqG/DrGpBMImeZh1 WcuRo7uWj/n7VGwU0PE5BfYoBCE5dT14+DUeaRJJaVvm2KSqZdnyyrV+XddxHOXETZzBOAJnE 9vF7xcnb5AWCBMFWIApkmKpYCQZYwcbc7xmmTIBbuhEM1iZ6Z9dWQ8WbKQZp+jTYCimLOP7BQ 9GdulsMzf0Qi7DXUbTpUul26fn4Kb/ZQ= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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 --- 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 Fri Mar 20 16:12:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11449843 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 43BAA913 for ; Fri, 20 Mar 2020 16:44:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 19B3520739 for ; Fri, 20 Mar 2020 16:44:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727534AbgCTQog (ORCPT ); Fri, 20 Mar 2020 12:44:36 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:52549 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727317AbgCTQog (ORCPT ); Fri, 20 Mar 2020 12:44:36 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MUXYs-1iope63Ax6-00QPAL for ; Fri, 20 Mar 2020 17:44:34 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id 8834064FB08 for ; Fri, 20 Mar 2020 16:44:34 +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 2hIa8OKLCDoC for ; Fri, 20 Mar 2020 17:44:34 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 1038664F8B2 for ; Fri, 20 Mar 2020 17:44:34 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.8.5.41) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 20 Mar 2020 17:44:33 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id D8C8280506; Fri, 20 Mar 2020 17:12:04 +0100 (CET) Date: Fri, 20 Mar 2020 17:12:04 +0100 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v3 09/11] arm64: dts: renesas: salvator: add a connection from adv748x codec (HDMI input) to the R-Car SoC Message-ID: <077a97942890b79fef2b271e889055fc07c74939.1584720678.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.41] 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: 37303A290D7F536A6D7660 X-Provags-ID: V03:K1:n/cylIVhtZGSs2W1aa2uC38zxwrsNpJGxT4m4DPQ94LRa5FkBhi Hkh2iFdEs785BggxMv1DnU/01pEn8flKqtHDkFL89j6/PVG7I71/AEGvBjIpWsfIk2x0CJJ 0+AsicYl3zMBskomTo0h+YzpLcFzEw5hLX9wDsFThB3nHJVV/PI6J5T/nVWikWehztUL5uU XK0Cfnnr3hnqJuh482zLA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:pELDrjzIvKk=:7zyee+p27PSyJxv/TGiwKX WndSeruLU2Bt21wRQ2ZPtBsBABPGKpdNYhKrSzR1Ahp/pfu810k9lqd0j/NKz9NB6X4AAEwWi sH39GODoXykRUCxO0apmZmAmvUcB+vfH8H6n6q1JlCWpyeH426HHv1ZyZ3nZ4zkfXbSFUgEId 6kZ5aQGRUzSkNab3hO97+2a7kguJv3Dlpzxm4zmjCin4RP3031EdnBkcNpR++6oTvfuMk4zpd a5I14Kn/2020k6DUwaFp/bPe4+M08cSVZKD+eri2+UyHtyAtAiz+E3QrLlZ501CmDcoRTc4Tm r2LuptjlQE9e93yDbzdnulg/ik6YP2gK+G+IJA3HqwxiKwP6DA58g5+mKBdpCqkngugLAsxCM bolLhtWQIgg0a56bQKv0irXLn8pkwP/v1/TbMOIlGmsGx65qNMcR+41ps71DLQYd3a2K+pNDs 4Y5DiWqGGwkn+nrsbInCFdvgGc4VJSdKXbKG9IZBH7d8CpG7apjuxHupMrcesyefkpqHOx0N0 4RsfzYpzxlXfTlwtWUYYl7aaw3jSUu/+Fg7pmSYqqkqV7og4B2RZGMavcvxSeRSHEx9MTx3m5 ZuarKq5aED/jwPcKhTb0D9lQ2VnzCvGDIV/WUHPJUUIuGpHBeuyrn0QjRa9LAckbRMmeOai53 7/3an0zyJDApI8gMr0H5bHsKJNCU8xpo0rgHzAf/PhlrzXtLwI1mNC1lkJlxKMbZXv73EfKSz HDiwvatW1ir1FYosc6koC+AqFhVrnqRJeCrAokfHbqX98wMZeM4l/E3In0R0O5gM8lEIa/7dg xpsD/WWfWdNGtpoq9Ngq/p/9U/0gP9LrvR6t8mcMP6tRv4TWFzQlr2aLIMQ9XEu9npmUsu/qt Gok0QYivmqv2rHT8pMMfFjGeiAWLQHncG3LAxsZv6Mp3MFQv2S4+7+CkqdA5WCVPHSo/MpzOz Q40wdrHsAsD2DS72wNJLztkNfkM8t5ik= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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: 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. Suggested-by: Geert Uytterhoeven 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). Suggested-by: Geert Uytterhoeven 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. Suggested-by: Geert Uytterhoeven 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 The driver provides only MCLK clock, not the SCLK and LRCLK, which are part of the I2S protocol. Reviewed-by: Laurent Pinchart --- .../boot/dts/renesas/r8a77950-salvator-x.dts | 3 +- .../boot/dts/renesas/salvator-common.dtsi | 47 +++++++++++++++++-- 2 files changed, 44 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/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>; + }; + }; }; }; From patchwork Fri Mar 20 16:12:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11449847 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 6C46817E6 for ; Fri, 20 Mar 2020 16:48:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4265920777 for ; Fri, 20 Mar 2020 16:48:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727163AbgCTQr7 (ORCPT ); Fri, 20 Mar 2020 12:47:59 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:35193 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726983AbgCTQr7 (ORCPT ); Fri, 20 Mar 2020 12:47:59 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MvazO-1jWBAo2uGM-00sbpf for ; Fri, 20 Mar 2020 17:47:56 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id 803006502CC for ; Fri, 20 Mar 2020 16:47: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 VTub53IziEhd for ; Fri, 20 Mar 2020 17:47:55 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id E865F6500B7 for ; Fri, 20 Mar 2020 17:47:55 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.8.5.41) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 20 Mar 2020 17:47:55 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 95A9480507; Fri, 20 Mar 2020 17:12:05 +0100 (CET) Date: Fri, 20 Mar 2020 17:12:05 +0100 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v3 10/11] media: adv748x: add support for log_status ioctl 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.41] 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: 37303A290D7F536A6D7660 X-Provags-ID: V03:K1:gJX0zAM0cCGK5F9UhFrEB/U3IcTgaeGcU1ZCU38lHWY3+4TqALb afpuj1IuPvj21svyEttKjtLXgjsNSGoMiJTSQxmwn/n54xPqrl3639lXcjKh1ePaY0a/q3y 8MBP/GtiY00d/yWVR4iq1R1fYnWXu8Q5MZlO4eSrSuAROwVJ20xRyljMZzb+e1QAoanxARi hI70d1DHnFhFoDvLSVhaQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:bliAmVUkZjg=:gkw/DS6xTPw31ecZSp2XE5 0UaibsYyhqA5aT36tnB2qpAgtOg1y1WZWmVRqCbgxMO7DRK9VgF1b2b9IRFPcuE4Z387ClxmA qWn1qJbOhB4e87wYxUln1eodc1ApBaeu98/x6qtbVOOHP6EYVFsjQdVjgbjVivm9Dniit0xNx qtcJpnu8R+yyw4HN0spzDdTNe5kd8voqVKZP7v1cyzRDnKYCR7j2AnZOW4oV3dQuLZO7sRxTx oDAqaF8JEU0Ou/vyqgoYQc1sDqCs0Ox2kKcmByf/n1DTAlpVv44FeW/FzAFQcQdcPBmjmo/kg zPL8EizWqOMXeUJ+aiJM36oAwpgG0cCCEO/7pldoTzR9YND1G2UdV32Y82Liv2xehMn/O0+Jl UwiFjvTaxf2BdS2Hu3NNiqMCAogpnCVr3TZXP9vI/W2GsMiTH6jLrHjsgbgMZNrUGBXdxKS5r v1lir1dEVqQXGBfBFsC4jFCOtCv7Duba2BirHEIn5X7x6zX7BV28W8ZVzKDG8CSS+hKtsUfGX Tz/MgA5YayXpSvQ0PRtM3JYbSYZpDy/U7kOXKbOIpGY/tOGfIb0aBXA5/e32Gs1/LYPZvSC76 VnBu/xCSZttrB98UfdN3QpCoQB1LcAL3mZoIV4nGvlkpOARC4waKTLtveEhm7ykZ8oZ6zhCBb FkywGmPW1btT4lseuoFUpaoHo2FrHjkqsnasNy7phIC0K08Wc2GHWycj+sh+XXvDxscSS8nwB EW82HWTfR18l8FXcHKepyQs/dn2OeuyEVBlLDNaHpdmEL90mY56ekIKbwe7VsTeQjo76IGyNX BLhuJuONzI+n+uNzJjMgEzdLFYlpILTSgXJO1hBfEvDzQatN7XHSKXx9BeYu5qBjL7y4M7itt 71SQhU5td012BZt6qI1OkJlaF8M4b8cZyWsJPOYgbKRlceHtH2vqK/gPOg977yMjcZadjCrF7 tqs2cArTGkY5gZ5qzKeypFIhMXvBUEcE= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The logged information provides insights about cable connection and the state of the HDMI decoder. It is very useful when debugging hardware problems in environments without easy access to the connectors. This change adds a device-specific wrapper for register block read, because some of the devices I2C-accessible registers (for instance, cs_data for stereo channel information or tmds_params for TMDS channel information) located in adjacent cells. According to manufacturers information, these registers can be read using block transactions. Signed-off-by: Alexander Riesen --- drivers/media/i2c/adv748x/adv748x-core.c | 15 ++ drivers/media/i2c/adv748x/adv748x-hdmi.c | 179 +++++++++++++++++++++++ drivers/media/i2c/adv748x/adv748x.h | 2 + 3 files changed, 196 insertions(+) diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c index 3513ca138e53..775450ab2bad 100644 --- a/drivers/media/i2c/adv748x/adv748x-core.c +++ b/drivers/media/i2c/adv748x/adv748x-core.c @@ -95,6 +95,21 @@ static const struct adv748x_register_map adv748x_default_addresses[] = { [ADV748X_PAGE_TXA] = { "txa", 0x4a }, }; +int adv748x_read_block(struct adv748x_state *state, u8 client_page, u8 reg, + void *val, size_t reg_count) +{ + struct i2c_client *client = state->i2c_clients[client_page]; + int err; + + err = regmap_bulk_read(state->regmap[client_page], reg, val, reg_count); + if (err) { + adv_err(state, "error reading %02x, %02x-%02lx: %d\n", + client->addr, reg, reg + reg_count - 1, err); + return err; + } + return 0; +} + static int adv748x_read_check(struct adv748x_state *state, int client_page, u8 reg) { diff --git a/drivers/media/i2c/adv748x/adv748x-hdmi.c b/drivers/media/i2c/adv748x/adv748x-hdmi.c index f598acec3b5c..664930e55baf 100644 --- a/drivers/media/i2c/adv748x/adv748x-hdmi.c +++ b/drivers/media/i2c/adv748x/adv748x-hdmi.c @@ -7,6 +7,7 @@ #include "adv748x.h" +#include #include #include @@ -601,11 +602,189 @@ static const struct v4l2_subdev_pad_ops adv748x_pad_ops_hdmi = { .enum_dv_timings = adv748x_hdmi_enum_dv_timings, }; +struct tmds_params { + u32 cts, n; + u16 tmdsfreq, tmdsfreq_frac; +}; + +static inline const char *cs_data_smpl_freq_str(u8 cs_data_3) +{ + switch (cs_data_3 & 0xf) { + case 0: + return "44.1"; + case 2: + return "48"; + case 3: + return "32"; + case 8: + return "88.2"; + case 10: + return "96"; + case 12: + return "176"; + case 14: + return "192"; + } + return "reserved"; +} + +static inline const char *cs_data_clk_lvl_str(u8 cs_data_3) +{ + switch (cs_data_3 & 0x30) { + case 0: + return "Level II"; + case 1: + return "Level I"; + case 2: + return "Level III, variable pitch shifted"; + } + return "reserved"; +} + +static inline const char *i2s_out_mode_str(u8 i2s_mode) +{ + switch (i2s_mode & ADV748X_HDMI_I2SOUTMODE_MASK) { + case 0 << ADV748X_HDMI_I2SOUTMODE_SHIFT: + return "I2S"; + case 1 << ADV748X_HDMI_I2SOUTMODE_SHIFT: + return "right"; + case 2 << ADV748X_HDMI_I2SOUTMODE_SHIFT: + return "left"; + case 3 << ADV748X_HDMI_I2SOUTMODE_SHIFT: + return "spdif"; + } + return ""; +} + +static int adv748x_hdmi_log_status(struct v4l2_subdev *sd) +{ + struct adv748x_hdmi *hdmi = adv748x_sd_to_hdmi(sd); + struct adv748x_state *state = adv748x_hdmi_to_state(hdmi); + u8 rv, i2s_tdm_mode_enable; + u8 cts_n[5]; + u8 cs_data[0x3a - 0x36 + 1]; + u8 tmdsfreq[2]; /* both tmdsfreq and tmdsfreq_frac */ + struct tmds_params tmds_params; + + /* Audio control and configuration */ + rv = io_read(state, 0x71); + pr_info("cable_det_a_raw %s\n", + rv & BIT(6) ? "detected" : "no cable"); + pr_info("tmds_clk_a_raw %s\n", + rv & BIT(3) ? "detected" : "no TMDS clock"); + pr_info("tmdspll_lck_a_raw %s\n", + rv & BIT(7) ? "locked to incoming clock" : "not locked"); + pr_info("hdmi_encrpt_a_raw %s\n", + rv & BIT(5) ? "current frame encrypted" : "not encrypted"); + rv = hdmi_read(state, 0x04); + pr_info("audio_pll_locked 0x%02lx\n", rv & BIT(0)); + pr_info("tmds_pll_locked 0x%02lx\n", rv & BIT(1)); + rv = io_read(state, 0x6c); + pr_info("gamut_mdata_raw %s\n", + rv & BIT(0) ? "received" : "-"); + pr_info("audio_c_pckt_raw %s\n", + rv & BIT(1) ? "ACR received" : "-"); + pr_info("gen_ctl_pckt_raw %s\n", + rv & BIT(2) ? "received" : "-"); + pr_info("hdmi_mode_raw %s\n", + rv & BIT(3) ? "HDMI/MHL" : "-"); + pr_info("audio_ch_md_raw %s\n", + rv & BIT(4) ? "multichannel" : "-"); + pr_info("av_mute_raw %s\n", + rv & BIT(5) ? "received" : "-"); + pr_info("internal_mute_raw %s\n", + rv & BIT(6) ? "asserted" : "-"); + pr_info("cs_data_valid_raw %s\n", + rv & BIT(7) ? "valid" : "-"); + rv = hdmi_read(state, 0x6d); + pr_info("i2s_tdm_mode_enable %s\n", + rv & BIT(7) ? "TDM (multichannel)" : "I2S (stereo)"); + i2s_tdm_mode_enable = rv & BIT(7); + + /* i2s_tdm_mode_enable must be unset */ + if (adv748x_read_block(state, ADV748X_PAGE_HDMI, 0x36, + cs_data, ARRAY_SIZE(cs_data)) == 0) { + pr_info("... cs_data %s\n", + cs_data[0] & BIT(0) ? "pro" : "consumer"); + pr_info("... cs_data %s\n", + cs_data[0] & BIT(1) ? "other" : "L-PCM"); + pr_info("... cs_data %s copyright\n", + cs_data[0] & BIT(2) ? "no" : "asserted"); + pr_info("... cs_data %s (%lu)\n", + cs_data[0] & GENMASK(5, 3) ? + "50/15" : "no pre-emphasis", + (cs_data[0] & GENMASK(5, 3)) >> 4); + pr_info("... cs_data channels status mode %lu\n", + (cs_data[0] & GENMASK(7, 6)) >> 7); + pr_info("... cs_data category code 0x%02x\n", cs_data[1]); + pr_info("... cs_data source number %u\n", cs_data[2] & 0xf); + pr_info("... cs_data channel number %u\n", + (cs_data[2] & 0xf0) >> 4); + pr_info("... cs_data sampling frequency %s (%u)\n", + cs_data_smpl_freq_str(cs_data[3]), cs_data[3] & 0xf); + pr_info("... cs_data clock accuracy %s\n", + cs_data_clk_lvl_str(cs_data[3])); + } + rv = hdmi_read(state, ADV748X_HDMI_I2S); + pr_info("i2soutmode %s\n", i2s_out_mode_str(rv)); + pr_info("i2sbitwidth %u\n", rv & 0x1fu); + rv = hdmi_read(state, 0x05); + pr_info("hdmi_mode %s\n", rv & BIT(7) ? "HDMI" : "DVI"); + rv = hdmi_read(state, 0x07); + pr_info("audio_channel_mode %s\n", + rv & BIT(6) ? "multichannel" : "stereo or compressed"); + rv = hdmi_read(state, 0x0f); + /* The bits 6 and 7 must be 1 if TDM mode */ + pr_info("man_audio_dl_bypass 0x%02lx\n", rv & BIT(7)); + pr_info("audio_delay_line_bypass 0x%02lx\n", rv & BIT(6)); + rv = hdmi_read(state, 0x6e); + pr_info("mux_spdif_to_i2s_enable %s\n", rv & BIT(3) ? "SPDIF" : "I2S"); + rv = dpll_read(state, ADV748X_DPLL_MCLK_FS); + pr_info("mclk_fs_n %lu\n", + ((rv & ADV748X_DPLL_MCLK_FS_N_MASK) + 1) * 128); + + /* i2s_tdm_mode_enable must be set */ + memset(&tmds_params, 0, sizeof(tmds_params)); + if (adv748x_read_block(state, ADV748X_PAGE_HDMI, 0x5b, cts_n, 5) == 0) { + tmds_params.cts = cts_n[0] << 12; + tmds_params.cts |= cts_n[1] << 4; + tmds_params.cts |= cts_n[2] >> 4; + tmds_params.n = (cts_n[2] & 0xf) << 16; + tmds_params.n |= cts_n[3] << 8; + tmds_params.n |= cts_n[4]; + pr_info("... TDM: ACR cts %u\n", tmds_params.cts); + pr_info("... TDM: ACR n %u\n", tmds_params.n); + } + if (adv748x_read_block(state, ADV748X_PAGE_HDMI, 0x51, + tmdsfreq, 2) == 0) { + tmds_params.tmdsfreq = tmdsfreq[0] << 1; + tmds_params.tmdsfreq |= tmdsfreq[1] >> 7; + tmds_params.tmdsfreq_frac = tmdsfreq[1] & 0x7f; + pr_info("... TDM: tmdsfreq %d MHz\n", + tmds_params.tmdsfreq); + pr_info("... TDM: tmdsfreq_frac %d 1/128\n", + tmds_params.tmdsfreq_frac); + } + if (i2s_tdm_mode_enable) + pr_info("... TDM: sampling frequency %u Hz\n", + tmds_params.cts ? + (tmds_params.tmdsfreq * tmds_params.n + + tmds_params.tmdsfreq_frac * tmds_params.n / 128) * + 1000 / (128 * tmds_params.cts / 1000) : + UINT_MAX); + return 0; +} + +static const struct v4l2_subdev_core_ops adv748x_core_ops_hdmi = { + .log_status = adv748x_hdmi_log_status, +}; + /* ----------------------------------------------------------------------------- * v4l2_subdev_ops */ static const struct v4l2_subdev_ops adv748x_ops_hdmi = { + .core = &adv748x_core_ops_hdmi, .video = &adv748x_video_ops_hdmi, .pad = &adv748x_pad_ops_hdmi, }; diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h index b0735de0ced5..6421a4c02c60 100644 --- a/drivers/media/i2c/adv748x/adv748x.h +++ b/drivers/media/i2c/adv748x/adv748x.h @@ -433,6 +433,8 @@ struct adv748x_state { /* Register handling */ int adv748x_read(struct adv748x_state *state, u8 addr, u8 reg); +int adv748x_read_block(struct adv748x_state *state, u8 page, u8 reg, + void *val, size_t reg_count); 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, From patchwork Fri Mar 20 16:12: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: 11449865 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 761B8913 for ; Fri, 20 Mar 2020 16:51:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 547BB2076F for ; Fri, 20 Mar 2020 16:51:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727546AbgCTQvT (ORCPT ); Fri, 20 Mar 2020 12:51:19 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:38175 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726983AbgCTQvT (ORCPT ); Fri, 20 Mar 2020 12:51:19 -0400 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MjSHa-1jiK2G0LM2-00ktPG for ; Fri, 20 Mar 2020 17:51:18 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id D19DB64FB26 for ; Fri, 20 Mar 2020 16:51: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 wxWVLusRGkSr for ; Fri, 20 Mar 2020 17:51:17 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 828D664D62D for ; Fri, 20 Mar 2020 17:51:17 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.8.5.41) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 20 Mar 2020 17:51:17 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 86EAC80509; Fri, 20 Mar 2020 17:12:06 +0100 (CET) Date: Fri, 20 Mar 2020 17:12:06 +0100 From: Alex Riesen To: Kieran Bingham CC: Geert Uytterhoeven , Mauro Carvalho Chehab , Hans Verkuil , "Laurent Pinchart" , Rob Herring , Mark Rutland , Kuninori Morimoto , , , , , Subject: [PATCH v3 11/11] media: adv748x: allow the HDMI sub-device to accept EDID Message-ID: <4fce566b68bbe4f85cf92cd80a455b575a5d95d1.1584720678.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.41] 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: 37303A290D7F536A6D7660 X-Provags-ID: V03:K1:kmxSu3XQAVB7Gl5PCCmRsvwr91dwWE511EXQREeJxA5jeHtnVdC gaUo2YoXhI4rQcsUIb9syBR9oZVDKLZ/EETjzfmDaVwN5vAyXKGR9Inf7tDTY+3gDLEu595 1G/hADVPntpo1r8O1zICBpIaA3A4h1LukxR/eO1xQZLxGwBzNlyEXihMMOmV3RA1OBWnSvt pvFGNUGVrwZdpXvowG5sg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:ZBzJeD9Rrrc=:0ZsSP28H9EvPzLf1y+x2zx 0eR0aACCNN2ATPuc4chitUN8UzHrK/znaiJQha1nuZT5om1zmed3d8DIkv9MYbISqrq9DOnxT bV8hLOtFiV4cANPR5dOSexBV//9kU1RZfpX3HM1NF2j1mS+R+km07s0kTjtqpgcTcdRyMRidE /M8EEwAgxgFQJWkK0X/K4BrZmQMRrC9Z/FXHktw6b6W6X8m5Q1wggbRwN0QSdzZ2+W454+rgk xht00XaPUZ49Pn8CJccKBi1hOks/GcJhfP/NDxxAHbNwF4QHkTr7HDfNsUSL1SqZz00j1mlDT BDomGs3sbXufGT01FUYKf0PDewxnvwCqXYgMMzsj8yDNXxeHhkq9Tj8EboSF2LNOzJ1oHkpz5 SGmVjk+jh64I6yji8+oK/VOM4EJ5ti/Ha5/8l+C/2n8EweUQkZ4L3rz/EOyB3B3iYMK/VfV6G qVO6gX305mgH79pbW+IUhV5xM+HwZSb6O6xc40Atvt/JOSsaQ0B82EuywVEwG1Q1paiW1GxYF e4L7OaCk5kM9e4/LAZYCP6wR/4JVpXG41rIpycprk2gJBD/EelMeU5E0VTsL5ydvsHjJXWjsV AD9tOQw8h1YyLEhZxrcgn/tK0lU2xTimBG9BHrASPoS+hL884QLh6eReguDCcdHWVuVLwYulV brU4NNfa/IRkT+y+CP+ETd/lJz5sYiiGBd9dfv0JNDFH8e5NV7UHOg1YuEG6GicRJ9/aS2R94 5IWJMsjr8gzBebu9nyJTwoaqeQo9bQAQOO+lymadBFSMVy3x5kiXbtldST+xOwpkfvXeMapPY shFLZv8+LtfUprr0jv95d/fI2U5PWTPfNfu2iI7jcgPeQEEVNByyVe3vw8jBzd9ct5lSipU3o /FvH/bivlT0ClYw5HdK3BhnmQzVmQVnijDmu5OrEP7D2emioakB9uC6HbXpX16s8vU9BVplkx 5SPS/Eej/T7tziB/VTJQdWtj7xDQK8cU= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This makes it possible to load a EDID reported by the device with v4l2-ctl utility: vdev=/dev/$(grep -l '^adv748x.*hdmi$' /sys/class/video4linux/v4l-subdev*/name |cut -d/ -f5-5) v4l2-ctl -d $vdev --set-edid=pad=0,file=/etc/adv7482.edid Signed-off-by: Alexander Riesen --- I would like to avoid doing that, but found no other way yet. Suggestions very welcome. --- drivers/media/i2c/adv748x/adv748x-hdmi.c | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/media/i2c/adv748x/adv748x-hdmi.c b/drivers/media/i2c/adv748x/adv748x-hdmi.c index 664930e55baf..fea133472911 100644 --- a/drivers/media/i2c/adv748x/adv748x-hdmi.c +++ b/drivers/media/i2c/adv748x/adv748x-hdmi.c @@ -775,7 +775,34 @@ static int adv748x_hdmi_log_status(struct v4l2_subdev *sd) return 0; } +static long adv748x_hdmi_querycap(struct adv748x_hdmi *hdmi, + struct v4l2_capability *cap) +{ + struct adv748x_state *state = adv748x_hdmi_to_state(hdmi); + + cap->version = LINUX_VERSION_CODE; + strlcpy(cap->driver, state->dev->driver->name, sizeof(cap->driver)); + strlcpy(cap->card, "hdmi", sizeof(cap->card)); + snprintf(cap->bus_info, sizeof(cap->bus_info), "i2c:%d-%04x", + i2c_adapter_id(state->client->adapter), + state->client->addr); + cap->device_caps = V4L2_CAP_AUDIO | V4L2_CAP_VIDEO_CAPTURE; + cap->capabilities = V4L2_CAP_DEVICE_CAPS; + return 0; +} + +static long adv748x_hdmi_ioctl(struct v4l2_subdev *sd, + unsigned int cmd, void *arg) +{ + struct adv748x_hdmi *hdmi = adv748x_sd_to_hdmi(sd); + + if (cmd == VIDIOC_QUERYCAP) + return adv748x_hdmi_querycap(hdmi, arg); + return -ENOTTY; +} + static const struct v4l2_subdev_core_ops adv748x_core_ops_hdmi = { + .ioctl = adv748x_hdmi_ioctl, .log_status = adv748x_hdmi_log_status, };