]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
gpu: host1x: syncpt: Request syncpoints per client
authorThierry Reding <treding@nvidia.com>
Wed, 30 Aug 2017 10:48:31 +0000 (12:48 +0200)
committerThierry Reding <treding@nvidia.com>
Fri, 20 Oct 2017 12:19:51 +0000 (14:19 +0200)
Rather than request syncpoints for a struct device *, request them for a
struct host1x_client *. This is important because subsequent patches are
going to break the assumption that host1x will always be the parent for
devices requesting a syncpoint. It's also a more natural choice because
host1x clients are really the only ones that will know how to deal with
syncpoints.

Note that host1x clients are always guaranteed to be children of host1x,
regardless of their location in the device tree.

Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/dc.c
drivers/gpu/drm/tegra/gr2d.c
drivers/gpu/drm/tegra/gr3d.c
drivers/gpu/drm/tegra/vic.c
drivers/gpu/host1x/syncpt.c
drivers/gpu/host1x/syncpt.h
include/linux/host1x.h

index 4df39112e38ec6052beb2165e0550594922174f6..bc51eb855bf11e82be6c96d89cb02fb5eff624f3 100644 (file)
@@ -1756,7 +1756,7 @@ static int tegra_dc_init(struct host1x_client *client)
        struct drm_plane *cursor = NULL;
        int err;
 
-       dc->syncpt = host1x_syncpt_request(dc->dev, flags);
+       dc->syncpt = host1x_syncpt_request(client, flags);
        if (!dc->syncpt)
                dev_warn(dc->dev, "failed to allocate syncpoint\n");
 
index 6ea070da7718dbb68e4246544aa04b300a48002c..9a8ea93016a97bf03bb135fd4dfb6fa581054d6b 100644 (file)
@@ -36,7 +36,7 @@ static int gr2d_init(struct host1x_client *client)
        if (!gr2d->channel)
                return -ENOMEM;
 
-       client->syncpts[0] = host1x_syncpt_request(client->dev, flags);
+       client->syncpts[0] = host1x_syncpt_request(client, flags);
        if (!client->syncpts[0]) {
                host1x_channel_put(gr2d->channel);
                return -ENOMEM;
index cee2ab645cde93eba7dbbcd4cf6b83af9f7fb132..28c4ef63065bd170f03645e7523843c03c9310b8 100644 (file)
@@ -46,7 +46,7 @@ static int gr3d_init(struct host1x_client *client)
        if (!gr3d->channel)
                return -ENOMEM;
 
-       client->syncpts[0] = host1x_syncpt_request(client->dev, flags);
+       client->syncpts[0] = host1x_syncpt_request(client, flags);
        if (!client->syncpts[0]) {
                host1x_channel_put(gr3d->channel);
                return -ENOMEM;
index 2448229fa653b2b226fd6e9decb90f873dd10eed..52899fba15e627df9657a2c54255908d462e1743 100644 (file)
@@ -167,7 +167,7 @@ static int vic_init(struct host1x_client *client)
                goto detach_device;
        }
 
-       client->syncpts[0] = host1x_syncpt_request(client->dev, 0);
+       client->syncpts[0] = host1x_syncpt_request(client, 0);
        if (!client->syncpts[0]) {
                err = -ENOMEM;
                goto free_channel;
index 048ac9e344ce270c6958275f4b65809ffeb8445e..fcba94cbf4ed0128cc629ad620bd0dc825d6f0ac 100644 (file)
@@ -54,7 +54,7 @@ static void host1x_syncpt_base_free(struct host1x_syncpt_base *base)
 }
 
 static struct host1x_syncpt *host1x_syncpt_alloc(struct host1x *host,
-                                                struct device *dev,
+                                                struct host1x_client *client,
                                                 unsigned long flags)
 {
        int i;
@@ -76,11 +76,11 @@ static struct host1x_syncpt *host1x_syncpt_alloc(struct host1x *host,
        }
 
        name = kasprintf(GFP_KERNEL, "%02u-%s", sp->id,
-                       dev ? dev_name(dev) : NULL);
+                        client ? dev_name(client->dev) : NULL);
        if (!name)
                goto free_base;
 
-       sp->dev = dev;
+       sp->client = client;
        sp->name = name;
 
        if (flags & HOST1X_SYNCPT_CLIENT_MANAGED)
@@ -419,7 +419,7 @@ int host1x_syncpt_init(struct host1x *host)
 
 /**
  * host1x_syncpt_request() - request a syncpoint
- * @dev: device requesting the syncpoint
+ * @client: client requesting the syncpoint
  * @flags: flags
  *
  * host1x client drivers can use this function to allocate a syncpoint for
@@ -427,12 +427,12 @@ int host1x_syncpt_init(struct host1x *host)
  * use by the client exclusively. When no longer using a syncpoint, a host1x
  * client driver needs to release it using host1x_syncpt_free().
  */
-struct host1x_syncpt *host1x_syncpt_request(struct device *dev,
+struct host1x_syncpt *host1x_syncpt_request(struct host1x_client *client,
                                            unsigned long flags)
 {
-       struct host1x *host = dev_get_drvdata(dev->parent);
+       struct host1x *host = dev_get_drvdata(client->parent->parent);
 
-       return host1x_syncpt_alloc(host, dev, flags);
+       return host1x_syncpt_alloc(host, client, flags);
 }
 EXPORT_SYMBOL(host1x_syncpt_request);
 
@@ -456,7 +456,7 @@ void host1x_syncpt_free(struct host1x_syncpt *sp)
        host1x_syncpt_base_free(sp->base);
        kfree(sp->name);
        sp->base = NULL;
-       sp->dev = NULL;
+       sp->client = NULL;
        sp->name = NULL;
        sp->client_managed = false;
 
index f719205105ac19192bd8b7881d17ab87810696eb..9d88d37c2397232cec563221c3fbc0244422e4ea 100644 (file)
@@ -44,7 +44,7 @@ struct host1x_syncpt {
        const char *name;
        bool client_managed;
        struct host1x *host;
-       struct device *dev;
+       struct host1x_client *client;
        struct host1x_syncpt_base *base;
 
        /* interrupt data */
index 630b1a98ab58a91ce0554fef3bf5228f460cd11d..ddf7f9ca86ccd6fe3702a14b78322bae7161fe83 100644 (file)
@@ -157,7 +157,7 @@ int host1x_syncpt_incr(struct host1x_syncpt *sp);
 u32 host1x_syncpt_incr_max(struct host1x_syncpt *sp, u32 incrs);
 int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
                       u32 *value);
-struct host1x_syncpt *host1x_syncpt_request(struct device *dev,
+struct host1x_syncpt *host1x_syncpt_request(struct host1x_client *client,
                                            unsigned long flags);
 void host1x_syncpt_free(struct host1x_syncpt *sp);