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 <[email protected]>:
>
>> 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
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html