Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2690821imm; Wed, 16 May 2018 18:06:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp3hY5m5kF106/7JP8/S9r8+RuZj/K3mqpbGKP4bSUCyXBi9CrUal0zo6CYwWauXneEbdeO X-Received: by 2002:a62:dfcd:: with SMTP id d74-v6mr3186200pfl.114.1526519199011; Wed, 16 May 2018 18:06:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526519198; cv=none; d=google.com; s=arc-20160816; b=XDv1aQRVEcFbG76ByGf9VOZZGH+BrI+omRgmCaDb78pWUeE+xT3f5dzzFfdLttRXqa +AArnuYgT2C8SuUiQ9LpUGyZNinsU+ZDfs9oN19pRX8g3lb0ZqHToyEDU4BLMS7hnHat y65rNBCSOCw70ecbYA3b2xpdf47VxPT6T2Ezz9hD1QGoHDGHiXq5+1Dj+DpkOkUuddTn tkU+a8801hkf9AgdSMkr6G07PBCgZ5c+mxVchqw4OmVH/xXGwdwUuU9EXK9sBkwYIb0p ww3aMzx2XdFHWnbbW82jpr1KgLaGpTUP1ulG8Ga2glHkQZ/DzcropUXiwV/tlE9sxLNP hsqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language:thread-index :content-transfer-encoding:mime-version:message-id:date:subject :in-reply-to:references:cc:to:from:arc-authentication-results; bh=Yo4/lj8pPkeE8VvgxVMDXEnmbcGcFtJ7dShc/C4660w=; b=EjnZTgj16uky3Rxf1MtVBA4lGjtI928BF3ji3ZwLKWhdFhy6OsC8chrEc6Xgd5Z8sv PkeS6hiuE95+bm2Aij4OztMQwlKdpMYsC0Qq7wgT9Pgmpver5c2MLrosMvbywLH3/i8/ UqOobhiAszQPZ2bewAVhgq7fEUqRZMrjo4gnZ9krx6zWXHuQYK/6ZZ/RAgf0weivgQ8z XzbYVsIGfVxWzzxSmRgVbFTI9FqGruKKfisRKTHfISE0j0p8nZsza033LHjGN6wuviNN rz8xM54QAcjqvWHJAzXCQqJUOSWgc62Jh+hB1ojpgNS51qaQnylkF4x6RRPAlzybyj/k 2lxw== 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 p83-v6si4110641pfl.279.2018.05.16.18.06.24; Wed, 16 May 2018 18:06:38 -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 S1751564AbeEQBFk convert rfc822-to-8bit (ORCPT + 99 others); Wed, 16 May 2018 21:05:40 -0400 Received: from mx.socionext.com ([202.248.49.38]:17717 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751013AbeEQBFi (ORCPT ); Wed, 16 May 2018 21:05:38 -0400 Received: from unknown (HELO kinkan-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 17 May 2018 10:05:37 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by kinkan-ex.css.socionext.com (Postfix) with ESMTP id 117131800ED; Thu, 17 May 2018 10:05:37 +0900 (JST) Received: from 172.31.9.53 (172.31.9.53) by m-FILTER with ESMTP; Thu, 17 May 2018 10:05:36 +0900 Received: from yuzu.css.socionext.com (yuzu [172.31.8.45]) by iyokan.css.socionext.com (Postfix) with ESMTP id 887464039D; Thu, 17 May 2018 10:05:36 +0900 (JST) Received: from DESKTOPFLNNJ4T (unknown [10.213.132.95]) by yuzu.css.socionext.com (Postfix) with ESMTP id 5BF73120134; Thu, 17 May 2018 10:05:36 +0900 (JST) From: "Katsuhiro Suzuki" To: "'Abylay Ospan'" , =?utf-8?B?U3V6dWtpLCBLYXRzdWhpcm8v6Yi05pyoIOWLneWNmg==?= Cc: "Mauro Carvalho Chehab" , "linux-media" , "Masami Hiramatsu" , "Jassi Brar" , , References: <20180516083753.15510-1-suzuki.katsuhiro@socionext.com> In-Reply-To: Subject: Re: [PATCH v2] media: helene: add I2C device probe function Date: Thu, 17 May 2018 10:05:33 +0900 Message-ID: <000701d3ed7b$282e7550$788b5ff0$@socionext.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8BIT X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQHT7PEvSnqE1PiJAk2z4UnnfdT6kKQxl6+AgAGCzCA= Content-Language: ja x-securitypolicycheck: OK by SHieldMailChecker v2.5.2 x-shieldmailcheckerpolicyversion: POLICY180220 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Abylay, > -----Original Message----- > From: Abylay Ospan > Sent: Wednesday, May 16, 2018 7:54 PM > To: Suzuki, Katsuhiro/鈴木 勝博 > Cc: Mauro Carvalho Chehab ; linux-media > ; Masami Hiramatsu ; > Jassi Brar ; linux-arm-kernel@lists.infradead.org; > linux-kernel@vger.kernel.org > Subject: Re: [PATCH v2] media: helene: add I2C device probe function > > Hi Katsuhiro, > > Thanks for patch. > > What is the purpose to rework helene_set_params(_t|_s) ? > other part of this patch looks ok for me, but not tested due to lack of spare time ;( > I'm using Socionext SC1501A (or MN88443x) ISDB-S/ISDB-T demodulator with this tuner. This demodulator has 1 port, and can use ISDB-S or ISDB-T exclusively. So I think I cannot use ISDB-S features of this tuner if I use helene_attach(), and I cannot use ISDB-T if I use helene_attach_s() too. Regards, -- Katsuhiro Suzuki > > 2018-05-16 4:37 GMT-04:00 Katsuhiro Suzuki >: > > > This patch adds I2C probe function to use dvb_module_probe() > with this driver. > > Signed-off-by: Katsuhiro Suzuki > > > --- > > 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(-) > > 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) > -- > 2.17.0 > > > > > > > -- > > Abylay Ospan, > NetUP Inc. > http://www.netup.tv