From: spanda-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org
To: Stephen Boyd <swboyd-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
ryadav-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
nganji-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
Sean Paul <seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
hoegsberg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
chandanu-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org
Subject: Re: [PATCH v5 1/4] drm/bridge: add support for sn65dsi86 bridge driver
Date: Fri, 11 May 2018 16:46:11 +0530 [thread overview]
Message-ID: <9e3c5e599a9313c8e86e810a008910d8@codeaurora.org> (raw)
In-Reply-To: <152573164597.138124.14000479717180675318-n1Xw8LXHxjTHt/MElyovVYaSKrA+ACpX0E9HWUfgJXw@public.gmane.org>
On 2018-05-08 03:50, Stephen Boyd wrote:
> Quoting Sean Paul (2018-05-02 12:03:16)
>> On Wed, May 02, 2018 at 10:01:59AM +0530, Sandeep Panda wrote:
>>
>> > + struct drm_display_mode curr_mode;
>> > + struct mutex lock;
>> > + unsigned int ctrl_ref_count;
>> > +};
>> > +
>> > +static const struct regmap_range ti_sn_bridge_volatile_ranges[] = {
>> > + { .range_min = 0, .range_max = 0xff },
>> > +};
>> > +
>> > +static const struct regmap_access_table ti_sn_bridge_volatile_table = {
>> > + .yes_ranges = ti_sn_bridge_volatile_ranges,
>> > + .n_yes_ranges = ARRAY_SIZE(ti_sn_bridge_volatile_ranges),
>> > +};
>> > +
>> > +static const struct regmap_config ti_sn_bridge_regmap_config = {
>> > + .reg_bits = 8,
>> > + .val_bits = 8,
>> > + .volatile_table = &ti_sn_bridge_volatile_table,
>> > + .cache_type = REGCACHE_NONE,
>> > +};
>> > +
>> > +static int ti_sn_bridge_power_ctrl(struct ti_sn_bridge *pdata, bool enable)
>> > +{
>> > + int ret = 0;
>> > +
>> > + mutex_lock(&pdata->lock);
>> > + if (enable)
>> > + pdata->ctrl_ref_count++;
>> > + else
>> > + pdata->ctrl_ref_count--;
>>
>> I think you should use a kref instead of rolling your own ref_count.
>> You can
>> handle release by calling kref_put_mutex(), which will handle the
>> reference and
>> the lock. On the acquire side, you can use kref_get_unless_zero which
>> will be
>> fast if the reference is already active.
>
> Why not use runtime PM?
I think PM runtime will be a better approach since we are trying to
protect bridge power source related resources here.
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
next prev parent reply other threads:[~2018-05-11 11:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-02 4:31 [PATCH v5 0/4] Add suppport for sn65dsi86 bridge chip and Innolux 2k edp panel Sandeep Panda
[not found] ` <1525235522-8954-1-git-send-email-spanda-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-05-02 4:31 ` [PATCH v5 1/4] drm/bridge: add support for sn65dsi86 bridge driver Sandeep Panda
2018-05-02 19:03 ` Sean Paul
2018-05-07 22:20 ` Stephen Boyd
[not found] ` <152573164597.138124.14000479717180675318-n1Xw8LXHxjTHt/MElyovVYaSKrA+ACpX0E9HWUfgJXw@public.gmane.org>
2018-05-11 11:16 ` spanda-sgV2jX0FEOL9JmXXK+q4OQ [this message]
2018-05-15 5:50 ` spanda-sgV2jX0FEOL9JmXXK+q4OQ
2018-05-02 4:32 ` [PATCH v5 2/4] dt-bindings: drm/bridge: Document sn65dsi86 bridge bindings Sandeep Panda
[not found] ` <1525235522-8954-3-git-send-email-spanda-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-05-02 17:01 ` Stephen Boyd
[not found] ` <152528047237.138124.6199225836688931193-n1Xw8LXHxjTHt/MElyovVYaSKrA+ACpX0E9HWUfgJXw@public.gmane.org>
2018-05-03 9:41 ` spanda-sgV2jX0FEOL9JmXXK+q4OQ
[not found] ` <3c44e961a198e20a606742034152d456-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-05-07 22:18 ` Stephen Boyd
[not found] ` <152573150728.138124.7552894725134629406-n1Xw8LXHxjTHt/MElyovVYaSKrA+ACpX0E9HWUfgJXw@public.gmane.org>
2018-05-11 11:18 ` spanda-sgV2jX0FEOL9JmXXK+q4OQ
2018-05-02 4:32 ` [PATCH v5 3/4] drm/panel: add Innolux TV123WAM panel driver support Sandeep Panda
[not found] ` <1525235522-8954-4-git-send-email-spanda-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-05-02 19:05 ` Sean Paul
2018-05-15 5:50 ` spanda-sgV2jX0FEOL9JmXXK+q4OQ
2018-05-02 4:32 ` [PATCH v5 4/4] dt-bindings: drm/panel: Document Innolux TV123WAM panel bindings Sandeep Panda
2018-05-07 14:21 ` Rob Herring
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=9e3c5e599a9313c8e86e810a008910d8@codeaurora.org \
--to=spanda-sgv2jx0feol9jmxxk+q4oq@public.gmane.org \
--cc=abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=chandanu-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=hoegsberg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=nganji-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=ryadav-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=swboyd-F7+t8E8rja9g9hUCZPvPmw@public.gmane.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;
as well as URLs for NNTP newsgroup(s).