* Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T
@ 2009-06-23 12:33 Hans Verkuil
2009-06-23 13:10 ` Terry Wu
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Hans Verkuil @ 2009-06-23 12:33 UTC (permalink / raw)
To: Andy Walls; +Cc: linux-media, stoth, Terry Wu
> On Tue, 2009-06-23 at 11:39 +0800, Terry Wu wrote:
>> Hi,
>>
>> I add the following codes in the cx23885_initialize() of
>> cx25840-core.c:
>> /* Drive GPIO2 (GPIO 19~23) direction and values for DVB-T */
>> cx25840_and_or(client, 0x160, 0x1d, 0x00);
>> cx25840_write(client, 0x164, 0x00);
>>
>> Before that, the tuning status is 0x1e, but <0> service found.
>> Now, I can watch DVB-T (Taiwan, 6MHz bandwidth).
>>
>> And if you are living in Australia, you should update the
>> tuner-xc2028.c too:
>> http://tw1965.myweb.hinet.net/Linux/v4l-dvb/20090611-TDA18271HDC2/tuner-xc2028.c
>>
>> Best Regards,
>> Terry
>
>
> Hans,
>
> As I think of potential ways to handle this, I thought we may need to
> add a v4l2_subdev interface for setting and reading GPIO's.
There is already an s_gpio in the core ops. It would be simple to add a
g_gpio as well if needed.
It is not a good idea to directly control GPIO pins from within a subdev
driver for the simple reason that the subdev driver has no idea how its
gpio pins are hooked up. This should really be done from the v4l driver
itself. If you need a notification from the subdev that the v4l driver
needs to take some action, then the subdev can send a notification through
the notify function in v4l2_device. That's currently used by one subdev
driver that requires that the v4l driver toggles a GPIO pin at the right
time.
Regards,
Hans
> A CX23418 based board has a Winbond W8360x GPIO IC connected via I2C.
> When I get to writing a v4l2_subdevice driver for that, it will need
> such an internal interface as well.
>
> Thoughts?
>
> Regards,
> Andy
>
>
--
Hans Verkuil - video4linux developer - sponsored by TANDBERG
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T
2009-06-23 12:33 PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T Hans Verkuil
@ 2009-06-23 13:10 ` Terry Wu
2009-06-23 21:53 ` Andy Walls
2009-06-23 21:50 ` Andy Walls
2009-06-25 2:40 ` v4l2_subdev GPIO and Pin Control ops (Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T) Andy Walls
2 siblings, 1 reply; 13+ messages in thread
From: Terry Wu @ 2009-06-23 13:10 UTC (permalink / raw)
To: Hans Verkuil; +Cc: Andy Walls, linux-media, stoth
Hi,
1. The CX23885's < GPIO 23 thru 19 - On the cx25840 a/v core> is not
implemented yet.
You can find the following codes in the cx23885-core.c :
/* Mask represents 32 different GPIOs, GPIO's are split into multiple
* registers depending on the board configuration (and whether the
* 417 encoder (wi it's own GPIO's) are present. Each GPIO bit will
* be pushed into the correct hardware register, regardless of the
* physical location. Certain registers are shared so we sanity check
* and report errors if we think we're tampering with a GPIo that might
* be assigned to the encoder (and used for the host bus).
*
* GPIO 2 thru 0 - On the cx23885 bridge
* GPIO 18 thru 3 - On the cx23417 host bus interface
* GPIO 23 thru 19 - On the cx25840 a/v core
*/
void cx23885_gpio_set(struct cx23885_dev *dev, u32 mask)
{
if (mask & 0x7)
cx_set(GP0_IO, mask & 0x7);
if (mask & 0x0007fff8) {
if (encoder_on_portb(dev) || encoder_on_portc(dev))
printk(KERN_ERR
"%s: Setting GPIO on encoder ports\n",
dev->name);
cx_set(MC417_RWD, (mask & 0x0007fff8) >> 3);
}
/* TODO: 23-19 */
if (mask & 0x00f80000)
printk(KERN_INFO "%s: Unsupported\n", dev->name);
}
void cx23885_gpio_clear(struct cx23885_dev *dev, u32 mask)
{
if (mask & 0x00000007)
cx_clear(GP0_IO, mask & 0x7);
if (mask & 0x0007fff8) {
if (encoder_on_portb(dev) || encoder_on_portc(dev))
printk(KERN_ERR
"%s: Clearing GPIO moving on encoder ports\n",
dev->name);
cx_clear(MC417_RWD, (mask & 0x7fff8) >> 3);
}
/* TODO: 23-19 */
if (mask & 0x00f80000)
printk(KERN_INFO "%s: Unsupported\n", dev->name);
}
void cx23885_gpio_enable(struct cx23885_dev *dev, u32 mask, int asoutput)
{
if ((mask & 0x00000007) && asoutput)
cx_set(GP0_IO, (mask & 0x7) << 16);
else if ((mask & 0x00000007) && !asoutput)
cx_clear(GP0_IO, (mask & 0x7) << 16);
if (mask & 0x0007fff8) {
if (encoder_on_portb(dev) || encoder_on_portc(dev))
printk(KERN_ERR
"%s: Enabling GPIO on encoder ports\n",
dev->name);
}
/* MC417_OEN is active low for output, write 1 for an input */
if ((mask & 0x0007fff8) && asoutput)
cx_clear(MC417_OEN, (mask & 0x7fff8) >> 3);
else if ((mask & 0x0007fff8) && !asoutput)
cx_set(MC417_OEN, (mask & 0x7fff8) >> 3);
/* TODO: 23-19 */
}
2. Also, I can not find GPIO functions in the cx25840-core.c
Something missing or unfinished ?
Best Regards,
Terry
2009/6/23 Hans Verkuil <hverkuil@xs4all.nl>:
>
>> On Tue, 2009-06-23 at 11:39 +0800, Terry Wu wrote:
>>> Hi,
>>>
>>> I add the following codes in the cx23885_initialize() of
>>> cx25840-core.c:
>>> /* Drive GPIO2 (GPIO 19~23) direction and values for DVB-T */
>>> cx25840_and_or(client, 0x160, 0x1d, 0x00);
>>> cx25840_write(client, 0x164, 0x00);
>>>
>>> Before that, the tuning status is 0x1e, but <0> service found.
>>> Now, I can watch DVB-T (Taiwan, 6MHz bandwidth).
>>>
>>> And if you are living in Australia, you should update the
>>> tuner-xc2028.c too:
>>> http://tw1965.myweb.hinet.net/Linux/v4l-dvb/20090611-TDA18271HDC2/tuner-xc2028.c
>>>
>>> Best Regards,
>>> Terry
>>
>>
>> Hans,
>>
>> As I think of potential ways to handle this, I thought we may need to
>> add a v4l2_subdev interface for setting and reading GPIO's.
>
> There is already an s_gpio in the core ops. It would be simple to add a
> g_gpio as well if needed.
>
> It is not a good idea to directly control GPIO pins from within a subdev
> driver for the simple reason that the subdev driver has no idea how its
> gpio pins are hooked up. This should really be done from the v4l driver
> itself. If you need a notification from the subdev that the v4l driver
> needs to take some action, then the subdev can send a notification through
> the notify function in v4l2_device. That's currently used by one subdev
> driver that requires that the v4l driver toggles a GPIO pin at the right
> time.
>
> Regards,
>
> Hans
>
>> A CX23418 based board has a Winbond W8360x GPIO IC connected via I2C.
>> When I get to writing a v4l2_subdevice driver for that, it will need
>> such an internal interface as well.
>>
>> Thoughts?
>>
>> Regards,
>> Andy
>>
>>
>
>
> --
> Hans Verkuil - video4linux developer - sponsored by TANDBERG
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T
2009-06-23 12:33 PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T Hans Verkuil
2009-06-23 13:10 ` Terry Wu
@ 2009-06-23 21:50 ` Andy Walls
2009-06-25 2:40 ` v4l2_subdev GPIO and Pin Control ops (Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T) Andy Walls
2 siblings, 0 replies; 13+ messages in thread
From: Andy Walls @ 2009-06-23 21:50 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, stoth, Terry Wu
On Tue, 2009-06-23 at 14:33 +0200, Hans Verkuil wrote:
> > On Tue, 2009-06-23 at 11:39 +0800, Terry Wu wrote:
> >> Hi,
> >>
> >> I add the following codes in the cx23885_initialize() of
> >> cx25840-core.c:
> >> /* Drive GPIO2 (GPIO 19~23) direction and values for DVB-T */
> >> cx25840_and_or(client, 0x160, 0x1d, 0x00);
> >> cx25840_write(client, 0x164, 0x00);
> >>
> >> Before that, the tuning status is 0x1e, but <0> service found.
> >> Now, I can watch DVB-T (Taiwan, 6MHz bandwidth).
> >>
> >> And if you are living in Australia, you should update the
> >> tuner-xc2028.c too:
> >> http://tw1965.myweb.hinet.net/Linux/v4l-dvb/20090611-TDA18271HDC2/tuner-xc2028.c
> >>
> >> Best Regards,
> >> Terry
> >
> >
> > Hans,
> >
> > As I think of potential ways to handle this, I thought we may need to
> > add a v4l2_subdev interface for setting and reading GPIO's.
>
> There is already an s_gpio in the core ops. It would be simple to add a
> g_gpio as well if needed.
Ooops. Sorry for not doing my homework. Thanks.
>
> It is not a good idea to directly control GPIO pins from within a subdev
> driver for the simple reason that the subdev driver has no idea how its
> gpio pins are hooked up. This should really be done from the v4l driver
> itself.
Agree. This is what I waas thinking.
Regards,
Andy
> If you need a notification from the subdev that the v4l driver
> needs to take some action, then the subdev can send a notification through
> the notify function in v4l2_device. That's currently used by one subdev
> driver that requires that the v4l driver toggles a GPIO pin at the right
> time.
>
> Regards,
>
> Hans
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T
2009-06-23 13:10 ` Terry Wu
@ 2009-06-23 21:53 ` Andy Walls
0 siblings, 0 replies; 13+ messages in thread
From: Andy Walls @ 2009-06-23 21:53 UTC (permalink / raw)
To: Terry Wu; +Cc: Hans Verkuil, linux-media, stoth
On Tue, 2009-06-23 at 21:10 +0800, Terry Wu wrote:
> 2. Also, I can not find GPIO functions in the cx25840-core.c
>
> Something missing or unfinished ?
Missing: they are not implemented in the cx25840 driver. I will at
least implement a change to the cx25840 module so the v4l bridge driver
(cx23885) can set the GPIOs.
Regards,
Andy
> Best Regards,
> Terry
^ permalink raw reply [flat|nested] 13+ messages in thread
* v4l2_subdev GPIO and Pin Control ops (Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T)
2009-06-23 12:33 PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T Hans Verkuil
2009-06-23 13:10 ` Terry Wu
2009-06-23 21:50 ` Andy Walls
@ 2009-06-25 2:40 ` Andy Walls
2009-06-25 6:39 ` Hans Verkuil
2 siblings, 1 reply; 13+ messages in thread
From: Andy Walls @ 2009-06-25 2:40 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, stoth, Terry Wu
On Tue, 2009-06-23 at 14:33 +0200, Hans Verkuil wrote:
> > On Tue, 2009-06-23 at 11:39 +0800, Terry Wu wrote:
> >
> There is already an s_gpio in the core ops. It would be simple to add a
> g_gpio as well if needed.
Hans,
As you probably know
int (*s_gpio)(v4l2_subdev *sd, u32 val);
is a little too simple for initial setup of GPIO pins. With the
collection of chips & cores supported by cx25840 module, setting the
GPIO configuration also requires:
direction: In or Out
multiplexed pins: GPIO or some other function
I could tack on direction as an argument to s_gpio(), but I think that
is a bit inconvenient.. I'd rather have a
int (*s_gpio_config)(v4l2_subdev *sd, u32 dir, u32 initval);
but that leaves out the method for multiplexed pin/pad configuration.
Perhaps explicity setting a GPIO direction to OUT could be an implicit
indication that a multiplexed pin should be set to it's GPIO function.
However, that doesn't help for GPIO inputs that might have their pins
multiplexed with other functions.
Here's an idea on how to specify multiplexed pin configuration
information and it could involve pins that multiplex functions other
than GPIO (the CX25843 is quite flexible in this regard):
int (*s_pin_function)(v4l2_subdev *sd, u32 pin_id, u32 function);
The type checking ends up pretty weak, but I figured it was better than
a 'void *config' that had a subdev specific collection of pin
configuration information.
Comments?
Regards,
Andy
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: v4l2_subdev GPIO and Pin Control ops (Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T)
2009-06-25 2:40 ` v4l2_subdev GPIO and Pin Control ops (Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T) Andy Walls
@ 2009-06-25 6:39 ` Hans Verkuil
2009-06-25 11:15 ` Andy Walls
0 siblings, 1 reply; 13+ messages in thread
From: Hans Verkuil @ 2009-06-25 6:39 UTC (permalink / raw)
To: Andy Walls; +Cc: linux-media, stoth, Terry Wu
On Thursday 25 June 2009 04:40:11 Andy Walls wrote:
> On Tue, 2009-06-23 at 14:33 +0200, Hans Verkuil wrote:
> > > On Tue, 2009-06-23 at 11:39 +0800, Terry Wu wrote:
> > >
>
> > There is already an s_gpio in the core ops. It would be simple to add a
> > g_gpio as well if needed.
>
> Hans,
>
> As you probably know
>
> int (*s_gpio)(v4l2_subdev *sd, u32 val);
>
> is a little too simple for initial setup of GPIO pins. With the
> collection of chips & cores supported by cx25840 module, setting the
> GPIO configuration also requires:
>
> direction: In or Out
> multiplexed pins: GPIO or some other function
>
> I could tack on direction as an argument to s_gpio(), but I think that
> is a bit inconvenient.. I'd rather have a
>
> int (*s_gpio_config)(v4l2_subdev *sd, u32 dir, u32 initval);
>
> but that leaves out the method for multiplexed pin/pad configuration.
> Perhaps explicity setting a GPIO direction to OUT could be an implicit
> indication that a multiplexed pin should be set to it's GPIO function.
> However, that doesn't help for GPIO inputs that might have their pins
> multiplexed with other functions.
>
> Here's an idea on how to specify multiplexed pin configuration
> information and it could involve pins that multiplex functions other
> than GPIO (the CX25843 is quite flexible in this regard):
>
> int (*s_pin_function)(v4l2_subdev *sd, u32 pin_id, u32 function);
>
> The type checking ends up pretty weak, but I figured it was better than
> a 'void *config' that had a subdev specific collection of pin
> configuration information.
>
> Comments?
Hi Andy,
Is there any driver that needs to setup the multiplex functions? If not, then
I would not add support for this at the moment. Adding unused code is a bad
idea in general.
In addition, such information should only be needed at initialization time,
and since we now have the new v4l2_i2c_new_subdev_cfg function I think that
that is the right way to do this. The same approach can be used for setting
the gpio pin directions. That too is something you setup at config time.
Regards,
Hans
--
Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: v4l2_subdev GPIO and Pin Control ops (Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T)
2009-06-25 6:39 ` Hans Verkuil
@ 2009-06-25 11:15 ` Andy Walls
2009-06-26 14:37 ` Steven Toth
0 siblings, 1 reply; 13+ messages in thread
From: Andy Walls @ 2009-06-25 11:15 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, stoth, Terry Wu
On Thu, 2009-06-25 at 08:39 +0200, Hans Verkuil wrote:
> On Thursday 25 June 2009 04:40:11 Andy Walls wrote:
> > On Tue, 2009-06-23 at 14:33 +0200, Hans Verkuil wrote:
> > > > On Tue, 2009-06-23 at 11:39 +0800, Terry Wu wrote:
> > > >
> >
> > > There is already an s_gpio in the core ops. It would be simple to add a
> > > g_gpio as well if needed.
> >
> > Hans,
> >
> > As you probably know
> >
> > int (*s_gpio)(v4l2_subdev *sd, u32 val);
> >
> > is a little too simple for initial setup of GPIO pins. With the
> > collection of chips & cores supported by cx25840 module, setting the
> > GPIO configuration also requires:
> >
> > direction: In or Out
> > multiplexed pins: GPIO or some other function
> >
> > I could tack on direction as an argument to s_gpio(), but I think that
> > is a bit inconvenient.. I'd rather have a
> >
> > int (*s_gpio_config)(v4l2_subdev *sd, u32 dir, u32 initval);
> >
> > but that leaves out the method for multiplexed pin/pad configuration.
> > Perhaps explicity setting a GPIO direction to OUT could be an implicit
> > indication that a multiplexed pin should be set to it's GPIO function.
> > However, that doesn't help for GPIO inputs that might have their pins
> > multiplexed with other functions.
> >
> > Here's an idea on how to specify multiplexed pin configuration
> > information and it could involve pins that multiplex functions other
> > than GPIO (the CX25843 is quite flexible in this regard):
> >
> > int (*s_pin_function)(v4l2_subdev *sd, u32 pin_id, u32 function);
> >
> > The type checking ends up pretty weak, but I figured it was better than
> > a 'void *config' that had a subdev specific collection of pin
> > configuration information.
> >
> > Comments?
>
> Hi Andy,
>
> Is there any driver that needs to setup the multiplex functions? If not, then
> I would not add support for this at the moment.
Well, the group of GPIO pins in question for the CX23885 are all
multiplexed with other functions. We could just initialize the CX23885
to have those pins set as GPIOs, but I have to check the cx23885 driver
to make sure that's safe.
> Adding unused code is a bad
> idea in general.
Yes.
> In addition, such information should only be needed at initialization time,
> and since we now have the new v4l2_i2c_new_subdev_cfg function I think that
> that is the right way to do this. The same approach can be used for setting
> the gpio pin directions. That too is something you setup at config time.
Yup. OK, thanks.
Regards,
Andy
> Regards,
>
> Hans
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: v4l2_subdev GPIO and Pin Control ops (Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T)
2009-06-25 11:15 ` Andy Walls
@ 2009-06-26 14:37 ` Steven Toth
2009-06-26 16:12 ` Andy Walls
0 siblings, 1 reply; 13+ messages in thread
From: Steven Toth @ 2009-06-26 14:37 UTC (permalink / raw)
To: Andy Walls, Hans Verkuil; +Cc: linux-media, Terry Wu
On 6/25/09 7:15 AM, Andy Walls wrote:
> On Thu, 2009-06-25 at 08:39 +0200, Hans Verkuil wrote:
>> On Thursday 25 June 2009 04:40:11 Andy Walls wrote:
>>> On Tue, 2009-06-23 at 14:33 +0200, Hans Verkuil wrote:
>>>>> On Tue, 2009-06-23 at 11:39 +0800, Terry Wu wrote:
>>>>>
>>>> There is already an s_gpio in the core ops. It would be simple to add a
>>>> g_gpio as well if needed.
>>> Hans,
>>>
>>> As you probably know
>>>
>>> int (*s_gpio)(v4l2_subdev *sd, u32 val);
>>>
>>> is a little too simple for initial setup of GPIO pins. With the
>>> collection of chips& cores supported by cx25840 module, setting the
>>> GPIO configuration also requires:
>>>
>>> direction: In or Out
>>> multiplexed pins: GPIO or some other function
>>>
>>> I could tack on direction as an argument to s_gpio(), but I think that
>>> is a bit inconvenient.. I'd rather have a
>>>
>>> int (*s_gpio_config)(v4l2_subdev *sd, u32 dir, u32 initval);
>>>
>>> but that leaves out the method for multiplexed pin/pad configuration.
>>> Perhaps explicity setting a GPIO direction to OUT could be an implicit
>>> indication that a multiplexed pin should be set to it's GPIO function.
>>> However, that doesn't help for GPIO inputs that might have their pins
>>> multiplexed with other functions.
>>>
>>> Here's an idea on how to specify multiplexed pin configuration
>>> information and it could involve pins that multiplex functions other
>>> than GPIO (the CX25843 is quite flexible in this regard):
>>>
>>> int (*s_pin_function)(v4l2_subdev *sd, u32 pin_id, u32 function);
>>>
>>> The type checking ends up pretty weak, but I figured it was better than
>>> a 'void *config' that had a subdev specific collection of pin
>>> configuration information.
>>>
>>> Comments?
>> Hi Andy,
>>
>> Is there any driver that needs to setup the multiplex functions? If not, then
>> I would not add support for this at the moment.
>
> Well, the group of GPIO pins in question for the CX23885 are all
> multiplexed with other functions. We could just initialize the CX23885
> to have those pins set as GPIOs, but I have to check the cx23885 driver
> to make sure that's safe.
I'm in the process of rationalizing the GPIO handing inside the cx23885 driver,
largely because of the cx23417. The current encoder driver has a hardcoded GPIO
used on GPIO 15. (legacy from the first HVR1800 implementation, which I'm
cleaning up).
I would add this to the conversation, the product I'm working on now HVR1850
needs to switch GPIO's on the fly to enable and disable parts (the ATSC demod)
via an encoder GPIO pin, depending on the cards operating mode. This isn't a
one-time operation, it needs to be dynamic.
In effect we have to tri-state / float certain parts depending whether we're in
analog or digital mode, and depending on which tuner is being used.
--
Steven Toth - Kernel Labs
http://www.kernellabs.com
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: v4l2_subdev GPIO and Pin Control ops (Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T)
2009-06-26 14:37 ` Steven Toth
@ 2009-06-26 16:12 ` Andy Walls
2009-06-26 16:25 ` Steven Toth
0 siblings, 1 reply; 13+ messages in thread
From: Andy Walls @ 2009-06-26 16:12 UTC (permalink / raw)
To: Steven Toth; +Cc: Hans Verkuil, linux-media, Terry Wu
On Fri, 2009-06-26 at 10:37 -0400, Steven Toth wrote:
> On 6/25/09 7:15 AM, Andy Walls wrote:
> > On Thu, 2009-06-25 at 08:39 +0200, Hans Verkuil wrote:
> >> On Thursday 25 June 2009 04:40:11 Andy Walls wrote:
> >>> On Tue, 2009-06-23 at 14:33 +0200, Hans Verkuil wrote:
> >>>>> On Tue, 2009-06-23 at 11:39 +0800, Terry Wu wrote:
> >>>>>
> >>>> There is already an s_gpio in the core ops. It would be simple to add a
> >>>> g_gpio as well if needed.
> >>> Hans,
> >>>
> >>> As you probably know
> >>>
> >>> int (*s_gpio)(v4l2_subdev *sd, u32 val);
> >>>
> >>> is a little too simple for initial setup of GPIO pins. With the
> >>> collection of chips& cores supported by cx25840 module, setting the
> >>> GPIO configuration also requires:
> >>>
> >>> direction: In or Out
> >>> multiplexed pins: GPIO or some other function
> >>>
> >>> I could tack on direction as an argument to s_gpio(), but I think that
> >>> is a bit inconvenient.. I'd rather have a
> >>>
> >>> int (*s_gpio_config)(v4l2_subdev *sd, u32 dir, u32 initval);
> >>>
> >>> but that leaves out the method for multiplexed pin/pad configuration.
> >>> Perhaps explicity setting a GPIO direction to OUT could be an implicit
> >>> indication that a multiplexed pin should be set to it's GPIO function.
> >>> However, that doesn't help for GPIO inputs that might have their pins
> >>> multiplexed with other functions.
> >>>
> >>> Here's an idea on how to specify multiplexed pin configuration
> >>> information and it could involve pins that multiplex functions other
> >>> than GPIO (the CX25843 is quite flexible in this regard):
> >>>
> >>> int (*s_pin_function)(v4l2_subdev *sd, u32 pin_id, u32 function);
> >>>
> >>> The type checking ends up pretty weak, but I figured it was better than
> >>> a 'void *config' that had a subdev specific collection of pin
> >>> configuration information.
> >>>
> >>> Comments?
> >> Hi Andy,
> >>
> >> Is there any driver that needs to setup the multiplex functions? If not, then
> >> I would not add support for this at the moment.
> >
> > Well, the group of GPIO pins in question for the CX23885 are all
> > multiplexed with other functions. We could just initialize the CX23885
> > to have those pins set as GPIOs, but I have to check the cx23885 driver
> > to make sure that's safe.
>
> I'm in the process of rationalizing the GPIO handing inside the cx23885 driver,
> largely because of the cx23417. The current encoder driver has a hardcoded GPIO
> used on GPIO 15. (legacy from the first HVR1800 implementation, which I'm
> cleaning up).
>
> I would add this to the conversation, the product I'm working on now HVR1850
> needs to switch GPIO's on the fly to enable and disable parts (the ATSC demod)
> via an encoder GPIO pin, depending on the cards operating mode. This isn't a
> one-time operation, it needs to be dynamic.
>
> In effect we have to tri-state / float certain parts depending whether we're in
> analog or digital mode, and depending on which tuner is being used.
Steve,
The setting of GPIO's is (or will be) dynamic via the .s_gpio()
v4l2_subdev operation.
Just to clarify some things above:
1. I assume setting of GPIO direction is not required to be done the
fly. Is that correct?
2. I assume switching of the internal routing of signals to chip pins is
not required to be done on the fly. Is that correct?
My plan was to add the necessary support to the cx25840 module for
setting up the cx23885 pin control multiplexers (subdev config time),
the GPIO 23-19 directions (subdev config time), and the GPIO 23-19
output states (dynamically as needed via subdev's .s_gpio call).
Is this a bad plan for your needs?
Regards,
Andy
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: v4l2_subdev GPIO and Pin Control ops (Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T)
2009-06-26 16:12 ` Andy Walls
@ 2009-06-26 16:25 ` Steven Toth
2009-06-26 18:11 ` Andy Walls
2009-06-26 18:19 ` Andy Walls
0 siblings, 2 replies; 13+ messages in thread
From: Steven Toth @ 2009-06-26 16:25 UTC (permalink / raw)
To: Andy Walls; +Cc: Hans Verkuil, linux-media, Terry Wu
On 6/26/09 12:12 PM, Andy Walls wrote:
> On Fri, 2009-06-26 at 10:37 -0400, Steven Toth wrote:
>> On 6/25/09 7:15 AM, Andy Walls wrote:
>>> On Thu, 2009-06-25 at 08:39 +0200, Hans Verkuil wrote:
>>>> On Thursday 25 June 2009 04:40:11 Andy Walls wrote:
>>>>> On Tue, 2009-06-23 at 14:33 +0200, Hans Verkuil wrote:
>>>>>>> On Tue, 2009-06-23 at 11:39 +0800, Terry Wu wrote:
>>>>>>>
>>>>>> There is already an s_gpio in the core ops. It would be simple to add a
>>>>>> g_gpio as well if needed.
>>>>> Hans,
>>>>>
>>>>> As you probably know
>>>>>
>>>>> int (*s_gpio)(v4l2_subdev *sd, u32 val);
>>>>>
>>>>> is a little too simple for initial setup of GPIO pins. With the
>>>>> collection of chips& cores supported by cx25840 module, setting the
>>>>> GPIO configuration also requires:
>>>>>
>>>>> direction: In or Out
>>>>> multiplexed pins: GPIO or some other function
>>>>>
>>>>> I could tack on direction as an argument to s_gpio(), but I think that
>>>>> is a bit inconvenient.. I'd rather have a
>>>>>
>>>>> int (*s_gpio_config)(v4l2_subdev *sd, u32 dir, u32 initval);
>>>>>
>>>>> but that leaves out the method for multiplexed pin/pad configuration.
>>>>> Perhaps explicity setting a GPIO direction to OUT could be an implicit
>>>>> indication that a multiplexed pin should be set to it's GPIO function.
>>>>> However, that doesn't help for GPIO inputs that might have their pins
>>>>> multiplexed with other functions.
>>>>>
>>>>> Here's an idea on how to specify multiplexed pin configuration
>>>>> information and it could involve pins that multiplex functions other
>>>>> than GPIO (the CX25843 is quite flexible in this regard):
>>>>>
>>>>> int (*s_pin_function)(v4l2_subdev *sd, u32 pin_id, u32 function);
>>>>>
>>>>> The type checking ends up pretty weak, but I figured it was better than
>>>>> a 'void *config' that had a subdev specific collection of pin
>>>>> configuration information.
>>>>>
>>>>> Comments?
>>>> Hi Andy,
>>>>
>>>> Is there any driver that needs to setup the multiplex functions? If not, then
>>>> I would not add support for this at the moment.
>>> Well, the group of GPIO pins in question for the CX23885 are all
>>> multiplexed with other functions. We could just initialize the CX23885
>>> to have those pins set as GPIOs, but I have to check the cx23885 driver
>>> to make sure that's safe.
>> I'm in the process of rationalizing the GPIO handing inside the cx23885 driver,
>> largely because of the cx23417. The current encoder driver has a hardcoded GPIO
>> used on GPIO 15. (legacy from the first HVR1800 implementation, which I'm
>> cleaning up).
>>
>> I would add this to the conversation, the product I'm working on now HVR1850
>> needs to switch GPIO's on the fly to enable and disable parts (the ATSC demod)
>> via an encoder GPIO pin, depending on the cards operating mode. This isn't a
>> one-time operation, it needs to be dynamic.
>>
>> In effect we have to tri-state / float certain parts depending whether we're in
>> analog or digital mode, and depending on which tuner is being used.
>
>
> Steve,
>
> The setting of GPIO's is (or will be) dynamic via the .s_gpio()
> v4l2_subdev operation.
>
> Just to clarify some things above:
>
> 1. I assume setting of GPIO direction is not required to be done the
> fly. Is that correct?
No, incorrect. We have cases where we need to float the GPIO (HVR1300, HVR1850)
we hack around this at the moment for various encoders and demods. Generally we
need this functionality across a number of drivers.
>
> 2. I assume switching of the internal routing of signals to chip pins is
> not required to be done on the fly. Is that correct?
No, incorrect. Same as above.
>
>
>
> My plan was to add the necessary support to the cx25840 module for
> setting up the cx23885 pin control multiplexers (subdev config time),
> the GPIO 23-19 directions (subdev config time), and the GPIO 23-19
> output states (dynamically as needed via subdev's .s_gpio call).
Ahh. I'm already working on this, the code is partially merged for the GPIO
overhaul (a few weeks ago). I'm currently on the next stage. You should see some
todo comments in the current cx23885 driver.
Doesn't the cx23885 driver already configure the multiplexer pins at config time
for the cx25840? Check the -cards.c for the HVR1800 entry.
>
> Is this a bad plan for your needs?
It sounds like in some respects were working on the same thing, perhaps from
different approaches. Although my needs are not to modify the 25840 driver as
such, but have the cx23885 bridge be intelligent enough to be able to flip all
32 GPIO's regardless of whether they're in the avcore (embedded 25840), or the
encoder or on the bridge itself.
If I'm late to the party and I've missed something obvious then I apologize in
advance.
--
Steven Toth - Kernel Labs
http://www.kernellabs.com
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: v4l2_subdev GPIO and Pin Control ops (Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T)
2009-06-26 16:25 ` Steven Toth
@ 2009-06-26 18:11 ` Andy Walls
2009-06-26 18:19 ` Andy Walls
1 sibling, 0 replies; 13+ messages in thread
From: Andy Walls @ 2009-06-26 18:11 UTC (permalink / raw)
To: Steven Toth; +Cc: Hans Verkuil, linux-media, Terry Wu
On Fri, 2009-06-26 at 12:25 -0400, Steven Toth wrote:
> On 6/26/09 12:12 PM, Andy Walls wrote:
> > On Fri, 2009-06-26 at 10:37 -0400, Steven Toth wrote:
> >> On 6/25/09 7:15 AM, Andy Walls wrote:
> >>> On Thu, 2009-06-25 at 08:39 +0200, Hans Verkuil wrote:
> >>>> On Thursday 25 June 2009 04:40:11 Andy Walls wrote:
> >>>>> On Tue, 2009-06-23 at 14:33 +0200, Hans Verkuil wrote:
> >>>>>>> On Tue, 2009-06-23 at 11:39 +0800, Terry Wu wrote:
> >>>>>>>
> >>>>>> There is already an s_gpio in the core ops. It would be simple to add a
> >>>>>> g_gpio as well if needed.
> >>>>> Hans,
> >>>>>
> >>>>> As you probably know
> >>>>>
> >>>>> int (*s_gpio)(v4l2_subdev *sd, u32 val);
> >>>>>
> >>>>> is a little too simple for initial setup of GPIO pins. With the
> >>>>> collection of chips& cores supported by cx25840 module, setting the
> >>>>> GPIO configuration also requires:
> >>>>>
> >>>>> direction: In or Out
> >>>>> multiplexed pins: GPIO or some other function
> >>>>>
> >>>>> I could tack on direction as an argument to s_gpio(), but I think that
> >>>>> is a bit inconvenient.. I'd rather have a
> >>>>>
> >>>>> int (*s_gpio_config)(v4l2_subdev *sd, u32 dir, u32 initval);
> >>>>>
> >>>>> but that leaves out the method for multiplexed pin/pad configuration.
> >>>>> Perhaps explicity setting a GPIO direction to OUT could be an implicit
> >>>>> indication that a multiplexed pin should be set to it's GPIO function.
> >>>>> However, that doesn't help for GPIO inputs that might have their pins
> >>>>> multiplexed with other functions.
> >>>>>
> >>>>> Here's an idea on how to specify multiplexed pin configuration
> >>>>> information and it could involve pins that multiplex functions other
> >>>>> than GPIO (the CX25843 is quite flexible in this regard):
> >>>>>
> >>>>> int (*s_pin_function)(v4l2_subdev *sd, u32 pin_id, u32 function);
> >>>>>
> >>>>> The type checking ends up pretty weak, but I figured it was better than
> >>>>> a 'void *config' that had a subdev specific collection of pin
> >>>>> configuration information.
> >>>>>
> >>>>> Comments?
> >>>> Hi Andy,
> >>>>
> >>>> Is there any driver that needs to setup the multiplex functions? If not, then
> >>>> I would not add support for this at the moment.
> >>> Well, the group of GPIO pins in question for the CX23885 are all
> >>> multiplexed with other functions. We could just initialize the CX23885
> >>> to have those pins set as GPIOs, but I have to check the cx23885 driver
> >>> to make sure that's safe.
> >> I'm in the process of rationalizing the GPIO handing inside the cx23885 driver,
> >> largely because of the cx23417. The current encoder driver has a hardcoded GPIO
> >> used on GPIO 15. (legacy from the first HVR1800 implementation, which I'm
> >> cleaning up).
> >>
> >> I would add this to the conversation, the product I'm working on now HVR1850
> >> needs to switch GPIO's on the fly to enable and disable parts (the ATSC demod)
> >> via an encoder GPIO pin, depending on the cards operating mode. This isn't a
> >> one-time operation, it needs to be dynamic.
> >>
> >> In effect we have to tri-state / float certain parts depending whether we're in
> >> analog or digital mode, and depending on which tuner is being used.
> >
> >
> > Steve,
> >
> > The setting of GPIO's is (or will be) dynamic via the .s_gpio()
> > v4l2_subdev operation.
> >
> > Just to clarify some things above:
> >
> > 1. I assume setting of GPIO direction is not required to be done the
> > fly. Is that correct?
>
> No, incorrect. We have cases where we need to float the GPIO (HVR1300, HVR1850)
> we hack around this at the moment for various encoders and demods. Generally we
> need this functionality across a number of drivers.
>
> >
> > 2. I assume switching of the internal routing of signals to chip pins is
> > not required to be done on the fly. Is that correct?
>
> No, incorrect. Same as above.
>
> >
> >
> >
> > My plan was to add the necessary support to the cx25840 module for
> > setting up the cx23885 pin control multiplexers (subdev config time),
> > the GPIO 23-19 directions (subdev config time), and the GPIO 23-19
> > output states (dynamically as needed via subdev's .s_gpio call).
>
> Ahh. I'm already working on this, the code is partially merged for the GPIO
> overhaul (a few weeks ago). I'm currently on the next stage. You should see some
> todo comments in the current cx23885 driver.
>
> Doesn't the cx23885 driver already configure the multiplexer pins at config time
> for the cx25840? Check the -cards.c for the HVR1800 entry.
>
> >
> > Is this a bad plan for your needs?
>
> It sounds like in some respects were working on the same thing, perhaps from
> different approaches. Although my needs are not to modify the 25840 driver as
> such, but have the cx23885 bridge be intelligent enough to be able to flip all
> 32 GPIO's regardless of whether they're in the avcore (embedded 25840), or the
> encoder or on the bridge itself.
>
> If I'm late to the party and I've missed something obvious then I apologize in
> advance.
Nope. I'll spin down my effort which is at 5 lines of code so far. :)
I was just going to handle part of the cx25840 module changes needed to
add/fix GPIO settings for cx23885 since the cx23885 bridge essentailly
is treating it's A/V core as a v4l2_subdevice (and since I muck with
that module for ivtv occassionally and Hans was probably too busy).
I just didn't want any needed cx25840 changes holding up support for the
PxDVR3200 or any other card.
Regards,
Andy
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: v4l2_subdev GPIO and Pin Control ops (Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T)
2009-06-26 16:25 ` Steven Toth
2009-06-26 18:11 ` Andy Walls
@ 2009-06-26 18:19 ` Andy Walls
2009-06-29 13:47 ` Steven Toth
1 sibling, 1 reply; 13+ messages in thread
From: Andy Walls @ 2009-06-26 18:19 UTC (permalink / raw)
To: Steven Toth; +Cc: Hans Verkuil, linux-media, Terry Wu
On Fri, 2009-06-26 at 12:25 -0400, Steven Toth wrote:
> On 6/26/09 12:12 PM, Andy Walls wrote:
> >
> > My plan was to add the necessary support to the cx25840 module for
> > setting up the cx23885 pin control multiplexers (subdev config time),
> > the GPIO 23-19 directions (subdev config time), and the GPIO 23-19
> > output states (dynamically as needed via subdev's .s_gpio call).
>
> Ahh. I'm already working on this, the code is partially merged for the GPIO
> overhaul (a few weeks ago). I'm currently on the next stage. You should see some
> todo comments in the current cx23885 driver.
>
> Doesn't the cx23885 driver already configure the multiplexer pins at config time
> for the cx25840? Check the -cards.c for the HVR1800 entry.
I'm not talking about the AFE Mux, I was refering to things like, as an
example, if an external pin could be configured as either GPIO[n] pin or
an audio sample clock. The mux setting that handles that.
Regards,
Andy
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: v4l2_subdev GPIO and Pin Control ops (Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T)
2009-06-26 18:19 ` Andy Walls
@ 2009-06-29 13:47 ` Steven Toth
0 siblings, 0 replies; 13+ messages in thread
From: Steven Toth @ 2009-06-29 13:47 UTC (permalink / raw)
To: Andy Walls; +Cc: Hans Verkuil, linux-media, Terry Wu
On 6/26/09 2:19 PM, Andy Walls wrote:
> On Fri, 2009-06-26 at 12:25 -0400, Steven Toth wrote:
>> On 6/26/09 12:12 PM, Andy Walls wrote:
>
>>> My plan was to add the necessary support to the cx25840 module for
>>> setting up the cx23885 pin control multiplexers (subdev config time),
>>> the GPIO 23-19 directions (subdev config time), and the GPIO 23-19
>>> output states (dynamically as needed via subdev's .s_gpio call).
>> Ahh. I'm already working on this, the code is partially merged for the GPIO
>> overhaul (a few weeks ago). I'm currently on the next stage. You should see some
>> todo comments in the current cx23885 driver.
>>
>> Doesn't the cx23885 driver already configure the multiplexer pins at config time
>> for the cx25840? Check the -cards.c for the HVR1800 entry.
>
> I'm not talking about the AFE Mux, I was refering to things like, as an
> example, if an external pin could be configured as either GPIO[n] pin or
> an audio sample clock. The mux setting that handles that.
>
> Regards,
> Andy
>
Ahh, fair enough, thanks Andy.
Give me a little while to resolve some of the missing GPIO pieces then lets
review. If I still don't have what you need then we can review again and I'd be
happy to implement any ideas we think make sense.
Some HVR1800 ioctl work is stuck in the queue prior to this, so it could be a
couple of weeks before I get back to it.
--
Steven Toth - Kernel Labs
http://www.kernellabs.com
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2009-06-29 13:47 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-23 12:33 PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T Hans Verkuil
2009-06-23 13:10 ` Terry Wu
2009-06-23 21:53 ` Andy Walls
2009-06-23 21:50 ` Andy Walls
2009-06-25 2:40 ` v4l2_subdev GPIO and Pin Control ops (Re: PxDVR3200 H LinuxTV v4l-dvb patch : Pull GPIO-20 low for DVB-T) Andy Walls
2009-06-25 6:39 ` Hans Verkuil
2009-06-25 11:15 ` Andy Walls
2009-06-26 14:37 ` Steven Toth
2009-06-26 16:12 ` Andy Walls
2009-06-26 16:25 ` Steven Toth
2009-06-26 18:11 ` Andy Walls
2009-06-26 18:19 ` Andy Walls
2009-06-29 13:47 ` Steven Toth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox