[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e29e5003-37bb-4ad7-a64a-45e6f9f1c6d1@gmail.com>
Date: Fri, 12 Sep 2025 12:30:47 +0300
From: Matti Vaittinen <mazziesaccount@...il.com>
To: David Lechner <dlechner@...libre.com>, Jonathan Cameron
<jic23@...nel.org>, Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>
Cc: linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org
Subject: Re: [PATCH v4 2/3] iio: adc: Support ROHM BD79112 ADC/GPIO
On 12/09/2025 00:20, David Lechner wrote:
> On 9/10/25 6:24 AM, Matti Vaittinen wrote:
>
> ...
>
>> diff --git a/drivers/iio/adc/rohm-bd79112.c b/drivers/iio/adc/rohm-bd79112.c
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..a2a3affe2c6dc86a237a164139c27ec66dc9d131
>> --- /dev/null
>> +++ b/drivers/iio/adc/rohm-bd79112.c
>> @@ -0,0 +1,553 @@
>> +// SPDX-License-Identifier: GPL-2.0-only
>> +/*
>> + * ROHM ADC driver for BD79112 signal monitoring hub.
>> + * Copyright (C) 2025, ROHM Semiconductor.
>> + *
>> + * SPI communication derived from ad7923.c and ti-ads7950.c
>
> Really? I wrote the ti-ads7950 driver and I can't say I see the
> resemblance. ;-)
Really. :) I picked the idea of populating the transfers in the probe
and using buffers from the driver-data, from these drivers :) Well, I
admit it ended up being a bit different - but the starting point was
those drivers ;)
>
>> + */
>> +
>
> ...
>
>> +static int bd79112_get_gpio_pins(const struct iio_chan_spec *cs, int num_channels)
>
> u32 would make more sense when dealing with bit flags.
>
>> +{
>> + int i, gpio_channels;
>
> same for the local variable.
Meh. Ok :)
> ...
>
>> +static int bd79112_probe(struct spi_device *spi)
>> +{
>
> ...
>
>> +
>> + data->read_xfer[0].tx_buf = &data->read_tx[0];
>> + data->read_xfer[0].len = sizeof(data->read_tx);
>> + data->read_xfer[0].cs_change = 1;
>> + data->read_xfer[1].rx_buf = &data->read_rx;
>> + data->read_xfer[1].len = sizeof(data->read_rx);
>> + spi_message_init_with_transfers(&data->read_msg, data->read_xfer, 2);
>> +
>> + data->write_xfer.tx_buf = &data->reg_write_tx[0];
>> + data->write_xfer.len = sizeof(data->reg_write_tx);
>> + spi_message_init_with_transfers(&data->write_msg, &data->write_xfer, 1);
>
> If these messages never change (other than the data in the buffers), you can
> call devm_spi_optimize_message() here on each message to get reduced CPU usage
> on every SPI message for free.
>
Thanks!
Yours,
-- Matti
Powered by blists - more mailing lists