lkml.org 
[lkml]   [2021]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH 1/8] gpio: Add Elba SoC gpio driver for spi cs control
    From
    Date
    On 04/03/2021 04:41, Brad Larson wrote:
    > This GPIO driver is for the Pensando Elba SoC which
    > provides control of four chip selects on two SPI busses.
    >
    > Signed-off-by: Brad Larson <brad@pensando.io>
    > ---
    > drivers/gpio/Kconfig | 6 ++
    > drivers/gpio/Makefile | 1 +
    > drivers/gpio/gpio-elba-spics.c | 120 +++++++++++++++++++++++++++++++++
    > 3 files changed, 127 insertions(+)
    > create mode 100644 drivers/gpio/gpio-elba-spics.c

    (...)

    > +static int elba_spics_probe(struct platform_device *pdev)
    > +{
    > + struct elba_spics_priv *p;
    > + struct resource *res;
    > + int ret;
    > +
    > + p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
    > + if (!p)
    > + return -ENOMEM;
    > +
    > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
    > + p->base = devm_ioremap_resource(&pdev->dev, res);
    > + if (IS_ERR(p->base)) {
    > + dev_err(&pdev->dev, "failed to remap I/O memory\n");
    > + return PTR_ERR(p->base);
    > + }
    > + spin_lock_init(&p->lock);
    > + platform_set_drvdata(pdev, p);
    > +
    > + p->chip.ngpio = 4; /* 2 cs pins for spi0, and 2 for spi1 */
    > + p->chip.base = -1;
    > + p->chip.direction_input = elba_spics_direction_input;
    > + p->chip.direction_output = elba_spics_direction_output;
    > + p->chip.get = elba_spics_get_value;
    > + p->chip.set = elba_spics_set_value;
    > + p->chip.label = dev_name(&pdev->dev);
    > + p->chip.parent = &pdev->dev;
    > + p->chip.owner = THIS_MODULE;
    > +
    > + ret = devm_gpiochip_add_data(&pdev->dev, &p->chip, p);
    > + if (ret) {
    > + dev_err(&pdev->dev, "unable to add gpio chip\n");
    > + return ret;
    > + }
    > +
    > + dev_info(&pdev->dev, "elba spics registered\n");

    Don't print trivial probe results, unless you print here something
    useful. If you need it for debugging, keep it dev_dbg.

    Best regards,
    Krzysztof

    \
     
     \ /
      Last update: 2021-03-05 12:27    [W:4.733 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site