RE: [PATCH v2] input: touchscreen: add OF match table for ads7846

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Thomas,

> -----Original Message-----
> From: linux-input-owner@xxxxxxxxxxxxxxx
> [mailto:linux-input-owner@xxxxxxxxxxxxxxx] On Behalf Of Thomas Chou
> Sent: 2011年6月15日 12:02
> To: Baohua Song
> Cc: dmitry.torokhov@xxxxxxxxx; linux-input@xxxxxxxxxxxxxxx; DL-SHA-APBU
> Linux; Junyi Zhang; Grant Likely
> Subject: Re: [PATCH v2] input: touchscreen: add OF match table for ads7846
> 
> On 06/14/2011 02:38 PM, Baohua Song wrote:
> >> Could we add an option for gpio
> >> pendown, like this?
> >>
> >> - gpios : should specify GPIO used for pendown.
> >>
> >> If interrupt node is not present in this node, gpio_to_irq of the pen
> >> down GPIO will be used.
> >
> > I disagree... An optional gpio node doesn't make sense here. The result of
> gpio_to_irq is still an interrupt, then we can place the result in interrupt node.
> > And the ads7846 driver required an interrupt node but not a gpio node since
> we don't find any of_get_gpio() in this driver.
> > BTW, it even doesn’t make sense to call function gpio_to_irq in a driver like
> ads7846. on the contrary, drivers/input/keyboard/gpio_keys.c is really an good
> user of gpio_to_irq.
> 
> Hi Barry,
> 
> The classical platform data is seldom used when device tree is passed.
> So it would be better to disable platform data passing to verify device
> tree support.
> 
> Without platform data passing, we don't have pdata and
> pdata->get_pendown_state func for ads7846_setup_pendown(). The
> ads7846_probe() will need updates on this.

Now the pdata has many fields and several hardware-special callback functions. Non-callback fields can be OF property but callbacks are difficult to be handled in DT. 
So for the moment, we use notifier_block to set pdata in board file as below

static int prima2_touchscreen_notifier_call(struct notifier_block *nb,
                                        unsigned long event, void *__dev)
{
        struct device *dev = __dev;
        struct spi_device *spi = to_spi_device(dev);

        if ((event == BUS_NOTIFY_ADD_DEVICE) &&
            of_device_is_compatible(dev->of_node, "ti,ads7845")) {
                spi->controller_data = &ads7845_ctrldata;
                dev->platform_data = &prima2_ads7845_pdata;
                return NOTIFY_OK;
        }   
        return NOTIFY_DONE;
}

static struct notifier_block prima2_touchscreen_nb = { 
        .notifier_call = prima2_touchscreen_notifier_call,
};

static void __init prima2_touchscreen_init(void)
{
        bus_register_notifier(&spi_bus_type, &prima2_touchscreen_nb);
}

> 
> Passing gpio for pendown might be a possible solution, as device tree
> supports "gpios" node. We could use of_get_gpio_flags() to retrieve it.

Yes. Since ads7846 must read pendown gpio to get pendown status, gpio is necessary to ads7846 and interrupt is probably repeated copy of gpio since we can get it by gpio_to_irq().
gpio field in pdata may be deleted and moved to DT. that can be another patch after this one is merged. I maybe send it later

> 
> I sent an earlier work of mine on this back in Feb. to you.
> 
> Best regards,
> Thomas
-barry



Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
?韬{.n?????%??檩??w?{.n???{炳)楹哜?^n?■???h?璀?{?夸z罐?+€?zf"?????i?????_璁?:+v??撸?



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux