From patchwork Tue Oct 15 08:07:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 13835838 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2EABF19F420; Tue, 15 Oct 2024 08:08:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728979688; cv=none; b=YBpWajhGbMxIx1VwiM27AjHONYx1IwhaCM+13mR8cpK7WaSKHcvNM6L1bUyf6Y/YTcftqew4rZf/btd1wNggPbu9XOI4uMgK9YS0HMD6Kjh2jiEE1XbpENMIpTMCJ139W+ebhRHMOxJrNSzpH1V7HUiAsKh6lJJBxbTnrKjcJIk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728979688; c=relaxed/simple; bh=0HM5QzbApdifMro5Q6I0Vfw6ka77pCzXs9quQRKR2us=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=D/9E44mh+XBHadWB8yQcvuXIA09Sf+BuBqn15FmoYQzOvanrBnRLOgY9lrrvQmzFWSOZ2fugRHgEZ1xt9AhseqPG9XGYsxFdfSn3KvlQvin6zv2WqMGpPJKBHZbqpszk7V5cSB4mxlw/MG6024IRXTRatuStyEN0jFJhGcxZ370= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZP/gCuNF; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZP/gCuNF" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-53a007743e7so328602e87.1; Tue, 15 Oct 2024 01:08:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728979684; x=1729584484; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Qf4YX1pnBlpdfRPG1tk8PhQCn7JdDosYa2aEpKQFtec=; b=ZP/gCuNFZroSRIO/r77w0cXXDSjmmiW/dk00nqkl/Nm4bHQ56RfUWwBgZi4I2cfJLo m5EhIIIZFJbtcMNDcDURPv9dhdH9zGTocOdR/sWqnCyvM/G9dtGKUdCmXFiKjmV0WePb aoE3FIL9HvtSzz7d59PqK0ySq02X+xMzYEc/7qyVRntV7CeBOzJQ45iFAUxdi17De0cR ZSjeXtWRZJxTb8VQVwkfzSHlfWXwrO43PYvdilDZsUAX9l0ELy4Sfg/+Mz/uKg6jACky xk16ThyQBJbibEUZdATkPlRznW32ag0PWpv9PCxeysOKoqZZPzRlMCqTYg+3SuLCWEC+ 20kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728979684; x=1729584484; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Qf4YX1pnBlpdfRPG1tk8PhQCn7JdDosYa2aEpKQFtec=; b=HvLRn3WbokrKPvRCQdQl3LZhGhigk8ZvH8Bc6YCxWomCVFtVxQx6GxxqrLprXVD9MP 0sKIas2WXRQ9UD6kCl5Ll6KMDOLdtg/4YNQcsYGx9kSUhIWQ3e15cnLFGIotpxBJcdcy YHORSgHpvVPgxW2e7qmTaDkaX43Yw2HwB78fJGoVJijlahJYuhwXYO3BUjLp7YI6kMvr UqenjPYjIffkOu97pjs8E+i8YHtIW58dzpm08UVlbxE9kw7yVoak8yJ8tlY/EQs5ybbM 31GOeCuX29ZWrYX9eWvB9hEyKVzSFFRx8MDAtjVudrav7o2Yw4AQpdQCD3MGfU+ks1nq pnvQ== X-Gm-Message-State: AOJu0YxbuD5L1Oqnv+63G9RR3sw4fKX+GwZTFH+UlGTVbiqVepdCnzx1 4Qe/XBtqHAKctn8+M7F5irEpPk7rpvXOtq3ZGw9kdNpxVkOMZhIdotVHNQKgCQc= X-Google-Smtp-Source: AGHT+IEv1hJjXrzLHsjIxDivTbnZhYVuj6vaZhprgrQSN8mpwxtBFCbAyWJBy1N163Rq17jGawuGsw== X-Received: by 2002:a05:6512:3c92:b0:536:9f72:c427 with SMTP id 2adb3069b0e04-539da4e12dfmr6293352e87.28.1728979683201; Tue, 15 Oct 2024 01:08:03 -0700 (PDT) Received: from localhost.localdomain ([188.243.23.53]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539ffff3ddfsm94736e87.149.2024.10.15.01.07.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 01:08:01 -0700 (PDT) From: Alexander Shiyan To: linux-media@vger.kernel.org Cc: devicetree@vger.kernel.org, Tomi Valkeinen , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sakari Ailus , Hans Verkuil , Laurent Pinchart , Alexander Shiyan Subject: [PATCH v3 1/3] media: i2c: ds90ub960: Convert IC specific variables to enums Date: Tue, 15 Oct 2024 11:07:35 +0300 Message-Id: <20241015080737.16272-1-eagle.alexander923@gmail.com> X-Mailer: git-send-email 2.39.1 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This patch converts chip-specific variables into chip enums that can be used to easily add support for other chip types. Signed-off-by: Alexander Shiyan --- v2: Use family enumeration instead of flags to indicate FPD3/FPD4 difference. v3: Fix Media-CI test warnings --- drivers/media/i2c/ds90ub960.c | 83 ++++++++++++++++++++++++----------- 1 file changed, 58 insertions(+), 25 deletions(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index ffe5f25f8647..8000801d5810 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -402,12 +402,21 @@ #define UB960_MAX_EQ_LEVEL 14 #define UB960_NUM_EQ_LEVELS (UB960_MAX_EQ_LEVEL - UB960_MIN_EQ_LEVEL + 1) +enum chip_type { + UB960, + UB9702, +}; + +enum chip_family { + FAMILY_FPD3, + FAMILY_FPD4, +}; + struct ub960_hw_data { - const char *model; + enum chip_type chip_type; + enum chip_family chip_family; u8 num_rxports; u8 num_txports; - bool is_ub9702; - bool is_fpdlink4; }; enum ub960_rxport_mode { @@ -1654,10 +1663,15 @@ static int ub960_rxport_add_serializer(struct ub960_data *priv, u8 nport) ser_pdata->port = nport; ser_pdata->atr = priv->atr; - if (priv->hw_data->is_ub9702) + + switch (priv->hw_data->chip_type) { + case UB9702: ser_pdata->bc_rate = ub960_calc_bc_clk_rate_ub9702(priv, rxport); - else + break; + default: ser_pdata->bc_rate = ub960_calc_bc_clk_rate_ub960(priv, rxport); + break; + } /* * The serializer is added under the same i2c adapter as the @@ -1785,7 +1799,7 @@ static int ub960_init_tx_ports(struct ub960_data *priv) ub960_write(priv, UB960_SR_CSI_PLL_CTL, speed_select); - if (priv->hw_data->is_ub9702) { + if (priv->hw_data->chip_type == UB9702) { ub960_write(priv, UB960_SR_CSI_PLL_DIV, pll_div); switch (priv->tx_data_rate) { @@ -2140,10 +2154,14 @@ static int ub960_init_rx_ports(struct ub960_data *priv) if (!rxport) continue; - if (priv->hw_data->is_ub9702) + switch (priv->hw_data->chip_type) { + case UB9702: ub960_init_rx_port_ub9702(priv, rxport); - else + break; + default: ub960_init_rx_port_ub960(priv, rxport); + break; + } } return 0; @@ -2486,6 +2504,7 @@ static int ub960_configure_ports_for_streaming(struct ub960_data *priv, for (nport = 0; nport < priv->hw_data->num_rxports; nport++) { struct ub960_rxport *rxport = priv->rxports[nport]; u8 vc = vc_map[nport]; + unsigned int i; if (rx_data[nport].num_streams == 0) continue; @@ -2509,21 +2528,22 @@ static int ub960_configure_ports_for_streaming(struct ub960_data *priv, case RXPORT_MODE_CSI2_SYNC: case RXPORT_MODE_CSI2_NONSYNC: - if (!priv->hw_data->is_ub9702) { + switch (priv->hw_data->chip_type) { + case UB9702: + /* Map all VCs from this port to VC(nport) */ + for (i = 0; i < 8; i++) + ub960_rxport_write(priv, nport, + UB960_RR_VC_ID_MAP(i), + nport); + break; + default: /* Map all VCs from this port to the same VC */ ub960_rxport_write(priv, nport, UB960_RR_CSI_VC_MAP, (vc << UB960_RR_CSI_VC_MAP_SHIFT(3)) | (vc << UB960_RR_CSI_VC_MAP_SHIFT(2)) | (vc << UB960_RR_CSI_VC_MAP_SHIFT(1)) | (vc << UB960_RR_CSI_VC_MAP_SHIFT(0))); - } else { - unsigned int i; - - /* Map all VCs from this port to VC(nport) */ - for (i = 0; i < 8; i++) - ub960_rxport_write(priv, nport, - UB960_RR_VC_ID_MAP(i), - nport); + break; } break; @@ -3217,7 +3237,8 @@ ub960_parse_dt_rxport_link_properties(struct ub960_data *priv, return -EINVAL; } - if (!priv->hw_data->is_fpdlink4 && cdr_mode == RXPORT_CDR_FPD4) { + if (priv->hw_data->chip_family != FAMILY_FPD4 && + cdr_mode == RXPORT_CDR_FPD4) { dev_err(dev, "rx%u: FPD-Link 4 CDR not supported\n", nport); return -EINVAL; } @@ -3796,6 +3817,7 @@ static int ub960_get_hw_resources(struct ub960_data *priv) static int ub960_enable_core_hw(struct ub960_data *priv) { struct device *dev = &priv->client->dev; + const char *model; u8 rev_mask; int ret; u8 dev_sts; @@ -3830,8 +3852,19 @@ static int ub960_enable_core_hw(struct ub960_data *priv) goto err_pd_gpio; } - dev_dbg(dev, "Found %s (rev/mask %#04x)\n", priv->hw_data->model, - rev_mask); + switch (priv->hw_data->chip_type) { + case UB960: + model = "UB960"; + break; + case UB9702: + model = "UB9702"; + break; + default: + model = "Unknown"; + break; + } + + dev_info(dev, "Found %s (rev/mask %#04x)\n", model, rev_mask); ret = ub960_read(priv, UB960_SR_DEVICE_STS, &dev_sts); if (ret) @@ -3851,7 +3884,7 @@ static int ub960_enable_core_hw(struct ub960_data *priv) goto err_pd_gpio; /* release GPIO lock */ - if (priv->hw_data->is_ub9702) { + if (priv->hw_data->chip_type == UB9702) { ret = ub960_update_bits(priv, UB960_SR_RESET, UB960_SR_RESET_GPIO_LOCK_RELEASE, UB960_SR_RESET_GPIO_LOCK_RELEASE); @@ -4013,17 +4046,17 @@ static void ub960_remove(struct i2c_client *client) } static const struct ub960_hw_data ds90ub960_hw = { - .model = "ub960", + .chip_type = UB960, + .chip_family = FAMILY_FPD3, .num_rxports = 4, .num_txports = 2, }; static const struct ub960_hw_data ds90ub9702_hw = { - .model = "ub9702", + .chip_type = UB9702, + .chip_family = FAMILY_FPD4, .num_rxports = 4, .num_txports = 2, - .is_ub9702 = true, - .is_fpdlink4 = true, }; static const struct i2c_device_id ub960_id[] = { From patchwork Tue Oct 15 08:07:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 13835839 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DB731C233E; Tue, 15 Oct 2024 08:08:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728979692; cv=none; b=pEdF8a7sAqXMZx+ljKmC9r1BsXktoclW1bni1dj3SDjPht3wx30L4mwJtbarrwQicchfG9NuSAgpqpOGLkU/JlYZyc1Wy2ZruqP79xu7kxM9QTQTiJZ7lyQPKP5LoPeOazeltMfF8lWerh+PYqkslVhVNXU8gKjV6jbRmyib9hM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728979692; c=relaxed/simple; bh=MQ9Ytm+hxvpCDsBW4EujpQGGUncwYo1BVMDZiSOOZcE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qR/8ovW5N2xLqkn2YTLsl9F+RZYwI5+OmKJn4yJr3YUfal+rxhy6pxLRFHdPqgXiXp/E3ToVeVUM2TyYNEf3dx657jIbLD39iJh/qjhtUdpFVj5oTEkYc9Jh/fU75L/d5kiYJ6ryP7vLiCI5YC/R3NRPfSk82YJ4Hf3EDmfPp1Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lumL0BqT; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lumL0BqT" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-539f4d8ef84so2338355e87.0; Tue, 15 Oct 2024 01:08:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728979689; x=1729584489; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HYUK+ZHP63y8EBGKj6xXLUuCn0+yJAOR87u+nvJa/Jo=; b=lumL0BqTiDvaRkzPDBKYPehRR+2ASoeUr6fAvYMTBp4rAGDCDRjGLXWb3i72Upe1Ez PWAtzXtoaOA7hzB1a6eotF5AHz4jFnEYd6/L/4piYhctdvjFT1wmnaDuRNyOQXDt48o5 ZlWlETYhKHYj44WV6vuBD49XnrrpHAptIhB7nlhKg2lVA+S9Vz6gDFUDsvmZbD2UcEkU Ze8PxiZMZYSme32HNi6i21PJyPbVCSyMJSXnjopie3Wx9asfBK7xHFO9gDQ9bnfdxoWM dQ9kLv7yee2+BcE/Iqs+2SjbxFD7jWaD2t+wkIP3aRYGWDSVZ16PGEixVHk1ASVtVzwj FFBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728979689; x=1729584489; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HYUK+ZHP63y8EBGKj6xXLUuCn0+yJAOR87u+nvJa/Jo=; b=Tb1X72axTXDeqxlfUoWhTRM4dNpGXc6lXdD6N9EHzaBHPWkO2yoUcthjTCErAGOeUG Wu7lRWGrXl0lRR58ZLs0c8d5MnFB2jS2KZiZQEFuvkNzt5GtjmE3YOjyQ/wYYJK2q2+m Z+rdsTPnNLRB3Z9HlnNK3Fpa+9akbfeempTyBf656n92N7MsVB2jPwTmkXfilXRcBZRi NUaecHUbCCpxt288JjvwaweSWzs8P9AdyCSoWT3FOTq40oaDAocxWrXbb90N0J5YrDDp wUZpHk5hqEWufNW8uQV0lZP3BFE35vlISaF7e0R1niDXx+PksMVMdB8kTRAV+7T9Bpev ZCYw== X-Gm-Message-State: AOJu0YxEClzhgMORxAtyZT7mHIRWh+4cLvXGQKdH3kJAPHMcF/Koq9XL 7mLcSoc1D0L+oh2s4Bz0Efwuv15wJJ7Oo1Qu/nUOoy0S+xD5WdGe5egA5CdDTtw= X-Google-Smtp-Source: AGHT+IFnaMMaL27Pu+KUSITg1UOjNPOGe5ftSOQVNYgmhTE8sKJPWxU+fZ4VK48SD8lmKgq4UDbyvA== X-Received: by 2002:a05:6512:b88:b0:539:e98c:c33b with SMTP id 2adb3069b0e04-539e98cc3c1mr3766403e87.41.1728979688485; Tue, 15 Oct 2024 01:08:08 -0700 (PDT) Received: from localhost.localdomain ([188.243.23.53]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539ffff3ddfsm94736e87.149.2024.10.15.01.08.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 01:08:06 -0700 (PDT) From: Alexander Shiyan To: linux-media@vger.kernel.org Cc: devicetree@vger.kernel.org, Tomi Valkeinen , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sakari Ailus , Hans Verkuil , Laurent Pinchart , Alexander Shiyan Subject: [PATCH v3 2/3] media: i2c: ds90ub960: Add DS90UB954 support Date: Tue, 15 Oct 2024 11:07:36 +0300 Message-Id: <20241015080737.16272-2-eagle.alexander923@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20241015080737.16272-1-eagle.alexander923@gmail.com> References: <20241015080737.16272-1-eagle.alexander923@gmail.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add support for TI DS90UB954 FPD-Link III Deserializer. Signed-off-by: Alexander Shiyan --- v2: Avoid potentially infinite loop when checking chip frequency. Move chip specific checks to appropriate functions. v3: Fix Media-CI test warnings --- drivers/media/i2c/Kconfig | 4 +-- drivers/media/i2c/ds90ub960.c | 58 ++++++++++++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 8ba096b8ebca..91fd2c3eb8bb 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -1604,8 +1604,8 @@ config VIDEO_DS90UB960 select V4L2_FWNODE select VIDEO_V4L2_SUBDEV_API help - Device driver for the Texas Instruments DS90UB960 - FPD-Link III Deserializer and DS90UB9702 FPD-Link IV Deserializer. + Device driver for the Texas Instruments DS90UB954/DS90UB960 + FPD-Link III Deserializers and DS90UB9702 FPD-Link IV Deserializer. config VIDEO_MAX96714 tristate "Maxim MAX96714 GMSL2 deserializer" diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index 8000801d5810..7efe8635b221 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -403,6 +403,7 @@ #define UB960_NUM_EQ_LEVELS (UB960_MAX_EQ_LEVEL - UB960_MIN_EQ_LEVEL + 1) enum chip_type { + UB954, UB960, UB9702, }; @@ -815,6 +816,10 @@ static int ub960_txport_select(struct ub960_data *priv, u8 nport) lockdep_assert_held(&priv->reg_lock); + /* TX port registers is shared for UB954 */ + if (priv->hw_data->chip_type == UB954) + return 0; + if (priv->reg_current.txport == nport) return 0; @@ -1157,10 +1162,18 @@ static int ub960_parse_dt_txport(struct ub960_data *priv, priv->tx_link_freq[0] = vep.link_frequencies[0]; priv->tx_data_rate = priv->tx_link_freq[0] * 2; - if (priv->tx_data_rate != MHZ(1600) && - priv->tx_data_rate != MHZ(1200) && - priv->tx_data_rate != MHZ(800) && - priv->tx_data_rate != MHZ(400)) { + switch (priv->tx_data_rate) { + case MHZ(1600): + case MHZ(800): + case MHZ(400): + break; + case MHZ(1200): + /* UB954 does not support 1.2 Gbps */ + if (priv->hw_data->chip_type == UB960 || + priv->hw_data->chip_type == UB9702) + break; + fallthrough; + default: dev_err(dev, "tx%u: invalid 'link-frequencies' value\n", nport); ret = -EINVAL; goto err_free_vep; @@ -1311,6 +1324,10 @@ static void ub960_rxport_set_strobe_pos(struct ub960_data *priv, { u8 clk_delay, data_delay; + /* FIXME: After writing to this area the UB954 chip no longer responds */ + if (priv->hw_data->chip_type == UB954) + return; + clk_delay = UB960_IR_RX_ANA_STROBE_SET_CLK_NO_EXTRA_DELAY; data_delay = UB960_IR_RX_ANA_STROBE_SET_DATA_NO_EXTRA_DELAY; @@ -3853,6 +3870,9 @@ static int ub960_enable_core_hw(struct ub960_data *priv) } switch (priv->hw_data->chip_type) { + case UB954: + model = "UB954"; + break; case UB960: model = "UB960"; break; @@ -3874,6 +3894,27 @@ static int ub960_enable_core_hw(struct ub960_data *priv) if (ret) goto err_pd_gpio; + if (priv->hw_data->chip_type == UB954) { + /* From DS90UB954-Q1 datasheet: + * "REFCLK_FREQ measurement is not synchronized. Value in this + * register should read twice and only considered valid if + * REFCLK_FREQ is unchanged between reads." + */ + unsigned long timeout = jiffies + msecs_to_jiffies(100); + + do { + u8 refclk_new; + + ret = ub960_read(priv, UB960_XR_REFCLK_FREQ, &refclk_new); + if (ret) + goto err_pd_gpio; + + if (refclk_new == refclk_freq) + break; + refclk_freq = refclk_new; + } while (time_before(jiffies, timeout)); + } + dev_dbg(dev, "refclk valid %u freq %u MHz (clk fw freq %lu MHz)\n", !!(dev_sts & BIT(4)), refclk_freq, clk_get_rate(priv->refclk) / 1000000); @@ -4045,6 +4086,13 @@ static void ub960_remove(struct i2c_client *client) mutex_destroy(&priv->reg_lock); } +static const struct ub960_hw_data ds90ub954_hw = { + .chip_type = UB954, + .chip_family = FAMILY_FPD3, + .num_rxports = 2, + .num_txports = 1, +}; + static const struct ub960_hw_data ds90ub960_hw = { .chip_type = UB960, .chip_family = FAMILY_FPD3, @@ -4060,6 +4108,7 @@ static const struct ub960_hw_data ds90ub9702_hw = { }; static const struct i2c_device_id ub960_id[] = { + { "ds90ub954-q1", (kernel_ulong_t)&ds90ub954_hw }, { "ds90ub960-q1", (kernel_ulong_t)&ds90ub960_hw }, { "ds90ub9702-q1", (kernel_ulong_t)&ds90ub9702_hw }, {} @@ -4067,6 +4116,7 @@ static const struct i2c_device_id ub960_id[] = { MODULE_DEVICE_TABLE(i2c, ub960_id); static const struct of_device_id ub960_dt_ids[] = { + { .compatible = "ti,ds90ub954-q1", .data = &ds90ub954_hw }, { .compatible = "ti,ds90ub960-q1", .data = &ds90ub960_hw }, { .compatible = "ti,ds90ub9702-q1", .data = &ds90ub9702_hw }, {} From patchwork Tue Oct 15 08:07:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 13835840 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 848921C8FC6; Tue, 15 Oct 2024 08:08:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728979697; cv=none; b=J+NqV/tJVg7XjsTtwHNRV6YtBM3w1AmaXB5QoGuqtN8Cb3MkwrPmm+1XkIuiMbZ49CtW2835SUzJDKoUnCqay/05rtiRM8QGp86ZyRbAE+yC25E1+hFBUVOF1dhisN5j8FZQp1RpKLn0qFtiT9rI0wd8xNaMotvAxMakXC1mgJw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728979697; c=relaxed/simple; bh=u5iK7N1sGDGQGeNVgL/RzdIODVfZqJiLClLx6saPxzA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mswGmhCguoDYTvH/4giA26JeK1MwZp1JWO9RedvC9u9r1ZXSGmGGxue5JOucqqs3s4Jnl6DEK2TIaB51NICdq7EnBjpAYdBkRBFu89S+iFm2z4tOqQhEp8NK0OXKePYesQcwUhPvmfi3LvaqsQI+etF34pf54rfexLreJDslvnI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NqWoB1p2; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NqWoB1p2" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-539e4b7409fso2839341e87.0; Tue, 15 Oct 2024 01:08:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728979693; x=1729584493; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LSvltiDJsHK24aMx8hk7NkxBylZL/vFqXqk0X+fc2aU=; b=NqWoB1p26P1otG4UwI36QiB0DcG5Yv6Fsi0gLDkkoLPLY1O3AEvT9CyusDsYR3EVvo l8W2P6p58v8wk51fHlaxIO4E/Y7kYFSejw4Rt5ZETK1Md01gL2M6+woATIK86cmt4fxc nMJ2GlNk6TAMk1cPCjrgr2zjmqGokliqCcoNKJDLq3ZL8OKjFvmzCnAbjtskj1OdKF3M yQTfcpkDYa4QhkmpVaIWQywVf+sIh/fAVzjOsCl+dX60CLFG2b5KJcNmvIGd77eqSeDc qFgQ3HaJ9slblAlFcymOaez+1Vqhr/KA2bsgX4u9qOzbiJafYsTdN4cWHxo6CQDW814J WlbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728979693; x=1729584493; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LSvltiDJsHK24aMx8hk7NkxBylZL/vFqXqk0X+fc2aU=; b=mKcBRdRJJ2MZoeo0LLyGBThf0vtjytdmvwNlUH2vnZqEn+2YiH5rK4iFn8eFCL9Ywq 2PZVnlmU5YbBw4onJnXizi2UdePMZuuYgkAaKrMsSvSDdEsl7MRn8loRB8TA+REtkkVu bvEVYWF48ATRnDnOdvRfcD/Hysz2LSO3E1Vh1vqi2qung+bZcCPtylymHsDUzlpeeHnV Y4n5pjeJJ+W8uHcUzO4q4fM2OuWNpLsYlyn0flwrsNHNUxmS8LhzEXQq/boaw4/0hTVp ur0VOlCx9RgPieFU52WtvQo5f1/KutbzBWe6bzBdORrA8IPSkBUO0S7NMa0zma414T1v iUpg== X-Gm-Message-State: AOJu0YykJfO9ZlhMonbOKJ6MfdFDTbRc9SSxcjRI40j7ngq/0ZrxpbjC j//N7Br3X8SfSLwP7ChSyFLd4tSXkjapQ6+XBGslkWEiU5VRTuj9gDbhoweKzDk= X-Google-Smtp-Source: AGHT+IGRSgYUjdksRCpoex8/NdvF1yocrNTsMzsNDmIplJ3Y2qHfwlS+XQf1aRXxBuW0Cgf/u0y6Gw== X-Received: by 2002:a05:6512:3b13:b0:539:fde9:4bca with SMTP id 2adb3069b0e04-539fde94fcemr736812e87.29.1728979692675; Tue, 15 Oct 2024 01:08:12 -0700 (PDT) Received: from localhost.localdomain ([188.243.23.53]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539ffff3ddfsm94736e87.149.2024.10.15.01.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 01:08:10 -0700 (PDT) From: Alexander Shiyan To: linux-media@vger.kernel.org Cc: devicetree@vger.kernel.org, Tomi Valkeinen , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sakari Ailus , Hans Verkuil , Laurent Pinchart , Alexander Shiyan , Conor Dooley Subject: [PATCH v3 3/3] media: dt-bindings: i2c: ds90ub960: Add DS90UB954 support Date: Tue, 15 Oct 2024 11:07:37 +0300 Message-Id: <20241015080737.16272-3-eagle.alexander923@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20241015080737.16272-1-eagle.alexander923@gmail.com> References: <20241015080737.16272-1-eagle.alexander923@gmail.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The ds90ub960 driver can now be used for the DS90UB954 chip as it has a similar register set and configuration. Let's add an additional compatibility line to the bindings. Signed-off-by: Alexander Shiyan Acked-by: Conor Dooley --- v2: No changes v3: Change patch description, no functional changes --- Documentation/devicetree/bindings/media/i2c/ti,ds90ub960.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/media/i2c/ti,ds90ub960.yaml b/Documentation/devicetree/bindings/media/i2c/ti,ds90ub960.yaml index 0b71e6f911a8..86d43d949dd3 100644 --- a/Documentation/devicetree/bindings/media/i2c/ti,ds90ub960.yaml +++ b/Documentation/devicetree/bindings/media/i2c/ti,ds90ub960.yaml @@ -19,6 +19,7 @@ allOf: properties: compatible: enum: + - ti,ds90ub954-q1 - ti,ds90ub960-q1 - ti,ds90ub9702-q1