From patchwork Mon Jan 13 14:15:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11330297 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 2B481138D for ; Mon, 13 Jan 2020 14:15:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 13625207FD for ; Mon, 13 Jan 2020 14:15:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728956AbgAMOPU (ORCPT ); Mon, 13 Jan 2020 09:15:20 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:41521 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728774AbgAMOPU (ORCPT ); Mon, 13 Jan 2020 09:15:20 -0500 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mhl0I-1jLvTC41B2-00dkGK; Mon, 13 Jan 2020 15:15:11 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id A5F5D64F294; Mon, 13 Jan 2020 14:15: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 VgsXzwaqNrMb; Mon, 13 Jan 2020 15:15:10 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 54CA164E74F; Mon, 13 Jan 2020 15:15:10 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.10.2.141) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Mon, 13 Jan 2020 15:15:10 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 03FBA804E9; Mon, 13 Jan 2020 15:15:10 +0100 (CET) Date: Mon, 13 Jan 2020 15:15:09 +0100 From: Alex Riesen To: Kieran Bingham CC: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , "Mark Rutland" , , , , , Subject: [PATCH 1/8] media: adv748x: add a device-specific wrapper for register block read Message-ID: <20200113141509.GB3606@pflmari> Mail-Followup-To: Alex Riesen , Kieran Bingham , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , Mark Rutland , 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.10.2.141] 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: 37303A29536F936F657D64 X-Provags-ID: V03:K1:1JPns5GasBHjZTgrFQHGNnhSdRNObQT1UzzxL7GpDV7WAKNmB4M FkmhKG1563Jb6HctQGmZSpMgIeSwQB+IAPuB1DWMHLL5UWjYbjY8q6VDpW2YPVZ5mXxmRAU 7tHsDxWHLTkOkig+l361chO7oeD+NzSokH6TWf34P6Jdw3ab1GrVde5sd82zoUD+n5IywYX olpMdKOipTgyqYe01wKJw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:ohg2w/+Fy6k=:lzV+9xqdJNzc3oSdT6agH+ thHHtKQem4M1Am71+kbcrfFKd39yx56vI1nLOMttFkaLr4qxZ7UDsxqgaGbJDoIN9r0Wrtosp KWSkR8EcOqyvt5mQWprLNxGywSReXV1pleSMIj9VQuCpOtVOf8CNZSJAYLvwAYuI63o8GS5FW 4k6nOe2ZnMmvGiOm733eLxi09/+DOjrGI+ZRJCbO8Z2GsqJOcRL7gnsJfLw75l1Cbv6aKv6Gv Dj6YhPpGUHSQhEzbV6nzFB7MCkzSIwmnEqDzvV39q4Dn2DkgMeKK16SbskOcmeHYWK2v6wmZG 5savYW5J0YNWjuCV1rksX067WIi00wcwYF5WaM4NdqtHFcW1HwPkSjqF68fq3Ah4BpgpxMiaA MVzc4VCEMNy20bYk3apcSxFyo/YHusB1Hm2mwyPsfzXZ/x2lf2FP1eKO5mGHyUJipot1UeI/X Jbyeu/tiWrDMaityXq+uyVvC/zp54T9beB1dXJdozTqDSvwvmcsA/nQzIA76+YZRoo2B4UFp7 BjMI2vs5CqzzzNBPdfcrPvar1peF55ZGLgaXdYSYiP2tAFxS5ZfUZyfc6NfQpIHuNuFjxM3yr dV53B2pWPHPOfMorlfatB89qnN2aeXQXD0jA6Jdvw5NHu+zmj0Wxzh80SemVMrVYbj0Jf2vDt cTatCC3f9hlUENlkAAo+v0rBYa1/xGpjYfWonHa0qeWqS6DyqwEYO9l9nFb1M2KHpI35Ll05C 03pH4bWxaSkw8MPXdrekRDBJrwEeH0xWsLhcqCmtJMjG89g+Sgl2Z+s5Sjljpha8PurgWr+qB NAQPCSK8F0X7JoQC8mdqow+2G+StDrmxIVXl7PR+qPwwobSO4f2/sJJAKkQyt/zWGfUdH9Tm9 Ah4f3/LUgRYgWQPxVjlZ7AsmSKyB2ywV4T8hyAEtA= Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org 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.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c index 23e02ff27b17..bc49aa93793c 100644 --- a/drivers/media/i2c/adv748x/adv748x-core.c +++ b/drivers/media/i2c/adv748x/adv748x-core.c @@ -97,6 +97,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.h b/drivers/media/i2c/adv748x/adv748x.h index 5042f9e94aee..db6346a06351 100644 --- a/drivers/media/i2c/adv748x/adv748x.h +++ b/drivers/media/i2c/adv748x/adv748x.h @@ -387,6 +387,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 Mon Jan 13 14:15:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11330323 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 8AF8B138D for ; Mon, 13 Jan 2020 14:16:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 600A224655 for ; Mon, 13 Jan 2020 14:16:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728890AbgAMOPk (ORCPT ); Mon, 13 Jan 2020 09:15:40 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:56819 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727331AbgAMOPj (ORCPT ); Mon, 13 Jan 2020 09:15:39 -0500 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MwjO6-1jbnM03ksc-00y9Ph; Mon, 13 Jan 2020 15:15:22 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id 1743C64F293; Mon, 13 Jan 2020 14:15: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 z6daAkZQeN_e; Mon, 13 Jan 2020 15:15:21 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 5ED4564E74F; Mon, 13 Jan 2020 15:15:21 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.10.2.141) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Mon, 13 Jan 2020 15:15:21 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 1142F804E9; Mon, 13 Jan 2020 15:15:21 +0100 (CET) Date: Mon, 13 Jan 2020 15:15:21 +0100 From: Alex Riesen To: Kieran Bingham CC: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , "Mark Rutland" , , , , , Subject: [PATCH 2/8] media: adv748x: add audio mute control and output selection ioctls Message-ID: <20200113141521.GC3606@pflmari> Mail-Followup-To: Alex Riesen , Kieran Bingham , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , Mark Rutland , 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.10.2.141] 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: 37303A29536F936F657D64 X-Provags-ID: V03:K1:DIrn3CSu0MRyfE7IK5wV5IobbDZ6Oy+ZCIRw905xg95hBcY/XrX aCFM/NcIj4V1xepWMVsWQAyqv7D1r5YFPWVLALtzjd2eSg6n3AfGpKDt0XSmC3iNp5wWGNz 3c/yC8+ttkULDSdfcg7VohCmTpWBTd2ZW941/0uDlSCsHAfCPMN41VQO7dC5uf+yXpXk/mp ESSkOkxcF1FSSGEQtJw/w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:YakssdLKZoY=:C4l5RNkGp3kzcHbG1mxqsE Sb4EyC0+pkIL4NP4A0ayFeMYaVuJkZ29m1F+3SQr2uPd6aGNSzR8y4cQItC5jBXr/GqEE272z hEAAaiS30KZXKQmKJhtzEJLjqlSh+XTYx7A6eMuYDhdQvtxpTgA1AifiV+VyIT4SILdDz5XqH /mhLb8MdGkaUFpbseRThEIg761gUrdDGBjW0f7vlyj2mhxPBDmGU1puMJNPo8TabvdOgITVSO dATUTCGpjHJ4onH1jNYIoOrg+eoePTGm+CQap5dPxv3czuElQDGLMSXK/1d3zt1U2z4uXoqxF A/CRSA0gqkBuVdZogCL11mFKcdtb/E2I4yZXmy7vihqL2+tV7MbM0jm+0wyu/k8qMmO71ZjNJ m6ux47J0NdCjjOiBKRCtv3AzmCF4auM3KnZKVPXwTrtVoJsyoFwyUEeCuSNLbHsvIJInHOTJx +kTooMdRrZGcXUDtMMBiygYvMD8hE2v6JJBLzcy91+j4idb/OcKNYr8OBJ5UH88+9q3w9Nd8U mY87Pk89XvijRDIUJ3/ghav5EZ+YNUr1kTXJrho9y4mOyto4Ea5a560yT92UX1b3NNbV1PpAP qoConwKPhUTA7v8sMBX5cAoPoyqopGDGj5/WSw1WZRUenLGKTKBtsDKf+4CygglXP0aw3HOcy U2NnJPHIzLX4KFTPiT96PVnCStN1Zt3Reeagoz135FCPmB1MUKr1aB+gEaXyvfemK0OVlb0QL QhMZwVq8zOIY2c0NFHbkyems4bENTO+gccKlEW0bJbiE3nP1AQQQgiwqIpI9TCaV/ownUbRxn IeRMkg+nI9gV0u51zBbNRrEplR+Kf3nbC07RJcXmObLD+ub13aUWBrF+tdDmJpLbXTroTklRC 6ZzqQQaDurBvj5grtiza/hEuAmIg+42xAHAy6Vgi8= Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org This change implements audio-related V4L2 ioctls for the HDMI subdevice. The master audio clock is configured for 256fs, as supported by the only device available at the moment. For the same reason, the TDM slot is formatted using left justification of its bits. Signed-off-by: Alexander Riesen --- drivers/media/i2c/adv748x/adv748x-core.c | 6 + drivers/media/i2c/adv748x/adv748x-hdmi.c | 182 +++++++++++++++++++++++ drivers/media/i2c/adv748x/adv748x.h | 42 ++++++ 3 files changed, 230 insertions(+) diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c index bc49aa93793c..b6067ffb1e0d 100644 --- a/drivers/media/i2c/adv748x/adv748x-core.c +++ b/drivers/media/i2c/adv748x/adv748x-core.c @@ -150,6 +150,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-hdmi.c b/drivers/media/i2c/adv748x/adv748x-hdmi.c index c557f8fdf11a..9bc9237c9116 100644 --- a/drivers/media/i2c/adv748x/adv748x-hdmi.c +++ b/drivers/media/i2c/adv748x/adv748x-hdmi.c @@ -5,6 +5,7 @@ * Copyright (C) 2017 Renesas Electronics Corp. */ +#include #include #include @@ -603,11 +604,186 @@ static const struct v4l2_subdev_pad_ops adv748x_pad_ops_hdmi = { .enum_dv_timings = adv748x_hdmi_enum_dv_timings, }; +static int adv748x_hdmi_audio_mute(struct adv748x_hdmi *hdmi, int enable) +{ + struct adv748x_state *state = adv748x_hdmi_to_state(hdmi); + + return hdmi_update(state, ADV748X_HDMI_MUTE_CTRL, + ADV748X_HDMI_MUTE_CTRL_MUTE_AUDIO, + enable ? 0xff : 0); +} + + +#define HDMI_AOUT_NONE 0 +#define HDMI_AOUT_I2S 1 +#define HDMI_AOUT_I2S_TDM 2 + +static int adv748x_hdmi_enumaudout(struct adv748x_hdmi *hdmi, + struct v4l2_audioout *a) +{ + switch (a->index) { + case HDMI_AOUT_NONE: + strlcpy(a->name, "None", sizeof(a->name)); + break; + case HDMI_AOUT_I2S: + strlcpy(a->name, "I2S/stereo", sizeof(a->name)); + break; + case HDMI_AOUT_I2S_TDM: + strlcpy(a->name, "I2S-TDM/multichannel", sizeof(a->name)); + break; + default: + return -EINVAL; + } + return 0; +} + +static int adv748x_hdmi_g_audout(struct adv748x_hdmi *hdmi, + struct v4l2_audioout *a) +{ + a->index = hdmi->audio_out; + return adv748x_hdmi_enumaudout(hdmi, a); +} + +static int set_audio_pads_state(struct adv748x_state *state, int on) +{ + return io_update(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) +{ + if (fs % 128 || fs > 768) + return -EINVAL; + return dpll_update(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_update(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_update(state, ADV748X_HDMI_AUDIO_MUTE_SPEED, + ADV748X_MAN_AUDIO_DL_BYPASS | + ADV748X_AUDIO_DELAY_LINE_BYPASS, + is_tdm ? 0xff : 0); + if (ret < 0) + goto fail; + ret = hdmi_update(state, ADV748X_HDMI_REG_6D, + ADV748X_I2S_TDM_MODE_ENABLE, + is_tdm ? 0xff : 0); + if (ret < 0) + goto fail; + ret = set_i2s_format(state, ADV748X_I2SOUTMODE_LEFT_J, 24); +fail: + return ret; +} + +static int set_audio_out(struct adv748x_state *state, int aout) +{ + int ret; + + switch (aout) { + case HDMI_AOUT_NONE: + ret = set_audio_pads_state(state, 0); + break; + case HDMI_AOUT_I2S: + ret = set_dpll_mclk_fs(state, 256); + if (ret < 0) + goto fail; + ret = set_i2s_tdm_mode(state, 1); + if (ret < 0) + goto fail; + ret = set_audio_pads_state(state, 1); + if (ret < 0) + goto fail; + break; + case HDMI_AOUT_I2S_TDM: + ret = set_dpll_mclk_fs(state, 256); + if (ret < 0) + goto fail; + ret = set_i2s_tdm_mode(state, 1); + if (ret < 0) + goto fail; + ret = set_audio_pads_state(state, 1); + if (ret < 0) + goto fail; + break; + default: + ret = -EINVAL; + goto fail; + } + return 0; +fail: + return ret; +} + +static int adv748x_hdmi_s_audout(struct adv748x_hdmi *hdmi, + const struct v4l2_audioout *a) +{ + struct adv748x_state *state = adv748x_hdmi_to_state(hdmi); + int ret = set_audio_out(state, a->index); + + if (ret == 0) + hdmi->audio_out = a->index; + return ret; +} + +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); + + switch (cmd) { + case VIDIOC_ENUMAUDOUT: + return adv748x_hdmi_enumaudout(hdmi, arg); + case VIDIOC_S_AUDOUT: + return adv748x_hdmi_s_audout(hdmi, arg); + case VIDIOC_G_AUDOUT: + return adv748x_hdmi_g_audout(hdmi, arg); + case 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, +}; + /* ----------------------------------------------------------------------------- * 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, }; @@ -633,6 +809,8 @@ static int adv748x_hdmi_s_ctrl(struct v4l2_ctrl *ctrl) int ret; u8 pattern; + if (ctrl->id == V4L2_CID_AUDIO_MUTE) + return adv748x_hdmi_audio_mute(hdmi, ctrl->val); /* Enable video adjustment first */ ret = cp_clrset(state, ADV748X_CP_VID_ADJ, ADV748X_CP_VID_ADJ_ENABLE, @@ -697,6 +875,8 @@ static int adv748x_hdmi_init_controls(struct adv748x_hdmi *hdmi) v4l2_ctrl_new_std(&hdmi->ctrl_hdl, &adv748x_hdmi_ctrl_ops, V4L2_CID_HUE, ADV748X_CP_HUE_MIN, ADV748X_CP_HUE_MAX, 1, ADV748X_CP_HUE_DEF); + v4l2_ctrl_new_std(&hdmi->ctrl_hdl, &adv748x_hdmi_ctrl_ops, + V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1); /* * Todo: V4L2_CID_DV_RX_POWER_PRESENT should also be supported when @@ -755,6 +935,8 @@ int adv748x_hdmi_init(struct adv748x_hdmi *hdmi) void adv748x_hdmi_cleanup(struct adv748x_hdmi *hdmi) { + adv748x_hdmi_audio_mute(hdmi, 1); + set_audio_out(adv748x_hdmi_to_state(hdmi), HDMI_AOUT_NONE); v4l2_device_unregister_subdev(&hdmi->sd); media_entity_cleanup(&hdmi->sd.entity); v4l2_ctrl_handler_free(&hdmi->ctrl_hdl); diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h index db6346a06351..fdda6982e437 100644 --- a/drivers/media/i2c/adv748x/adv748x.h +++ b/drivers/media/i2c/adv748x/adv748x.h @@ -128,6 +128,7 @@ struct adv748x_hdmi { u32 present; unsigned int blocks; } edid; + int audio_out; }; #define adv748x_ctrl_to_hdmi(ctrl) \ @@ -224,6 +225,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) @@ -246,7 +252,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) @@ -258,6 +278,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 @@ -279,6 +309,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 @@ -393,14 +426,23 @@ 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_update(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_update(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_update(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) From patchwork Mon Jan 13 14:15:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11330319 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 CB5F66C1 for ; Mon, 13 Jan 2020 14:16:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A07DA21569 for ; Mon, 13 Jan 2020 14:16:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728799AbgAMOPq (ORCPT ); Mon, 13 Jan 2020 09:15:46 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:60681 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729048AbgAMOPo (ORCPT ); Mon, 13 Jan 2020 09:15:44 -0500 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N7zRz-1jn2gM32Kh-0155ap; Mon, 13 Jan 2020 15:15:29 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id 2467C64F293; Mon, 13 Jan 2020 14:15: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 Tu-rQ8yTIw5j; Mon, 13 Jan 2020 15:15:28 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 9F26C64E74F; Mon, 13 Jan 2020 15:15:28 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.10.2.141) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Mon, 13 Jan 2020 15:15:28 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 45698804E9; Mon, 13 Jan 2020 15:15:28 +0100 (CET) Date: Mon, 13 Jan 2020 15:15:28 +0100 From: Alex Riesen To: Kieran Bingham CC: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , "Mark Rutland" , , , , , Subject: [PATCH 3/8] media: adv748x: add log_status ioctl Message-ID: <20200113141528.GD3606@pflmari> Mail-Followup-To: Alex Riesen , Kieran Bingham , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , Mark Rutland , 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.10.2.141] 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: 37303A29536F936F657D64 X-Provags-ID: V03:K1:ZnbHu0eArWqhZj+Ge6wEDwGlg/zmJDFMpUVumqc+kkTfEPUa8bi TpgZ+2xLKaHmcbiHxjDN0mdLPz7VxKVKS+5rI0/6GfteVk6lKdwGZgWh+wjxi3QRBK0l6pK AFDn/h2cRq0Ne/uYMWfZycHnEr85ehrElGfD1Pl2Kz3U/+0f5I9QZCCpKEk5GbIthY3N1ub 8zt5RFWpNhzncKV2WbE3g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:ZWKBPrwkpaU=:7lOO0POFYFRkYm7k/t4atN Hfm71KfQRaEJBUdBp4s0t98uX99ARz68FSV3OPCNCG593WLF+6+8Zw0moAGDTEdqL3BlkxyE2 xK1kigVVg8kXHwHHQKwbeAgQSUcE5vJMoermVjX5ikw9myZHZZOrZUHo/vdBiThsdKCoPiyFx t7Tou+9Ya/UQv4AdnyrDYGcaK+wHB/iMzDdu2fNtTDKpRuU7Y7Ep3G/TbxHAXyRdnMaI39Fq9 lo3hKUUTjZ7/LX59rzC9f1xjpAY44wKdGwT+IDqiZ33y8/qQSL9hNQmbmvQe6hfOzSxIudjCi HFOU4IPC88qhaAd85t0H+ORTWxtKj0n7q2HD0Yiy1Mxq8DQybj5W9kP/XweYdSTAEhoUllbOu /N63VPz7YxLSMZvGj1HHxadlwBo+AaloV2iEFjKvn0LRhTLTd1rUeoJigYooSPZDqX31L1VhB o3dzekz0fxBcKAMS4uV84acjhbEnRFInJac5qOFFDY2udcQ8wM3wrbl1y5RimqWoi0kJ6A9wX q0XesusKKDXXD9+jJ9nC9GKdBQxdkpfyDehLJ89L/2OWhC8VjnB73GTkLLUjK+NVtlHpIHA3i N72EZkmBiagMGjFvuTafvM2n8XJhc9e8Z/DBsitWUP8sNYveeYISXU2Xm3rwf5avxhHbMslEe px/WmPQSc7zIdPgn73oRUimp6aPCdmD6Dy72CYaMem6Zm9OAFRQ6gG61P+9g7WD7hZSiqpuY8 y0uyyLGE+wZ3gsACzRwomiTCrQ3PF9B91AheyGCkPqW8YWsr1Y+5Ajs5H5GLlG9bVXbtn+Uaa GWSt9L8qgsrVpTSyLIygYo0r4OWmbdJIG1UndK4alqv5DPzrT4Z4MWz8VqrKLb+Hqga3kyB8d Hf7fb2NKWUIHopNIZbRWWjvmpac3pTRoj5V535yac= Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@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. Signed-off-by: Alexander Riesen --- drivers/media/i2c/adv748x/adv748x-hdmi.c | 173 +++++++++++++++++++++++ 1 file changed, 173 insertions(+) diff --git a/drivers/media/i2c/adv748x/adv748x-hdmi.c b/drivers/media/i2c/adv748x/adv748x-hdmi.c index 9bc9237c9116..69dfafc4e0f5 100644 --- a/drivers/media/i2c/adv748x/adv748x-hdmi.c +++ b/drivers/media/i2c/adv748x/adv748x-hdmi.c @@ -613,6 +613,178 @@ static int adv748x_hdmi_audio_mute(struct adv748x_hdmi *hdmi, int enable) enable ? 0xff : 0); } +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; +} #define HDMI_AOUT_NONE 0 #define HDMI_AOUT_I2S 1 @@ -775,6 +947,7 @@ static long adv748x_hdmi_ioctl(struct v4l2_subdev *sd, } static const struct v4l2_subdev_core_ops adv748x_core_ops_hdmi = { + .log_status = adv748x_hdmi_log_status, .ioctl = adv748x_hdmi_ioctl, }; From patchwork Mon Jan 13 14:15:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11330313 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 8A7A56C1 for ; Mon, 13 Jan 2020 14:16:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 727DD207FD for ; Mon, 13 Jan 2020 14:16:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729100AbgAMOPz (ORCPT ); Mon, 13 Jan 2020 09:15:55 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:53131 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729064AbgAMOPs (ORCPT ); Mon, 13 Jan 2020 09:15:48 -0500 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N9dbx-1jlOmx0isn-015e1N; Mon, 13 Jan 2020 15:15:34 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id EAD7A64F293; Mon, 13 Jan 2020 14:15:33 +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 zSUt-Fw9X00y; Mon, 13 Jan 2020 15:15:33 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id A747864E2AB; Mon, 13 Jan 2020 15:15:33 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.10.2.141) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Mon, 13 Jan 2020 15:15:33 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 5D6DB804E9; Mon, 13 Jan 2020 15:15:33 +0100 (CET) Date: Mon, 13 Jan 2020 15:15:33 +0100 From: Alex Riesen To: Kieran Bingham CC: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , "Mark Rutland" , , , , , Subject: [PATCH 4/8] media: adv748x: reserve space for the audio (I2S) port in the driver structures Message-ID: <20200113141533.GE3606@pflmari> Mail-Followup-To: Alex Riesen , Kieran Bingham , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , Mark Rutland , 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.10.2.141] 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: 37303A29536F936F657D64 X-Provags-ID: V03:K1:GCk2luEwK7oQKq+TVDmnLvDi4cpAoKdN6TRH/nlXVMKt3Z5GHwu H3avNrMuWgo13wQ7Ze/a2VAvbetXqrN6m+l72/5aFqtdk2UyXNuWQJHDhFrsY38zJsq3Uws +Nh74MidEuL3prr2ArVSCHN9M4ykTAlnbyxPCdDMKRSR6pLqKYtXwfv5NU2/yCF19ZsVknR qE1k9GTehtJ1US1u68Fzg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:IdhXLHCtac8=:FwiUzFjjrZsbLy8MBOXV/l jrlUrLFzvSSLWKSSNT18aCS4sNiVsHlAa49p0eYIwYKUNaXsePcAxPb+hya2JFD24Qvkunifd AVBx7hjI8giCZN7rko0ogwSQLQBLIrVz0M3d3tQ93++1vCsmuxI/owy8Dgc5rJQ5I9Hgi2kKw YTzc8Cb6bf8uFoJJ9UR/yb/eS1VjpiLmBhFOA4N4ceRuyROuNBAK4HBlcp9mAoz8WnYYQB1ZK F5YkTo2/TVPj1Fv9GG4yB1nFidCk37j4Sp0qXaLtG5C8sD/I3SRftWhnnF10vBORFvGZ6Vg9v T/tnEx3scvamELA6QmP4b0UNayGaDyakyfY8V/1pyURCQYrzJ5rzNsaBhgR57R87fIcGv35hu 3YZUHo/z8X0flMtuCQYId1YXy24c/GGQzETlISKRGTCo/jtoy8gvBk+sEFBMmu3HC5OSp461h +OSHNKliS/6rrFnZceiq12RZAgZWpw+7dG4h/BrVhUXBquBny3oQ47yrcSGKadysIsG5T/wTY U+nUtk771wmCq7Dh1yF9ahwNr7yv52VuG0JHKHhc4KGm51OojhqufJLKfcyX36Le4v+lTQyGu IfBd7WgIvGXUYbR2ewj7CEiEpP0otKV9BTTyz6OCjV6M6nEmbIVwWjTbRVafQ1D+O/uTLWg1T zsMu28Cep9PWUnhmeBSldJXX/Rj78IbkYeXv3xG5ry6L/f0bhkp3gAnFsnqKaP4jkDqaWspre aIF/nf2OfFgAtKB9JMSLL965QHHMAPb3A3jOVo3lQF12Q93bvQcSKjN+akSAb0aFhma50hcHg 0X1EF7OZ3dL1umwjmDCjRRAdnqE0DiZ86GBO6L75vd6F0h3CexOctlUHpFOy/ODP4zu2M6aoN 3lWmghCN1TRokcwhUJrpaDA7VeuxwGcICVQ/D3ynM= Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org This allows use of the port in the device tree files. Signed-off-by: Alexander Riesen --- drivers/media/i2c/adv748x/adv748x.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h index fdda6982e437..5db06410f102 100644 --- a/drivers/media/i2c/adv748x/adv748x.h +++ b/drivers/media/i2c/adv748x/adv748x.h @@ -61,7 +61,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 { From patchwork Mon Jan 13 14:15: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: 11330305 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 3EAD86C1 for ; Mon, 13 Jan 2020 14:15:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1C97F21569 for ; Mon, 13 Jan 2020 14:15:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729048AbgAMOPt (ORCPT ); Mon, 13 Jan 2020 09:15:49 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:49669 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726074AbgAMOPq (ORCPT ); Mon, 13 Jan 2020 09:15:46 -0500 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MOQu6-1j1Meb0nyI-00PtQg; Mon, 13 Jan 2020 15:15:39 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id DDDF164F293; Mon, 13 Jan 2020 14:15:38 +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 FJJfW3vl2UUn; Mon, 13 Jan 2020 15:15:38 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 8BB4264E2AB; Mon, 13 Jan 2020 15:15:38 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.10.2.141) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Mon, 13 Jan 2020 15:15:38 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id 46F3E804E9; Mon, 13 Jan 2020 15:15:38 +0100 (CET) Date: Mon, 13 Jan 2020 15:15:38 +0100 From: Alex Riesen To: Kieran Bingham CC: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , "Mark Rutland" , , , , , Subject: [PATCH 5/8] media: adv748x: add an ASoC DAI definition to the driver Message-ID: <20200113141538.GF3606@pflmari> Mail-Followup-To: Alex Riesen , Kieran Bingham , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , Mark Rutland , 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.10.2.141] 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: 37303A29536F936F657D64 X-Provags-ID: V03:K1:6FJRURYFpLuIRnEqV7dHBObZJ3W8OMcOPQAWg4QF66BHJHHtoET vvNJ/DpF9AH0ZK9nJjKSY3pUcd9KMZwwegHhqK/fG/HjCk6gqyenXtHW1ZHcVyXKEWrN4M5 faY+QfS2otL/SMtO8GxCQRi33P3hdnbxEE/tKevsVELh5DhBdsvYNV+/QgTcoO1u/IND1mY AymYw4G00G1+nY8y5Iwmg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:OvP7KTwnn7I=:y61Rba4svO+wcAEAOhC5z5 qVkYWGWDNB9JQ1Gumiy2jAUvKUA8JPLEvDP1fpQyYwrFR63tG3a2F0hwrSndL6xO6R0sgyvL+ XrDgr3oP1d0KGmkUqttVQU5O3JbM8txu5gue3mazLXiHYssrZnWkoBuCrwz+K/8+9TGgzn/Jl Xlr6sSoEM5YvUP/GrtPm1qIbE2RRnESvhKET2x/fddKaok867Y1jRGHllMJhOlSkezk79zgm9 QjtSG3QfLexY7tc5DsN22XiUDiAlmlvJkcrtyNlPTGOnC9i2Sr9pu83/kNW4NBd0J2T04tMG/ 5X01zGWVwny6Lp3BvhAD+mE1oNCyMImI/mHfwU+PsOIsGlrCsLQIBGwI9U0WtAsWMAH1X3ohu PGz5IRn/XGqUWhj77eOIFesAWOK0YsIyZf9yiYlIlCt7Y63KBvufXrR1ikKqIRAH6PU8ynZ4a 3HDlIKHup7lZTOPyCs9MltB+OULHqhUEy2KybSXGK/wnuiB1p0oTYNnUIGwi0aSdnzMRBhd1N mAM/RkHnJjlIHfJFO9BkoBW06OC3RjcboaklD4XqCVri+ZaYehQftGpC8VxuDsb3eqHZ3az+4 AajZGmSMO/kG8XcnkBBhkSafTFxKMf4VQgnrtWg17rt/gDoREORu5pUzAFX/K388p2XXBCdZh hMYt0Woila84XH6Hx5HpSps8nSgc1goL9Kmw1itmjJbpF44J4EWGJ76pgrngi1kU5Tnvof1mk pUtxRfWX1Qq9sK5SRQcpc6Iz+8y4xGIi4X4JGR5lXooMiMtQSfCbxIPa7F7+nA/Qwrt03Wlvi YX19uHWYhFLtf133uOoSIY71rz4mIr7oQRDUIjBPUK/CULWHzRYRrLqwUKfwiLlvrtEsTqehk uKDV0jgWN5/c/3TGSDWdnQMTYiatEf5SzqWqO1xy4= Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The definition is used to publish hardware constraints and can be used to implement in-demand device configuration. Signed-off-by: Alexander Riesen --- drivers/media/i2c/adv748x/adv748x-core.c | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c index b6067ffb1e0d..75e4bf144ad7 100644 --- a/drivers/media/i2c/adv748x/adv748x-core.c +++ b/drivers/media/i2c/adv748x/adv748x-core.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "adv748x.h" @@ -689,6 +690,30 @@ static void adv748x_dt_cleanup(struct adv748x_state *state) of_node_put(state->endpoints[i]); } +static struct snd_soc_dai_driver adv748x_dai = { + .name = "adv748x-i2s", + .capture = { + .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, + }, +}; + +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, +}; + static int adv748x_probe(struct i2c_client *client) { struct adv748x_state *state; @@ -782,8 +807,16 @@ static int adv748x_probe(struct i2c_client *client) goto err_cleanup_txa; } + ret = devm_snd_soc_register_component(state->dev, &adv748x_codec, + &adv748x_dai, 1); + if (ret < 0) { + adv_err(state, "Failed to register the codec"); + 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: From patchwork Mon Jan 13 14:15:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11330317 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 13FC4138D for ; Mon, 13 Jan 2020 14:16:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F05E721569 for ; Mon, 13 Jan 2020 14:16:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729076AbgAMOPz (ORCPT ); Mon, 13 Jan 2020 09:15:55 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:42957 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726074AbgAMOPy (ORCPT ); Mon, 13 Jan 2020 09:15:54 -0500 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mq1GE-1jVEoL1Rkg-00nAr8; Mon, 13 Jan 2020 15:15:47 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id 09B8564F293; Mon, 13 Jan 2020 14:15:47 +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 MpW3x8_PgRq7; Mon, 13 Jan 2020 15:15:46 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 3D7C264D641; Mon, 13 Jan 2020 15:15:46 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.10.2.141) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Mon, 13 Jan 2020 15:15:46 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id E583A804E9; Mon, 13 Jan 2020 15:15:45 +0100 (CET) Date: Mon, 13 Jan 2020 15:15:45 +0100 From: Alex Riesen To: Kieran Bingham CC: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , "Mark Rutland" , , , , , Subject: [PATCH 6/8] media: adv748x: reduce amount of code for bitwise modification of device registers Message-ID: <20200113141545.GG3606@pflmari> Mail-Followup-To: Alex Riesen , Kieran Bingham , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , Mark Rutland , 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.10.2.141] 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: 37303A29536F936F657D64 X-Provags-ID: V03:K1:/85G/aaVRJTZkr6Gku52togdEm1yvKqdKcF2c6D9t/wZUMxfwf+ ueDyXqBfeWDjMif7FvC+VnxwEbJgUx3FyGyTzatFR1guD9V4uw2RNoDaNeH/Nwnp0pV4896 DESxa+kfbQ+uqth3DkTy9kl+NvJsPVifiYh/OpUX30+bAkg2vu/QBJ2kTzX9Sh27m1aE5S2 7B6hcDjYeJBDE0WrhNmsg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:5ZCwtVUm3R0=:K645eVt6J/mrOudtoJiooK MPK+yBSC1zEBtHzDuRiCAkKjRzkLtFB/2lbGxuSo0GCiyy9DW+wXlseZtCOrTysV6rqRf3MyO GqBQB6wkHW8p5v9EqUmhjB69ORSUKpfCbRubBOLlt9jrLLU7w9p541cFihbJAwV352Yq4J4fO wtQgyYQ1AkLsT8BEGVN9se34GMoFJkgOiT9sm7B29S2KMGSR/jB9wnjOfN6XSLO87zKEXks4Z 0PABl0gPXRX48X1/QBzZSDIixRtl7AepMJrAP3h1XG+K+Lx/SP0QuJi0dGNLC4Nalb4WasJ5i Db2+LbvTCVGnK5AvN4zy9y4SLk2amVboFL9pxZu+POZ2jBoOK08/GxZlwY946RWJq1J8LZKaW PLGCUbugnrqGUIeDOJLo1dGuFSZJHKv/d9HJmigyn/7PurV3QNSWm7NXYCZ+7R3kYFTlcv7Qv PdM1Sqwsn7uajbaFsMXJVhV73Jbj3MuJKv+zEI1iiCThlTfrN9wAnExMejo84kZiQT631gkbr +U8YEdD2m+qTfhcpAkXTK3F96AtdlCju6Mw2QVStUyPWb3v2K+enLPzgTq7hGmnkX4VUfG0Xu XqouWEOvbUpskEB6jRu2H+NXzDDulYJECfp/tsNNj5DLx2Qo+ciOVvhI7GIkP48ratxCYT6R5 D4pdQaMn3lMFltGT7bC3KEFJrOSnesRzVH8M3rr0hkFTWlADfLgBBB+7Qoi9pozCDE0OPzOe3 209hNcGsA281A51sfZouewsrkFIJRzBOeZH8XdeWtDZkOILvOhNWzzzXvkAqmTLyHU9mDwV9/ /ep+nApMI4YLZHFd8PSC6H4g5im4Jnd7SPlBVQljCHj0QVUTD9Itk673MCpCqeRZ9cMFwRNo7 EhhtCJD6UniZOJIJiXpTnaKy2vdPmzspAc8d0Q758= Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The regmap provides corresponding routine (regmap_update_bits) already wrapped for this device earlier. Signed-off-by: Alexander Riesen --- drivers/media/i2c/adv748x/adv748x.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h index 5db06410f102..ab3f754542fe 100644 --- a/drivers/media/i2c/adv748x/adv748x.h +++ b/drivers/media/i2c/adv748x/adv748x.h @@ -432,7 +432,7 @@ int adv748x_update_bits(struct adv748x_state *state, u8 page, u8 reg, #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 io_update(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) @@ -450,11 +450,11 @@ int adv748x_update_bits(struct adv748x_state *state, u8 page, u8 reg, #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 Mon Jan 13 14:15:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Riesen X-Patchwork-Id: 11330309 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 BF446138D for ; Mon, 13 Jan 2020 14:16:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A80FB21569 for ; Mon, 13 Jan 2020 14:16:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728928AbgAMOP7 (ORCPT ); Mon, 13 Jan 2020 09:15:59 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:52835 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729141AbgAMOP7 (ORCPT ); Mon, 13 Jan 2020 09:15:59 -0500 Received: from mail.cetitecgmbh.com ([87.190.42.90]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MtwIW-1jeZI32dDQ-00uJAi; Mon, 13 Jan 2020 15:15:51 +0100 Received: from pflvmailgateway.corp.cetitec.com (unknown [127.0.0.1]) by mail.cetitecgmbh.com (Postfix) with ESMTP id 56FA764F293; Mon, 13 Jan 2020 14:15: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 Cy68gE_GQgSA; Mon, 13 Jan 2020 15:15:51 +0100 (CET) Received: from pfwsexchange.corp.cetitec.com (unknown [10.10.1.99]) by mail.cetitecgmbh.com (Postfix) with ESMTPS id 0556764D641; Mon, 13 Jan 2020 15:15:51 +0100 (CET) Received: from pflmari.corp.cetitec.com (10.10.2.141) by PFWSEXCHANGE.corp.cetitec.com (10.10.1.99) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Mon, 13 Jan 2020 15:15:51 +0100 Received: by pflmari.corp.cetitec.com (Postfix, from userid 1000) id ACF2D804E9; Mon, 13 Jan 2020 15:15:50 +0100 (CET) Date: Mon, 13 Jan 2020 15:15:50 +0100 From: Alex Riesen To: Kieran Bingham CC: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , "Mark Rutland" , , , , , Subject: [PATCH 7/8] dt-bindings: adv748x: add information about serial audio interface (I2S/TDM) Message-ID: <20200113141550.GH3606@pflmari> Mail-Followup-To: Alex Riesen , Kieran Bingham , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Rob Herring , Mark Rutland , 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.10.2.141] 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: 37303A29536F936F657D64 X-Provags-ID: V03:K1:3UWAIQ3PRfLO3SwbaMk2tmknBL5osw0uZ9NNz1XG25ufDyVB987 Rnh6LNFpwA3UZYI6ufAhoe4a8NtVJEBSoSefoOWiac4vzKPdAmaGA4uud+7nVPLtU+hwlKB ivmJWe3VtUSjoh29NJQYrX4aCjT9VPfn5H6VWbIKyeCuKF/LKs4ZBDoy4NoDeIe820DTsAX l1pZXy2FDQa7eBA3kGxXA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:eaTY7FtP9y8=:+ydYl8ej9B+Czt0/FVvRtv wFuQ6GLarf54qSdmILfr09Zx+LImhPvVnwrRC1YZTuWroqVCyo99Kn0OXd9FdMr0kFajMoErU IIiIr7UaqHHHtqEIJTEQGU7EKfDyywZOrHVL/NZB90V5oYxh8pfqRAUfDv698egqrD3bArFSP dTP77quAllDo8aRHmmWADCqtzdPejdzfT+JzIEHsm1WgzslmPKnVPiI9o8vB7uvvR8UCmCv6C IZDlGky+6GcQN3yWjpR36X1VsGyuBGRJsXP7E7xNaG3GCU1QjRUfVQxUHr1w/5d90KKZ0Z7Kb AaBQmIVgZ93KMiPPwfk/Qtt9+JFGxmAF38jJiw1Zl7Ixx/5b7VE8+7ffPAyJ+H9qDxBMNouLx ck+r5Xo6QIW1Wklok99XIKeVVuaiR35Uepr5Kkrp3w7T8nFtmzbI4Xq8iCIDalNC7YRZM7+d6 f3/c51N0i4Z1cckJJNfXAUgt0Gi+PfsitW+RpCWfpEAAyNHJWpnvXrr8pNoQiqwngTFYEjZEL 3FIc9MTNbdlleP6M8IbBFDvZq+LfhVvU8VHYQo8vxV7fR6WLscrF4Zi8gzJWAS/tSZI2e0N0F SsQQ3MFuYebE+eViR4fzsojaMdVDx4w/swB5FQxWPOifVd2n9+kXFPGLsv2xMafST+j/4y0wQ jxXBF7SdszeIB7dcptZZ21GZToZEfFo025aKn+Oa+zR/aF71q//qOUnzTvENew7OQgKCu13pN e6YfRw9+8QaMPaE2kteGUgzWnBiHkRxwoGmI8l0CyqF/F6hsk1aJN2ZOKoTRrBI1Y/5BNyyKZ 7ZWIgWarBIeDOCNGuhjjS9XudHlUy4vEVvW2HAPH6+ZTFNR++DqEEP9dg+2I+rh/hcMo2+BUi 71TdhWNhfLsCTi1enMoZNAWb8zzMjJFcXDROx7SWU= 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 --- .../devicetree/bindings/media/i2c/adv748x.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/media/i2c/adv748x.txt b/Documentation/devicetree/bindings/media/i2c/adv748x.txt index 4f91686e54a6..c42dffb37a82 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: @@ -47,6 +49,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 @@ -113,4 +116,12 @@ Example: remote-endpoint = <&csi20_in>; }; }; + + port@c { + reg = <12>; + + adv7482_i2s: endpoint { + remote-endpoint = <&i2s_in>; + }; + }; };