From: Antti Palosaari <crope@iki.fi>
To: Antonio Ospite <ospite@studenti.unina.it>
Cc: linux-media@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@infradead.org>,
Michael Krufky <mkrufky@linuxtv.org>,
Patrick Boettcher <patrick.boettcher@desy.de>
Subject: Re: [PATCH 1/5] [media] dvb-usb: add a pre_init hook to struct dvb_usb_device_properties
Date: Tue, 06 Nov 2012 02:07:19 +0200 [thread overview]
Message-ID: <509854B7.40606@iki.fi> (raw)
In-Reply-To: <1352158096-17737-2-git-send-email-ospite@studenti.unina.it>
On 11/06/2012 01:28 AM, Antonio Ospite wrote:
> Some devices need to issue a pre-initialization command sequence via
> i2c in order to "enable" the communication with some adapter components.
>
> This happens for instance in the vp7049 USB DVB-T stick on which the
> frontend cannot be detected without first sending a certain sequence of
> commands via i2c.
I looked patch 3 and it is not I2C communication but direct M9206 memory
access you did. I could guess it is GPIO sequence to reset & power demod
and tuner. Due to that, correct place for this kind of initialization is
inside demod and tuner attach.
With a USB power meter, some trial & error testing, and maybe fw disasm
you could even detect those GPIOS :)
> Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
> ---
>
> If this approach is OK I can send a similar patch for dvb-usb-v2.
There is already such callbacks - but no callback between I2C init and
FE attach. There is read_config() which is called first, good place to
make probing device and detect hw config. Another new callback is
.init() which is called after demod and tuner attach. Stuff like USB
interface config should remain here. On USB power management case
reset_resume() that function is called too in order re-configure reseted
USB IF.
I don't see need yet another new callback.
> Are all the dvb-usb drivers going to be ported to dvb-usb-v2 eventually?
There is still quite many drivers to convert, so maybe it is not happen
anytime soon or even later. Feel free to convert that driver. For bonus
you will get for example power-management support for free.
>
>
> drivers/media/usb/dvb-usb/dvb-usb.h | 5 +++++
> drivers/media/usb/dvb-usb/dvb-usb-init.c | 6 ++++++
> 2 files changed, 11 insertions(+)
>
> diff --git a/drivers/media/usb/dvb-usb/dvb-usb.h b/drivers/media/usb/dvb-usb/dvb-usb.h
> index aab0f99..1fcea68 100644
> --- a/drivers/media/usb/dvb-usb/dvb-usb.h
> +++ b/drivers/media/usb/dvb-usb/dvb-usb.h
> @@ -233,6 +233,9 @@ enum dvb_usb_mode {
> * @size_of_priv: how many bytes shall be allocated for the private field
> * of struct dvb_usb_device.
> *
> + * @pre_init: function executed after i2c initialization but
> + * before the adapters get initialized
> + *
> * @power_ctrl: called to enable/disable power of the device.
> * @read_mac_address: called to read the MAC address of the device.
> * @identify_state: called to determine the state (cold or warm), when it
> @@ -274,6 +277,8 @@ struct dvb_usb_device_properties {
>
> int size_of_priv;
>
> + int (*pre_init) (struct dvb_usb_device *);
> +
> int num_adapters;
> struct dvb_usb_adapter_properties adapter[MAX_NO_OF_ADAPTER_PER_DEVICE];
>
> diff --git a/drivers/media/usb/dvb-usb/dvb-usb-init.c b/drivers/media/usb/dvb-usb/dvb-usb-init.c
> index 169196e..8ab916e 100644
> --- a/drivers/media/usb/dvb-usb/dvb-usb-init.c
> +++ b/drivers/media/usb/dvb-usb/dvb-usb-init.c
> @@ -31,6 +31,12 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs)
> struct dvb_usb_adapter *adap;
> int ret, n, o;
>
> + if (d->props.pre_init) {
> + ret = d->props.pre_init(d);
> + if (ret < 0)
> + return ret;
> + }
> +
> for (n = 0; n < d->props.num_adapters; n++) {
> adap = &d->adapter[n];
> adap->dev = d;
>
regards
Antti
--
http://palosaari.fi/
next prev parent reply other threads:[~2012-11-06 0:07 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-05 23:28 [PATCH 0/5] dvb-usb: support VP-7049 Twinhan DVB-T USB Stick and other fixes Antonio Ospite
2012-11-05 23:28 ` [PATCH 1/5] [media] dvb-usb: add a pre_init hook to struct dvb_usb_device_properties Antonio Ospite
2012-11-06 0:07 ` Antti Palosaari [this message]
2012-11-13 17:35 ` Antonio Ospite
2012-11-05 23:28 ` [PATCH 2/5] [media] get_dvb_firmware: add dvb-usb-vp7049-0.95.fw Antonio Ospite
2012-11-05 23:28 ` [PATCH 3/5] [media] m920x: Add support for the VP-7049 Twinhan DVB-T USB Stick Antonio Ospite
2012-11-05 23:28 ` [PATCH 4/5] [media] dvb-usb: fix indentation of a for loop Antonio Ospite
2012-11-05 23:28 ` [PATCH 5/5] [media] m920x: fix a typo in a comment Antonio Ospite
2012-12-10 21:37 ` [PATCHv2 0/9] dvb-usb/m920x: support VP-7049 DVB-T USB Stick and other fixes Antonio Ospite
2012-12-10 21:37 ` [PATCHv2 1/9] [media] dvb-usb: fix indentation of a for loop Antonio Ospite
2012-12-10 21:37 ` [PATCHv2 2/9] [media] m920x: fix a typo in a comment Antonio Ospite
2012-12-10 21:37 ` [PATCHv2 3/9] [media] m920x: factor out a m920x_write_seq() function Antonio Ospite
2012-12-10 21:37 ` [PATCHv2 4/9] [media] m920x: factor out a m920x_parse_rc_state() function Antonio Ospite
2012-12-10 21:37 ` [PATCHv2 5/9] [media] m920x: avoid repeating RC state parsing at each keycode Antonio Ospite
2012-12-10 21:37 ` [PATCHv2 6/9] [media] m920x: introduce m920x_rc_core_query() Antonio Ospite
2012-12-10 21:37 ` [PATCHv2 7/9] [media] m920x: send the RC init sequence also when rc.core is used Antonio Ospite
2012-12-10 21:37 ` [PATCHv2 8/9] [media] get_dvb_firmware: add entry for the vp7049 firmware Antonio Ospite
2012-12-10 21:37 ` [PATCHv2 9/9] [media] m920x: add support for the VP-7049 Twinhan DVB-T USB Stick Antonio Ospite
2012-12-27 12:23 ` [PATCHv2 0/9] dvb-usb/m920x: support VP-7049 DVB-T USB Stick and other fixes Antonio Ospite
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=509854B7.40606@iki.fi \
--to=crope@iki.fi \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=mkrufky@linuxtv.org \
--cc=ospite@studenti.unina.it \
--cc=patrick.boettcher@desy.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.