Re: Platform driver probe() not being called when device-tree overlaid

2019-02-16 Thread Laurence Rochfort
This was caused by a version difference on the device-tree overlay
symbol module_layout. Using the dtc command in the kernel, rather than
that shipped with the distro fixed the issue.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Platform driver probe() not being called when device-tree overlaid

2019-02-15 Thread Laurence Rochfort
Hi all,

I'm attempting to write a platform device driver that gets loaded when
a compatible device-tree overlay is loaded by dtoverlay.

This is just a learning exercise at the moment, so I'm trying to write
the simplest platform device I can, rather than extending one of the device 
drivers that extend platform device (terminology?). I'm trying to get just 
enough to get the driver's probe() function called when the device-tree overlay 
is applied, and then create a misc device.

My module seems to init just fine, and the device-tree overlay seems
to also load without issue, but for some reason probe() is never
called.

Am I correct in using probe() with platform devices? I understand
platform devices can't be enumerated/detected, but I thought that probe() would 
be called when there was a compatibility match between the driver and the 
device-tree overlay.

Any pointers would be much appreciated.

Cheers,
Laurence.


Here's what /sys shows:

$ cat /sys/devices/platform/gde060f3/uevent
OF_NAME=gde060f3
OF_FULLNAME=/gde060f3
OF_COMPATIBLE_0=gde060f3
OF_COMPATIBLE_N=1
MODALIAS=of:Ngde060f3TCgde060f3

$ cat /sys/firmware/devicetree/base/gde060f3/compatible 
gde060f3

$ cat /sys/firmware/devicetree/base/gde060f3/name
gde060f3

$ cat /sys/firmware/devicetree/base/gde060f3/status
okay


Here's the loaded device-tree:

$ dtc -I fs /proc/device-tree
/dts-v1/;

/ {
compatible = "raspberrypi,3-model-b-plus", "brcm,bcm2837";
serial-number = "427625f0";
model = "Raspberry Pi 3 Model B Plus Rev 1.3";
memreserve = <0x3b40 0x4c0>;
interrupt-parent = <0x1>;
#address-cells = <0x1>;
#size-cells = <0x1>;

clocks {
*** SNIPPED ***
};

__overrides__ {
*** SNIPPED ***
};

gde060f3 {
compatible = "gde060f3";
status = "okay";
phandle = <0x7b>;
linux,phandle = <0x7b>;
};

system {
linux,serial = <0x0 0x427625f0>;
linux,revision = <0xa020d3>;
};

*** SNIPPED ***
};


module file:

#define DEBUG

#include 
#include 
#include 
#include 
#include 
#include 
#include 

struct gde060f3_struct {
struct platform_device *pdev;
struct miscdevice mdev;
};

static inline struct gde060f3_struct *to_gde060f3_struct(struct file *file)
{
struct miscdevice *miscdev = file->private_data;
return container_of(miscdev, struct gde060f3_struct, mdev);
}

static ssize_t gde060f3_read(struct file *file, char __user *buf, size_t count,
 loff_t *pos)
{
struct gde060f3_struct *gde060f3 = to_gde060f3_struct(file); /* just 
for example */

(void)gde060f3; /* unused */
return simple_read_from_buffer(buf, count, pos, "gde060f3 text", 14);
}

static const struct file_operations gde060f3_fops = {
.owner  = THIS_MODULE,
.read   = gde060f3_read,
};

static const struct of_device_id gde060f3_match[] = {
{ .compatible = "gde060f3" },
{},
};
MODULE_DEVICE_TABLE(of, gde060f3_match);

static int gde060f3_probe(struct platform_device *pdev)
{
struct gde060f3_struct *gde060f3;
int ret;

pr_info("gde060f3_probe()\n");
gde060f3 = kmalloc(sizeof(*gde060f3), GFP_KERNEL);
if (!gde060f3)
return -ENOMEM;

platform_set_drvdata(pdev, gde060f3);
gde060f3->pdev = pdev;

gde060f3->mdev.minor  = MISC_DYNAMIC_MINOR;
gde060f3->mdev.name   = "gde060f3";
gde060f3->mdev.fops   = _fops;
gde060f3->mdev.parent = NULL;

ret = misc_register(>mdev);
if (ret) {
dev_err(>dev, "Failed to register miscdev\n");
return ret;
}

dev_info(>dev, "Registered\n");
pr_info("Registered\n");

return 0;
}

static int gde060f3_remove(struct platform_device *pdev)
{
struct gde060f3_struct *gde060f3 = platform_get_drvdata(pdev);

misc_deregister(>mdev);
kfree(gde060f3);
dev_info(>dev, "Unregistered\n");
pr_info("Unregistered\n");

return 0;
}

static struct platform_driver gde060f3_driver = {
.probe  = gde060f3_probe,
.remove     = gde060f3_remove,
.driver = {
.name = "gde060f3",
.of_match_table = gde060f3_match,
},
};

module_platform_driver_probe(gde060f3_driver, gde060f3_probe);


MODULE_AUTHOR("Laurence Rochfort ");
MODULE_DESCRIPTION("GPIO  driver for Good Display GDE060F3 ePaper Display");
MODULE_LICENSE("GPL");




overlay file:

/dts-v1/;
/plugin/

Userspace configurable GPIO pinout

2019-01-28 Thread Laurence Rochfort
Hi all,

I'm writing a driver for an ePaper display, that will attach via GPIO.

I've read the docs in Documentation/GPIO, and
Documentation/devicetree/bindings/gpio.

The ePaper itself just has a 34pin flat-flex cable, so people will have to
use an adapter board to convert to the GPIO headers for a given system.

I'd appreciate advice on the best/canonical way to allow userspace to
configure the pinout. I read the devicetree docs, but my interpretation was
that was more for a somewhat static configuration to be provided by device
vendors.

Many thanks,
Laurence
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Kernel development virtualization options

2018-11-16 Thread Laurence Rochfort
Hi all,

Thus far, I've been testing my kernel patches in a KVM vm with a full
distro installation, but it's pretty slow and cumbersome.

Valerie Aurora has a blog post on using User-mode Linux, and others
mention QEMU with an overlay filesystem and BusyBox.

What do people recommend for quick iterative development, with good
GDB integration?

Cheers,
Laurence.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Eudyptula Challenge scripts not responding?

2017-07-06 Thread Laurence Rochfort
Thanks all.

Yeah, I understand a judgement on a submission could take a while, but I
wasn't getting an auto-response either.

Looks like it was a mail routing issue on my side and I also got the
subject format wrong.

On Thu, 6 Jul 2017, 17:24 David Wittman, <dwitt...@gmail.com> wrote:

> That said, the autoresponder should reply pretty quickly after your
> submission.
>
> On Thu, Jul 6, 2017 at 9:30 AM, Alexander Kapshuk <
> alexander.kaps...@gmail.com> wrote:
>
>> On Thu, Jul 6, 2017 at 4:04 PM, Laurence Rochfort
>> <laurence.rochf...@gmail.com> wrote:
>> > Hi all,
>> >
>> > The Eudyptula Challenge scripts seem to not be responding these past few
>> > days.
>> >
>> > if anybody here is involved behind the scenes, would you please take a
>> look?
>> >
>> > Cheers,
>> > Laurence.
>> >
>> > ___
>> > Kernelnewbies mailing list
>> > Kernelnewbies@kernelnewbies.org
>> > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>> >
>>
>> The response times vary between hearing from them the same day to up
>> to a few weeks.
>>
>> They will get back to you eventually.
>>
>> ___
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Eudyptula Challenge scripts not responding?

2017-07-06 Thread Laurence Rochfort
Hi all,

The Eudyptula Challenge scripts seem to not be responding these past few
days.

if anybody here is involved behind the scenes, would you please take a look?

Cheers,
Laurence.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Kernelnewbies Digest, Vol 71, Issue 26

2016-10-21 Thread Laurence Rochfort
Ah yes, you're correct. The Z80 ran the program and the 6502 then handled
I/O.

https://en.wikipedia.org/wiki/Tube_%28BBC_Micro%29?wprov=sfla1

On Fri, 21 Oct 2016, 18:40 , <valdis.kletni...@vt.edu> wrote:

> On Fri, 21 Oct 2016 17:04:50 -, Laurence Rochfort said:
>
> > The BBC Micro which was 6502 based had an add on that let you connect a
> Z80
> > straight onto the same bus.
>
> If I remember correctly, that one was basically an either/or - you could
> boot the 6502, or the Z80, but you couldn't run both at the same time
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Kernelnewbies Digest, Vol 71, Issue 26

2016-10-21 Thread Laurence Rochfort
The BBC Micro which was 6502 based had an add on that let you connect a Z80
straight onto the same bus.

Different regards "operating system" I know, but it has been tried before.

On Fri, 21 Oct 2016, 17:00 , 
wrote:

> Send Kernelnewbies mailing list submissions to
> kernelnewbies@kernelnewbies.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> or, via email, send a message with subject or body 'help' to
> kernelnewbies-requ...@kernelnewbies.org
>
> You can reach the person managing the list at
> kernelnewbies-ow...@kernelnewbies.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Kernelnewbies digest..."
>
>
> Today's Topics:
>
>1. Is that possible to implement a single machine with
>   heterogeneous architecture. (Douglas Su)
>2. Re: Is that possible to implement a single machine with
>   heterogeneous architecture. (Felix Bytow)
>3. Re: Is that possible to implement a single machine with
>   heterogeneous architecture. (valdis.kletni...@vt.edu)
>
>
> --
>
> Message: 1
> Date: Fri, 21 Oct 2016 03:10:28 +
> From: Douglas Su 
> Subject: Is that possible to implement a single machine with
> heterogeneous   architecture.
> To: kernelnewbies 
> Message-ID:
> <
> sn1pr04mb2096827d49ca8f766da1392eec...@sn1pr04mb2096.namprd04.prod.outlook.com
> >
>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hello everyone,
>
>
> Is that possible to install multiple CPUs which have different
> architecture on a single machine? For example, on a single machine with two
> different cpu sockets for X86 and MIPS cpu respectively, and these two cpus
> are inter-connected with some sorts of bus (PCI or other advanced buses).
>
>
> If it is possible, Is this machine still SMP? What will lscpu (or cat
> /proc/cpuinfo) dump?
>
>
> Thx!
> -- next part --
> An HTML attachment was scrubbed...
> URL:
> http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20161021/42ebef5d/attachment-0001.html
>
> --
>
> Message: 2
> Date: Fri, 21 Oct 2016 06:48:16 +0200
> From: Felix Bytow 
> Subject: Re: Is that possible to implement a single machine with
> heterogeneous   architecture.
> To: kernelnewbies@kernelnewbies.org
> Message-ID: <0f45ce48-02da-1e53-8341-0fc976100...@googlemail.com>
> Content-Type: text/plain; charset="utf-8"
>
> That question reminds me of this:
>
> https://www.kickstarter.com/projects/udoo/udoo-x86-the-most-powerful-maker-board-ever/description
>
> It is basically a hybrid of an x86 cpu and a microcontroller. Don't know
> if that counts for you^^
>
>
> Am 21.10.2016 um 05:10 schrieb Douglas Su:
> >
> > Hello everyone,
> >
> >
> > Is that possible to install multiple CPUs which have different
> > architecture on a single machine? For example, on a single machine
> > with two different cpu sockets for X86 and MIPS cpu respectively, and
> > these two cpus are inter-connected with some sorts of bus (PCI or
> > other advanced buses).
> >
> >
> > If it is possible, Is this machine still SMP? What will lscpu (or cat
> > /proc/cpuinfo) dump?
> >
> >
> > Thx!
> >
> >
> >
> > ___
> > Kernelnewbies mailing list
> > Kernelnewbies@kernelnewbies.org
> > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
> -- next part --
> An HTML attachment was scrubbed...
> URL:
> http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20161021/c4e31dfc/attachment-0001.html
>
> --
>
> Message: 3
> Date: Fri, 21 Oct 2016 09:49:49 -0400
> From: valdis.kletni...@vt.edu
> Subject: Re: Is that possible to implement a single machine with
> heterogeneous   architecture.
> To: Douglas Su 
> Cc: kernelnewbies 
> Message-ID: <51610.1477057...@turing-police.cc.vt.edu>
> Content-Type: text/plain; charset="us-ascii"
>
> On Fri, 21 Oct 2016 03:10:28 -, Douglas Su said:
>
> > Is that possible to install multiple CPUs which have different
> architecture
> > on a single machine? For example, on a single machine with two different
> cpu
> > sockets for X86 and MIPS cpu respectively, and these two cpus are
> > inter-connected with some sorts of bus (PCI or other advanced buses).
>
> Is it possible?  Probably.
>
> Is it worth the effort?  Probably not - I suspect that things like the
> IBM Power-based Cell architecture (used in the Playstation 3 and the
> Blue Gene supercomputers), or GPU accelerators from NVidia, are as far
> as you can reasonably stretch the idea.
>
> For starters, you'd probably *not* be 

Re: CodingStyle indentation and alignment

2016-09-27 Thread Laurence Rochfort
Good point.

On Tue, Sep 27, 2016 at 3:47 PM Andrey Utkin <andrey_ut...@fastmail.com>
wrote:

> On Tue, Sep 27, 2016 at 02:27:27PM +, Laurence Rochfort wrote:
> > Thanks very much for the comprehensive answer.
> >
> > Using spaces and tabs for alignment does make the code more readable
> > to my mind.
> >
> > The reason behind my question originally was that the CodingStyle doc
> > states:
> >
> > "Outside of comments, documentation and except in Kconfig, spaces are
> never
> > used for indentation, and the above example is deliberately broken."
> >
> > however most code I have seen is not compliant with that.
> >
> > Should the docs be updated?
>
> There's difference between terms "indentation" and "alignment".
> Please see paragraph "Indentation and alignment" of previously
> referenced article:
>
> http://dmitryfrank.com/articles/indent_with_tabs_align_with_spaces#indentation_and_alignment
>
> Accounting this difference, the doc is correct in strict sense.
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: CodingStyle indentation and alignment

2016-09-27 Thread Laurence Rochfort
Thanks very much for the comprehensive answer.

Using spaces and tabs for alignment does make the code more readable
to my mind.

The reason behind my question originally was that the CodingStyle doc
states:

"Outside of comments, documentation and except in Kconfig, spaces are never
used for indentation, and the above example is deliberately broken."

however most code I have seen is not compliant with that.

Should the docs be updated?

Cheers,
Laurence.

On Mon, Sep 26, 2016 at 10:32:06PM +0300, Andrey Utkin wrote:
> On Mon, Sep 26, 2016 at 06:28:58PM +0100, Laurence Rochfort wrote:
> > Hi all,
> >
> > I've read Documentation/CodingStyle and it states to use 8 character
tabs.
> >
> > Reading several USB driver files including drivers/usb/usb-skeleton.c,
I see that multi-line lists of argument and operands are often aligned on
top of each other using a mixture of tabs and spaces. checkpatch doesn't
complain about the mixture.
> >
> > For instance from usb-skeleton.c:
> >
> > static int skel_probe(struct usb_interface *interface,
> >   const struct usb_device_id *id)
> >
> > uses two tabs and 6 spaces, not just tabs like:
> >
> > static int skel_probe(struct usb_interface *interface,
> >const struct usb_device_id *id)
> >
> > or
> >
> > static int skel_probe(struct usb_interface *interface,
> >  const struct usb_device_id *id)
> >
> >
> > Is a mixture of tabs and spaces acceptable if it enhances readability?
If not, which of the tabs-only forms is correct?
> >
> > Similarly, what about assignment alignment in structs?
>
> By my observations, conventional alignment in kernel contributions
> nowadays is N*tab followed by M*space, where M < 8. For details, consult
> "checkpatch --strict" output. It's not a paramount to make all existing
> codebase to pass that check cleanly, but if you are polishing your new
> patch, you can use that as guidance.
>
> If you use Vim, see https://github.com/vivien/vim-linux-coding-style -
> it will indent your code more or less in accordance with coding style,
> also making checkpatch happy.
>
> checkpatch in --strict mode actually prefers trailing lines to be
> aligned on opening brace. Tabs and spaces are allowed for such alignment
> (and you _need_ spaces to be able to align like that).
>
> So what above vim plugin makes, and what is widely used in kernel
> codebase, is something like this ("|tab--->" or a smaller part
> represents tab character, "." represents space):
>
> static int blah_blah_blah(struct usb_interface *interface,
> |tab--->|tab--->|tab--->..const struct usb_device_id *id)
> {
> |tab--->if (1) {
> |tab--->|tab--->int var = blah_blah(interface->foo_bar->baz_fuzz,
> |tab--->|tab--->|tab--->|tab--->11 + 111);
>
> Also
>
> |tab--->|tab--->|tab--->|tab--->|tab--->|tab--->|tab---> (shown for
reference)
> #define DRIVERNAME_REGISTER1_NAMEXXX--->|tab--->0xdead
> #define DRIVERNAME_REGISTER2_NAME_WHICH_IS_LONG>0xdeaf
>
> Which looks this way with actual tab characters:
>
> #define DRIVERNAME_REGISTER1_NAMEXXX  0xdead
> #define DRIVERNAME_REGISTER2_NAME_WHICH_IS_LONG   0xdeaf
>
> This is supposed to be displayed ALWAYS with 8-char tab (this is carved
> in slate of CodingStyle), thus arguments about breaking viewing with
> different tab sizes are to be ignored.
>
> To my taste this is not best possible approach, and I would like all
> readers of this thread to check this article:
> http://dmitryfrank.com/articles/indent_with_tabs_align_with_spaces
> But, unfortunately, checkpatch is explicitly not happy with that
> approach, giving notices of ERROR and WARNING levels for first example,
> however accepting #define case to be aligned with spaces IIRC.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


CodingStyle indentation and alignment

2016-09-26 Thread Laurence Rochfort
Hi all,

I've read Documentation/CodingStyle and it states to use 8 character tabs.

Reading several USB driver files including drivers/usb/usb-skeleton.c, I see 
that multi-line lists of argument and operands are often aligned on top of each 
other using a mixture of tabs and spaces. checkpatch doesn't complain about the 
mixture.

For instance from usb-skeleton.c:

static int skel_probe(struct usb_interface *interface,  

  const struct usb_device_id *id)

uses two tabs and 6 spaces, not just tabs like:

static int skel_probe(struct usb_interface *interface,
   const struct usb_device_id *id)

or

static int skel_probe(struct usb_interface *interface,
 const struct usb_device_id *id)


Is a mixture of tabs and spaces acceptable if it enhances readability? If not, 
which of the tabs-only forms is correct?

Similarly, what about assignment alignment in structs?

Cheers,
Laurence.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies