From patchwork Wed May 23 00:27:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Katsuhiro Suzuki X-Patchwork-Id: 136607 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp241553lji; Tue, 22 May 2018 17:28:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp4OnfQR+T9ALc2au4Ep/83kcgEtpYEtJ0drZ3fWT5s9WMcCO5vjOlUk0V88UAJ1UQDsjws X-Received: by 2002:a62:c485:: with SMTP id h5-v6mr640365pfk.86.1527035283403; Tue, 22 May 2018 17:28:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527035283; cv=none; d=google.com; s=arc-20160816; b=lEaQZGf40Cd7bgO8ezHFVDRjVU9ewr/SEqPThreN83Cdhs6fo+dRQLWVJDAMGRA8k7 2elmxjysDqG3+C0x3smMxqOQ7bV1f0WNtXO0jR1ffp8DCC+lSkCRyl5UP0gN1edZIXfG WOge6uoW9QI3dke4PRe4tbmjg5rvsQ5atrvPRoVwF/yLXdXjSxQZLO1F9Nx4+Zqgc4aT XDOFILT20a3O62ov6d5zgpe4HbbA1+kGv1fMbMZgoiUTN6jCuXTBRvGOcxYNUxQwq2uE ysWLAMPrsxFgrf9mPa8LwHqhSWtSEGj15pECINLveiaHp0zc0sW75zTW0VRSCGLP0hHB zKXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ptF+PLhCbGQn88OMWVgBuyZ2T1E+/ehB1u1noomwC2Q=; b=Iq2h/70RaYll+4CyUeyR2Pbj8ERFq+jAz3FloiI3zgWAi38aoEFGEBQCiDNu02pjzj jmI3DeNSQ4dQteCU5sYN42WtPXy1GdSQuiBL6XT09Nr6iing7LcNMfYlJi/YqaCbNgGU GCRxkMbHEWgpUbiFOZ3S/0OhNoCfbCcM7dX/s8k+Pm0IvJqo5N/4HHBq8647UTlIQ8f7 9jl+B68XTwuDC9alJd7vm4jqePGCXErTEIg5+LwhbRmUtNRGLPSsyN6A51VaKhQ6cncC Ce/ug6zSIkwKCVUVNWdBjU2UvQPkrsB7ZjiVLsHj7IaRLFK+hkuazwkSEGj7UWywvhEa ymCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 y1-v6si1818516pgv.36.2018.05.22.17.28.03; Tue, 22 May 2018 17:28:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753908AbeEWA2B (ORCPT + 30 others); Tue, 22 May 2018 20:28:01 -0400 Received: from mx.socionext.com ([202.248.49.38]:41428 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752681AbeEWA1z (ORCPT ); Tue, 22 May 2018 20:27:55 -0400 Received: from unknown (HELO iyokan-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 23 May 2018 09:27:53 +0900 Received: from mail.mfilter.local (m-filter-1 [10.213.24.61]) by iyokan-ex.css.socionext.com (Postfix) with ESMTP id 8CA2C600E8; Wed, 23 May 2018 09:27:53 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Wed, 23 May 2018 09:27:53 +0900 Received: from yuzu.css.socionext.com (yuzu [172.31.8.45]) by kinkan.css.socionext.com (Postfix) with ESMTP id 731ED1A1309; Wed, 23 May 2018 09:27:53 +0900 (JST) Received: from aegis.e01.socionext.com (unknown [10.213.134.210]) by yuzu.css.socionext.com (Postfix) with ESMTP id 49AD012014C; Wed, 23 May 2018 09:27:53 +0900 (JST) From: Katsuhiro Suzuki To: Abylay Ospan , 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 v3 1/2] media: helene: add I2C device probe function Date: Wed, 23 May 2018 09:27:49 +0900 Message-Id: <20180523002750.27136-1-suzuki.katsuhiro@socionext.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds I2C probe function to use dvb_module_probe() with this driver. Signed-off-by: Katsuhiro Suzuki --- Changes since v2: - Nothing Changes since v1: - Add documents for dvb_frontend member of helene_config --- drivers/media/dvb-frontends/helene.c | 88 ++++++++++++++++++++++++++-- drivers/media/dvb-frontends/helene.h | 3 + 2 files changed, 87 insertions(+), 4 deletions(-) -- 2.17.0 diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/helene.c index a0d0b53c91d7..04033f0c278b 100644 --- a/drivers/media/dvb-frontends/helene.c +++ b/drivers/media/dvb-frontends/helene.c @@ -666,7 +666,7 @@ static int helene_set_params_s(struct dvb_frontend *fe) return 0; } -static int helene_set_params(struct dvb_frontend *fe) +static int helene_set_params_t(struct dvb_frontend *fe) { u8 data[MAX_WRITE_REGSIZE]; u32 frequency; @@ -835,6 +835,19 @@ static int helene_set_params(struct dvb_frontend *fe) return 0; } +static int helene_set_params(struct dvb_frontend *fe) +{ + struct dtv_frontend_properties *p = &fe->dtv_property_cache; + + if (p->delivery_system == SYS_DVBT || + p->delivery_system == SYS_DVBT2 || + p->delivery_system == SYS_ISDBT || + p->delivery_system == SYS_DVBC_ANNEX_A) + return helene_set_params_t(fe); + + return helene_set_params_s(fe); +} + static int helene_get_frequency(struct dvb_frontend *fe, u32 *frequency) { struct helene_priv *priv = fe->tuner_priv; @@ -843,7 +856,7 @@ static int helene_get_frequency(struct dvb_frontend *fe, u32 *frequency) return 0; } -static const struct dvb_tuner_ops helene_tuner_ops = { +static const struct dvb_tuner_ops helene_tuner_ops_t = { .info = { .name = "Sony HELENE Ter tuner", .frequency_min = 1000000, @@ -853,7 +866,7 @@ static const struct dvb_tuner_ops helene_tuner_ops = { .init = helene_init, .release = helene_release, .sleep = helene_sleep, - .set_params = helene_set_params, + .set_params = helene_set_params_t, .get_frequency = helene_get_frequency, }; @@ -871,6 +884,20 @@ static const struct dvb_tuner_ops helene_tuner_ops_s = { .get_frequency = helene_get_frequency, }; +static const struct dvb_tuner_ops helene_tuner_ops = { + .info = { + .name = "Sony HELENE Sat/Ter tuner", + .frequency_min = 500000, + .frequency_max = 1200000000, + .frequency_step = 1000, + }, + .init = helene_init, + .release = helene_release, + .sleep = helene_sleep, + .set_params = helene_set_params, + .get_frequency = helene_get_frequency, +}; + /* power-on tuner * call once after reset */ @@ -1032,7 +1059,7 @@ struct dvb_frontend *helene_attach(struct dvb_frontend *fe, if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); - memcpy(&fe->ops.tuner_ops, &helene_tuner_ops, + memcpy(&fe->ops.tuner_ops, &helene_tuner_ops_t, sizeof(struct dvb_tuner_ops)); fe->tuner_priv = priv; dev_info(&priv->i2c->dev, @@ -1042,6 +1069,59 @@ struct dvb_frontend *helene_attach(struct dvb_frontend *fe, } EXPORT_SYMBOL(helene_attach); +static int helene_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct helene_config *config = client->dev.platform_data; + struct dvb_frontend *fe = config->fe; + struct device *dev = &client->dev; + struct helene_priv *priv; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->i2c_address = client->addr; + priv->i2c = client->adapter; + priv->set_tuner_data = config->set_tuner_priv; + priv->set_tuner = config->set_tuner_callback; + priv->xtal = config->xtal; + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + + if (helene_x_pon(priv) != 0) + return -EINVAL; + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 0); + + memcpy(&fe->ops.tuner_ops, &helene_tuner_ops, + sizeof(struct dvb_tuner_ops)); + fe->tuner_priv = priv; + i2c_set_clientdata(client, priv); + + dev_info(dev, "Sony HELENE attached on addr=%x at I2C adapter %p\n", + priv->i2c_address, priv->i2c); + + return 0; +} + +static const struct i2c_device_id helene_id[] = { + { "helene", }, + {} +}; +MODULE_DEVICE_TABLE(i2c, helene_id); + +static struct i2c_driver helene_driver = { + .driver = { + .name = "helene", + }, + .probe = helene_probe, + .id_table = helene_id, +}; +module_i2c_driver(helene_driver); + MODULE_DESCRIPTION("Sony HELENE Sat/Ter tuner driver"); MODULE_AUTHOR("Abylay Ospan "); MODULE_LICENSE("GPL"); diff --git a/drivers/media/dvb-frontends/helene.h b/drivers/media/dvb-frontends/helene.h index c9fc81c7e4e7..8562d01bc93e 100644 --- a/drivers/media/dvb-frontends/helene.h +++ b/drivers/media/dvb-frontends/helene.h @@ -39,6 +39,7 @@ enum helene_xtal { * @set_tuner_callback: Callback function that notifies the parent driver * which tuner is active now * @xtal: Cristal frequency as described by &enum helene_xtal + * @fe: Frontend for which connects this tuner */ struct helene_config { u8 i2c_address; @@ -46,6 +47,8 @@ struct helene_config { void *set_tuner_priv; int (*set_tuner_callback)(void *, int); enum helene_xtal xtal; + + struct dvb_frontend *fe; }; #if IS_REACHABLE(CONFIG_DVB_HELENE) From patchwork Wed May 23 00:27:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Katsuhiro Suzuki X-Patchwork-Id: 136608 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp241664lji; Tue, 22 May 2018 17:28:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZodig7yxVK8OnZUqYGbqD9fHXL7lOfIrVCvuHQLntQyBa0pgLxcNgp1NU9bMD20tpfkfxim X-Received: by 2002:a17:902:b087:: with SMTP id p7-v6mr624378plr.227.1527035293571; Tue, 22 May 2018 17:28:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527035293; cv=none; d=google.com; s=arc-20160816; b=M0rc8ADEuxlAqQr02yTOzNUx6R+cgG+4kBwDgHfcJu3hv5gUaJ+kgsPzQInIXFWJn9 IQQienUSVSxXtJWhsHwLW1VnEj1FqpWBFx1xO1uqmM2/FcXj/2UdDQbFObkhM3q0sSR1 KSX0Oi4xcITfIpK2T9ien2Wki+rfGefPO7Q5w+zXKa/ZDFBYyt1dv8Lrtj5KVs7BW1qz yHbPptuumd7bZ/e/q6ziTrW7N9mXjXLh7l6Bs4uX4gaKjOwu1Z1DzPInT6H9FJRkQKTG bRH+1naY0nCxxaKgs1vCtYXdK7dQAtkzetq+RhkDGx8bj4YqyJoVrLn/MWLffeKW5UqY uQ6w== 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=bbTPLvZ08LKCNs/bDtCF8PJqfVOP6fM493W/ur+7akI=; b=qjlOM5c0t4/txG+ezREW50HrZovn+jwbjcowI1bz1az+P9deHwtulWNyVH6VZSXjdc gyw8oVH26D7LdS4+SERvXVrDB0salKDNINongwSZRA7Bv0icoEtgYpivyY+kHqYqhLc3 HUYx63DF6MXJx3g8MdyhwuALh74G/47rxFwRr186x3UW60E/tDkp1P1eRfocPLlFIwDR jAeNhxTn2f9G0vcKsnJaEKH15BaLh6yiDEzalpvEtWiqKd7W18zE6MZ4qMGHCWH0lpee hMdYOxq7OpWKjYNO3mbxwIoG7vnjKGE79+MqXE7CSLvz/hs2GGjun+jXI9yP7Remf/54 IRAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 y1-v6si1818516pgv.36.2018.05.22.17.28.13; Tue, 22 May 2018 17:28:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753896AbeEWA2A (ORCPT + 30 others); Tue, 22 May 2018 20:28:00 -0400 Received: from mx.socionext.com ([202.248.49.38]:41428 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753571AbeEWA14 (ORCPT ); Tue, 22 May 2018 20:27:56 -0400 Received: from unknown (HELO iyokan-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 23 May 2018 09:27:53 +0900 Received: from mail.mfilter.local (m-filter-1 [10.213.24.61]) by iyokan-ex.css.socionext.com (Postfix) with ESMTP id 16757600E8; Wed, 23 May 2018 09:27:54 +0900 (JST) Received: from 172.31.9.53 (172.31.9.53) by m-FILTER with ESMTP; Wed, 23 May 2018 09:27:54 +0900 Received: from yuzu.css.socionext.com (yuzu [172.31.8.45]) by iyokan.css.socionext.com (Postfix) with ESMTP id AB28E403A6; Wed, 23 May 2018 09:27:53 +0900 (JST) Received: from aegis.e01.socionext.com (unknown [10.213.134.210]) by yuzu.css.socionext.com (Postfix) with ESMTP id 7890D12014C; Wed, 23 May 2018 09:27:53 +0900 (JST) From: Katsuhiro Suzuki To: Abylay Ospan , 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 v3 2/2] media: helene: support IF frequency of ISDB-S Date: Wed, 23 May 2018 09:27:50 +0900 Message-Id: <20180523002750.27136-2-suzuki.katsuhiro@socionext.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180523002750.27136-1-suzuki.katsuhiro@socionext.com> References: <20180523002750.27136-1-suzuki.katsuhiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch enhances maximum IF frequency to 2.072GHz of this tuner for supporting ISDB-S in Japan. Maimum RF center frequency of ISDB-S for right-handed circularly polarized. BSAT BS-23 12.14944GHz N-SAT-110 ND-24 12.731GHz Local frequency of BS/CS converter is typically 10.678GHz. --- Changes since v2: - Newly added Signed-off-by: Katsuhiro Suzuki --- drivers/media/dvb-frontends/helene.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.0 diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/helene.c index 04033f0c278b..7d02a9ea7d95 100644 --- a/drivers/media/dvb-frontends/helene.c +++ b/drivers/media/dvb-frontends/helene.c @@ -874,7 +874,7 @@ static const struct dvb_tuner_ops helene_tuner_ops_s = { .info = { .name = "Sony HELENE Sat tuner", .frequency_min = 500000, - .frequency_max = 2500000, + .frequency_max = 2072000000, .frequency_step = 1000, }, .init = helene_init, @@ -888,7 +888,7 @@ static const struct dvb_tuner_ops helene_tuner_ops = { .info = { .name = "Sony HELENE Sat/Ter tuner", .frequency_min = 500000, - .frequency_max = 1200000000, + .frequency_max = 2072000000, .frequency_step = 1000, }, .init = helene_init,