From: Alexandre Belloni <alexandre.belloni@bootlin.com> To: Parshuram Thombare <pthombar@cadence.com> Cc: slongerbeam@gmail.com, vitor.soares@synopsys.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, mparab@cadence.com, praneeth@ti.com Subject: Re: [PATCH v10 6/7] i3c: master: sysfs key for acquire bus Date: Wed, 9 Jun 2021 01:33:26 +0200 [thread overview] Message-ID: <YL/+RvUEqniqcwRt@piout.net> (raw) In-Reply-To: <1606717202-4206-1-git-send-email-pthombar@cadence.com> On 30/11/2020 07:20:02+0100, Parshuram Thombare wrote: > Added support to acquire I3C bus through sysfs interface. > > Signed-off-by: Parshuram Thombare <pthombar@cadence.com> > --- > drivers/i3c/master.c | 18 ++++++++++++++++++ > 1 files changed, 18 insertions(+), 0 deletions(-) > > diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c > index c01ba00..beb7495 100644 > --- a/drivers/i3c/master.c > +++ b/drivers/i3c/master.c > @@ -581,6 +581,23 @@ static ssize_t i2c_scl_frequency_show(struct device *dev, > } > static DEVICE_ATTR_RO(i2c_scl_frequency); > > +static ssize_t i3c_acquire_bus_store(struct device *dev, > + struct device_attribute *attr, > + const char *buf, size_t count) > +{ > + struct i3c_master_controller *master = dev_to_i3cmaster(dev); > + int ret; > + > + i3c_bus_normaluse_lock(&master->bus); > + ret = i3c_master_acquire_bus(master); > + i3c_bus_normaluse_unlock(&master->bus); > + if (!ret) > + i3c_master_enable_mr_events(master); > + > + return ret ?: count; > +} > +static DEVICE_ATTR_WO(i3c_acquire_bus); > + I'm wondering whether we should allow userspace to actually control that. Shouldn't we simply request mastership when a driver needs to talk to a device on the bus? Is it really useful to have that until there is an i3c-dev userspace interface? > static struct attribute *i3c_masterdev_attrs[] = { > &dev_attr_mode.attr, > &dev_attr_current_master.attr, > @@ -591,6 +608,7 @@ static ssize_t i2c_scl_frequency_show(struct device *dev, > &dev_attr_pid.attr, > &dev_attr_dynamic_address.attr, > &dev_attr_hdrcap.attr, > + &dev_attr_i3c_acquire_bus.attr, > NULL, > }; > ATTRIBUTE_GROUPS(i3c_masterdev); > -- > 1.7.1 > -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@bootlin.com> To: Parshuram Thombare <pthombar@cadence.com> Cc: slongerbeam@gmail.com, vitor.soares@synopsys.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, mparab@cadence.com, praneeth@ti.com Subject: Re: [PATCH v10 6/7] i3c: master: sysfs key for acquire bus Date: Wed, 9 Jun 2021 01:33:26 +0200 [thread overview] Message-ID: <YL/+RvUEqniqcwRt@piout.net> (raw) In-Reply-To: <1606717202-4206-1-git-send-email-pthombar@cadence.com> On 30/11/2020 07:20:02+0100, Parshuram Thombare wrote: > Added support to acquire I3C bus through sysfs interface. > > Signed-off-by: Parshuram Thombare <pthombar@cadence.com> > --- > drivers/i3c/master.c | 18 ++++++++++++++++++ > 1 files changed, 18 insertions(+), 0 deletions(-) > > diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c > index c01ba00..beb7495 100644 > --- a/drivers/i3c/master.c > +++ b/drivers/i3c/master.c > @@ -581,6 +581,23 @@ static ssize_t i2c_scl_frequency_show(struct device *dev, > } > static DEVICE_ATTR_RO(i2c_scl_frequency); > > +static ssize_t i3c_acquire_bus_store(struct device *dev, > + struct device_attribute *attr, > + const char *buf, size_t count) > +{ > + struct i3c_master_controller *master = dev_to_i3cmaster(dev); > + int ret; > + > + i3c_bus_normaluse_lock(&master->bus); > + ret = i3c_master_acquire_bus(master); > + i3c_bus_normaluse_unlock(&master->bus); > + if (!ret) > + i3c_master_enable_mr_events(master); > + > + return ret ?: count; > +} > +static DEVICE_ATTR_WO(i3c_acquire_bus); > + I'm wondering whether we should allow userspace to actually control that. Shouldn't we simply request mastership when a driver needs to talk to a device on the bus? Is it really useful to have that until there is an i3c-dev userspace interface? > static struct attribute *i3c_masterdev_attrs[] = { > &dev_attr_mode.attr, > &dev_attr_current_master.attr, > @@ -591,6 +608,7 @@ static ssize_t i2c_scl_frequency_show(struct device *dev, > &dev_attr_pid.attr, > &dev_attr_dynamic_address.attr, > &dev_attr_hdrcap.attr, > + &dev_attr_i3c_acquire_bus.attr, > NULL, > }; > ATTRIBUTE_GROUPS(i3c_masterdev); > -- > 1.7.1 > -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com -- linux-i3c mailing list linux-i3c@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-i3c
next prev parent reply other threads:[~2021-06-08 23:33 UTC|newest] Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-30 6:16 [PATCH v10 0/7] I3C mastership handover support Parshuram Thombare 2020-11-30 6:16 ` Parshuram Thombare 2020-11-30 6:16 ` [PATCH v10 1/7] i3c: master: master initialization flow document Parshuram Thombare 2020-11-30 6:16 ` Parshuram Thombare 2020-11-30 6:17 ` [PATCH v10 2/7] i3c: master: use i3c_master_register only for main master Parshuram Thombare 2020-11-30 6:17 ` Parshuram Thombare 2020-12-04 4:24 ` Nicolas Pitre 2020-12-04 4:24 ` Nicolas Pitre 2020-12-08 5:47 ` Parshuram Raju Thombare 2020-12-08 5:47 ` Parshuram Raju Thombare 2021-06-08 23:21 ` Alexandre Belloni 2021-06-08 23:21 ` Alexandre Belloni 2021-06-17 8:42 ` Parshuram Raju Thombare 2021-06-17 8:42 ` Parshuram Raju Thombare 2020-11-30 6:18 ` [PATCH v10 3/7] i3c: master: add i3c_secondary_master_register Parshuram Thombare 2020-11-30 6:18 ` Parshuram Thombare 2020-12-04 4:42 ` Nicolas Pitre 2020-12-04 4:42 ` Nicolas Pitre 2020-12-08 6:00 ` Parshuram Raju Thombare 2020-12-08 6:00 ` Parshuram Raju Thombare 2020-11-30 6:18 ` [PATCH v10 4/7] i3c: master: add mastership handover support Parshuram Thombare 2020-11-30 6:18 ` Parshuram Thombare 2020-11-30 6:19 ` [PATCH v10 5/7] i3c: master: add defslvs processing Parshuram Thombare 2020-11-30 6:19 ` Parshuram Thombare 2020-11-30 6:20 ` [PATCH v10 6/7] i3c: master: sysfs key for acquire bus Parshuram Thombare 2020-11-30 6:20 ` Parshuram Thombare 2021-06-08 23:33 ` Alexandre Belloni [this message] 2021-06-08 23:33 ` Alexandre Belloni 2021-06-17 9:13 ` Parshuram Raju Thombare 2021-06-17 9:13 ` Parshuram Raju Thombare 2020-11-30 6:20 ` [PATCH v10 7/7] i3c: master: mastership handover, defslvs processing in cdns controller driver Parshuram Thombare 2020-11-30 6:20 ` Parshuram Thombare 2021-06-08 23:47 ` Alexandre Belloni 2021-06-08 23:47 ` Alexandre Belloni 2021-06-17 10:28 ` Parshuram Raju Thombare 2021-06-17 10:28 ` Parshuram Raju Thombare 2021-03-04 10:06 ` [PATCH v10 0/7] I3C mastership handover support Parshuram Raju Thombare 2021-03-04 10:06 ` Parshuram Raju Thombare
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=YL/+RvUEqniqcwRt@piout.net \ --to=alexandre.belloni@bootlin.com \ --cc=linux-i3c@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mparab@cadence.com \ --cc=praneeth@ti.com \ --cc=pthombar@cadence.com \ --cc=slongerbeam@gmail.com \ --cc=vitor.soares@synopsys.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.