mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthias Brugger <mbrugger@suse.com>
To: nsaenzju@redhat.com, Charles Mirabile <cmirabil@redhat.com>,
	linux-kernel@vger.kernel.org
Cc: Miguel Ojeda <ojeda@kernel.org>,
	Serge Schneider <serge@raspberrypi.org>,
	Stefan Wahren <stefan.wahren@i2se.com>,
	linux-rpi-kernel@lists.infradead.org,
	fedora-rpi@googlegroups.com, Mwesigwa Guma <mguma@redhat.com>,
	Joel Savitz <jsavitz@redhat.com>
Subject: Re: [RFC PATCH v2 3/4] drivers/auxdisplay: senshat Raspberry Pi Sense HAT display driver
Date: Thu, 16 Sep 2021 13:00:14 +0200	[thread overview]
Message-ID: <d05a290c-1715-a3f1-4db3-7e708eae6f91@suse.com> (raw)
In-Reply-To: <b7e9dc19babef0e6993fa95be183c598a2f49bbd.camel@redhat.com>

On 30/08/2021 15:28, nsaenzju@redhat.com wrote:
> Hi Charles,
> 
> On Fri, 2021-08-20 at 14:08 -0400, Charles Mirabile wrote:
>> This patch implements control of the 8x8 RGB LED matrix display.
> 
> It'd be nice to get a more information on the i2c interface, and what each byte
> is supposed to represent.
> 
>> Signed-off-by: Charles Mirabile <cmirabil@redhat.com>
>> Signed-off-by: Mwesigwa Guma <mguma@redhat.com>
>> Signed-off-by: Joel Savitz <jsavitz@redhat.com>
>> ---
> 
> [...]
> 
>> +static long sensehat_display_ioctl(struct file *filp, unsigned int cmd,
>> +			     unsigned long arg)
>> +{
>> +	struct sensehat *sensehat = container_of(filp->private_data, struct sensehat, display.mdev);
>> +	struct sensehat_display *sensehat_display = &sensehat->display;
>> +	void __user *user_ptr = (void __user *)arg;
>> +	u8 temp[GAMMA_SIZE];
>> +	int ret;
>> +
>> +	if (mutex_lock_interruptible(&sensehat_display->rw_mtx))
>> +		return -ERESTARTSYS;
>> +	switch (cmd) {
>> +	case SENSEDISP_IOGET_GAMMA:
>> +		if (copy_to_user(user_ptr, sensehat_display->gamma, GAMMA_SIZE)) {
>> +			ret = -EFAULT;
>> +			goto out_unlock;
>> +		}
>> +		ret = 0;
>> +		goto out_unlock;
>> +	case SENSEDISP_IOSET_GAMMA:
>> +		if (copy_from_user(temp, user_ptr, GAMMA_SIZE)) {
>> +			ret = -EFAULT;
>> +			goto out_unlock;
>> +		}
>> +		ret = 0;
>> +		goto out_update;
>> +	case SENSEDISP_IORESET_GAMMA:
>> +		if (arg < GAMMA_DEFAULT || arg >= GAMMA_PRESET_COUNT) {
>> +			ret = -EINVAL;
>> +			goto out_unlock;
>> +		}
>> +		memcpy(temp, gamma_presets[arg], GAMMA_SIZE);
>> +		ret = 0;
>> +		goto out_update;
>> +	default:
>> +		ret = -EINVAL;
>> +		goto out_unlock;
>> +	}
>> +out_update:
>> +	memcpy(sensehat_display->gamma, temp, GAMMA_SIZE);
>> +	sensehat_update_display(sensehat);
>> +out_unlock:
>> +	mutex_unlock(&sensehat_display->rw_mtx);
>> +	return ret;
>> +}
>> +
>> +static const struct file_operations sensehat_display_fops = {
>> +	.owner		= THIS_MODULE,
>> +	.llseek		= sensehat_display_llseek,
>> +	.read		= sensehat_display_read,
>> +	.write		= sensehat_display_write,
>> +	.unlocked_ioctl	= sensehat_display_ioctl,
>> +};
> 
> I doubt this approach will make it upstream. This should use an already
> existing kernel interface, or if not good enough, extend it. I'm sure this is
> not the first RGB led matrix to show up anyway. Maybe drivers/leds has
> infrastructure to deal with this. Or else a fb device?

I'm working on upstreaming that again and my approach is to use framebuffer for 
this. What is the reason you decided against framebuffer?

Regards,
Matthias

> 
> I presume you want to keep the IOCTL in order to be able to run RPi specific
> aplications/libraries. It'll be up to them to change once we settle on a proper
> way of handling this, not the other way around. Note that the RPi engineers
> have always preffered using official kernel interfaces when available, so I
> don't think this'll be problematic.
> 
> Regards,
> Nicolas
> 


  reply	other threads:[~2021-09-16 11:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 18:07 [RFC PATCH v2 0/4] Raspberry Pi Sense HAT driver Charles Mirabile
2021-08-20 18:07 ` [RFC PATCH v2 1/4] drivers/mfd: sensehat: Raspberry Pi Sense HAT core driver Charles Mirabile
2021-08-30 12:48   ` nsaenzju
2021-08-20 18:07 ` [RFC PATCH vs 2/4] drivers/input/joystick: sensehat: Raspberry Pi Sense HAT joystick driver Charles Mirabile
2021-08-30 13:00   ` nsaenzju
2021-08-20 18:08 ` [RFC PATCH v2 3/4] drivers/auxdisplay: senshat Raspberry Pi Sense HAT display driver Charles Mirabile
2021-08-30 13:28   ` nsaenzju
2021-09-16 11:00     ` Matthias Brugger [this message]
2021-08-20 18:08 ` [RFC PATCH v2 4/4] sensehat: Add device tree overlay (do not merge) Charles Mirabile
2021-08-30 12:45   ` nsaenzju
2021-09-16 10:57   ` Matthias Brugger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d05a290c-1715-a3f1-4db3-7e708eae6f91@suse.com \
    --to=mbrugger@suse.com \
    --cc=cmirabil@redhat.com \
    --cc=fedora-rpi@googlegroups.com \
    --cc=jsavitz@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=mguma@redhat.com \
    --cc=nsaenzju@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=serge@raspberrypi.org \
    --cc=stefan.wahren@i2se.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®