From: jacopo mondi <jacopo@jmondi.org>
To: ektor5 <ek5.chimenti@gmail.com>
Cc: hverkuil@xs4all.nl, luca.pisani@udoo.org,
jose.abreu@synopsys.com, sean@mess.org,
sakari.ailus@linux.intel.com,
Mauro Carvalho Chehab <mchehab@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Arnd Bergmann <arnd@arndb.de>,
Hans Verkuil <hans.verkuil@cisco.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Jacob Chen <jacob-chen@iotwrt.com>,
Jacopo Mondi <jacopo+renesas@jmondi.org>,
Neil Armstrong <narmstrong@baylibre.com>,
Todor Tomov <todor.tomov@linaro.org>,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH 1/2] media: add SECO cec driver
Date: Wed, 3 Oct 2018 18:14:01 +0200 [thread overview]
Message-ID: <20181003161401.GG20786@w540> (raw)
In-Reply-To: <20181003153204.ou3zup3jeoa34vvc@Ettosoft-T55>
[-- Attachment #1: Type: text/plain, Size: 3793 bytes --]
Hello,
On Wed, Oct 03, 2018 at 05:50:04PM +0200, ektor5 wrote:
> Hi Jacopo,
> Thanks for the quick reply, I will respond inline,
>
> On Wed, Oct 03, 2018 at 11:35:32AM +0200, jacopo mondi wrote:
> > Hi Ettore,
> > thanks for the patch.
> >
> > A few comments below, please have a look...
> >
> > On Tue, Oct 02, 2018 at 06:59:55PM +0200, ektor5 wrote:
> > > From: Ettore Chimenti <ek5.chimenti@gmail.com>
> > > +/* ----------------------------------------------------------------------- */
[snip]
> > > +
> > > +#ifdef CONFIG_PM_SLEEP
> >
> > I see CONFIG_PM_SLEEP is only selected if support for
> > 'suspend'/'hibernate' is enabled. Is this what you want, or you should
> > check for CONFIG_PM?
>
> I was just inspired by the implementation of cros-ec-cec, but I think
> this is right, because the device actually has suspend/hibernate states.
>
Your device maybe does... I feel like CONFIG_PM is the right choice, but
I let others to comment further.
> >
> > > +static int secocec_suspend(struct device *dev)
> > > +{
> > > + u16 val;
> > > + int status;
> > > +
> > > + dev_dbg(dev, "Device going to suspend, disabling");
> > > +
> > > + /* Clear the status register */
> > > + status = smb_rd16(SECOCEC_STATUS_REG_1, &val);
> > > + if (status)
> > > + goto err;
> > > +
> > > + status = smb_wr16(SECOCEC_STATUS_REG_1, val);
> > > + if (status)
> > > + goto err;
> > > +
> > > + /* Disable the interrupts */
> > > + status = smb_rd16(SECOCEC_ENABLE_REG_1, &val);
> > > + if (status)
> > > + goto err;
> > > +
> > > + status = smb_wr16(SECOCEC_ENABLE_REG_1, val &
> > > + ~SECOCEC_ENABLE_REG_1_CEC & ~SECOCEC_ENABLE_REG_1_IR);
> > > + if (status)
> > > + goto err;
> > > +
> > > + return 0;
> > > +
> > > +err:
> > > + dev_err(dev, "Suspend failed (err: %d)", status);
> > > + return status;
> > > +}
> > > +
> > > +static int secocec_resume(struct device *dev)
> > > +{
> > > + u16 val;
> > > + int status;
> > > +
> > > + dev_dbg(dev, "Resuming device from suspend");
> > > +
> > > + /* Clear the status register */
> > > + status = smb_rd16(SECOCEC_STATUS_REG_1, &val);
> > > + if (status)
> > > + goto err;
> > > +
> > > + status = smb_wr16(SECOCEC_STATUS_REG_1, val);
> > > + if (status)
> > > + goto err;
> > > +
> > > + /* Enable the interrupts */
> > > + status = smb_rd16(SECOCEC_ENABLE_REG_1, &val);
> > > + if (status)
> > > + goto err;
> > > +
> > > + status = smb_wr16(SECOCEC_ENABLE_REG_1, val | SECOCEC_ENABLE_REG_1_CEC);
> > > + if (status)
> > > + goto err;
> > > +
> > > + dev_dbg(dev, "Device resumed from suspend");
> > > +
> > > + return 0;
> > > +
> > > +err:
> > > + dev_err(dev, "Resume failed (err: %d)", status);
> > > + return status;
> > > +}
> > > +
> > > +static SIMPLE_DEV_PM_OPS(secocec_pm_ops, secocec_suspend, secocec_resume);
> > > +#define SECOCEC_PM_OPS (&secocec_pm_ops)
> > > +#else
> > > +#define SECOCEC_PM_OPS NULL
> > > +#endif
> > > +
> > > +#ifdef CONFIG_ACPI
> > > +static const struct acpi_device_id secocec_acpi_match[] = {
> > > + {"CEC00001", 0},
> > > + {},
> > > +};
> > > +
> > > +MODULE_DEVICE_TABLE(acpi, secocec_acpi_match);
> > > +#endif
> > > +
> > > +static struct platform_driver secocec_driver = {
> > > + .driver = {
> > > + .name = SECOCEC_DEV_NAME,
> > > + .acpi_match_table = ACPI_PTR(secocec_acpi_match),
> > > + .pm = SECOCEC_PM_OPS,
> > > + },
> > > + .probe = secocec_probe,
> > > + .remove = secocec_remove,
> > > +};
> >
> > As you can see most of my comments are nits or trivial things. I would
> > wait for more feedbacks on the CEC and x86/SMbus part from others before
> > sending v2 if I were you :)
> >
> > Thanks
> > j
> >
>
> Many thanks, this is my first patch, so I need plenty of comments. :)
>
I wish my first patches were as good as this one!
Thanks for sharing
j
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2018-10-03 23:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-02 16:59 [PATCH 0/2] Add SECO Boards CEC device driver ektor5
2018-10-02 16:59 ` [PATCH 1/2] media: add SECO cec driver ektor5
2018-10-03 9:35 ` jacopo mondi
2018-10-03 15:50 ` ektor5
2018-10-03 16:14 ` jacopo mondi [this message]
2018-10-04 11:52 ` Hans Verkuil
2018-10-04 21:31 ` ektor5
2018-10-04 21:39 ` Hans Verkuil
2018-10-02 16:59 ` [PATCH 2/2] seco-cec: add Consumer-IR support ektor5
2018-10-04 13:49 ` Sean Young
2018-10-04 21:46 ` ektor5
2018-10-04 22:47 ` Sean Young
2018-10-04 12:29 ` [PATCH 0/2] Add SECO Boards CEC device driver Neil Armstrong
2018-10-04 21:18 ` ektor5
2018-10-05 17:33 ` [PATCH v2 " ektor5
2018-10-05 17:33 ` [PATCH v2 1/2] media: add SECO cec driver ektor5
2018-10-06 13:49 ` jacopo mondi
2018-10-07 8:18 ` Hans Verkuil
2018-10-08 12:49 ` ektor5
2018-10-05 17:33 ` [PATCH v2 2/2] seco-cec: add Consumer-IR support ektor5
2018-10-06 9:40 ` Sean Young
2018-10-06 9:54 ` [PATCH v2 0/2] Add SECO Boards CEC device driver Hans Verkuil
2018-10-10 12:09 ` ektor5
2018-10-10 13:45 ` Hans Verkuil
2018-10-10 21:20 ` ektor5
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=20181003161401.GG20786@w540 \
--to=jacopo@jmondi.org \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=ek5.chimenti@gmail.com \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=hans.verkuil@cisco.com \
--cc=hverkuil@xs4all.nl \
--cc=jacob-chen@iotwrt.com \
--cc=jacopo+renesas@jmondi.org \
--cc=jose.abreu@synopsys.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=luca.pisani@udoo.org \
--cc=mchehab@kernel.org \
--cc=narmstrong@baylibre.com \
--cc=sakari.ailus@linux.intel.com \
--cc=sean@mess.org \
--cc=todor.tomov@linaro.org \
/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