From patchwork Wed May 30 09:09:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Katsuhiro Suzuki X-Patchwork-Id: 137239 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp5070174lji; Wed, 30 May 2018 02:10:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLab/fRrHOcwRalU692xx+HW+1aEIHIcWl97mROHU1oBnUFCtSzZnTU6uoK0mGT0nlIxW87 X-Received: by 2002:a62:1306:: with SMTP id b6-v6mr1964556pfj.58.1527671458481; Wed, 30 May 2018 02:10:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527671458; cv=none; d=google.com; s=arc-20160816; b=YJG9Iw1xi+N6wnUitqvRhViDSc1+LtpbLfuetTGoiVWcP2E8xJV1SaqECM/dCFrM3p 0H4ttO6V22APbEa1L/VmPzk6EovYJVUx9g4nLMzh8FmpPIg02zNjtNjnegYLwxyjxErZ wZt/zgCqlD5vzHjvmKwK/NwhtcNaBNUR42UoNeN3oGHBDP11JLoX74dA3o9ENlRxdNdf /G1aF2MCyteEnZfugOCUp8ANI/mTVSuOLdZ6I9OlDmoGzRrbERROdKSI7gJ260XqWq1U qxJi7JACYW64hoZxrhjreOus18b3DCmPzv/JVkJXkqXherda3gdvoEO1qMV8HMYmHSgn tdjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Zc0hWMKQqmtxNiFJR3+qaElwCyxP62rX0fWV3NvKfPI=; b=I9t8z98g/0ltV0YMOTOUFtQuhj5ZPPkranu3ZGnnUZDP4Sw+cy1fA0x4K4CkHD7ZXD HPDDe3iq1URBWI2OpYpu3AiV0bLFNWhfA8TLB284hP+YWOCtZBGc10rS/bXaXpviEgkK caubI+quEBnBFXP1f6WpjJjI4KxP9hYPHEzRDfJn9xFh+NYSs6NE+FJ9APWV7NMNm7Vf vW209bmEwI/UlxoIlRndwFYxtE6ZT35qwwNEW/BxzIGifqhCZsjnd8tu6pdAixviqUfJ LkTrbbX2DghmkNsJM6XiWBYqPnZAHdEHpCd3N84+meaNm0ySU5kG5a08XWYegcE+DyYf iwyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20-v6si34060039plo.326.2018.05.30.02.10.58; Wed, 30 May 2018 02:10:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968835AbeE3JKz (ORCPT + 4 others); Wed, 30 May 2018 05:10:55 -0400 Received: from mx.socionext.com ([202.248.49.38]:35842 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968832AbeE3JJw (ORCPT ); Wed, 30 May 2018 05:09:52 -0400 Received: from unknown (HELO kinkan-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 30 May 2018 18:09:49 +0900 Received: from mail.mfilter.local (m-filter-1 [10.213.24.61]) by kinkan-ex.css.socionext.com (Postfix) with ESMTP id BC990180AF7; Wed, 30 May 2018 18:09:49 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Wed, 30 May 2018 18:09:49 +0900 Received: from yuzu.css.socionext.com (yuzu [172.31.8.45]) by kinkan.css.socionext.com (Postfix) with ESMTP id 86E061A01BB; Wed, 30 May 2018 18:09:49 +0900 (JST) Received: from aegis.e01.socionext.com (unknown [10.213.134.210]) by yuzu.css.socionext.com (Postfix) with ESMTP id 6248E120139; Wed, 30 May 2018 18:09:49 +0900 (JST) From: Katsuhiro Suzuki To: Mauro Carvalho Chehab , linux-media@vger.kernel.org Cc: Masami Hiramatsu , Jassi Brar , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Katsuhiro Suzuki Subject: [PATCH 6/8] media: uniphier: add common module of DVB adapter drivers Date: Wed, 30 May 2018 18:09:44 +0900 Message-Id: <20180530090946.1635-7-suzuki.katsuhiro@socionext.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180530090946.1635-1-suzuki.katsuhiro@socionext.com> References: <20180530090946.1635-1-suzuki.katsuhiro@socionext.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This patch adds common module for UniPhier DVB adapter drivers that equipments tuners and demod that connected by I2C and UniPhier demux. Signed-off-by: Katsuhiro Suzuki --- drivers/media/platform/uniphier/Makefile | 5 ++ drivers/media/platform/uniphier/hsc-core.c | 8 --- .../platform/uniphier/uniphier-adapter.c | 54 +++++++++++++++++++ .../platform/uniphier/uniphier-adapter.h | 42 +++++++++++++++ 4 files changed, 101 insertions(+), 8 deletions(-) create mode 100644 drivers/media/platform/uniphier/uniphier-adapter.c create mode 100644 drivers/media/platform/uniphier/uniphier-adapter.h -- 2.17.0 diff --git a/drivers/media/platform/uniphier/Makefile b/drivers/media/platform/uniphier/Makefile index 0622f04d9e68..9e75ad081b77 100644 --- a/drivers/media/platform/uniphier/Makefile +++ b/drivers/media/platform/uniphier/Makefile @@ -3,3 +3,8 @@ uniphier-dvb-y += hsc-core.o hsc-ucode.o hsc-css.o hsc-ts.o hsc-dma.o uniphier-dvb-$(CONFIG_DVB_UNIPHIER_LD11) += hsc-ld11.o obj-$(CONFIG_DVB_UNIPHIER) += uniphier-dvb.o + +ccflags-y += -Idrivers/media/dvb-frontends/ +ccflags-y += -Idrivers/media/tuners/ + +uniphier-dvb-y += uniphier-adapter.o diff --git a/drivers/media/platform/uniphier/hsc-core.c b/drivers/media/platform/uniphier/hsc-core.c index cdb488e4df8c..a8d247cfd302 100644 --- a/drivers/media/platform/uniphier/hsc-core.c +++ b/drivers/media/platform/uniphier/hsc-core.c @@ -256,14 +256,6 @@ static void hsc_dmaif_feed_worker(struct work_struct *work) dma_sync_single_for_cpu(dev, dmapos, cnt, DMA_FROM_DEVICE); for (i = 0; i < cnt; i += SZ_M2TS_PKT) { pkt = buf->virt + buf->rd_offs + i; - - if (pkt[4] == 0x47 && pkt[5] == 0x1f && pkt[6] == 0xff) - continue; - if (pkt[5] & 0x80) - continue; - if (pkt[7] & 0xc0) - continue; - dvb_dmx_swfilter_packets(&tsif->demux, &pkt[4], 1); } dma_sync_single_for_device(dev, dmapos, cnt, DMA_FROM_DEVICE); diff --git a/drivers/media/platform/uniphier/uniphier-adapter.c b/drivers/media/platform/uniphier/uniphier-adapter.c new file mode 100644 index 000000000000..c895bbd9988e --- /dev/null +++ b/drivers/media/platform/uniphier/uniphier-adapter.c @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Socionext UniPhier LD20 adapter driver for ISDB. +// Using Socionext MN884434 ISDB-S/ISDB-T demodulator and +// SONY HELENE tuner. +// +// Copyright (c) 2018 Socionext Inc. + +#include +#include +#include + +#include "hsc.h" +#include "uniphier-adapter.h" + +int uniphier_adapter_demux_probe(struct uniphier_adapter_priv *priv) +{ + const struct uniphier_adapter_spec *spec = priv->spec; + struct device *dev = &priv->pdev->dev; + struct device_node *node; + int ret, i; + + node = of_parse_phandle(dev->of_node, "demux", 0); + if (!node) { + dev_err(dev, "Failed to parse demux\n"); + return -ENODEV; + } + + priv->pdev_demux = of_find_device_by_node(node); + if (!priv->pdev_demux) { + dev_err(dev, "Failed to find demux device\n"); + of_node_put(node); + return -ENODEV; + } + of_node_put(node); + + priv->chip = platform_get_drvdata(priv->pdev_demux); + + for (i = 0; i < spec->adapters; i++) { + ret = hsc_tsif_init(&priv->chip->tsif[i], &spec->hsc_conf[i]); + if (ret) { + dev_err(dev, "Failed to init TS I/F\n"); + return ret; + } + + ret = hsc_dmaif_init(&priv->chip->dmaif[i], &spec->hsc_conf[i]); + if (ret) { + dev_err(dev, "Failed to init DMA I/F\n"); + return ret; + } + } + + return 0; +} diff --git a/drivers/media/platform/uniphier/uniphier-adapter.h b/drivers/media/platform/uniphier/uniphier-adapter.h new file mode 100644 index 000000000000..1faada3fd378 --- /dev/null +++ b/drivers/media/platform/uniphier/uniphier-adapter.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Socionext UniPhier DVB driver for High-speed Stream Controller (HSC). + * + * Copyright (c) 2018 Socionext Inc. + */ + +#ifndef DVB_UNIPHIER_ADAPTER_H__ +#define DVB_UNIPHIER_ADAPTER_H__ + +struct uniphier_adapter_spec { + int adapters; + const struct hsc_conf *hsc_conf; + const struct i2c_board_info *demod_i2c_info; + const struct i2c_board_info *tuner_i2c_info; +}; + +struct uniphier_adapter_fe { + struct i2c_client *demod_i2c; + struct i2c_client *tuner_i2c; + struct dvb_frontend *fe; +}; + +struct uniphier_adapter_priv { + const struct uniphier_adapter_spec *spec; + + struct platform_device *pdev; + struct hsc_chip *chip; + + struct platform_device *pdev_demux; + struct clk *demod_mclk; + struct gpio_desc *demod_gpio; + struct i2c_adapter *demod_i2c_adapter; + struct gpio_desc *tuner_gpio; + struct i2c_adapter *tuner_i2c_adapter; + + struct uniphier_adapter_fe *fe; +}; + +int uniphier_adapter_demux_probe(struct uniphier_adapter_priv *priv); + +#endif /* DVB_UNIPHIER_ADAPTER_H__ */