Skip to content

Commit

Permalink
[media] media: blackfin: ppi: Pass device pointer to request peripher…
Browse files Browse the repository at this point in the history
…al pins

if the pinctrl driver is enabled.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Acked-by: Scott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
  • Loading branch information
Sonic Zhang authored and Mauro Carvalho Chehab committed Jul 26, 2014
1 parent 3d3a410 commit f7d0e6d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion drivers/media/platform/blackfin/bfin_capture.c
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ static int bcap_probe(struct platform_device *pdev)

bcap_dev->cfg = config;

bcap_dev->ppi = ppi_create_instance(config->ppi_info);
bcap_dev->ppi = ppi_create_instance(pdev, config->ppi_info);
if (!bcap_dev->ppi) {
v4l2_err(pdev->dev.driver, "Unable to create ppi\n");
ret = -ENODEV;
Expand Down
8 changes: 5 additions & 3 deletions drivers/media/platform/blackfin/ppi.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/platform_device.h>

#include <asm/bfin_ppi.h>
#include <asm/blackfin.h>
Expand Down Expand Up @@ -307,22 +308,23 @@ static void ppi_update_addr(struct ppi_if *ppi, unsigned long addr)
set_dma_start_addr(ppi->info->dma_ch, addr);
}

struct ppi_if *ppi_create_instance(const struct ppi_info *info)
struct ppi_if *ppi_create_instance(struct platform_device *pdev,
const struct ppi_info *info)
{
struct ppi_if *ppi;

if (!info || !info->pin_req)
return NULL;

if (peripheral_request_list(info->pin_req, KBUILD_MODNAME)) {
pr_err("request peripheral failed\n");
dev_err(&pdev->dev, "request peripheral failed\n");
return NULL;
}

ppi = kzalloc(sizeof(*ppi), GFP_KERNEL);
if (!ppi) {
peripheral_free_list(info->pin_req);
pr_err("unable to allocate memory for ppi handle\n");
dev_err(&pdev->dev, "unable to allocate memory for ppi handle\n");
return NULL;
}
ppi->ops = &ppi_ops;
Expand Down
3 changes: 2 additions & 1 deletion include/media/blackfin/ppi.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ struct ppi_if {
void *priv;
};

struct ppi_if *ppi_create_instance(const struct ppi_info *info);
struct ppi_if *ppi_create_instance(struct platform_device *pdev,
const struct ppi_info *info);
void ppi_delete_instance(struct ppi_if *ppi);
#endif

0 comments on commit f7d0e6d

Please sign in to comment.