From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Yasunari.Takiguchi@sony.com
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-media@vger.kernel.org, tbird20d@gmail.com,
frowand.list@gmail.com,
Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>,
Hideki Nozawa <Hideki.Nozawa@sony.com>,
Kota Yonezawa <Kota.Yonezawa@sony.com>,
Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>,
Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Subject: Re: [PATCH v4 06/12] [media] cxd2880: Add integration layer for the driver
Date: Wed, 13 Dec 2017 17:13:19 -0200 [thread overview]
Message-ID: <20171213171319.675b39a6@vento.lan> (raw)
In-Reply-To: <20171013060834.21526-1-Yasunari.Takiguchi@sony.com>
Em Fri, 13 Oct 2017 15:08:34 +0900
<Yasunari.Takiguchi@sony.com> escreveu:
> From: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
>
> These functions monitor the driver and watch for task completion.
> This is part of the Sony CXD2880 DVB-T2/T tuner + demodulator driver.
If I understand well, the goal here is to have thread that would
be waking up from time to time, right? Just use the infrastructure
that the Kernel has for it, like a kthread, or timer_setup() & friends.
Take a look at include/linux/timer.h, and just use what's already
defined.
>
> Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
> Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
> Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
> Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
> Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
> Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
> ---
>
> [Change list]
> Changes in V4
> drivers/media/dvb-frontends/cxd2880/cxd2880_integ.c
> -removed unnecessary initialization at variable declaration
>
> Changes in V3
> drivers/media/dvb-frontends/cxd2880/cxd2880_integ.c
> -changed cxd2880_atomic_read to atomic_read
> -changed cxd2880_atomic_set to atomic_set
> -modified return code
> -modified coding style of if()
> drivers/media/dvb-frontends/cxd2880/cxd2880_integ.h
> -modified return code
>
> .../media/dvb-frontends/cxd2880/cxd2880_integ.c | 98 ++++++++++++++++++++++
> .../media/dvb-frontends/cxd2880/cxd2880_integ.h | 44 ++++++++++
> 2 files changed, 142 insertions(+)
> create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_integ.c
> create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_integ.h
>
> diff --git a/drivers/media/dvb-frontends/cxd2880/cxd2880_integ.c b/drivers/media/dvb-frontends/cxd2880/cxd2880_integ.c
> new file mode 100644
> index 000000000000..7264fc355d6b
> --- /dev/null
> +++ b/drivers/media/dvb-frontends/cxd2880/cxd2880_integ.c
> @@ -0,0 +1,98 @@
> +/*
> + * cxd2880_integ.c
> + * Sony CXD2880 DVB-T2/T tuner + demodulator driver
> + * integration layer common functions
> + *
> + * Copyright (C) 2016, 2017 Sony Semiconductor Solutions Corporation
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; version 2 of the License.
> + *
> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
> + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
> + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "cxd2880_tnrdmd.h"
> +#include "cxd2880_tnrdmd_mon.h"
> +#include "cxd2880_integ.h"
> +
> +int cxd2880_integ_init(struct cxd2880_tnrdmd *tnr_dmd)
> +{
> + int ret;
> + struct cxd2880_stopwatch timer;
> + unsigned int elapsed_time = 0;
> + u8 cpu_task_completed = 0;
> +
> + if (!tnr_dmd)
> + return -EINVAL;
> +
> + ret = cxd2880_tnrdmd_init1(tnr_dmd);
> + if (ret)
> + return ret;
> +
> + ret = cxd2880_stopwatch_start(&timer);
> + if (ret)
> + return ret;
> +
> + while (1) {
> + ret = cxd2880_stopwatch_elapsed(&timer, &elapsed_time);
> + if (ret)
> + return ret;
> +
> + ret =
> + cxd2880_tnrdmd_check_internal_cpu_status(tnr_dmd,
> + &cpu_task_completed);
> + if (ret)
> + return ret;
> +
> + if (cpu_task_completed)
> + break;
> +
> + if (elapsed_time > CXD2880_TNRDMD_WAIT_INIT_TIMEOUT)
> + return -ETIME;
> + ret =
> + cxd2880_stopwatch_sleep(&timer,
> + CXD2880_TNRDMD_WAIT_INIT_INTVL);
> + if (ret)
> + return ret;
> + }
> +
> + ret = cxd2880_tnrdmd_init2(tnr_dmd);
> + if (ret)
> + return ret;
> +
> + return 0;
> +}
> +
> +int cxd2880_integ_cancel(struct cxd2880_tnrdmd *tnr_dmd)
> +{
> + if (!tnr_dmd)
> + return -EINVAL;
> +
> + atomic_set(&tnr_dmd->cancel, 1);
> +
> + return 0;
> +}
> +
> +int cxd2880_integ_check_cancellation(struct cxd2880_tnrdmd *tnr_dmd)
> +{
> + if (!tnr_dmd)
> + return -EINVAL;
> +
> + if (atomic_read(&tnr_dmd->cancel) != 0)
> + return -ECANCELED;
> +
> + return 0;
> +}
> diff --git a/drivers/media/dvb-frontends/cxd2880/cxd2880_integ.h b/drivers/media/dvb-frontends/cxd2880/cxd2880_integ.h
> new file mode 100644
> index 000000000000..2b4fe5c3743b
> --- /dev/null
> +++ b/drivers/media/dvb-frontends/cxd2880/cxd2880_integ.h
> @@ -0,0 +1,44 @@
> +/*
> + * cxd2880_integ.h
> + * Sony CXD2880 DVB-T2/T tuner + demodulator driver
> + * integration layer common interface
> + *
> + * Copyright (C) 2016, 2017 Sony Semiconductor Solutions Corporation
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; version 2 of the License.
> + *
> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
> + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
> + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#ifndef CXD2880_INTEG_H
> +#define CXD2880_INTEG_H
> +
> +#include "cxd2880_tnrdmd.h"
> +
> +#define CXD2880_TNRDMD_WAIT_INIT_TIMEOUT 500
> +#define CXD2880_TNRDMD_WAIT_INIT_INTVL 10
> +
> +#define CXD2880_TNRDMD_WAIT_AGC_STABLE 100
> +
> +int cxd2880_integ_init(struct cxd2880_tnrdmd *tnr_dmd);
> +
> +int cxd2880_integ_cancel(struct cxd2880_tnrdmd *tnr_dmd);
> +
> +int cxd2880_integ_check_cancellation(struct cxd2880_tnrdmd
> + *tnr_dmd);
> +
> +#endif
Thanks,
Mauro
next prev parent reply other threads:[~2017-12-13 19:13 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 5:46 [PATCH v4 00/12] [dt-bindings] [media] Add document file and driver for Sony CXD2880 DVB-T2/T tuner + demodulator Yasunari.Takiguchi
2017-10-13 5:58 ` [PATCH v4 01/12] [dt-bindings] [media] Add document file for CXD2880 SPI I/F Yasunari.Takiguchi
2017-10-13 5:59 ` [PATCH v4 02/12] [media] cxd2880-spi: Add support for CXD2880 SPI interface Yasunari.Takiguchi
2017-10-13 8:44 ` Honza Petrouš
2017-10-13 9:10 ` Takiguchi, Yasunari
[not found] ` <eab5bd7b-d909-343d-7078-842e3d0d9ab9-7U/KSKJipcs@public.gmane.org>
2017-10-13 10:26 ` Honza Petrouš
2017-10-16 1:35 ` Takiguchi, Yasunari
[not found] ` <20171013055928.21132-1-Yasunari.Takiguchi-7U/KSKJipcs@public.gmane.org>
2017-12-13 17:54 ` Mauro Carvalho Chehab
2017-12-20 0:54 ` Takiguchi, Yasunari
2017-10-13 6:02 ` [PATCH v4 03/12] [media] cxd2880: Add common files for the driver Yasunari.Takiguchi
2017-12-13 18:02 ` Mauro Carvalho Chehab
[not found] ` <20171013054635.20946-1-Yasunari.Takiguchi-7U/KSKJipcs@public.gmane.org>
2017-10-13 6:05 ` [PATCH v4 04/12] [media] cxd2880: Add spi device IO routines Yasunari.Takiguchi-7U/KSKJipcs
2017-10-13 6:07 ` [PATCH v4 05/12] [media] cxd2880: Add tuner part of the driver Yasunari.Takiguchi-7U/KSKJipcs
[not found] ` <20171013060725.21439-1-Yasunari.Takiguchi-7U/KSKJipcs@public.gmane.org>
2017-12-13 18:40 ` Mauro Carvalho Chehab
2017-12-20 1:01 ` Takiguchi, Yasunari
2017-10-13 6:08 ` [PATCH v4 06/12] [media] cxd2880: Add integration layer for " Yasunari.Takiguchi-7U/KSKJipcs
2017-12-03 18:23 ` Sean Young
2017-12-13 19:13 ` Mauro Carvalho Chehab [this message]
[not found] ` <20171213171319.675b39a6-ch4gOOMV7nf/PtFMR13I2A@public.gmane.org>
2017-12-20 1:06 ` Takiguchi, Yasunari
2017-10-13 6:09 ` [PATCH v4 07/12] [media] cxd2880: Add top level of " Yasunari.Takiguchi-7U/KSKJipcs
[not found] ` <20171013060934.21612-1-Yasunari.Takiguchi-7U/KSKJipcs@public.gmane.org>
2017-12-03 22:59 ` Sean Young
2017-12-05 11:47 ` Takiguchi, Yasunari
2017-12-13 19:25 ` Mauro Carvalho Chehab
2017-12-20 1:18 ` Takiguchi, Yasunari
2017-10-13 6:11 ` [PATCH v4 09/12] [media] cxd2880: Add DVB-T monitor functions Yasunari.Takiguchi-7U/KSKJipcs
2017-11-16 1:07 ` [PATCH v4 00/12] [dt-bindings] [media] Add document file and driver for Sony CXD2880 DVB-T2/T tuner + demodulator Takiguchi, Yasunari
[not found] ` <67ca63fc-4675-8a97-e43e-6336bbc9fada-7U/KSKJipcs@public.gmane.org>
2017-11-22 4:17 ` Takiguchi, Yasunari
[not found] ` <3e2f788b-3e4a-eb9b-eb36-2f65ffce669a-7U/KSKJipcs@public.gmane.org>
2017-11-29 7:38 ` Mauro Carvalho Chehab
2017-11-29 8:21 ` Takiguchi, Yasunari
2017-12-13 19:36 ` Mauro Carvalho Chehab
[not found] ` <20171213173633.57edca85-ch4gOOMV7nf/PtFMR13I2A@public.gmane.org>
2017-12-14 9:59 ` Takiguchi, Yasunari
2017-12-14 10:55 ` Mauro Carvalho Chehab
[not found] ` <20171214085503.289f06f8-ch4gOOMV7nf/PtFMR13I2A@public.gmane.org>
2017-12-14 14:25 ` Philippe Ombredanne
[not found] ` <CAOFm3uEYfMH8Zj8uEx-D9yYrTyDMTG_j02619esHu-j0brQKaA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-12-14 17:32 ` Bird, Timothy
2017-12-14 18:04 ` Mauro Carvalho Chehab
2017-12-14 18:30 ` Philippe Ombredanne
2018-01-15 0:49 ` Takiguchi, Yasunari
2018-01-15 1:27 ` Takiguchi, Yasunari
2017-12-14 18:22 ` Philippe Ombredanne
2017-10-13 6:10 ` [PATCH v4 08/12] [media] cxd2880: Add DVB-T control functions the driver Yasunari.Takiguchi
2017-10-13 6:13 ` [PATCH v4 10/12] [media] cxd2880: Add DVB-T2 control functions for " Yasunari.Takiguchi
2017-10-13 6:15 ` [PATCH v4 11/12] [media] cxd2880: Add DVB-T2 monitor functions Yasunari.Takiguchi
2017-10-13 6:17 ` [PATCH v4 12/12] [media] cxd2880: Add all Makefile, Kconfig files and Update MAINTAINERS file for the driver Yasunari.Takiguchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171213171319.675b39a6@vento.lan \
--to=mchehab@s-opensource.com \
--cc=Hideki.Nozawa@sony.com \
--cc=Kota.Yonezawa@sony.com \
--cc=Masayuki.Yamamoto@sony.com \
--cc=Satoshi.C.Watanabe@sony.com \
--cc=Toshihiko.Matsumoto@sony.com \
--cc=Yasunari.Takiguchi@sony.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=tbird20d@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).