lkml.org 
[lkml]   [2022]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH RFC v1 1/2] bus: add Wiegand write-only GPIO driver
On Mon, Sep 19, 2022 at 2:57 PM Martin Zaťovič <m.zatovic1@gmail.com> wrote:

> 1. drivers/bus/wiegand.c
> 2. include/linux/wiegand.h
> 3. drivers/gpio/gpio-wiegand.h
>
> I have looked for drivers with a similar division and tried to figure out what the file drivers/bus/wiegand.c should contain.
> So far I am only sure that it will contain the parity calculation functions.

That is a question for people who know wiegand... Maybe just yourself!

You also clearly need some bus infrastructure to populate and spawn devices.
This mechanism depends on the specifics of the bus.

> The code for sysfs attribute files may also be a part of this file, but I am not sure about it.
> If hypothetically there was another Wiegand driver besides the GPIO one and a user would
> like to connect both of these Wiegand interfaces, he would loose the ability to set attributes
> for individual Wiegand interfaces, am I right?

You should spawn individual devices on a wiegand bus (the kernel concept of
bus). Each new device becomes something like a struct wiegand_device that
contains a struct device, and the struct device is the anchor in sysfs.
https://www.kernel.org/doc/html/latest/driver-api/driver-model/bus.html

> Should the drivers/bus/wiegand.c be a full-scale driver or should it just be a file that
> contains the Wiegand-specific functions(such as parity calculation)?

It should be what we call a bus driver, OK a bit self-referential, but anything
that is common for the bus and the code to spawn the devices.

Yours,
Linus Walleij

\
 
 \ /
  Last update: 2022-09-20 11:46    [W:0.329 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site