The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Dr. David Alan Gilbert" <linux@treblig.org>
Cc: malattia@linux.it, Hans de Goede <hdegoede@redhat.com>,
	hverkuil@xs4all.nl,  platform-driver-x86@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] platform/x86/sony-laptop: Remove unused sony laptop camera code
Date: Mon, 5 May 2025 15:04:59 +0300 (EEST)	[thread overview]
Message-ID: <bbd883e2-7615-c37b-3a6a-acddd76bf3ad@linux.intel.com> (raw)
In-Reply-To: <20250505005539.336183-1-linux@treblig.org>

On Mon, 5 May 2025, linux@treblig.org wrote:

> From: "Dr. David Alan Gilbert" <linux@treblig.org>
> 
> commit ba47652ba655 ("media: meye: remove this deprecated driver")
> removed the meye driver but left behind the code in sony-laptop.c
> which that driver used to call.
> 
> Remove the sony_pic_camera_command() function, and the set of
> defines (SONY_PIC_COMMAND_*) in a header used for the interface
> and the static helpers it called.
> 
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
> ---
>  MAINTAINERS                        |   1 -
>  drivers/platform/x86/sony-laptop.c | 135 -----------------------------
>  include/linux/sony-laptop.h        |  39 ---------
>  3 files changed, 175 deletions(-)
>  delete mode 100644 include/linux/sony-laptop.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 2aed76827090..6c865b5d8fae 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -22671,7 +22671,6 @@ W:	http://www.linux.it/~malattia/wiki/index.php/Sony_drivers
>  F:	Documentation/admin-guide/laptops/sony-laptop.rst
>  F:	drivers/char/sonypi.c
>  F:	drivers/platform/x86/sony-laptop.c
> -F:	include/linux/sony-laptop.h
>  
>  SOPHGO DEVICETREES and DRIVERS
>  M:	Chen Wang <unicorn_wang@outlook.com>
> diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
> index b52390fbd743..4efd0d7031a5 100644
> --- a/drivers/platform/x86/sony-laptop.c
> +++ b/drivers/platform/x86/sony-laptop.c
> @@ -48,7 +48,6 @@
>  #include <linux/acpi.h>
>  #include <linux/slab.h>
>  #include <linux/sonypi.h>
> -#include <linux/sony-laptop.h>
>  #include <linux/rfkill.h>
>  #ifdef CONFIG_SONYPI_COMPAT
>  #include <linux/poll.h>
> @@ -3619,22 +3618,6 @@ static u8 sony_pic_call2(u8 dev, u8 fn)
>  	return v1;
>  }
>  
> -static u8 sony_pic_call3(u8 dev, u8 fn, u8 v)
> -{
> -	u8 v1;
> -
> -	wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2, ITERATIONS_LONG);
> -	outb(dev, spic_dev.cur_ioport->io1.minimum + 4);
> -	wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2, ITERATIONS_LONG);
> -	outb(fn, spic_dev.cur_ioport->io1.minimum);
> -	wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2, ITERATIONS_LONG);
> -	outb(v, spic_dev.cur_ioport->io1.minimum);
> -	v1 = inb_p(spic_dev.cur_ioport->io1.minimum);
> -	dprintk("sony_pic_call3(0x%.2x - 0x%.2x - 0x%.2x): 0x%.4x\n",
> -			dev, fn, v, v1);
> -	return v1;
> -}
> -
>  /*
>   * minidrivers for SPIC models
>   */
> @@ -3754,124 +3737,6 @@ static void sony_pic_detect_device_type(struct sony_pic_dev *dev)
>  #define SONYPI_CAMERA_REVISION 			8
>  #define SONYPI_CAMERA_ROMVERSION 		9
>  
> -static int __sony_pic_camera_ready(void)
> -{
> -	u8 v;
> -
> -	v = sony_pic_call2(0x8f, SONYPI_CAMERA_STATUS);
> -	return (v != 0xff && (v & SONYPI_CAMERA_STATUS_READY));
> -}
> -
> -static int __sony_pic_camera_off(void)
> -{
> -	if (!camera) {
> -		pr_warn("camera control not enabled\n");
> -		return -ENODEV;
> -	}
> -
> -	wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_PICTURE,
> -				SONYPI_CAMERA_MUTE_MASK),
> -			ITERATIONS_SHORT);
> -
> -	if (spic_dev.camera_power) {
> -		sony_pic_call2(0x91, 0);
> -		spic_dev.camera_power = 0;
> -	}
> -	return 0;
> -}
> -
> -static int __sony_pic_camera_on(void)
> -{
> -	int i, j, x;
> -
> -	if (!camera) {
> -		pr_warn("camera control not enabled\n");
> -		return -ENODEV;
> -	}
> -
> -	if (spic_dev.camera_power)
> -		return 0;
> -
> -	for (j = 5; j > 0; j--) {
> -
> -		for (x = 0; x < 100 && sony_pic_call2(0x91, 0x1); x++)
> -			msleep(10);
> -		sony_pic_call1(0x93);
> -
> -		for (i = 400; i > 0; i--) {
> -			if (__sony_pic_camera_ready())
> -				break;
> -			msleep(10);
> -		}
> -		if (i)
> -			break;
> -	}
> -
> -	if (j == 0) {
> -		pr_warn("failed to power on camera\n");
> -		return -ENODEV;
> -	}
> -
> -	wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_CONTROL,
> -				0x5a),
> -			ITERATIONS_SHORT);
> -
> -	spic_dev.camera_power = 1;
> -	return 0;
> -}
> -
> -/* External camera command (exported to the motion eye v4l driver) */
> -int sony_pic_camera_command(int command, u8 value)
> -{
> -	if (!camera)
> -		return -EIO;
> -
> -	mutex_lock(&spic_dev.lock);
> -
> -	switch (command) {
> -	case SONY_PIC_COMMAND_SETCAMERA:
> -		if (value)
> -			__sony_pic_camera_on();
> -		else
> -			__sony_pic_camera_off();
> -		break;
> -	case SONY_PIC_COMMAND_SETCAMERABRIGHTNESS:
> -		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_BRIGHTNESS, value),
> -				ITERATIONS_SHORT);
> -		break;
> -	case SONY_PIC_COMMAND_SETCAMERACONTRAST:
> -		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_CONTRAST, value),
> -				ITERATIONS_SHORT);
> -		break;
> -	case SONY_PIC_COMMAND_SETCAMERAHUE:
> -		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_HUE, value),
> -				ITERATIONS_SHORT);
> -		break;
> -	case SONY_PIC_COMMAND_SETCAMERACOLOR:
> -		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_COLOR, value),
> -				ITERATIONS_SHORT);
> -		break;
> -	case SONY_PIC_COMMAND_SETCAMERASHARPNESS:
> -		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_SHARPNESS, value),
> -				ITERATIONS_SHORT);
> -		break;
> -	case SONY_PIC_COMMAND_SETCAMERAPICTURE:
> -		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_PICTURE, value),
> -				ITERATIONS_SHORT);
> -		break;
> -	case SONY_PIC_COMMAND_SETCAMERAAGC:
> -		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_AGC, value),
> -				ITERATIONS_SHORT);

Hi,

Shouldn't sony_pic_call3() be removed too? AFAICT, all users are gone 
after this removal?

And what about SONYPI_CAMERA_* ? Also SONYPI_DIRECTION_BACKWARDS that is 
among the CAMERA defs seems unused.

-- 
 i.


> -		break;
> -	default:
> -		pr_err("sony_pic_camera_command invalid: %d\n", command);
> -		break;
> -	}
> -	mutex_unlock(&spic_dev.lock);
> -	return 0;
> -}
> -EXPORT_SYMBOL(sony_pic_camera_command);
> -
>  /* gprs/edge modem (SZ460N and SZ210P), thanks to Joshua Wise */
>  static void __sony_pic_set_wwanpower(u8 state)
>  {
> diff --git a/include/linux/sony-laptop.h b/include/linux/sony-laptop.h
> deleted file mode 100644
> index 1e3c92feea6e..000000000000
> --- a/include/linux/sony-laptop.h
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -#ifndef _SONYLAPTOP_H_
> -#define _SONYLAPTOP_H_
> -
> -#include <linux/types.h>
> -
> -#ifdef __KERNEL__
> -
> -/* used only for communication between v4l and sony-laptop */
> -
> -#define SONY_PIC_COMMAND_GETCAMERA		 1	/* obsolete */
> -#define SONY_PIC_COMMAND_SETCAMERA		 2
> -#define SONY_PIC_COMMAND_GETCAMERABRIGHTNESS	 3	/* obsolete */
> -#define SONY_PIC_COMMAND_SETCAMERABRIGHTNESS	 4
> -#define SONY_PIC_COMMAND_GETCAMERACONTRAST	 5	/* obsolete */
> -#define SONY_PIC_COMMAND_SETCAMERACONTRAST	 6
> -#define SONY_PIC_COMMAND_GETCAMERAHUE		 7	/* obsolete */
> -#define SONY_PIC_COMMAND_SETCAMERAHUE		 8
> -#define SONY_PIC_COMMAND_GETCAMERACOLOR		 9	/* obsolete */
> -#define SONY_PIC_COMMAND_SETCAMERACOLOR		10
> -#define SONY_PIC_COMMAND_GETCAMERASHARPNESS	11	/* obsolete */
> -#define SONY_PIC_COMMAND_SETCAMERASHARPNESS	12
> -#define SONY_PIC_COMMAND_GETCAMERAPICTURE	13	/* obsolete */
> -#define SONY_PIC_COMMAND_SETCAMERAPICTURE	14
> -#define SONY_PIC_COMMAND_GETCAMERAAGC		15	/* obsolete */
> -#define SONY_PIC_COMMAND_SETCAMERAAGC		16
> -#define SONY_PIC_COMMAND_GETCAMERADIRECTION	17	/* obsolete */
> -#define SONY_PIC_COMMAND_GETCAMERAROMVERSION	18	/* obsolete */
> -#define SONY_PIC_COMMAND_GETCAMERAREVISION	19	/* obsolete */
> -
> -#if IS_ENABLED(CONFIG_SONY_LAPTOP)
> -int sony_pic_camera_command(int command, u8 value);
> -#else
> -static inline int sony_pic_camera_command(int command, u8 value) { return 0; }
> -#endif
> -
> -#endif	/* __KERNEL__ */
> -
> -#endif /* _SONYLAPTOP_H_ */
> 

  reply	other threads:[~2025-05-05 12:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-05  0:55 [PATCH] platform/x86/sony-laptop: Remove unused sony laptop camera code linux
2025-05-05 12:04 ` Ilpo Järvinen [this message]
2025-05-05 15:27   ` Dr. David Alan Gilbert

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=bbd883e2-7615-c37b-3a6a-acddd76bf3ad@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@treblig.org \
    --cc=malattia@linux.it \
    --cc=platform-driver-x86@vger.kernel.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